2 # String tests for pidl
3 # (C) 2005 Jelmer Vernooij <jelmer@samba.org>
4 # Published under the GNU General Public License
7 use Test
::More tests
=> 3 * 8;
8 use FindBin
qw($RealBin);
10 use Util qw(test_samba4_ndr);
12 test_samba4_ndr
("string-pull-empty",
13 ' [public] void TestString([in,flag(STR_ASCII|LIBNDR_FLAG_STR_SIZE4)] string data);',
15 uint8_t data[] = { 0x00, 0x00, 0x00, 0x00 };
16 DATA_BLOB b = { data, 4 };
17 struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
21 if (NT_STATUS_IS_ERR(ndr_pull_TestString(ndr, NDR_IN, &r)))
24 if (r.in.data == NULL)
27 if (r.in.data[0] != 0)
31 test_samba4_ndr
("string-ascii-pull",
33 [public] void TestString([in,flag(STR_ASCII|LIBNDR_FLAG_STR_SIZE4)] string data);
36 uint8_t data[] = { 0x03, 0x00, 0x00, 0x00,
37 \'f\', \'o\', \'o\', 0 };
38 DATA_BLOB b = { data, 8 };
39 struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
43 if (NT_STATUS_IS_ERR(ndr_pull_TestString(ndr, NDR_IN, &r)))
46 if (r.in.data == NULL)
49 if (strncmp(r.in.data, "foo", 3) != 0)
52 if (r.in.data[4] != 0)
57 skip
"doesn't seem to work yet", 8;
59 test_samba4_ndr
("string-out",
61 [public] void TestString([out,string,charset(UNIX)] uint8 **data);
64 uint8_t data[] = { 0x03, 0x00, 0x00, 0x00,
65 \'f\', \'o\', \'o\', 0 };
66 DATA_BLOB b = { data, 8 };
67 struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
72 if (NT_STATUS_IS_ERR(ndr_pull_TestString(ndr, NDR_IN, &r)))
75 if (r.out.data == NULL)
78 if (*r.out.data == NULL)
81 if (strncmp(r.out.data, "foo", 3) != 0)
84 if (r.out.data[4] != 0)