File Coverage

tests/ndr_array.pl
Criterion Covered Total %
statement 16 18 88.8
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 22 24 91.6


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2             # Array testing
3             # (C) 2005 Jelmer Vernooij
4             # Published under the GNU General Public License
5 1     1   7 use strict;
  1         1  
  1         48  
6              
7 1     1   1137 use Test::More tests => 8;
  1         20988  
  1         12  
8 1     1   1919 use FindBin qw($RealBin);
  1         1413  
  1         318  
9 1     1   862 use lib "$RealBin/../lib";
  1         680  
  1         7  
10 1     1   160 use lib "$RealBin";
  1         3  
  1         5  
11 1     1   585 use Util qw(test_samba4_ndr);
  0            
  0            
12              
13             test_samba4_ndr(
14             'Fixed-Array',
15            
16             '[public] void Test([in] uint8 x[10]);',
17            
18             '
19             uint8_t data[] = {1,2,3,4,5,6,7,8,9,10};
20             int i;
21             DATA_BLOB b;
22             struct ndr_pull *ndr;
23             struct Test r;
24              
25             b.data = data;
26             b.length = 10;
27             ndr = ndr_pull_init_blob(&b, mem_ctx);
28              
29             if (NT_STATUS_IS_ERR(ndr_pull_Test(ndr, NDR_IN, &r)))
30             return 1;
31              
32             if (ndr->offset != 10)
33             return 2;
34            
35             for (i = 0; i < 10; i++) {
36             if (r.in.x[i] != i+1) return 3;
37             }
38             ');