Skip to content

Commit

Permalink
Fix struct size tests on 32-bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
schungx committed Mar 24, 2024
1 parent d920568 commit e42d75e
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,32 @@ fn check_struct_sizes() {
16
}
);
assert_eq!(size_of::<Option<Dynamic>>(), if PACKED { 8 } else { 16 });
assert_eq!(
size_of::<Option<Dynamic>>(),
if PACKED {
8
} else if IS_32_BIT {
12
} else {
16
}
);
assert_eq!(
size_of::<Position>(),
if cfg!(feature = "no_position") { 0 } else { 4 }
);
assert_eq!(size_of::<tokenizer::Token>(), 2 * WORD_SIZE);
assert_eq!(
size_of::<tokenizer::Token>(),
if IS_32_BIT {
if cfg!(feature = "only_i32") {
2 * WORD_SIZE
} else {
3 * WORD_SIZE
}
} else {
2 * WORD_SIZE
}
);
assert_eq!(size_of::<ast::Expr>(), if PACKED { 12 } else { 16 });
assert_eq!(size_of::<Option<ast::Expr>>(), if PACKED { 12 } else { 16 });
assert_eq!(size_of::<ast::Stmt>(), if IS_32_BIT { 12 } else { 16 });
Expand Down

0 comments on commit e42d75e

Please sign in to comment.