Lite/Util/t/comp128.t

filter: Statementstmt 100% 24 / 24 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 94.2% 33 / 35 CC 2 SCAR 3.2
CC
2
Cov
93%
END
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Lite/Util/t/ipv6_any2n.t ↑ Summary Lite/Util/t/leftshift.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..4\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 ipv6_aton
13 ipv6_n2x
14 comp128
15 1 );
16  
17 1 $loaded = 1;
18 1 print "ok 1\n";
19 ######################### End of black magic.
20  
21 # Insert your test code below (better if it prints "ok 13"
22 # (correspondingly "not ok 13") depending on the success of chunk 13
23 # of the test code):
24  
25 1 $test = 2;
26  
27 3 ▶sub ok {
Subroutine ok: called CC=1 SCAR=0.0
28 3 print "ok $test\n";
29 3 ++$test;
30 }
31  
32 1 my @num = qw # input expected
33 ( :: FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF
34 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0:0:0:0:0:0:0:0
35 A1B2:C3D4:E5D6:F7E8:08F9:190A:2A1B:3B4C 5E4D:3C2B:1A29:817:F706:E6F5:D5E4:C4B3
36 );
37  
38 1 my $ff = ipv6_aton($num[1]);
39 1 ▶for(my $i=0;$i<@num;$i+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @num) 3 1 4
40 3 my $num = $num[$i];
41 3 my $bstr = ipv6_aton($num);
42 3 my $cnum = comp128($bstr);
43 3 my $rv = ipv6_n2x($cnum);
44 3 my $exp = $num[$i +1];
45 3 ▶ print "got: $rv\nexp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $rv eq $exp 0 3 3
46 unless $rv eq $exp;
47 3 &ok;
48 }
« Lite/Util/t/ipv6_any2n.t ↑ Summary Lite/Util/t/leftshift.t »