| 1 | |||||||||||
| 2 | #use diagnostics; | ||||||||||
| 3 | 1 | ▶ | use NetAddr::IP::Lite; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | $| = 1; | |||||||||
| 6 | |||||||||||
| 7 | 1 | print "1..6\n"; | |||||||||
| 8 | |||||||||||
| 9 | 1 | my $test = 1; | |||||||||
| 10 | 6 | ▶ | sub ok() { | ||||||||
|
Subroutine
ok: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 6 | print 'ok ',$test++,"\n"; | |||||||||
| 12 | } | ||||||||||
| 13 | |||||||||||
| 14 | 1 | my @tval = qw # IP bcd mask bcd | |||||||||
| 15 | ( 8000:0:0:0:0:0:0:1/112 170141183460469231731687303715884105729 340282366920938463463374607431768145920 | ||||||||||
| 16 | 1.2.3.4/24 16909060 4294967040 | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | 1 | ▶ | for (my $i=0;$i < @tval;$i+=3) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 2 | my $nip = NetAddr::IP::Lite->new($tval[$i]); | |||||||||
| 21 | ## test scalar return | ||||||||||
| 22 | 2 | my $sclr = $nip->numeric; | |||||||||
| 23 | 2 | ▶ | print "got: $sclr\nexp: $tval[$i+1]\nnot " | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | unless $sclr .'x' eq $tval[$i+1] .'x'; | ||||||||||
| 25 | 2 | &ok; | |||||||||
| 26 | |||||||||||
| 27 | ## test array return | ||||||||||
| 28 | 2 | my($addr,$mask) = $nip->numeric; | |||||||||
| 29 | 2 | ▶ | print "got: $addr\nexp: $tval[$i+1]\nnot " | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | unless $addr .'x' eq $tval[$i+1] .'x'; | ||||||||||
| 31 | 2 | &ok; | |||||||||
| 32 | |||||||||||
| 33 | 2 | ▶ | print "got: $mask\nexp: $tval[$i+2]\nnot " | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | unless $mask .'x' eq $tval[$i+2] .'x'; | ||||||||||
| 35 | 2 | &ok; | |||||||||
| 36 | } | ||||||||||