pidl: Assert that python arrays will not overflow the C array
[sfrench/samba-autobuild/.git] / pidl / tests / ndr_fullptr.pl
1 #!/usr/bin/perl
2 # Simple tests for unique pointers
3 # (C) 2006 Jelmer Vernooij <jelmer@samba.org>.
4 # Published under the GNU General Public License.
5 use strict;
6
7 use Test::More tests => 1 * 8;
8 use FindBin qw($RealBin);
9 use lib "$RealBin";
10 use Util qw(test_samba4_ndr);
11
12 SKIP: {
13         skip "full pointers not supported yet", 8;
14
15 test_samba4_ndr("fullptr-push-dup", 
16 '       
17         [public] uint16 echo_TestFull([in,ptr] uint32 *x, [in,ptr] uint32 *y);
18 ',
19 '
20         struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL);
21         uint32_t v = 13;
22         struct echo_TestFull r;
23         r.in.x = &v; 
24         r.in.y = &v; 
25
26         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_echo_TestFull(ndr, NDR_IN, &r))) {
27                 fprintf(stderr, "push failed\n");
28                 return 1;
29         }
30
31         if (ndr->offset != 12) {
32                 fprintf(stderr, "Offset(%d) != 12\n", ndr->offset);
33                 return 2;
34         }
35
36         if (ndr->data[0] != ndr->data[8] || 
37             ndr->data[1] != ndr->data[9] ||
38                 ndr->data[2] != ndr->data[10] ||
39                 ndr->data[3] != ndr->data[11]) {
40                 fprintf(stderr, "Data incorrect\n");
41                 return 3;
42         }
43 ');
44 }