smbXsrv_version: Remove unused smbXsrv_version_global0->db_rec
[Samba.git] / pidl / tests / ndr_represent.pl
blobaf9a92b6a238a8cfac0890c75625d210b9a81313
1 #!/usr/bin/perl
2 # NDR represent_as() / transmit_as() tests
3 # (C) 2006 Jelmer Vernooij. Published under the GNU GPL
4 use strict;
5 use warnings;
7 use Test::More tests => 2 * 8;
8 use FindBin qw($RealBin);
9 use lib "$RealBin";
10 use Util qw(test_samba4_ndr);
12 test_samba4_ndr('represent_as-simple',
14 void bla([in,represent_as(uint32)] uint8 x);
17 uint8_t expected[] = { 0x0D };
18 DATA_BLOB in_blob = { expected, 1 };
19 struct ndr_pull *ndr = ndr_pull_init_blob(&in_blob, NULL, NULL);
20 struct bla r;
22 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
23 return 1;
25 if (r.in.x != 13)
26 return 2;
29 enum ndr_err_code ndr_uint8_to_uint32(uint8_t from, uint32_t *to)
31 *to = from;
32 return NDR_ERR_SUCCESS;
35 enum ndr_err_code ndr_uint32_to_uint8(uint32_t from, uint8_t *to)
37 *to = from;
38 return NDR_ERR_SUCCESS;
43 test_samba4_ndr('transmit_as-simple',
45 void bla([in,transmit_as(uint32)] uint8 x);
48 uint8_t expected[] = { 0x0D };
49 DATA_BLOB in_blob = { expected, 1 };
50 struct ndr_pull *ndr = ndr_pull_init_blob(&in_blob, NULL, NULL);
51 struct bla r;
53 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
54 return 1;
56 if (r.in.x != 13)
57 return 2;
60 enum ndr_err_code ndr_uint8_to_uint32(uint8_t from, uint32_t *to)
62 *to = from;
63 return NDR_ERR_SUCCESS;
66 enum ndr_err_code ndr_uint32_to_uint8(uint32_t from, uint8_t *to)
68 *to = from;
69 return NDR_ERR_SUCCESS;