Lite/t/over_math.t

filter: Statementstmt 100% 39 / 39 Branchbran 50.0% 7 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 87.5% 49 / 56 CC 1 SCAR 0.0
CC
1
Cov
87%
BEGIN
1.0
BEGIN
1.0
ok
1.0
CRAP 1.0
« Lite/t/bin_ips.t ↑ Summary Lite/t/firstlast.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..7\n";
8  
9 1 my $test = 1;
10 7 ▶sub ok() {
Subroutine ok: called CC=1 SCAR=0.0
11 7 print 'ok ',$test++,"\n";
12 }
13  
14 1 my $ip = new NetAddr::IP::Lite('0.0.0.4/24');
15  
16 ## test '+'
17 1 my $exp = '0.0.0.132/24';
18 1 my $nip = $ip + 128;
19 1 ▶print 'got: ',$nip," exp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $nip eq $exp 0 1 1
20 unless $nip eq $exp;
21 1 &ok;
22  
23 ## test '+' wrap around
24 1 $nip = $ip + 257;
25 1 $exp = '0.0.0.5/24';
26 1 ▶print 'got: ',$nip," exp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $nip eq $exp 0 1 1
27 unless $nip eq $exp;
28 1 &ok;
29  
30 ## test '-' and wrap
31 1 $nip = $ip - 10;
32 1 $exp = '0.0.0.250/24';
33 1 ▶print 'got: ',$nip," exp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $nip eq $exp 0 1 1
34 unless $nip eq $exp;
35 1 &ok;
36  
37 ## test '++' post
38 1 $nip++;
39 1 $exp = '0.0.0.251/24';
40 1 ▶print 'got: ',$nip," exp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $nip eq $exp 0 1 1
41 unless $nip eq $exp;
42 1 &ok;
43  
44 ## test '++' pre
45 1 ++$nip;
46 1 $exp = '0.0.0.252/24';
47 1 ▶print 'got: ',$nip," exp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $nip eq $exp 0 1 1
48 unless $nip eq $exp;
49 1 &ok;
50  
51 ## test '--' post
52 1 $ip--;
53 1 $exp = '0.0.0.3/24';
54 1 ▶print 'got: ',$ip," exp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $ip eq $exp 0 1 1
55 unless $ip eq $exp;
56 1 &ok;
57  
58 ## test '--' pre
59 1 --$ip;
60 1 $exp = '0.0.0.2/24';
61 1 ▶print 'got: ',$ip," exp: $exp\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $ip eq $exp 0 1 1
62 unless $ip eq $exp;
63 1 &ok;
64  
« Lite/t/bin_ips.t ↑ Summary Lite/t/firstlast.t »