Lite/t/contains.t

filter: Statementstmt 100% 18 / 18 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 96.3% 26 / 27 CC 1 SCAR 0.0
CC
1
Cov
96%
BEGIN
1.0
BEGIN
1.0
ok
1.0
CRAP 1.0
« Lite/t/old-nth.t ↑ Summary Lite/t/within.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 1 print "1..12\n";
8  
9 1 my $test = 1;
10 12 ▶sub ok() {
Subroutine ok: called CC=1 SCAR=0.0
11 12 print 'ok ',$test++,"\n";
12 }
13  
14 1 my $net4 = NetAddr::IP::Lite->new('1.2.3.5/30');
15 1 my $net6 = NetAddr::IP::Lite->new('FF::85/126');
16 1 my @try = qw(
17 1.2.3.3 0
18 1.2.3.4 1
19 1.2.3.5 1
20 1.2.3.6 1
21 1.2.3.7 1
22 1.2.3.8 0
23 FF::83 0
24 FF::84 1
25 FF::85 1
26 FF::86 1
27 FF::87 1
28 FF::88 0
29 );
30  
31 1 ▶for (my $i=0;$i<@try;$i+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @try) 12 1 13
32 12 my $ip = NetAddr::IP::Lite->new($try[$i]);
33 12 ▶ my $rv = ($try[$i] =~ /:/)
Branch: 1 branch
BranchTrueFalseTotal
$try[$i] =~ /:/ ? : 6 6 12
34 ? $net6->contains($ip)
35 : $net4->contains($ip);
36 12 ▶ print "got: $rv, exp: $try[$i+1]\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $rv == $try[$i + 1] 0 12 12
37 unless $rv == $try[$i+1];
38 12 &ok;
39 }
40  
« Lite/t/old-nth.t ↑ Summary Lite/t/within.t »