Lite/t/v6-inc.t

filter: Statementstmt 100% 26 / 26 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 91.4% 32 / 35 CC 1 SCAR 0.0
CC
1
Cov
91%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Lite/t/copy.t ↑ Summary Lite/t/version.t »
1 1 ▶use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use NetAddr::IP::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 # Test ++ in IPv6 addresses (Bug rt.cpan.org #7070 by a guest)
5  
6 1 @ip = (NetAddr::IP::Lite->new('2001:468:ff:fffe::2/64'),
7 NetAddr::IP::Lite->new('2001:468:ff:fffe::2/64'),
8 NetAddr::IP::Lite->new('2001:468:ff:fffe::2/64'));
9  
10 1 $ip[1] ++;
11 1 $ip[2] ++; $ip[2] ++;
12  
13 1 plan tests => 11;
14  
15 # Test correct v6 creation
16 1 isa_ok($_, 'NetAddr::IP::Lite') for @ip;
17  
18 # Test that we did actually do something
19 1 ▶diag "$ip[0] -- $ip[1]"
Branch: 1 branch
BranchTrueFalseTotal
unless &ok($ip[0] != $ip[1], "Auto incremented once differ") 0 1 1
20 unless ok($ip[0] != $ip[1], "Auto incremented once differ");
21 1 ▶diag "$ip[0] -- $ip[2]"
Branch: 1 branch
BranchTrueFalseTotal
unless &ok($ip[0] != $ip[2], "Auto incremented twice differ") 0 1 1
22 unless ok($ip[0] != $ip[2], "Auto incremented twice differ");
23 1 ▶diag "$ip[1] -- $ip[2]"
Branch: 1 branch
BranchTrueFalseTotal
unless &ok($ip[1] != $ip[2], "Auto incremented two times differ") 0 1 1
24 unless ok($ip[1] != $ip[2], "Auto incremented two times differ");
25  
26 # Test that what we did is correct
27 1 is($ip[1], $ip[0] + 1, "Test of first auto-increment");
28 1 is($ip[2], $ip[0] + 2, "Test of second auto-increment");
29  
30 # Now test auto-decrement
31  
32 1 $ip[1] --;
33 1 $ip[2] --; $ip[2] --;
34  
35 1 is($ip[0], $ip[1], "Decrement of decrement once is ok");
36 1 is($ip[0], $ip[2], "Decrement of decrement twice is ok");
37 1 is($ip[1], $ip[2], "Third case");
38  
« Lite/t/copy.t ↑ Summary Lite/t/version.t »