Fix test.

This commit is contained in:
Stephen Chung 2022-01-12 11:01:03 +08:00
parent 37dbc68bf5
commit 4b4a6c944d

View File

@ -10,7 +10,7 @@ fn check_struct_sizes() {
const PACKED: bool = cfg!(all( const PACKED: bool = cfg!(all(
target_pointer_width = "32", target_pointer_width = "32",
feature = "only_i32", feature = "only_i32",
feature = "no_float" any(feature = "no_float", feature = "f32_float")
)); ));
assert_eq!(size_of::<Dynamic>(), if PACKED { 8 } else { 16 }); assert_eq!(size_of::<Dynamic>(), if PACKED { 8 } else { 16 });
@ -19,24 +19,28 @@ fn check_struct_sizes() {
size_of::<Position>(), size_of::<Position>(),
if cfg!(feature = "no_position") { 0 } else { 4 } if cfg!(feature = "no_position") { 0 } else { 4 }
); );
assert_eq!(size_of::<ast::Expr>(), 16); assert_eq!(size_of::<ast::Expr>(), if PACKED { 12 } else { 16 });
assert_eq!(size_of::<Option<ast::Expr>>(), 16); assert_eq!(size_of::<Option<ast::Expr>>(), if PACKED { 12 } else { 16 });
assert_eq!(size_of::<ast::Stmt>(), 32); assert_eq!(size_of::<ast::Stmt>(), if PACKED { 24 } else { 32 });
assert_eq!(size_of::<Option<ast::Stmt>>(), 32); assert_eq!(size_of::<Option<ast::Stmt>>(), if PACKED { 24 } else { 32 });
assert_eq!(size_of::<FnPtr>(), 80); assert_eq!(size_of::<FnPtr>(), if PACKED { 40 } else { 80 });
assert_eq!(size_of::<Scope>(), 464); assert_eq!(size_of::<Scope>(), if PACKED { 232 } else { 464 });
assert_eq!(size_of::<LexError>(), 56);
assert_eq!( #[cfg(target_pointer_width = "64")]
size_of::<ParseError>(), {
if cfg!(feature = "no_position") { 8 } else { 16 } assert_eq!(size_of::<LexError>(), 56);
); assert_eq!(
assert_eq!(size_of::<EvalAltResult>(), 72); size_of::<ParseError>(),
assert_eq!( if cfg!(feature = "no_position") { 8 } else { 16 }
size_of::<NativeCallContext>(), );
if cfg!(feature = "no_position") { assert_eq!(size_of::<EvalAltResult>(), 72);
64 assert_eq!(
} else { size_of::<NativeCallContext>(),
72 if cfg!(feature = "no_position") {
} 64
); } else {
72
}
);
}
} }