Skip to content

Commit

Permalink
test: do not hardcode alignment values in Scrncell tests
Browse files Browse the repository at this point in the history
  • Loading branch information
magiblot committed Jan 24, 2024
1 parent f933af5 commit 0917f04
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/platform/scrncell.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@

TEST(Scrncell, StructsShouldBeTrivialAndHaveTheExpectedAlignmentAndSize)
{
check_trivial_size_align(TColorDesired, 4, 4);
check_trivial_size_align(TColorAttr, 8, 8);
check_trivial_size_align(TAttrPair, 16, 8);
check_trivial_size_align(TCellChar, 16, 1);
check_trivial_size_align(TScreenCell, 24, 8);
check_trivial_size_align(TColorBIOS, 1, 1);
check_trivial_size_align(TColorRGB, 4, 4);
check_trivial_size_align(TColorXTerm, 1, 1);
// Use 'alignof(type)' rather than hardcoding the alignment values,
// given that they may vary among systems.
check_trivial_size_align(TColorDesired, 4, alignof(uint32_t));
check_trivial_size_align(TColorAttr, 8, alignof(uint64_t));
check_trivial_size_align(TAttrPair, 16, alignof(uint64_t));
check_trivial_size_align(TCellChar, 16, alignof(uint8_t));
check_trivial_size_align(TScreenCell, 24, alignof(uint64_t));
check_trivial_size_align(TColorBIOS, 1, alignof(uint8_t));
check_trivial_size_align(TColorRGB, 4, alignof(uint32_t));
check_trivial_size_align(TColorXTerm, 1, alignof(uint8_t));
}

0 comments on commit 0917f04

Please sign in to comment.