Skip to content

Commit

Permalink
Add tests for reading from Bufferfields and Concatenate.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt8898 committed Oct 25, 2019
1 parent f6dda26 commit 823594f
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 13 deletions.
30 changes: 19 additions & 11 deletions aml_tests/bufferfields.asl
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
//! (integer 0)
//! (integer 0x12)
//! (integer 0x3412)
//! (integer 0x78563412)
//! (integer 0x00EFCDAB78563412)

DefinitionBlock("out.aml", "DSDT", 1, "LAI", "LAI_TEST", 1)
DefinitionBlock("out.aml", "DSDT", 2, "LAI", "LAI_TEST", 1)
{
Scope(_SB)
{
Method(_INI, 0, Serialized)
{
Name(BUF, Buffer(8){0x12, 0x34, 0x56, 0x78, 0xAB, 0xCD, 0xEF, 0x00})
Method(_INI, 0, Serialized)
{
Name(BUF, Buffer(8){0x12, 0x34, 0x56, 0x78, 0xAB, 0xCD, 0xEF, 0x00})

CreateByteField(BUF, 0, B)
CreateWordField(BUF, 0, W)
CreateDWordField(BUF, 0, DW)
CreateQWordField(BUF, 0, QW)
CreateBitField(BUF, 0, BI)
CreateByteField(BUF, 0, B)
CreateWordField(BUF, 0, W)
CreateDWordField(BUF, 0, DW)
CreateQWordField(BUF, 0, QW)

// TODO: Test bit fields.

// TODO: Test that the fields work.
Debug = BI
Debug = B
Debug = W
Debug = DW
Debug = QW
}
}
}
42 changes: 42 additions & 0 deletions aml_tests/concatenate.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

//! (buffer 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0)
//! (buffer 0x05 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xFF 0xAA 0xAA 0xAA 0x00 0x00 0x00 0x00)
//! (buffer 5 0 0 0 0 0 0 0 0 0 0 0 170 170 170 255)
//! (buffer 0xFF 0x6E 0x6F 0xF4 0xFF 0x6E 0x7F 0xF4)
//! (buffer 255 110 111 244 84 69 83 84 0)
//! (buffer 0xFF 0x6E 0x6F 0xF4 0x5 0 0 0 0 0 0 0)
//! (string "TESTTEST")
//! (string "TEST0xAA 0xFF")
//! (string "TEST0000000000000005")
//! (buffer 0x12 0x34 0xAA 0x56 0x00 0x00 0x00 0x00 0xA 0x00 0x00 0x00 0x00 0x00 0x00 0x00)
//! (string "[Device Object]A")

DefinitionBlock("out.aml", "DSDT", 2, "LAI", "LAI_TEST", 1)
{
Scope(_SB)
{
Device(TEST){}

Method(_INI)
{
Name(BUF, Buffer(8){0x12, 0x34, 0xAA, 0x56, 0x12, 0x34, 0xAA, 0x56, 0x12, 0x34, 0xAA, 0x56, 0x12, 0x34, 0xAA, 0x56})
CreateDWordField(BUF, 0, B)
Name (PKGE, Package (0x01){})

Debug = Concatenate(0, 1)
Debug = Concatenate(5, Buffer(4){0XFF, 0xAA, 0xAA, 0xAA})
Debug = Concatenate(5, "FFAAAAAA00000000")

Debug = Concatenate(Buffer(4){0xFF, 0x6E, 0x6F, 0xF4}, Buffer(4){0xFF, 0x6E, 0x7F, 0xF4})
Debug = Concatenate(Buffer(4){0xFF, 0x6E, 0x6F, 0xF4}, "TEST")
Debug = Concatenate(Buffer(4){0xFF, 0x6E, 0x6F, 0xF4}, 5)

Debug = Concatenate("TEST", "TEST")
Debug = Concatenate("TEST", Buffer(2){0xAA, 0xFF})
Debug = Concatenate("TEST", 5)

Debug = Concatenate(B, "A")
Debug = Concatenate(TEST, "A")
}
}
}
3 changes: 2 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ aml_test_cases = [
'tointeger',
'findsetbit',
'tostring',
'objecttype'
'objecttype',
'concatenate'
]

aml_regression_cases = [
Expand Down
2 changes: 1 addition & 1 deletion subprojects/lai
Submodule lai updated from 954f85 to e63413

0 comments on commit 823594f

Please sign in to comment.