s3:lib/events: make use of samba_tevent_set_debug()
[Samba/gebeck_regimport.git] / pidl / tests / ndr_tagtype.pl
blob3f9b717bfef34753eee4b995eafa2c4f78a97a67
1 #!/usr/bin/perl
2 # Support for tagged types
3 # (C) 2005 Jelmer Vernooij. Published under the GNU GPL
4 use strict;
6 use Test::More tests => 3 * 8;
7 use FindBin qw($RealBin);
8 use lib "$RealBin";
9 use Util qw(test_samba4_ndr);
11 test_samba4_ndr('struct-notypedef', '[public] struct bla { uint8 x; }; ',
13 struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL);
14 struct bla r;
15 uint8_t expected[] = { 0x0D };
16 DATA_BLOB expected_blob = { expected, 1 };
17 DATA_BLOB result_blob;
18 r.x = 13;
20 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_STRUCT_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
21 return 1;
23 result_blob = ndr_push_blob(ndr);
25 if (data_blob_cmp(&result_blob, &expected_blob) != 0)
26 return 2;
27 ');
29 test_samba4_ndr('struct-notypedef-used', '[public] struct bla { uint8 x; };
30 [public] void myfn([in] struct bla r); ',
32 struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL);
33 struct myfn fn;
34 uint8_t expected[] = { 0x0D };
35 DATA_BLOB expected_blob = { expected, 1 };
36 DATA_BLOB result_blob;
37 fn.in.r.x = 13;
39 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_myfn(ndr, NDR_IN, &fn)))
40 return 1;
42 result_blob = ndr_push_blob(ndr);
44 if (data_blob_cmp(&result_blob, &expected_blob) != 0)
45 return 2;
46 ');
49 test_samba4_ndr('struct-notypedef-embedded', 'struct bla { uint8 x; };
50 [public] struct myst { struct bla r; }; ',
52 struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL);
53 struct myst st;
54 uint8_t expected[] = { 0x0D };
55 DATA_BLOB expected_blob = { expected, 1 };
56 DATA_BLOB result_blob;
57 st.r.x = 13;
59 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_STRUCT_myst(ndr, NDR_IN, &st)))
60 return 1;
62 result_blob = ndr_push_blob(ndr);
64 if (data_blob_cmp(&result_blob, &expected_blob) != 0)
65 return 2;
66 ');