Lite/t/old-nth.t

filter: Statementstmt 100% 17 / 17 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 96.1% 25 / 26 CC 1 SCAR 0.0
CC
1
Cov
96%
BEGIN
1.0
BEGIN
1.0
ok
1.0
CRAP 1.0
« Lite/t/rfc_1918.t ↑ Summary Lite/t/contains.t »
1  
2 #use diagnostics;
3 1 ▶use NetAddr::IP::Lite qw(:old_nth);
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 $| = 1;
6  
7 1 print "1..9\n";
8  
9 1 my $test = 1;
10 9 ▶sub ok() {
Subroutine ok: called CC=1 SCAR=0.0
11 9 print 'ok ',$test++,"\n";
12 }
13  
14 1 my $ip4 = NetAddr::IP::Lite->new('1.2.3.11/29');
15  
16 1 my @try = qw(
17 0 undef
18 1 1.2.3.9
19 2 1.2.3.10
20 3 1.2.3.11
21 4 1.2.3.12
22 5 1.2.3.13
23 6 1.2.3.14
24 7 1.2.3.15
25 8 undef
26 );
27  
28 1 ▶for (my $i=0;$i<@try;$i+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @try) 9 1 10
29 9 my $rv = $ip4->nth($try[$i]);
30 9 ▶ $rv = defined $rv
Branch: 1 branch
BranchTrueFalseTotal
defined $rv ? : 7 2 9
31 ? $rv->addr
32 : 'undef';
33 9 ▶ print "got: $rv, exp: $try[$i+1]\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $rv eq $try[$i + 1] 0 9 9
34 unless $rv eq $try[$i+1];
35 9 &ok;
36 }
« Lite/t/rfc_1918.t ↑ Summary Lite/t/contains.t »