File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -996,7 +996,23 @@ fn test_clone_from() {
996996#[ test]
997997fn test_size ( ) {
998998 use core:: mem:: size_of;
999- assert_eq ! ( 24 , size_of:: <SmallVec <[ u8 ; 8 ] >>( ) ) ;
999+ const PTR_SIZE : usize = size_of :: < usize > ( ) ;
1000+ #[ cfg( feature = "union" ) ]
1001+ {
1002+ assert_eq ! ( 3 * PTR_SIZE , size_of:: <SmallVec <[ u8 ; 0 ] >>( ) ) ;
1003+ assert_eq ! ( 3 * PTR_SIZE , size_of:: <SmallVec <[ u8 ; 1 ] >>( ) ) ;
1004+ assert_eq ! ( 3 * PTR_SIZE , size_of:: <SmallVec <[ u8 ; PTR_SIZE ] >>( ) ) ;
1005+ assert_eq ! ( 3 * PTR_SIZE , size_of:: <SmallVec <[ u8 ; PTR_SIZE + 1 ] >>( ) ) ;
1006+ assert_eq ! ( 3 * PTR_SIZE , size_of:: <SmallVec <[ u8 ; 2 * PTR_SIZE ] >>( ) ) ;
1007+ assert_eq ! ( 4 * PTR_SIZE , size_of:: <SmallVec <[ u8 ; 2 * PTR_SIZE + 1 ] >>( ) ) ;
1008+ }
1009+ #[ cfg( not( feature = "union" ) ) ]
1010+ {
1011+ assert_eq ! ( 3 * PTR_SIZE , size_of:: <SmallVec <[ u8 ; 0 ] >>( ) ) ;
1012+ assert_eq ! ( 3 * PTR_SIZE , size_of:: <SmallVec <[ u8 ; 1 ] >>( ) ) ;
1013+ assert_eq ! ( 3 * PTR_SIZE , size_of:: <SmallVec <[ u8 ; PTR_SIZE ] >>( ) ) ;
1014+ assert_eq ! ( 4 * PTR_SIZE , size_of:: <SmallVec <[ u8 ; PTR_SIZE + 1 ] >>( ) ) ;
1015+ }
10001016}
10011017
10021018#[ cfg( feature = "drain_filter" ) ]
You can’t perform that action at this time.
0 commit comments