Lite/Util/t/binet_n2ad.t

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