Lite/t/new-nth.t

filter: Statementstmt 100% 21 / 21 Branchbran 70.0% 7 / 10 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 75.0% 33 / 44 CC 1 SCAR 0.0
CC
1
Cov
81%
BEGIN
1.0
BEGIN
1.0
ok
1.0
CRAP 1.0
« Lite/t/addr.t ↑ Summary Lite/t/v4-numeric.t »
1  
2 #use diagnostics;
3 1 ▶use NetAddr::IP::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 $| = 1;
6  
7 9 ▶sub ok() {
Subroutine ok: called CC=1 SCAR=0.0
8 9 print 'ok ',$test++,"\n";
9 }
10  
11 1 my $ip4 = NetAddr::IP::Lite->new('1.2.3.11/29');
12  
13 1 my @try = qw(
14 0 1.2.3.9
15 1 1.2.3.10
16 2 1.2.3.11
17 3 1.2.3.12
18 4 1.2.3.13
19 5 1.2.3.14
20 6 undef
21 );
22  
23 1 print '1..', (@try/2) +2, "\n";
24  
25 1 $test = 1;
26  
27 1 ▶for (my $i=0;$i<@try;$i+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @try) 7 1 8
28 7 my $rv = $ip4->nth($try[$i]);
29 7 ▶ $rv = defined $rv
Branch: 1 branch
BranchTrueFalseTotal
defined $rv ? : 6 1 7
30 ? $rv->addr
31 : 'undef';
32 7 ▶ print "got: $rv, exp: $try[$i+1]\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $rv eq $try[$i + 1] 0 7 7
33 unless $rv eq $try[$i+1];
34 7 &ok;
35 }
36  
37 1 ▶print "got: $_, exp: 1\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $_ = "NetAddr::IP::Lite"->new("1.2.3.4/32")->num and $_ == 1 0 1 1
Condition33%1/3
$_ = "NetAddr::IP::Lite"->new("1.2.3.4/32")->num and $_ == 1
!ll&&!rl&&r
001
MC/DC0%0/2
$_ = "NetAddr::IP::Lite"->new("1.2.3.4/32")->num and $_ == 1
$_ = "NetAddr::IP::Lite"->new("1.2.3.4/32")->num $_ == 1
Truth table33%1/3
A and B
A= $_ = "NetAddr::IP::Lite"->new("1.2.3.4/32")->numB= $_ == 1
ABresult
0X0
100
111
38 unless ($_ = NetAddr::IP::Lite->new('1.2.3.4/32')->num()) && $_ == 1;
39 1 &ok;
40  
41 1 ▶print "got: $_, exp: 0\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless defined($_ = "NetAddr::IP::Lite"->new("1.2.3.4/31")->num) and $_ == 2 0 1 1
Condition33%1/3
defined($_ = "NetAddr::IP::Lite"->new("1.2.3.4/31")->num) and $_ == 2
!ll&&!rl&&r
001
MC/DC0%0/2
defined($_ = "NetAddr::IP::Lite"->new("1.2.3.4/31")->num) and $_ == 2
defined($_ = "NetAddr::IP::Lite"->new("1.2.3.4/31")->num) $_ == 2
Truth table33%1/3
A and B
A= defined($_ = "NetAddr::IP::Lite"->new("1.2.3.4/31")->num)B= $_ == 2
ABresult
0X0
100
111
42 unless defined ($_ = NetAddr::IP::Lite->new('1.2.3.4/31')->num()) && $_ == 2;
43 1 &ok;
44  
« Lite/t/addr.t ↑ Summary Lite/t/v4-numeric.t »