Lite/Util/t/badd.t

filter: Statementstmt 95.8% 23 / 24 Branchbran 66.6% 8 / 12 Conditioncond 28.5% 2 / 7 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 74.0% 37 / 50 CC 2 SCAR 3.8
CC
2
Cov
77%
END
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« Lite/Util/t/bin.t ↑ Summary Lite/Util/t/inet_4map6.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 1 $| = 1;
8 1 ▶END {print "1..1\nnot ok 1\n" unless $test;}
Subroutine END: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
unless $test 0 1 1
9  
10 1 ▶use NetAddr::IP::Util qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
11 ipv6_aton
12 ipv6_n2x
13 1 );
14  
15 1 $test = 1;
16  
17 18 ▶sub ok {
Subroutine ok: called CC=1 SCAR=0.0
18 18 print "ok $test\n";
19 18 ++$test;
20 }
21  
22 1 my @addr =
23 qw( :: 0:0:0:0:0:0:0:0
24 ::: undef
25 foo undef
26 ::foo undef
27 foo:: undef
28 abc::def::9 undef
29 abcd1:: undef
30 abcd:: abcd:0:0:0:0:0:0:0
31 ::abcde undef
32 :a:b:c:d:1:2:3:4 undef
33 :a:b:c:d undef
34 a:b:c:d:1:2:3:4: undef
35 a:b:c:d:1:2:3:4:: undef
36 ::a:b:c:d:1:2:3:4 undef
37 ::a:b:c:d:1:2:3 0:a:b:c:d:1:2:3
38 ::a:b:c:d:1:2:3: undef
39 :a:b:c:d:1:2:3:: undef
40 a:b:c:d:1:2:3:: a:b:c:d:1:2:3:0
41 );
42  
43 1 my $x = @addr/2;
44  
45 # notify TEST about number of tests
46 # Insert your test code below (better if it prints "ok 13"
47 # (correspondingly "not ok 13") depending on the success of chunk 13
48 # of the test code):
49  
50 1 print '1..',$x,"\n";
51  
52 1 ▶for ($x = 0;$x <= $#addr; $x+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($x <= $#addr) 18 1 19
53 18 my $bstr = ipv6_aton($addr[$x]);
54 18 ▶ if ($addr[$x +1] =~ /undef/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($addr[$x + 1] =~ /undef/) { } 14 4 18
55 14 ▶ print "unexpected return value for $addr[$x]: $_\nnot "
Branch: 1 branch
BranchTrueFalseTotal
if $_ = ipv6_aton() && (ipv6_n2x($_) || "not defined") 0 14 14
Condition20%1/5
ipv6_aton() && (ipv6_n2x($_) || 'not defined')
!ll&&!rl&&r
1400
ipv6_n2x($_) or "not defined"
l!l
00
MC/DC0%0/2
ipv6_aton() && (ipv6_n2x($_) || 'not defined')
ipv6_aton() ipv6_n2x($_)
Truth table33%1/3
A && B
A= ipv6_aton()B= ipv6_n2x($_)
ABresult
0X0
100
111
56 if ($_ = ipv6_aton && (ipv6_n2x($_) || 'not defined'));
57 } else {
58 4 my $rv = ipv6_aton($addr[$x]);
59 4 ▶ unless ($rv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rv) { } 4 0 4
60 0 print "got undefined value for $addr[$x]\nnot ";
61 }
62 else {
63 4 ▶ $rv = ipv6_n2x($rv) || 'not defined';
Condition50%1/2
ipv6_n2x($rv) || 'not defined'
l!l
40
MC/DC0%0/1
ipv6_n2x($rv) || 'not defined'
ipv6_n2x($rv)
Truth table50%1/2
A
A= ipv6_n2x($rv)
Aresult
11
00
64 4 ▶ print "got: $rv, exp: $addr[$x +1]\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $rv eq uc $addr[$x + 1] 0 4 4
65 unless $rv eq uc $addr[$x +1];
66 }
67 }
68 18 &ok;
69 }
« Lite/Util/t/bin.t ↑ Summary Lite/Util/t/inet_4map6.t »