| 1 | # I know this does not look like -*- perl -*-, but I swear it is... | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Test::More; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | $| = 1; | |||||||||
| 7 | |||||||||||
| 8 | 1 | my @badnets = ( | |||||||||
| 9 | '10.10.10.10/255.255.0.255', | ||||||||||
| 10 | '10.10.10.10/255.0.255.255', | ||||||||||
| 11 | '10.10.10.10/0.255.255.255', | ||||||||||
| 12 | '10.10.10.10/128.255.0.255', | ||||||||||
| 13 | '10.10.10.10/255.128.0.255', | ||||||||||
| 14 | '10.10.10.10/255.255.255.129', | ||||||||||
| 15 | '10.10.10.10/255.255.129.0', | ||||||||||
| 16 | '10.10.10.10/255.255.255.130', | ||||||||||
| 17 | '10.10.10.10/255.255.130.0', | ||||||||||
| 18 | '10.10.10.10/255.0.0.1', | ||||||||||
| 19 | '10.10.10.10/255.129.0.1', | ||||||||||
| 20 | '10.10.10.10/0.255.0.255', | ||||||||||
| 21 | '58.26.0.0-58.27.127.255', # Taken from APNIC's WHOIS case | ||||||||||
| 22 | ); | ||||||||||
| 23 | |||||||||||
| 24 | 1 | my @goodnets = (); | |||||||||
| 25 | |||||||||||
| 26 | 1 | push @goodnets, "10.0.0.1/$_" for (0 .. 32); | |||||||||
| 27 | 1 | push @goodnets, "10.0.0.1/255.255.255.255"; | |||||||||
| 28 | |||||||||||
| 29 | 1 | plan tests => 1 + @badnets + @goodnets; | |||||||||
| 30 | |||||||||||
| 31 | 1 | ▶ | die "# Cannot continue without NetAddr::IP::Lite\n" | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||
| 32 | unless use_ok('NetAddr::IP::Lite'); | ||||||||||
| 33 | |||||||||||
| 34 | 1 | my $count = 1; | |||||||||
| 35 | |||||||||||
| 36 | ok(! defined NetAddr::IP::Lite->new($_), "new $_ should fail") | ||||||||||
| 37 | 1 | for @badnets; | |||||||||
| 38 | |||||||||||
| 39 | ok(defined NetAddr::IP::Lite->new($_), "new $_ should work") | ||||||||||
| 40 | 1 | for @goodnets; | |||||||||
| 41 | |||||||||||
| 42 | |||||||||||