diff options
Diffstat (limited to 'source4/pidl/tests/ndr_tagtype.pl')
-rwxr-xr-x | source4/pidl/tests/ndr_tagtype.pl | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/source4/pidl/tests/ndr_tagtype.pl b/source4/pidl/tests/ndr_tagtype.pl index 067fa096b4..efc5b67746 100755 --- a/source4/pidl/tests/ndr_tagtype.pl +++ b/source4/pidl/tests/ndr_tagtype.pl @@ -3,7 +3,7 @@ # (C) 2005 Jelmer Vernooij. Published under the GNU GPL use strict; -use Test::More tests => 1 * 8; +use Test::More tests => 3 * 8; use FindBin qw($RealBin); use lib "$RealBin"; use Util qw(test_samba4_ndr); @@ -25,3 +25,42 @@ test_samba4_ndr('struct-notypedef', '[public] struct bla { uint8 x; }; ', if (!data_blob_equal(&result_blob, &expected_blob)) return 2; '); + +test_samba4_ndr('struct-notypedef-used', '[public] struct bla { uint8 x; }; + [public] void myfn([in] struct bla r); ', +' + struct ndr_push *ndr = ndr_push_init_ctx(NULL); + struct bla r; + uint8_t expected[] = { 0x0D }; + DATA_BLOB expected_blob = { expected, 1 }; + DATA_BLOB result_blob; + r.x = 13; + + if (NT_STATUS_IS_ERR(ndr_push_myfn(ndr, NDR_IN, &r))) + return 1; + + result_blob = ndr_push_blob(ndr); + + if (!data_blob_equal(&result_blob, &expected_blob)) + return 2; +'); + + +test_samba4_ndr('struct-notypedef-embedded', 'struct bla { uint8 x; }; + [public] struct myfn { struct bla r; }; ', +' + struct ndr_push *ndr = ndr_push_init_ctx(NULL); + struct bla r; + uint8_t expected[] = { 0x0D }; + DATA_BLOB expected_blob = { expected, 1 }; + DATA_BLOB result_blob; + r.x = 13; + + if (NT_STATUS_IS_ERR(ndr_push_myfn(ndr, NDR_IN, &r))) + return 1; + + result_blob = ndr_push_blob(ndr); + + if (!data_blob_equal(&result_blob, &expected_blob)) + return 2; +'); |