r7059: Use namespaces for pidl and the build system, so we can later on
[ira/wip.git] / source / build / pidl / tests / ndr_array.pl
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 FindBin qw($RealBin);
8 use lib "$RealBin/../..";
9 use test;
10
11 my %settings = Test::GetSettings(@ARGV);
12 $settings{'IDL-Arguments'} = ['--quiet', '--parse', '--parser=ndr_test.c', '--header=ndr_test.h'];
13 $settings{'IncludeFiles'} = ['ndr_test.h'];
14 $settings{'ExtraFiles'} = ['ndr_test.c'];
15
16 Test::test_idl(
17         # Name
18         'Fixed-Array',
19         
20         # Settings
21         \%settings,
22         
23         # IDL 
24         '[public] void Test([in] uint8 x[10]);',
25         
26         # C Test
27         '
28         uint8_t data[] = {1,2,3,4,5,6,7,8,9,10};
29         int i;
30         DATA_BLOB b;
31         struct ndr_pull *ndr;
32         struct Test r;
33
34         b.data = data;
35         b.length = 10;
36         ndr = ndr_pull_init_blob(&b, mem_ctx);
37
38         if (NT_STATUS_IS_ERR(ndr_pull_Test(ndr, NDR_IN, &r)))
39                 return 1;
40
41         if (ndr->offset != 10)
42                 return 2;
43         
44         for (i = 0; i < 10; i++) {
45                 if (r.in.x[i] != i+1) return 3;
46         }
47 ');