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 = "linux" )] |
17 | #[test ] |
18 | fn test_linux() { |
19 | use super::*; |
20 | assert_eq!(OperatingSystem::host(), OperatingSystem::Linux); |
21 | } |
22 | |
23 | #[cfg (target_os = "macos" )] |
24 | #[test ] |
25 | fn test_macos() { |
26 | use super::*; |
27 | assert_eq!(OperatingSystem::host(), OperatingSystem::Darwin); |
28 | } |
29 | |
30 | #[cfg (windows)] |
31 | #[test ] |
32 | fn test_windows() { |
33 | use super::*; |
34 | assert_eq!(OperatingSystem::host(), OperatingSystem::Windows); |
35 | } |
36 | |
37 | #[cfg (target_pointer_width = "16" )] |
38 | #[test ] |
39 | fn test_ptr16() { |
40 | use super::*; |
41 | assert_eq!(Architecture::host().pointer_width().unwrap().bits(), 16); |
42 | } |
43 | |
44 | #[cfg (target_pointer_width = "32" )] |
45 | #[test ] |
46 | fn test_ptr32() { |
47 | use super::*; |
48 | assert_eq!(Architecture::host().pointer_width().unwrap().bits(), 32); |
49 | } |
50 | |
51 | #[cfg (target_pointer_width = "64" )] |
52 | #[test ] |
53 | fn test_ptr64() { |
54 | use super::*; |
55 | assert_eq!(Architecture::host().pointer_width().unwrap().bits(), 64); |
56 | } |
57 | |
58 | #[test ] |
59 | fn host_object() { |
60 | use super::*; |
61 | assert_eq!(HOST, Triple::host()); |
62 | } |
63 | } |
64 | |