7d48c9f4d7149d138f42cb03ddf48082adb12103
[ira/wip.git] / source / build / pidl / tests / ndr_simple.pl
1 #!/usr/bin/perl
2 # Some simple tests for pidl
3 # (C) 2005 Jelmer Vernooij <jelmer@samba.org>
4 # Published under the GNU General Public License
5 use strict;
6
7 use Parse::Pidl::Test;
8
9 my %settings = Parse::Pidl::Test::GetSettings(@ARGV);
10 $settings{'IDL-Arguments'} = ['--quiet', '--parse', '--parser=ndr_test.c', '--header=ndr_test.h'];
11 $settings{'IncludeFiles'} = ['ndr_test.h'];
12 $settings{'ExtraFiles'} = ['ndr_test.c'];
13
14 Parse::Pidl::Test::test_idl(
15         # Name
16         'UInt8',
17         
18         # Settings
19         \%settings,
20         
21         # IDL 
22         'void Test();',
23         
24         # C Test
25         '
26         uint8_t data[] = { 0x02 };
27         uint8_t result;
28         DATA_BLOB b;
29         struct ndr_pull *ndr;
30
31         b.data = data;
32         b.length = 1;
33         ndr = ndr_pull_init_blob(&b, mem_ctx);
34
35         if (NT_STATUS_IS_ERR(ndr_pull_uint8(ndr, NDR_SCALARS, &result)))
36                 return 1;
37
38         if (result != 0x02) 
39                 return 2;
40 ');