Lite/t/v4-numeric.t

filter: Statementstmt 100% 18 / 18 Branchbran 50.0% 4 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 75.7% 25 / 33 CC 1 SCAR 0.0
CC
1
Cov
79%
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Lite/t/new-nth.t ↑ Summary Lite/t/over-qq.t »
1 1 ▶use NetAddr::IP::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 1 my $nets = {
4 '10.0.0.0/20' => [ 167772160, 4294963200 ],
5 '10.0.15.0/24' => [ 167776000, 4294967040 ],
6 '192.168.0.0/24' => [ 3232235520, 4294967040],
7 'broadcast' => [ 4294967295, 4294967295],
8 'default' => [ 0, 0 ],
9 };
10  
11 1 $| = 1;
12 1 print "1..", 4 * (scalar keys %$nets), "\n";
13  
14 1 my $count = 1;
15  
16 1 for my $a (keys %$nets) {
17 5 my $ip = new NetAddr::IP::Lite $a;
18 5 my ($addr, $mask) = $ip->numeric;
19  
20 5 my $nip = new NetAddr::IP::Lite $addr, $mask;
21  
22 5 ▶ print '', ($nip ? '' : 'not '), 'ok ', $count++, "\n";
Branch: 1 branch
BranchTrueFalseTotal
$nip ? : 5 0 5
23  
24 5 ▶ print '', ($nip and $nip->cidr eq $ip->cidr) ? '' : 'not ',
Branch: 1 branch
BranchTrueFalseTotal
$nip && $nip->cidr eq $ip->cidr ? : 5 0 5
Condition33%1/3
$nip and $nip->cidr eq $ip->cidr
!ll&&!rl&&r
005
MC/DC0%0/2
$nip and $nip->cidr eq $ip->cidr
$nip $nip->cidr eq $ip->cidr
Truth table33%1/3
A and B
A= $nipB= $nip->cidr eq $ip->cidr
ABresult
0X0
100
111
25 'ok ', $count ++, "\n";
26  
27 5 ▶ print '', (($addr != $nets->{$a}->[0] ? 'not ' : ''),
Branch: 1 branch
BranchTrueFalseTotal
$addr != $nets->{$a}[0] ? : 0 5 5
28 "ok ", $count++, "\n");
29  
30 5 ▶ print '', (($mask != $nets->{$a}->[1] ? 'not ' : ''),
Branch: 1 branch
BranchTrueFalseTotal
$mask != $nets->{$a}[1] ? : 0 5 5
31 "ok ", $count++, "\n");
32  
33  
34 }
35  
36  
« Lite/t/new-nth.t ↑ Summary Lite/t/over-qq.t »