BitFields - added tests which combine bitfields with flex array

This commit is contained in:
ghidra1 2019-05-16 11:57:02 -04:00
parent 50413f65f1
commit 3c185a21ad
3 changed files with 51 additions and 0 deletions

View file

@ -49,6 +49,23 @@ public class MSVCStructureImplBitFieldTest extends AbstractCompositeImplBitField
//@formatter:on
}
@Test
public void testStructureBitFieldsB1Flex() {
Structure struct = getStructure("B1flex");
//@formatter:off
CompositeTestUtils.assertExpectedComposite(this, "/B1flex\n" +
"Aligned\n" +
"Structure B1flex {\n" +
" 0 char 1 a \"\"\n" +
" 2 ushort:6(0) 1 b \"\"\n" +
" 4 int:8(0) 1 c \"\"\n" +
" 8 short:4(0) 1 d \"\"\n" +
" long[0] 0 flex \"\"\n" +
"}\n" +
"Size = 12 Actual Alignment = 4", struct);
//@formatter:on
}
@Test
public void testStructureBitFieldsB2() {
Structure struct = getStructure("B2");

View file

@ -51,6 +51,23 @@ public class StructureImplBigEndianBitFieldTest extends AbstractCompositeImplBit
//@formatter:on
}
@Test
public void testStructureBitFieldsB1Flex() {
Structure struct = getStructure("B1flex");
//@formatter:off
CompositeTestUtils.assertExpectedComposite(this, "/B1flex\n" +
"Aligned\n" +
"Structure B1flex {\n" +
" 0 char 1 a \"\"\n" +
" 1 ushort:6(2) 1 b \"\"\n" +
" 1 int:8(2) 2 c \"\"\n" +
" 2 short:4(6) 2 d \"\"\n" +
" long[0] 0 flex \"\"\n" +
"}\n" +
"Size = 4 Actual Alignment = 4", struct);
//@formatter:on
}
@Test
public void testStructureBitFieldsB2() {
Structure struct = getStructure("B2");

View file

@ -89,6 +89,23 @@ public class StructureImplLittleEndianBitFieldTest extends AbstractCompositeImpl
//@formatter:on
}
@Test
public void testStructureBitFieldsB1Flex() {
Structure struct = getStructure("B1flex");
//@formatter:off
CompositeTestUtils.assertExpectedComposite(this, "/B1flex\n" +
"Aligned\n" +
"Structure B1flex {\n" +
" 0 char 1 a \"\"\n" +
" 1 ushort:6(0) 1 b \"\"\n" +
" 1 int:8(6) 2 c \"\"\n" +
" 2 short:4(6) 2 d \"\"\n" +
" long[0] 0 flex \"\"\n" +
"}\n" +
"Size = 8 Actual Alignment = 8", struct);
//@formatter:on
}
@Test
public void testStructureBitFieldsB2() {
Structure struct = getStructure("B2");