view release on metacpan or search on metacpan
Lite/t/addr.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..3\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $loip = new NetAddr::IP::Lite('::1.2.3.4/120'); # same as 1.2.3.4/24
my $hiip = new NetAddr::IP::Lite('FF00::1:4/120');
## test '""' just for the heck of it
my $exp = 'FF00:0:0:0:0:0:1:4/120';
my $txt = sprintf("%s",$hiip);
print 'got: ',$txt," exp: $exp\nnot "
Lite/t/aton.t view on Meta::CPAN
use NetAddr::IP::Util qw(
inet_n2dx
);
use NetAddr::IP::Lite;
$| = 1;
print "1..2\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $loip = new NetAddr::IP::Lite('::1.2.3.4/120'); # same as 1.2.3.4/24
my $hiip = new NetAddr::IP::Lite('FF00::4/120');
## test aton
my $exp = 'FF00:0:0:0:0:0:0:4';
my $txt = inet_n2dx($hiip->aton);
Lite/t/bin_ips.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
print "1..10\n";
$test = 1;
############## test new6
my $exp = '0:0:0:0:0:0:0:3039/1';
Lite/t/bits.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..3\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $loip = new NetAddr::IP::Lite('::1.2.3.4/120'); # same as 1.2.3.4/24
my $hiip = new NetAddr::IP::Lite('FF00::1:4/120');
my $dqip = new NetAddr::IP::Lite('1.2.3.4/24');
## test bits lo
$exp = 128;
my $bits = $loip->bits;
Lite/t/broadcast.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..3\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $loip = new NetAddr::IP::Lite('::1.2.3.4/120'); # same as 1.2.3.4/24
my $hiip = new NetAddr::IP::Lite('FF00::4/120');
## test '""' just for the heck of it
my $exp = 'FF00:0:0:0:0:0:0:4/120';
my $txt = sprintf("%s",$hiip);
print 'got: ',$txt," exp: $exp\nnot "
Lite/t/bug62521.t view on Meta::CPAN
$loaded = 1;
print "ok 1\n";
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
my $test = 2;
sub ok() {
print 'ok ',$test++,"\n";
}
$exp = '0:0:0:0:0:0:7F00:0/104';
my $ip = new6 NetAddr::IP::Lite('127.0.0.0/8');
print "exp $exp\ngot ", $ip, "\nnot "
unless $ip eq $exp;
&ok;
$ip = new6 NetAddr::IP::Lite('127/8');
Lite/t/bug75976.t view on Meta::CPAN
$loaded = 1;
print "ok 1\n";
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
my $test = 2;
sub ok() {
print 'ok ',$test++,"\n";
}
my $ud = undef;
my @bugtest = (
0 => '0.0.0.0/32', '0:0:0:0:0:0:0:0/128',
$ud => '0.0.0.0/0', '0:0:0:0:0:0:0:0/0',
"" => 'undef', 'undef',
);
Lite/t/cidr.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..3\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $loip = new NetAddr::IP::Lite('::1.2.3.4/120'); # same as 1.2.3.4/24
my $hiip = new NetAddr::IP::Lite('FF00::4/120');
my $dqip = new NetAddr::IP::Lite('1.2.3.4/24');
## test cidr
my $exp = 'FF00:0:0:0:0:0:0:4/120';
Lite/t/contains.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..12\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $net4 = NetAddr::IP::Lite->new('1.2.3.5/30');
my $net6 = NetAddr::IP::Lite->new('FF::85/126');
my @try = qw(
1.2.3.3 0
1.2.3.4 1
1.2.3.5 1
1.2.3.6 1
Lite/t/copy.t view on Meta::CPAN
*Ones = \&NetAddr::IP::Lite::Ones;
use NetAddr::IP::Util qw(
ipv6_aton
shiftleft
);
$| = 1;
print "1..4\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $ip24 = '1.2.3.4/24';
my $o = new NetAddr::IP::Lite($ip24);
my $c = $o->copy;
## test 1 validate original
my $txto = sprintf("%s",$o);
my $txtc = sprintf("%s",$c);
Lite/t/firstlast.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..8\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $ip4 = NetAddr::IP::Lite->new('1.2.3.11/29');
my $ip6 = NetAddr::IP::Lite->new('FF::8B/125');
my $exp = '1.2.3.9';
my $rv = $ip4->first->addr;
print "got: $rv, exp: $exp\nnot "
unless $rv eq $exp;
Lite/t/ipv4FFFF.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..1\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $ip = new6FFFF NetAddr::IP::Lite('127.0.0.1');
my $exp = '0:0:0:0:0:FFFF:7F00:1/128';
print "got: $ip\nexp: $exp\nnot "
unless "$ip" eq $exp;
&ok;
Lite/t/is_local.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..9\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my @ips = qw(
126.255.255.255 0
127.0.0.0 1
127.0.0.1 1
127.255.255.254 1
127.255.255.255 1
128.0.0.0 0
Lite/t/mask.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..4\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $loip = new NetAddr::IP::Lite('::1.2.3.4/120'); # same as 1.2.3.4/24
my $hiip = new NetAddr::IP::Lite('FF00::1:4/120');
my $dqip = new NetAddr::IP::Lite('1.2.3.4/24');
## test '""' just for the heck of it
my $exp = 'FF00:0:0:0:0:0:1:4/120';
my $txt = sprintf("%s",$hiip);
Lite/t/masklen.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..3\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $loip = new NetAddr::IP::Lite('::1.2.3.4/120'); # same as 1.2.3.4/24
my $hiip = new NetAddr::IP::Lite('FF00::1:4/120');
my $dqip = new NetAddr::IP::Lite('1.2.3.4/24');
## test masklen lo
$exp = 120;
my $masklen = $loip->masklen;
Lite/t/network.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..4\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $loip = new NetAddr::IP::Lite('::1.2.3.4/120'); # same as 1.2.3.4/24
my $hiip = new NetAddr::IP::Lite('FF00::1:4/120');
my $dqip = new NetAddr::IP::Lite('1.2.3.4/24');
## test '""' just for the heck of it
my $exp = 'FF00:0:0:0:0:0:1:4/120';
my $txt = sprintf("%s",$hiip);
Lite/t/new-nth.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $ip4 = NetAddr::IP::Lite->new('1.2.3.11/29');
my @try = qw(
0 1.2.3.9
1 1.2.3.10
2 1.2.3.11
3 1.2.3.12
Lite/t/new-num.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my @try = qw(
10/32 1
10/31 2
10/30 2
::1/128 1
::1/127 2
::1/126 2
Lite/t/nofqdn.t view on Meta::CPAN
use NetAddr::IP::Lite
$| = 1;
print "1..2\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $ip = new NetAddr::IP::Lite('arin.net');
if (defined $ip) {
print "ok $test # Skipped, resolved $ip\n";
$test++;
} else {
print "ok $test # Skipped, resolver not working\n";
Lite/t/numeric.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..6\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my @tval = qw # IP bcd mask bcd
( 8000:0:0:0:0:0:0:1/112 170141183460469231731687303715884105729 340282366920938463463374607431768145920
1.2.3.4/24 16909060 4294967040
);
for (my $i=0;$i < @tval;$i+=3) {
my $nip = NetAddr::IP::Lite->new($tval[$i]);
Lite/t/old-nth.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite qw(:old_nth);
$| = 1;
print "1..9\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $ip4 = NetAddr::IP::Lite->new('1.2.3.11/29');
my @try = qw(
0 undef
1 1.2.3.9
2 1.2.3.10
3 1.2.3.11
Lite/t/old-num.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite qw(:old_nth);
$| = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my @try = qw(
10/32 0
10/31 1
10/30 3
::1/128 0
::1/127 1
::1/126 3
Lite/t/over_comp.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..21\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $four = new NetAddr::IP::Lite('::4');
$four->{val} = 4;
my $five = new NetAddr::IP::Lite('::5');
$five->{val} = 5;
my @t = (
# arg1 arg2 < <= == >= > <=> cmp
$four, $four, 0, 1, 1, 1, 0, 0, 0,
Lite/t/over_copy.t view on Meta::CPAN
*Ones = \&NetAddr::IP::Lite::Ones;
use NetAddr::IP::Util qw(
ipv6_aton
shiftleft
);
$| = 1;
print "1..8\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $ip24 = '1.2.3.4/24';
my $o = new NetAddr::IP::Lite($ip24);
my $c = $o;
## test 1 validate original
my $txto = sprintf("%s",$o);
my $txtc = sprintf("%s",$c);
Lite/t/over_equal.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..14\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $four = new NetAddr::IP::Lite('0.0.0.4'); # same as 0.0.0.4/32
my $four120 = new NetAddr::IP::Lite('::4/120'); # same as 0.0.0.4/24
my $t432 = '0.0.0.4/32';
my $t4120 = '0:0:0:0:0:0:0:4/120';
my $five = new NetAddr::IP::Lite('0.0.0.5');
Lite/t/over_math.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..7\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $ip = new NetAddr::IP::Lite('0.0.0.4/24');
## test '+'
my $exp = '0.0.0.132/24';
my $nip = $ip + 128;
print 'got: ',$nip," exp: $exp\nnot "
unless $nip eq $exp;
Lite/t/pathological.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
END {print "1..1\nnot ok 1\n" unless $test};
$| = 1;
$test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my @addrs = # pathological cases should fail
qw( ::foo
::f00/129
::f00/150
);
print '1..',(scalar @addrs),"\n";
Lite/t/range.t view on Meta::CPAN
inet_ntoa
ipv6_n2x
);
use NetAddr::IP::Lite;
$| = 1;
print "1..2\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $loip = new NetAddr::IP::Lite('1.2.3.4/24');
my $hiip = new NetAddr::IP::Lite('FF00::4/120');
## test range
my $exp = 'FF00:0:0:0:0:0:0:0 - FF00:0:0:0:0:0:0:FF';
my $txt = $hiip->range;
Lite/t/rfc_1918.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..12\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my @ips = qw(
9.255.255.255 0
10.0.0.0 1
10.255.255.255 1
11.0.0.0 0
172.15.255.255 0
172.16.0.0 1
Lite/t/version.t view on Meta::CPAN
#use diagnostics;
use NetAddr::IP::Lite;
$| = 1;
print "1..2\n";
my $test = 1;
sub ok() {
print 'ok ',$test++,"\n";
}
my $loip = new NetAddr::IP::Lite('1.2.3.4/24');
my $hiip = new NetAddr::IP::Lite('FF00::1:4/120');
## test version lo
$exp = 4;
my $version = $loip->version;
print "got: $version, exp: $exp\nnot "