~ubuntu-branches/debian/lenny/libnet-ip-perl/lenny

« back to all changes in this revision

Viewing changes to t/ipv4.t

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Schutz
  • Date: 2006-11-10 20:20:26 UTC
  • mfrom: (2.1.3 feisty)
  • Revision ID: james.westby@ubuntu.com-20061110202026-ney2zu1lsdwkzid9
Tags: 1.25-2
* Correct a bug in the ipcount script which prevents the use
  of option -d; thanks to Thomas Parmelan for reporting the bug
  and providing a patch (Closes: Bug#397941)
* Urgency medium to fix an annoying bug in time for Etch.
* Upload sponsored thanks to Anibal Monsalve Salazar

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
        };
13
13
};
14
14
 
15
 
my $numtests = 21;
 
15
my $numtests = 26;
16
16
 
17
17
# Create checker:
18
18
my $T = typical ExtUtils::TBone;
30
30
$T->ok_eq ($ip->binip(),'11000011011100100101000000000000',$ip->error());
31
31
$T->ok_eq ($ip->ip(),'195.114.80.0',$ip->error());
32
32
$T->ok_eq ($ip->print(),'195.114.80/24',$ip->error());
 
33
$T->ok_eq ($ip->hexip(),'0xc3725000',$ip->error());
 
34
$T->ok_eq ($ip->hexmask(),'0xffffff00',$ip->error());
33
35
$T->ok_eqnum ($ip->prefixlen(),24,$ip->error());
34
36
$T->ok_eqnum ($ip->version(),4,$ip->error());
35
37
$T->ok_eqnum ($ip->size(),256,$ip->error());
60
62
$T->ok_eqnum ($ip->bincomp('gt',$ip2),1,$ip->error());
61
63
 
62
64
$ip = new Net::IP('133.44.255.255-133.45.0.42');
63
 
 
64
65
$T->ok_eq (($ip->find_prefixes())[3],'133.45.0.40/31',$ip->error());
65
66
 
 
67
$ip = new Net::IP('192.168.2.254-192.168.2.255');
 
68
my @prefixes = $ip->find_prefixes();
 
69
$T->ok_eqnum (scalar(@prefixes), 1);
 
70
$T->ok_eq ($prefixes[0],'192.168.2.254/31',$ip->error());
 
71
 
66
72
$ip->set('201.33.128.0/22');
67
73
$ip2->set('201.33.129.0/24');
68
74
 
69
75
$T->ok_eqnum ($ip->overlaps($ip2),$IP_B_IN_A_OVERLAP,$ip->error());
70
76
 
 
77
$ip->set('192.168.0.3/32');
 
78
$T->ok_eqnum ($ip->size,1,$ip->error());
 
79
 
71
80
 
72
81
#------------------------------------------------------------------------------
73
82
$T->end;