Include/test1.pl untested

filter: Statementstmt 0.0% 0 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 26 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use C::Include;
2 use hiew;
3 use vars qw/$inc $file $buffer/;
4 use strict;
5  
6 $inc = new C::Include( \*DATA );
7  
8 # Make struct instance
9 $file = $inc->make_struct('FILE');
10  
11 # Fill struct fields
12 $$file{path} = '';
13 $$file{name} = $0;
14 $$file{links}[1]{linkname} = 'link to '.$0;
15 $$file{links}[1]{is_hard} = 1;
16  
17 # Pack struct to buffer
18 $buffer = $file->pack();
19  
20 # Pack to buffer predefined array of structs
21 #$buffer .= $_->pack for @{ $include->{file} };
22  
23 # Struct size
24 printf "Size of struct FILE: %d bytes\n", $file->size;
25 printf "Size of unsigned long: %d bytes\n", $inc->sizeof('unsigned long');
26  
27 # Print buffer to STDOUT
28 hiew( $buffer );
29  
30  
31 __DATA__