1 //! Compare libc's KERNEL_VERSION macro against a specific kernel version.
2 
3 #[cfg(target_os = "linux")]
4 mod t {
5     use libc;
6 
7     #[test]
8     fn test_kernel_version() {
9         assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 0) }, 393216);
10         // Check that the patch level saturates
11         assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 255) }, 393471);
12         assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 256) }, 393471);
13         assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 300) }, 393471);
14         assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, u32::MAX) }, 393471);
15     }
16 }
17