1
2#use diagnostics;
3use NetAddr::IP::Lite;
4
5$| = 1;
6
7print "1..3\n";
8
9my $test = 1;
10sub ok() {
11  print 'ok ',$test++,"\n";
12}
13
14my $loip	= new NetAddr::IP::Lite('::1.2.3.4/120');		# same as 1.2.3.4/24
15my $hiip	= new NetAddr::IP::Lite('FF00::1:4/120');
16
17## test '""' just for the heck of it
18my $exp = 'FF00:0:0:0:0:0:1:4/120';
19my $txt = sprintf("%s",$hiip);
20print 'got: ',$txt," exp: $exp\nnot "
21	unless $txt eq $exp;
22&ok;
23
24## test	addr lo
25$exp = '0:0:0:0:0:0:102:304';
26my $addr = $loip->addr;
27print "got: $addr, exp: $exp\nnot "
28	unless $addr eq $exp && ! ref $addr;
29&ok;
30
31## test addr hi
32$exp = 'FF00:0:0:0:0:0:1:4';
33$addr = $hiip->addr;
34print "got: $addr, exp: $exp\nnot "
35	unless $addr eq $exp && ! ref $addr;
36&ok;
37