File: rfc3021.t

package info (click to toggle)
libnetaddr-ip-perl 4.079%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,568 kB
  • sloc: perl: 1,417; cpp: 67; makefile: 9
file content (31 lines) | stat: -rw-r--r-- 627 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use NetAddr::IP;

$| = 1;

print '1..4', "\n";

my $test = 1;

my $ip = new NetAddr::IP('192.168.1.8/31');
my @hosts = $ip->hostenum;

print scalar(@hosts)," found where none expected\nnot "
	if @hosts;
print "ok ",$test++,"\n";

NetAddr::IP::import qw(:rfc3021);

@hosts = $ip->hostenum;

print scalar(@hosts)," found where 2 expected\nnot "
	unless @hosts == 2;
print "ok ",$test++,"\n";

print "got: $hosts[0], exp: 192.168.1.8/32\nnot "
	unless "$hosts[0]" eq '192.168.1.8/32';
print "ok ",$test++,"\n";

print "got: $hosts[1], exp: 192.168.1.9/32\nnot "
	unless "$hosts[1]" eq '192.168.1.9/32';
print "ok ",$test++,"\n";