| 1 | 1 | ▶ | use NetAddr::IP::Lite; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | |||||||||||
| 3 | 1 | my @subnets = ( | |||||||||
| 4 | [ '127.1', '127.0.0.1/32' ], | ||||||||||
| 5 | [ '127.1/16', '127.1.0.0/16' ], | ||||||||||
| 6 | [ '10.10.10', '10.10.0.10/32' ], | ||||||||||
| 7 | [ '10.10.10/24', '10.10.10.0/24' ], | ||||||||||
| 8 | # include test for cisco syntax using space instead of '/' | ||||||||||
| 9 | [ '127.1 16', '127.1.0.0/16' ], | ||||||||||
| 10 | [ '10.10.10 24', '10.10.10.0/24' ], | ||||||||||
| 11 | [ '10.10.10 255.255.255.0', '10.10.10.0/24' ], | ||||||||||
| 12 | ); | ||||||||||
| 13 | |||||||||||
| 14 | 1 | $| = 1; | |||||||||
| 15 | |||||||||||
| 16 | 1 | print '1..', (scalar @subnets) , "\n"; | |||||||||
| 17 | |||||||||||
| 18 | 1 | my $count = 1; | |||||||||
| 19 | |||||||||||
| 20 | 1 | for my $n (@subnets) { | |||||||||
| 21 | 7 | my $ip = new NetAddr::IP::Lite $n->[0]; | |||||||||
| 22 | 7 | ▶ | if ($ip eq $n->[1]) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 7 | print "ok $count\n"; | |||||||||
| 24 | } | ||||||||||
| 25 | else { | ||||||||||
| 26 | 0 | print "not ok $count\n"; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 7 | ++ $count; | |||||||||
| 30 | } | ||||||||||