mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
BitFields - added tests which combine bitfields with flex array
This commit is contained in:
parent
50413f65f1
commit
3c185a21ad
3 changed files with 51 additions and 0 deletions
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue