Lite/Util/t/packzeros.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/bpackzeros.t ↑ Summary Lite/Util/t/simple_pack.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::Util qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
12
13 packzeros
14 1 );
15  
16 1 $loaded = 1;
17 1 print "ok 1\n";
18 ######################### End of black magic.
19  
20 # Insert your test code below (better if it prints "ok 13"
21 # (correspondingly "not ok 13") depending on the success of chunk 13
22 # of the test code):
23  
24 1 $test = 2;
25  
26 12 ▶sub ok {
Subroutine ok: called CC=1 SCAR=0.0
27 12 print "ok $test\n";
28 12 ++$test;
29 }
30  
31 1 my @addr = qw # input expected
32 ( D0:00:0000:0000:000:b00:0000:000 d0::b00:0:0
33 0d0:00:0000:0000:000:0B00:: d0::b00:0:0
34 ::c3D4:e5d6:0:0:0:0 0:0:c3d4:e5d6::
35 0:0000:c3D4:e5d6:0:0:0:0 0:0:c3d4:e5d6::
36 0:0:0:0:0:0:0:0 ::
37 0:0:: ::
38 ::0:000:0 ::
39 0:0::1.2.3.4 ::1.2.3.4
40 ::1.2.3.4 ::1.2.3.4
41 ::01b2:C3d4:0:0:0:1.2.3.4 0:1b2:c3d4::1.2.3.4
42 0:0:0:0:a1b2:c3D4:: ::a1b2:c3d4:0:0
43 12:0:0:0:34:0:00:000 12::34:0:0:0
44 );
45  
46 1 ▶for(my $i=0;$i<@addr;$i+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @addr) 12 1 13
47 12 my $addr = $addr[$i];
48 12 my $rv = packzeros($addr);
49 12 my $exp = lc $addr[$i +1];
50 12 ▶ print "got: $rv\nexp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $rv eq $exp 0 12 12
51 unless $rv eq $exp;
52 12 &ok;
53 }
« Lite/Util/t/bpackzeros.t ↑ Summary Lite/Util/t/simple_pack.t »