Lite/t/copy.t

filter: Statementstmt 100% 34 / 34 Branchbran 50.0% 4 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 91.3% 42 / 46 CC 1 SCAR 0.0
CC
1
Cov
90%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Lite/t/masklen.t ↑ Summary Lite/t/v6-inc.t »
1  
2 #use diagnostics;
3 1 ▶use NetAddr::IP::Lite 0.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 *Ones = \&NetAddr::IP::Lite::Ones;
5 1 ▶use NetAddr::IP::Util qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
6 ipv6_aton
7 shiftleft
8 1 );
9 1 $| = 1;
10  
11 1 print "1..4\n";
12  
13 1 my $test = 1;
14 4 ▶sub ok() {
Subroutine ok: called CC=1 SCAR=0.0
15 4 print 'ok ',$test++,"\n";
16 }
17  
18 1 my $ip24 = '1.2.3.4/24';
19 1 my $o = new NetAddr::IP::Lite($ip24);
20 1 my $c = $o->copy;
21  
22 ## test 1 validate original
23 1 my $txto = sprintf("%s",$o);
24 1 my $txtc = sprintf("%s",$c);
25 1 ▶print "orig... got: $txto, exp: $ip24\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $txto eq $ip24 0 1 1
26 unless $txto eq $ip24;
27 1 &ok;
28  
29 ## test 2
30 1 ▶print "copy... got: $txtc, exp: $ip24\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $txtc eq $ip24 0 1 1
31 unless $txtc eq $ip24;
32 1 &ok;
33  
34 1 my $ip28 = '1.2.3.4/28';
35 1 my $mask = shiftleft(Ones(),32 - 28);
36  
37 1 $c->{mask} = $mask;
38 1 $txto = sprintf("%s",$o);
39 1 $txtc = sprintf("%s",$c);
40  
41 ## test 3 validate original
42 1 $txto = sprintf("%s",$o);
43 1 $txtc = sprintf("%s",$c);
44 1 ▶print "orig... got: $txto, exp: $ip24\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $txto eq $ip24 0 1 1
45 unless $txto eq $ip24;
46 1 &ok;
47  
48 ## test 4
49 1 ▶print "copy... got: $txtc, exp: $ip28\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $txtc eq $ip28 0 1 1
50 unless $txtc eq $ip28;
51 1 &ok;
52  
« Lite/t/masklen.t ↑ Summary Lite/t/v6-inc.t »