diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-05-17 15:51:35 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:16:51 -0500 |
commit | 1751007e645d206f48d2efa4470fd99fbbecf2b8 (patch) | |
tree | 480830deecc4a36e453be7e24dbe0766bcd69f67 /source4/build/pidl/tests/ndr_align.pl | |
parent | 9d56a6d8f86a2285231d1707635ce8a5bb996b1a (diff) | |
download | samba-1751007e645d206f48d2efa4470fd99fbbecf2b8.tar.gz samba-1751007e645d206f48d2efa4470fd99fbbecf2b8.tar.bz2 samba-1751007e645d206f48d2efa4470fd99fbbecf2b8.zip |
r6860: Add some allocation and alignment tests, remove uint64 from list of scalars
(it doesn't have any push/pull functions anymore either)
(This used to be commit 7d36e27e228ce83a5ce159eb424c4b5194c0e2fb)
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; +'); |