diff options
Diffstat (limited to 'source4/build/pidl/tests/ndr_align.pl')
-rwxr-xr-x | source4/build/pidl/tests/ndr_align.pl | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/source4/build/pidl/tests/ndr_align.pl b/source4/build/pidl/tests/ndr_align.pl index 5947c2998f..c428dd32bd 100755 --- a/source4/build/pidl/tests/ndr_align.pl +++ b/source4/build/pidl/tests/ndr_align.pl @@ -23,7 +23,7 @@ Test::test_idl('align-uint8-uint16', \%settings, ' struct ndr_push *ndr = ndr_push_init(); struct bla r; - uint8_t expected[] = { 0x0D, 0x00, 0xbe, 0xef }; + uint8_t expected[] = { 0x0D, 0x00, 0xef, 0xbe }; DATA_BLOB expected_blob = { expected, 4 }; DATA_BLOB result_blob; r.x = 13; @@ -37,3 +37,55 @@ Test::test_idl('align-uint8-uint16', \%settings, if (!data_blob_equal(&result_blob, &expected_blob)) return 2; '); + +Test::test_idl('align-uint8-uint32', \%settings, +' + typedef [public] struct { + uint8 x; + uint32 y; + } bla; +', +' + struct ndr_push *ndr = ndr_push_init(); + struct bla r; + uint8_t expected[] = { 0x0D, 0x00, 0x00, 0x00, 0xef, 0xbe, 0xef, 0xbe }; + DATA_BLOB expected_blob = { expected, 8 }; + DATA_BLOB result_blob; + r.x = 13; + r.y = 0xbeefbeef; + + if (NT_STATUS_IS_ERR(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r))) + return 1; + + result_blob = ndr_push_blob(ndr); + + if (!data_blob_equal(&result_blob, &expected_blob)) + return 2; +'); + + +Test::test_idl('align-uint8-hyper', \%settings, +' + typedef [public] struct { + uint8 x; + hyper y; + } bla; +', +' + struct ndr_push *ndr = ndr_push_init(); + struct bla r; + uint8_t expected[] = { 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xef, 0xbe, 0xef, 0xbe, 0xef, 0xbe, 0xef, 0xbe }; + DATA_BLOB expected_blob = { expected, 16 }; + DATA_BLOB result_blob; + r.x = 13; + r.y = 0xbeefbeefbeefbeef; + + if (NT_STATUS_IS_ERR(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r))) + return 1; + + result_blob = ndr_push_blob(ndr); + + if (!data_blob_equal(&result_blob, &expected_blob)) + return 2; +'); |