Lite/t/mask.t

filter: Statementstmt 100% 29 / 29 Branchbran 50.0% 4 / 8 Conditioncond 33.3% 3 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 70.9% 39 / 55 CC 1 SCAR 0.0
CC
1
Cov
78%
BEGIN
1.0
BEGIN
1.0
ok
1.0
CRAP 1.0
« Lite/Util/t/af_inet6.t ↑ Summary Lite/t/addr.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..4\n";
8  
9 1 my $test = 1;
10 4 ▶sub ok() {
Subroutine ok: called CC=1 SCAR=0.0
11 4 print 'ok ',$test++,"\n";
12 }
13  
14 1 my $loip = new NetAddr::IP::Lite('::1.2.3.4/120'); # same as 1.2.3.4/24
15 1 my $hiip = new NetAddr::IP::Lite('FF00::1:4/120');
16 1 my $dqip = new NetAddr::IP::Lite('1.2.3.4/24');
17  
18 ## test '""' just for the heck of it
19 1 my $exp = 'FF00:0:0:0:0:0:1:4/120';
20 1 my $txt = sprintf("%s",$hiip);
21 1 ▶print 'got: ',$txt," exp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $txt eq $exp 0 1 1
22 unless $txt eq $exp;
23 1 &ok;
24  
25 ## test lo ip
26 1 $exp = 'FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FF00';
27 1 my $mask = $loip->mask;
28 1 ▶print "got: $mask, exp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $mask eq $exp and not ref $mask 0 1 1
Condition33%1/3
$mask eq $exp and not ref $mask
!ll&&!rl&&r
001
MC/DC0%0/2
$mask eq $exp and not ref $mask
$mask eq $exp not ref $mask
Truth table33%1/3
A and not(B)
A= $mask eq $expB= not ref $mask
ABresult
0X0
100
111
29 unless $mask eq $exp && ! ref $mask;
30 1 &ok;
31  
32 ## test mask hi
33 1 $exp = 'FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FF00';
34 1 $mask = $hiip->mask;
35 1 ▶print "got: $mask, exp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $mask eq $exp and not ref $mask 0 1 1
Condition33%1/3
$mask eq $exp and not ref $mask
!ll&&!rl&&r
001
MC/DC0%0/2
$mask eq $exp and not ref $mask
$mask eq $exp not ref $mask
Truth table33%1/3
A and not(B)
A= $mask eq $expB= not ref $mask
ABresult
0X0
100
111
36 unless $mask eq $exp && ! ref $mask;
37 1 &ok;
38  
39 ## test mask dot quad
40 1 $exp = '255.255.255.0';
41 1 $mask = $dqip->mask;
42 1 ▶print "got: $mask, exp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $mask eq $exp and not ref $mask 0 1 1
Condition33%1/3
$mask eq $exp and not ref $mask
!ll&&!rl&&r
001
MC/DC0%0/2
$mask eq $exp and not ref $mask
$mask eq $exp not ref $mask
Truth table33%1/3
A and not(B)
A= $mask eq $expB= not ref $mask
ABresult
0X0
100
111
43 unless $mask eq $exp && ! ref $mask;
44 1 &ok;
« Lite/Util/t/af_inet6.t ↑ Summary Lite/t/addr.t »