diff --git a/src/tests.rs b/src/tests.rs index f53100c..d04771e 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -996,7 +996,23 @@ fn test_clone_from() { #[test] fn test_size() { use core::mem::size_of; - assert_eq!(24, size_of::>()); + const PTR_SIZE: usize = size_of::(); + #[cfg(feature = "union")] + { + assert_eq!(3 * PTR_SIZE, size_of::>()); + assert_eq!(3 * PTR_SIZE, size_of::>()); + assert_eq!(3 * PTR_SIZE, size_of::>()); + assert_eq!(3 * PTR_SIZE, size_of::>()); + assert_eq!(3 * PTR_SIZE, size_of::>()); + assert_eq!(4 * PTR_SIZE, size_of::>()); + } + #[cfg(not(feature = "union"))] + { + assert_eq!(3 * PTR_SIZE, size_of::>()); + assert_eq!(3 * PTR_SIZE, size_of::>()); + assert_eq!(3 * PTR_SIZE, size_of::>()); + assert_eq!(4 * PTR_SIZE, size_of::>()); + } } #[cfg(feature = "drain_filter")]