Lite/Util/t/inet_n2dx.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/inet_n2ad.t ↑ Summary Lite/Util/t/ipv6_any2n.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..6\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_n2dx
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 5 ▶sub ok {
Subroutine ok: called CC=1 SCAR=0.0
29 5 print "ok $test\n";
30 5 ++$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:2A1B:3B4C
35 1.2.3.4 1.2.3.4
36 A1B2:C3D4:E5D6:F7E8:08F9:190A:1.2.3.4 A1B2:C3D4:E5D6:F7E8:8F9:190A:102:304
37 ::1.2.3.4 1.2.3.4
38 ::FFFF:1.2.3.4 1.2.3.4
39 );
40  
41 1 my $ff = ipv6_aton($num[1]);
42 1 ▶for(my $i=0;$i<@num;$i+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @num) 5 1 6
43 5 my $num = $num[$i];
44 5 my $bstr = inet_any2n($num);
45 5 my $rv = inet_n2dx($bstr);
46 5 my $exp = $num[$i +1];
47 5 ▶ print "got: $rv\nexp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $rv eq $exp 0 5 5
48 unless $rv eq $exp;
49 5 &ok;
50 }
« Lite/Util/t/inet_n2ad.t ↑ Summary Lite/Util/t/ipv6_any2n.t »