//! Module containing unit tests. #![cfg(test)] /// This test is to make sure no code changes increase the sizes of critical data structures. #[test] fn check_struct_sizes() { use crate::*; use std::mem::size_of; const PACKED: bool = cfg!(all( target_pointer_width = "32", feature = "only_i32", any(feature = "no_float", feature = "f32_float") )); assert_eq!(size_of::(), if PACKED { 8 } else { 16 }); assert_eq!(size_of::>(), if PACKED { 8 } else { 16 }); assert_eq!( size_of::(), if cfg!(feature = "no_position") { 0 } else { 4 } ); assert_eq!(size_of::(), if PACKED { 12 } else { 16 }); assert_eq!(size_of::>(), if PACKED { 12 } else { 16 }); assert_eq!(size_of::(), if PACKED { 24 } else { 32 }); assert_eq!(size_of::>(), if PACKED { 24 } else { 32 }); #[cfg(target_pointer_width = "64")] { assert_eq!(size_of::(), 400); assert_eq!(size_of::(), 80); assert_eq!(size_of::(), 56); assert_eq!( size_of::(), if cfg!(feature = "no_position") { 8 } else { 16 } ); assert_eq!(size_of::(), 72); assert_eq!( size_of::(), if cfg!(feature = "no_position") { 64 } else { 72 } ); } }