Lite/t/v4-num.t

filter: Statementstmt 100% 24 / 24 Branchbran 83.3% 5 / 6 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 97.3% 37 / 38 CC 6 SCAR 15.6
CC
6
Cov
97%
tst
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.8
« blib/lib/NetAddr/IP/Util.pm ↑ Summary Lite/t/bignums.t »
1 1 ▶use NetAddr::IP::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 1 my $nets = {
4 '10.1.2.3' => [ 32, 0 ],
5 '10.2.3.4' => [ 31, 1 ],
6 '10.0.0.16' => [ 24, 255 ],
7 '10.128.0.1' => [ 8, 2 ** 24 - 1 ],
8 '10.0.0.5' => [ 30, 3 ],
9 '0.0.0.0' => [ 0, 2 ** 32 -1 ],
10 };
11  
12 1 my $new = 1; # flag for old vs new numeric returns
13  
14 1 $| = 1;
15  
16 1 $test = keys %$nets;
17 1 $test *= 2;
18 1 print "1..", $test, "\n";
19  
20 1 $test = 1;
21 2 ▶sub tst {
Subroutine tst: called CC=6 SCAR=17.9
22 2 for my $a (keys %$nets) {
23 12 my $nc = $nets->{$a}->[1] - $new; # net count
24 12 ▶ $nc = 1 if $nc < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $nc < 0 1 11 12
25 12 ▶ $nc = 2 if $new && $nets->{$a}->[0] == 31; # special case for /31, /127
Branch: 1 branch
BranchTrueFalseTotal
if $new and $nets->{$a}[0] == 31 1 11 12
Condition100%3/3
$new and $nets->{$a}[0] == 31
!ll&&!rl&&r
651
MC/DC100%2/2
$new and $nets->{$a}[0] == 31
$new $nets->{$a}[0] == 31
Truth table100%3/3
A and B
A= $newB= $nets->{$a}[0] == 31
ABresult
0X0
100
111
26 12 my $ip = new NetAddr::IP::Lite $a, $nets->{$a}->[0];
27 12 ▶ print "got: $_, exp: $nc\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless ($_ = $ip->num) == $nc 0 12 12
28 unless ($_ = $ip->num) == $nc;
29 12 print "ok ", $test++, "\n";
30 }
31 }
32  
33 1 tst();
34  
35 1 import NetAddr::IP::Lite qw(:old_nth);
36 1 $new = 0;
37 1 tst();
« blib/lib/NetAddr/IP/Util.pm ↑ Summary Lite/t/bignums.t »