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,
18
smb_iconv_convenience_init(NULL, "ASCII", "UTF8", true));
22
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_TestString(ndr, NDR_IN, &r)))
25
if (r.in.data == NULL)
28
if (r.in.data[0] != 0)
32
test_samba4_ndr("string-ascii-pull",
34
[public] void TestString([in,flag(STR_ASCII|LIBNDR_FLAG_STR_SIZE4)] string data);
37
uint8_t data[] = { 0x03, 0x00, 0x00, 0x00,
38
\'f\', \'o\', \'o\', 0 };
39
DATA_BLOB b = { data, 8 };
40
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL,
41
smb_iconv_convenience_init(NULL, "ASCII", "UTF8", true));
45
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_TestString(ndr, NDR_IN, &r)))
48
if (r.in.data == NULL)
51
if (strncmp(r.in.data, "foo", 3) != 0)
54
if (r.in.data[4] != 0)
59
skip "doesn't seem to work yet", 8;
61
test_samba4_ndr("string-out",
63
[public] void TestString([out,string,charset(UNIX)] uint8 **data);
66
uint8_t data[] = { 0x03, 0x00, 0x00, 0x00,
67
\'f\', \'o\', \'o\', 0 };
68
DATA_BLOB b = { data, 8 };
69
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL,
70
smb_iconv_convenience_init(NULL, "ASCII", "UTF8", true));
75
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_TestString(ndr, NDR_IN, &r)))
78
if (r.out.data == NULL)
81
if (*r.out.data == NULL)
84
if (strncmp(r.out.data, "foo", 3) != 0)
87
if (r.out.data[4] != 0)