Lite/Util/t/bpackzeros.t

filter: Statementstmt 100% 21 / 21 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 93.7% 30 / 32 CC 2 SCAR 3.2
CC
2
Cov
93%
END
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Lite/Util/t/bcd2bin.t ↑ Summary Lite/Util/t/packzeros.t »
1 # Before `make install' is performed this script should be runnable with
2 # `make test'. After `make install' it should work as `perl test.pl'
3  
4 ######################### We start with some black magic to print on failure.
5 # Change 1..1 below to 1..last_test_to_print .
6 # (It may become useful if the test is moved to ./t subdirectory.)
7  
8 1 ▶BEGIN { $| = 1; print "1..13\n"; }
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶END {print "not ok 1\n" unless $loaded;}
Subroutine END: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
unless $loaded 0 1 1
10  
11 1 ▶use NetAddr::IP::InetBase qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
12 packzeros
13 1 );
14  
15 1 $loaded = 1;
16 1 print "ok 1\n";
17 ######################### End of black magic.
18  
19 # Insert your test code below (better if it prints "ok 13"
20 # (correspondingly "not ok 13") depending on the success of chunk 13
21 # of the test code):
22  
23 1 $test = 2;
24  
25 12 ▶sub ok {
Subroutine ok: called CC=1 SCAR=0.0
26 12 print "ok $test\n";
27 12 ++$test;
28 }
29  
30 1 my @addr = qw # input expected
31 ( D0:00:0000:0000:000:b00:0000:000 d0::b00:0:0
32 0d0:00:0000:0000:000:0b00:: d0::b00:0:0
33 ::c3D4:E5d6:0:0:0:0 0:0:c3d4:e5d6::
34 0:0000:c3D4:e5d6:0:0:0:0 0:0:c3d4:e5d6::
35 0:0:0:0:0:0:0:0 ::
36 0:0:: ::
37 ::0:000:0 ::
38 0:0::1.2.3.4 ::1.2.3.4
39 ::1.2.3.4 ::1.2.3.4
40 ::01b2:c3D4:0:0:0:1.2.3.4 0:1b2:c3d4::1.2.3.4
41 0:0:0:0:a1B2:c3d4:: ::a1b2:c3d4:0:0
42 12:0:0:0:34:0:00:000 12::34:0:0:0
43 );
44  
45 1 ▶for(my $i=0;$i<@addr;$i+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @addr) 12 1 13
46 12 my $addr = $addr[$i];
47 12 my $rv = packzeros($addr);
48 12 my $exp = $addr[$i +1];
49 12 ▶ print "got: $rv\nexp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $rv eq $exp 0 12 12
50 unless $rv eq $exp;
51 12 &ok;
52 }
« Lite/Util/t/bcd2bin.t ↑ Summary Lite/Util/t/packzeros.t »