Lite/t/v4-new_from_aton.t

filter: Statementstmt 100% 23 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 27 / 27 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Lite/t/relops.t ↑ Summary Lite/t/v4-no_octal.t »
1 1 ▶use NetAddr::IP::Util qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
2 inet_aton
3 ipv6_n2x
4 1 );
5 1 ▶use NetAddr::IP::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 #use diagnostics;
8  
9 1 plan tests => 12 + 3;
10  
11 1 ok(! defined NetAddr::IP::Lite->new_from_aton(''), "blank netaddr returns undef");
12 1 ok(! defined NetAddr::IP::Lite->new_from_aton(undef), "undefined netaddr returns undef");
13 1 ok(! defined NetAddr::IP::Lite->new_from_aton('1.2.3.4'), "Dot Quad IP returns undef");
14  
15 1 foreach (qw(
16 0.0.0.0
17 127.0.0.1
18 255.255.255.255
19 )) {
20 3 my $naddr = inet_aton($_);
21 3 my $ip = new_from_aton NetAddr::IP::Lite($naddr);
22 3 ok(defined $ip, "$_ is defined");
23 3 ok($ip->bits == 32, "$_ is 32 bits wide");
24 3 ok($ip->mask eq '255.255.255.255', "mask is all ones");
25 3 ok($ip->version == 4, "version is IPv4");
26 }
27  
« Lite/t/relops.t ↑ Summary Lite/t/v4-no_octal.t »