Line | |
---|
1 | #!/usr/bin/perl
|
---|
2 | # Array testing
|
---|
3 | # (C) 2005 Jelmer Vernooij <jelmer@samba.org>
|
---|
4 | # Published under the GNU General Public License
|
---|
5 | use strict;
|
---|
6 |
|
---|
7 | use Test::More tests => 8;
|
---|
8 | use FindBin qw($RealBin);
|
---|
9 | use lib "$RealBin";
|
---|
10 | use Util qw(test_samba4_ndr);
|
---|
11 |
|
---|
12 | test_samba4_ndr(
|
---|
13 | 'Fixed-Array',
|
---|
14 |
|
---|
15 | '[public] void Test([in] uint8 x[10]);',
|
---|
16 |
|
---|
17 | '
|
---|
18 | uint8_t data[] = {1,2,3,4,5,6,7,8,9,10};
|
---|
19 | int i;
|
---|
20 | DATA_BLOB b;
|
---|
21 | struct ndr_pull *ndr;
|
---|
22 | struct Test r;
|
---|
23 |
|
---|
24 | b.data = data;
|
---|
25 | b.length = 10;
|
---|
26 | ndr = ndr_pull_init_blob(&b, mem_ctx, NULL);
|
---|
27 |
|
---|
28 | if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_Test(ndr, NDR_IN, &r)))
|
---|
29 | return 1;
|
---|
30 |
|
---|
31 | if (ndr->offset != 10)
|
---|
32 | return 2;
|
---|
33 |
|
---|
34 | for (i = 0; i < 10; i++) {
|
---|
35 | if (r.in.x[i] != i+1) return 3;
|
---|
36 | }
|
---|
37 | ');
|
---|
Note:
See
TracBrowser
for help on using the repository browser.