Add a unit test for odd-sized small structs (for #8117) (#8363)

* add an odd sized test

* formatting

---------

Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
nolen777
2024-08-19 21:27:32 -07:00
committed by GitHub
parent 42879f6ea6
commit 8db59321d9
2 changed files with 32 additions and 16 deletions

View File

@@ -21,15 +21,24 @@ table BadAlignmentRoot {
small: [BadAlignmentSmall];
}
// sizeof(JustSmallStruct) == 2
// alignof(JustSmallStruct) == 1
struct JustSmallStruct {
// sizeof(EvenSmallStruct) == 2
// alignof(EvenSmallStruct) == 1
struct EvenSmallStruct {
var_0: uint8;
var_1: uint8;
}
// sizeof(OddSmallStruct) == 3
// alignof(OddSmallStruct) == 1
struct OddSmallStruct {
var_0: uint8;
var_1: uint8;
var_2: uint8;
}
table SmallStructs {
small_structs: [JustSmallStruct];
even_structs: [EvenSmallStruct];
odd_structs: [OddSmallStruct];
}
root_type SmallStructs;