Branch Coverage

blib/lib/NetAddr/IP/Lite.pm
Criterion Covered Total %
branch 130 308 42.2


line true false branch
178 0 0 if ($pkg =~ /^$other/o and exists do { $other }->{$func})
185 0 0 if ($pkg eq ref $_[0]) { }
241 533 0 UNIVERSAL::isa($_[0], 'NetAddr::IP::Lite') ? :
242 3 530 UNIVERSAL::isa($_[1], 'NetAddr::IP::Lite') ? :
247 0 0 UNIVERSAL::isa($_[0], 'NetAddr::IP::Lite') ? :
248 0 0 UNIVERSAL::isa($_[1], 'NetAddr::IP::Lite') ? :
253 0 3 unless UNIVERSAL::isa($_[0], 'NetAddr::IP::Lite') and UNIVERSAL::isa($_[1], 'NetAddr::IP::Lite')
258 0 0 unless UNIVERSAL::isa($_[0], 'NetAddr::IP::Lite') and UNIVERSAL::isa($_[1], 'NetAddr::IP::Lite')
263 5 4 &comp_addr_mask > 0 ? :
267 8332 132 &comp_addr_mask < 0 ? :
271 0 0 &comp_addr_mask < 0 ? :
275 0 0 &comp_addr_mask > 0 ? :
284 65178 3535 unless $c
285 3336 199 if &hasbits($rv)
287 32 167 unless $c
288 20 147 &hasbits($rv) ? :
388 0 23 unless $const and $const < 2147483648 and $const > -2147483649
421 3 0 unless (ref $arg)
425 0 0 if ($carry) { }
426 0 0 if &hasbits($dif & $_smsk)
429 0 0 if &hasbits($dif & $_smsk ^ $_smsk)
690 0 5 if $lo == $hi
708 0 0 unless defined $ip
710 0 0 unless $addrlen == 4
732 0 0 if ($in[1] and $in[1] =~ /^(.+)\s+(.+)$/)
741 0 0 if ($in[1] and $in[1] =~ /^(.+)\s+(.+)$/)
758 0 7435 if ($isV6 < 0)
766 0 7435 if ($ip and $noctal and not $ip =~ m[(?:[^\s0123456789/. -])])
771 0 7435 if defined $ip and $ip eq ''
773 0 7435 unless defined $ip
774 0 7435 if ref $ip and ref $ip eq 'Math::BigInt'
785 6897 538 if (not @_) { }
538 0 elsif (defined $_[0]) { }
787 0 6897 if (not $ip =~ /\D/) { }
5874 1023 elsif ($ip =~ m[^([a-z0-9.:-]+)(?:/|\s+)([a-z0-9.:-]+)$] or $ip =~ m(^[\[]{1}([a-z0-9.:-]+)(?:/|\s+)([a-z0-9.:-]+)[\]]{1}$)) { }
9 1014 elsif (grep(($ip eq $_), ('default', 'any', 'broadcast', 'loopback', 'unspecified'))) { }
797 0 9 if $ip eq 'unspecified'
798 0 9 if ($isV6) { }
800 0 0 unless defined($ip = $fip6{$ip})
803 0 9 unless defined($ip = $fip4{$ip})
810 0 538 if ($_[0] =~ /ipv6/i or $isV6)
811 0 0 if (grep(($ip eq $_), ('default', 'any', 'loopback', 'unspecified'))) { }
816 0 0 unless $isV6
828 1014 6412 unless (defined $mask)
840 383 7043 if not $ip =~ /\D/ and length $ip > 3 || $ip > 255 and $try = &bcd2bin($ip) and not isIPv4($try) or index($ip, ':') >= 0 and $try = ipv6_aton($ip)
849 0 7426 if ref $mask and ref $mask eq 'Math::BigInt'
856 6399 1027 if (not $mask =~ /\D/) { }
9 1018 elsif ($mask =~ /^\d+\.\d+\.\d+\.\d+$/) { }
1014 4 elsif (grep(($mask eq $_), ('default', 'any', 'broadcast', 'loopback', 'unspecified', 'host'))) { }
858 169 6230 if ($isV6) { }
6230 0 elsif ($isCIDR and $mask < 33) { }
859 169 0 if ($isCIDR) { }
861 0 169 if ($ip =~ /^(\d+)(?:|\.(\d+)(?:|\.(\d+)(?:|\.(\d+))))$/ and do { $dq1 = $1; $dq2 = $2 || 0; $dq3 = $3 || 0; $dq4 = $4 || 0; 1 } and $dq1 >= 0 and $dq1 < 256 and $dq2 >= 0 and $dq2 < 256 and $dq3 >= 0 and $dq3 < 256 and $dq4 >= 0 and $dq4 < 256) { }
165 4 elsif ($mask < 128) { }
875 0 0 if ($mask < 32) { }
0 0 elsif ($mask == 32) { }
897 6200 30 if ($mask < 32) { }
30 0 elsif ($mask == 32) { }
910 169 6230 if ($try)
915 0 9 if $noctal
916 0 9 unless defined($mask = inet_aton($mask))
919 800 214 if (index($ip, ':') < 0 and not $isV6) { }
920 0 800 unless defined($mask = $fip4m{$mask})
922 0 214 unless defined($mask = $fip6m{$mask})
925 2 2 unless defined($mask = ipv6_aton($mask))
930 7039 216 if (index($ip, ':') < 0) { }
931 6989 50 if ($ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) { }
0 50 elsif (grep(($ip eq $_), ('default', 'any', 'broadcast', 'loopback'))) { }
4 46 elsif ($ip =~ /^(\d+)\.(\d+)$/) { }
2 44 elsif ($ip =~ /^(\d+)\.(\d+)\.(\d+)$/) { }
32 12 elsif ($ip =~ /^(\d+)$/ and $hasmask and $1 >= 0 and $1 < 256) { }
0 12 elsif ($ip =~ /^\d+$/) { }
0 12 elsif ($ip =~ /^0[xb]\d+$/ and $hasmask and ($tmp = eval "$ip") || 1 and $tmp >= 0 and $tmp < 256) { }
0 12 elsif ($ip =~ /^-?\d+$/) { }
0 12 elsif ($ip =~ /^-?0[xb]\d+$/) { }
1 11 elsif ($ip =~ /^(\d+)\.$/) { }
0 11 elsif ($ip =~ /^(\d+)\.(\d+)-(\d+)\.?$/ and $2 <= $3 and $3 < 256) { }
4 7 elsif ($ip =~ /^(\d+)-(\d+)\.?$/ and ($1 <= $2 and $2 < 256)) { }
1 6 elsif ($ip =~ /^(\d+)\.(\d+)\.$/) { }
1 5 elsif ($ip =~ /^(\d+)\.(\d+)\.(\d+)-(\d+)\.?$/ and $3 <= $4 and $4 < 256) { }
1 4 elsif ($ip =~ /^(\d+)\.(\d+)\.(\d+)\.$/) { }
0 4 elsif ($ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)-(\d+)$/ and $4 <= $5 and $5 < 256) { }
0 4 elsif ($ip =~ /^(\d+\.\d+\.\d+\.\d+) \s*-\s*(\d+\.\d+\.\d+\.\d+)$/x) { }
4 0 elsif (not $NetAddr::IP::Lite::NoFQDN || $ip =~ /[^a-zA-Z0-9\._-]/ and $tmp = gethostbyname fillIPv4($ip) and $tmp ne $_v4zero and $tmp ne $_zero) { }
0 0 elsif (not $NetAddr::IP::Lite::NoFQDN || $ip =~ /[^a-zA-Z0-9\._-]/ and havegethostbyname2() and $tmp = naip_gethostbyname($ip)) { }
0 0 elsif ($NetAddr::IP::Lite::Accept_Binary_IP and not $hasmask) { }
935 0 0 unless defined($ip = $fip4{$ip})
939 0 4 $hasmask ? :
944 2 0 $hasmask ? :
963 0 0 if $ip < 0
1009 0 0 unless $ip = inet_aton($1)
1010 0 0 unless $tmp = inet_aton($2)
1014 0 0 if ($tmp = unpack('N', $tmp) - unpack('N', $ip)) < 0
1018 0 0 if ¬contiguous($mask)
1020 0 0 if &hasbits($ip & $tmp)
1035 0 0 if (length $ip == 4) { }
0 0 elsif (length $ip == 16) { }
1046 0 7035 unless defined($ip = inet_aton($ip))
1053 3 213 if $ip =~ /\[([^\]]+)\]/
1054 216 0 if (defined($tmp = ipv6_aton($ip)))
1059 0 0 if grep(($ip eq $_), ('default', 'any', 'loopback', 'unspecified')) and defined($ip = $fip6{$ip})
1063 2 7431 if ¬contiguous($mask)
1084 323 8544 unless $ip->{'isv6'}
1114 25128 75518 $_[0]{'isv6'} ? :
1125 0 4 if $_[0]{'isv6'}
1128 4 0 isIPv4($_[0]{'addr'}) ? :
1140 13 40532 unless $len
1141 24985 15547 if $_[0]{'isv6'}
1143 15547 0 isIPv4($_[0]{'addr'}) ? :
1154 0 0 $_[0]{'isv6'} ? :
1166 0 0 $self->{'isv6'} ? :
1191 0 0 if $_[0]{'isv6'}
1194 0 0 isIPv4($_[0]{'addr'}) ? :
1222 0 0 if (wantarray)
1223 0 0 if (not $_[0]{'isv6'} and isIPv4($_[0]{'addr'})) { }
1234 0 0 !$_[0]{'isv6'} && isIPv4($_[0]{'addr'}) ? :
1287 0 0 if $no_mbi_emu
0 0 if (eval { do { require Math::BigInt if $no_mbi_emu } }) { }
1298 0 0 unless $biloaded
1303 0 0 unless $biloaded
1309 0 0 if (wantarray) { }
1310 0 0 if (not $_[0]{'isv6'} and isIPv4($_[0]{'addr'})) { }
1312 0 0 $_[0]{'addr'} ? :
1315 0 0 $_[0]{'mask'} ? :
1321 0 0 $_[0]{'addr'} ? :
1324 0 0 $_[0]{'mask'} ? :
1330 0 0 if (not $_[0]{'isv6'} and isIPv4($_[0]{'addr'})) { }
1332 0 0 $_[0]{'addr'} ? :
1337 0 0 $_[0]{'addr'} ? :
1364 0 293316 unless &hasbits($_[1]{'mask'})
1369 54288 239028 &sub128($netme, $neto) && &sub128($brdo, $brdme) ? :
1398 0 0 if &sub128($netme, $ip_10n) and &sub128($ip_10b, $brdme)
1399 0 0 if &sub128($netme, $ip_192n) and &sub128($ip_192b, $brdme)
1400 0 0 &sub128($netme, $ip_172n) && &sub128($ip_172b, $brdme) ? :
1418 0 0 $_[0]{'isv6'} ? :
1432 16 0 if (&hasbits($_[0]{'mask'} ^ $_cidr127)) { }
1448 3 0 if (&hasbits($_[0]{'mask'} ^ $_cidr127)) { }
1508 0 0 if ($NetAddr::IP::Lite::Old_nth) { }
0 0 elsif ($slash31) { }
1509 0 0 if $slash31 and $count != 1
1510 0 0 if $count < 1 or $count > $self->num
1513 0 0 if $count and $count != 1
1516 0 0 if $count < 1 or $count > $self->num
1557 2304 2304 if ($NetAddr::IP::Lite::Old_nth) { }
1560 0 2304 if $net[0] or $net[1] or $net[2]
1561 0 2304 if $net[3]
1564 2304 0 unless &hasbits($net)
1566 0 0 unless &hasbits($net)
1567 0 0 unless $_[0]{'isv6'}
1595 0 32 if (grep {$_ eq ':aton';} @_)
1599 0 32 if (grep {$_ eq ':old_nth';} @_)
1603 0 32 if (grep {$_ eq ':lower';} @_)
1608 0 32 if (grep {$_ eq ':upper';} @_)
1613 0 32 if (grep {$_ eq ':nofqdn';} @_)