s4:librpc/rpc: pass a mem_ctx to dcerpc_request_send()
[Samba.git] / pidl / tests / ndr_represent.pl
blob2d65fb92b09a836bbaa5c50276ff65f866a79636
1 #!/usr/bin/perl
2 # NDR represent_as() / transmit_as() tests
3 # (C) 2006 Jelmer Vernooij. Published under the GNU GPL
4 use strict;
6 use Test::More tests => 2 * 8;
7 use FindBin qw($RealBin);
8 use lib "$RealBin";
9 use Util qw(test_samba4_ndr);
11 test_samba4_ndr('represent_as-simple',
13 void bla([in,represent_as(uint32)] uint8 x);
16 uint8_t expected[] = { 0x0D };
17 DATA_BLOB in_blob = { expected, 1 };
18 struct ndr_pull *ndr = ndr_pull_init_blob(&in_blob, NULL, NULL);
19 struct bla r;
21 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
22 return 1;
24 if (r.in.x != 13)
25 return 2;
28 enum ndr_err_code ndr_uint8_to_uint32(uint8_t from, uint32_t *to)
30 *to = from;
31 return NDR_ERR_SUCCESS;
34 enum ndr_err_code ndr_uint32_to_uint8(uint32_t from, uint8_t *to)
36 *to = from;
37 return NDR_ERR_SUCCESS;
42 test_samba4_ndr('transmit_as-simple',
44 void bla([in,transmit_as(uint32)] uint8 x);
47 uint8_t expected[] = { 0x0D };
48 DATA_BLOB in_blob = { expected, 1 };
49 struct ndr_pull *ndr = ndr_pull_init_blob(&in_blob, NULL, NULL);
50 struct bla r;
52 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
53 return 1;
55 if (r.in.x != 13)
56 return 2;
59 enum ndr_err_code ndr_uint8_to_uint32(uint8_t from, uint32_t *to)
61 *to = from;
62 return NDR_ERR_SUCCESS;
65 enum ndr_err_code ndr_uint32_to_uint8(uint32_t from, uint8_t *to)
67 *to = from;
68 return NDR_ERR_SUCCESS;