Newer
Older
NetAddr-IP / t / v4-compplus.t
@Luis Muñoz Luis Muñoz on 21 Oct 2014 527 bytes Import of LUISMUNOZ/NetAddr-IP-3.12 from CPAN.
use NetAddr::IP;

# $Id: v4-compplus.t,v 1.2 2002/10/31 04:30:36 lem Exp $

$| = 1;

print "1..50\n";

my $count = 1;

for my $bits (8 .. 32) {
    my $large = new NetAddr::IP '10.0.0.0/8';
    my $small = new NetAddr::IP '10.0.0.0', $bits;

    my @c = NetAddr::IP::compact($large, $small);

    if (@c == 1) {
	print "ok $count\n";
    }
    else {
	print "not ok $count\n";
    }

    ++$count;

    if ($c[0]->cidr eq '10.0.0.0/8') {
	print "ok $count\n";
    }
    else {
	print "not ok $count\n";
    }

    ++$count;
}