| 1 | use crate::{Architecture, BinaryFormat, Environment, OperatingSystem, Triple, Vendor}; |
| 2 | |
| 3 | // Include the implementations of the `HOST` object containing information |
| 4 | // about the current host. |
| 5 | include!(concat!(env!("OUT_DIR"), "/host.rs")); |
| 6 | |
| 7 | #[cfg(test)] |
| 8 | mod tests { |
| 9 | #[cfg(target_os = "aix")] |
| 10 | #[test] |
| 11 | fn test_aix() { |
| 12 | use super::*; |
| 13 | assert_eq!(OperatingSystem::host(), OperatingSystem::Aix); |
| 14 | } |
| 15 | |
| 16 | #[cfg(target_os = "cygwin")] |
| 17 | #[test] |
| 18 | fn test_cygwin() { |
| 19 | use super::*; |
| 20 | assert_eq!(OperatingSystem::host(), OperatingSystem::Cygwin); |
| 21 | } |
| 22 | |
| 23 | #[cfg(target_os = "linux")] |
| 24 | #[test] |
| 25 | fn test_linux() { |
| 26 | use super::*; |
| 27 | assert_eq!(OperatingSystem::host(), OperatingSystem::Linux); |
| 28 | } |
| 29 | |
| 30 | #[cfg(target_os = "macos")] |
| 31 | #[test] |
| 32 | fn test_macos() { |
| 33 | use super::*; |
| 34 | assert_eq!(OperatingSystem::host(), OperatingSystem::Darwin(None)); |
| 35 | } |
| 36 | |
| 37 | #[cfg(windows)] |
| 38 | #[test] |
| 39 | fn test_windows() { |
| 40 | use super::*; |
| 41 | assert_eq!(OperatingSystem::host(), OperatingSystem::Windows); |
| 42 | } |
| 43 | |
| 44 | #[cfg(target_pointer_width = "16")] |
| 45 | #[test] |
| 46 | fn test_ptr16() { |
| 47 | use super::*; |
| 48 | assert_eq!(Architecture::host().pointer_width().unwrap().bits(), 16); |
| 49 | } |
| 50 | |
| 51 | #[cfg(target_pointer_width = "32")] |
| 52 | #[test] |
| 53 | fn test_ptr32() { |
| 54 | use super::*; |
| 55 | assert_eq!(Architecture::host().pointer_width().unwrap().bits(), 32); |
| 56 | } |
| 57 | |
| 58 | #[cfg(target_pointer_width = "64")] |
| 59 | #[test] |
| 60 | fn test_ptr64() { |
| 61 | use super::*; |
| 62 | assert_eq!(Architecture::host().pointer_width().unwrap().bits(), 64); |
| 63 | } |
| 64 | |
| 65 | #[test] |
| 66 | fn host_object() { |
| 67 | use super::*; |
| 68 | assert_eq!(HOST, Triple::host()); |
| 69 | } |
| 70 | } |