| 1 | 1 | ▶ | use NetAddr::IP::Lite; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | |||||||||||
| 3 | 1 | $| = 1; | |||||||||
| 4 | |||||||||||
| 5 | 1 | my @deltas = (0, 1, 2, 3, 255); | |||||||||
| 6 | |||||||||||
| 7 | 1 | print "1..", 15 + @deltas, "\n"; | |||||||||
| 8 | |||||||||||
| 9 | 1 | my $count = 1; | |||||||||
| 10 | |||||||||||
| 11 | 1 | ▶ | for (my $ip = new NetAddr::IP::Lite '10.0.0.1/28'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | $ip < $ip->broadcast; | ||||||||||
| 13 | $ip ++) | ||||||||||
| 14 | { | ||||||||||
| 15 | 14 | my $o = $ip->addr; | |||||||||
| 16 | |||||||||||
| 17 | 14 | $o =~ s/^.+\.(\d+)$/$1/; | |||||||||
| 18 | |||||||||||
| 19 | 14 | ▶ | if ($o == $count) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 14 | print "ok $count\n"; | |||||||||
| 21 | } | ||||||||||
| 22 | else { | ||||||||||
| 23 | 0 | print "not ok $count\n"; | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 14 | ++ $count; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 1 | my $ip = new NetAddr::IP::Lite '10.0.0.255/24'; | |||||||||
| 30 | 1 | $ip ++; | |||||||||
| 31 | |||||||||||
| 32 | 1 | ▶ | if ($ip eq '10.0.0.0/24') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 1 | print "ok $count\n"; | |||||||||
| 34 | } | ||||||||||
| 35 | else { | ||||||||||
| 36 | 0 | print "not ok $count\n"; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 1 | ++$count; | |||||||||
| 40 | |||||||||||
| 41 | 1 | $ip = new NetAddr::IP::Lite '10.0.0.0/24'; | |||||||||
| 42 | |||||||||||
| 43 | 1 | for my $v (@deltas) { | |||||||||
| 44 | 5 | ▶ | if ($ip + $v eq '10.0.0.' . $v . '/24') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | 5 | print "ok $count\n"; | |||||||||
| 46 | } | ||||||||||
| 47 | else { | ||||||||||
| 48 | 0 | print "not ok $count\n"; | |||||||||
| 49 | } | ||||||||||
| 50 | 5 | ++ $count; | |||||||||
| 51 | } | ||||||||||