2
# Support for tagged types
3
# (C) 2005 Jelmer Vernooij. Published under the GNU GPL
6
use Test::More tests => 3 * 8;
7
use FindBin qw($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);
15
uint8_t expected[] = { 0x0D };
16
DATA_BLOB expected_blob = { expected, 1 };
17
DATA_BLOB result_blob;
20
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_STRUCT_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
23
result_blob = ndr_push_blob(ndr);
25
if (data_blob_cmp(&result_blob, &expected_blob) != 0)
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);
34
uint8_t expected[] = { 0x0D };
35
DATA_BLOB expected_blob = { expected, 1 };
36
DATA_BLOB result_blob;
39
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_myfn(ndr, NDR_IN, &fn)))
42
result_blob = ndr_push_blob(ndr);
44
if (data_blob_cmp(&result_blob, &expected_blob) != 0)
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);
54
uint8_t expected[] = { 0x0D };
55
DATA_BLOB expected_blob = { expected, 1 };
56
DATA_BLOB result_blob;
59
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_STRUCT_myst(ndr, NDR_IN, &st)))
62
result_blob = ndr_push_blob(ndr);
64
if (data_blob_cmp(&result_blob, &expected_blob) != 0)