Lite/Util/t/inet_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/bipv6_any2n.t ↑ Summary Lite/Util/t/inet_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::Util qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
12 ipv6_aton
13 ipv6_n2x
14 inet_any2n
15 inet_n2ad
16 1 );
17  
18 1 $loaded = 1;
19 1 print "ok 1\n";
20 ######################### End of black magic.
21  
22 # Insert your test code below (better if it prints "ok 13"
23 # (correspondingly "not ok 13") depending on the success of chunk 13
24 # of the test code):
25  
26 1 $test = 2;
27  
28 3 ▶sub ok {
Subroutine ok: called CC=1 SCAR=0.0
29 3 print "ok $test\n";
30 3 ++$test;
31 }
32  
33 1 my @num = qw # input expected
34 ( a1b2:c3d4:e5d6:f7e8:08f9:190a:2a1b:3b4c A1B2:C3D4:E5D6:F7E8:8F9:190A:42.27.59.76
35 1.2.3.4 1.2.3.4
36 190A::102:304 190A:0:0:0:0:0:1.2.3.4
37 );
38  
39 1 my $ff = ipv6_aton($num[1]);
40 1 ▶for(my $i=0;$i<@num;$i+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @num) 3 1 4
41 3 my $num = $num[$i];
42 3 my $bstr = inet_any2n($num);
43 3 my $rv = inet_n2ad($bstr);
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/bipv6_any2n.t ↑ Summary Lite/Util/t/inet_n2dx.t »