Branch Coverage

blib/lib/NetAddr/IP/Lite.pm
Criterion Covered Total %
branch 128 310 41.2


line true false branch
178 0 0 if ($pkg =~ /^$other/o and exists ${$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 65121 3621 unless $c
285 3422 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+(.+)$/)
756 0 7367 if ($isV6 < 0)
765 0 7367 if defined $ip and $ip eq ''
767 0 7367 unless defined $ip
768 0 7367 if ref $ip and ref $ip eq 'Math::BigInt'
779 6829 538 if (not @_) { }
538 0 elsif (defined $_[0]) { }
781 0 6829 if (not $ip =~ /\D/) { }
5839 990 elsif ($ip =~ m[^([a-z0-9.:-]+)(?:/|\s+)([a-z0-9.:-]+)$] or $ip =~ m(^[\[]{1}([a-z0-9.:-]+)(?:/|\s+)([a-z0-9.:-]+)[\]]{1}$)) { }
9 981 elsif (grep(($ip eq $_), ('default', 'any', 'broadcast', 'loopback', 'unspecified'))) { }
791 0 9 if $ip eq 'unspecified'
792 0 9 if ($isV6) { }
794 0 0 unless defined($ip = $fip6{$ip})
797 0 9 unless defined($ip = $fip4{$ip})
804 0 538 if ($_[0] =~ /ipv6/i or $isV6)
805 0 0 if (grep(($ip eq $_), ('default', 'any', 'loopback', 'unspecified'))) { }
810 0 0 unless $isV6
822 981 6377 unless (defined $mask)
834 351 7007 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)
843 0 7358 if ref $mask and ref $mask eq 'Math::BigInt'
850 6364 994 if (not $mask =~ /\D/) { }
9 985 elsif ($mask =~ /^\d+\.\d+\.\d+\.\d+$/) { }
981 4 elsif (grep(($mask eq $_), ('default', 'any', 'broadcast', 'loopback', 'unspecified', 'host'))) { }
852 169 6195 if ($isV6) { }
6195 0 elsif ($isCIDR and $mask < 33) { }
853 169 0 if ($isCIDR) { }
855 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) { }
869 0 0 if ($mask < 32) { }
0 0 elsif ($mask == 32) { }
888 6165 30 if ($mask < 32) { }
30 0 elsif ($mask == 32) { }
901 169 6195 if ($try)
906 0 9 if $noctal
907 0 9 unless defined($mask = inet_aton($mask))
910 799 182 if (index($ip, ':') < 0 and not $isV6) { }
911 0 799 unless defined($mask = $fip4m{$mask})
913 0 182 unless defined($mask = $fip6m{$mask})
916 2 2 unless defined($mask = ipv6_aton($mask))
921 7003 184 if (index($ip, ':') < 0) { }
922 6986 17 if ($ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) { }
0 17 elsif (grep(($ip eq $_), ('default', 'any', 'broadcast', 'loopback'))) { }
4 13 elsif ($ip =~ /^(\d+)\.(\d+)$/) { }
2 11 elsif ($ip =~ /^(\d+)\.(\d+)\.(\d+)$/) { }
0 11 elsif ($ip =~ /^(\d+)$/ and $hasmask and $1 >= 0 and $1 < 256) { }
0 11 elsif ($ip =~ /^\d+$/) { }
0 11 elsif ($ip =~ /^0[xb]\d+$/ and $hasmask and ($tmp = eval "$ip") || 1 and $tmp >= 0 and $tmp < 256) { }
0 11 elsif ($ip =~ /^-?\d+$/) { }
0 11 elsif ($ip =~ /^-?0[xb]\d+$/) { }
1 10 elsif ($ip =~ /^(\d+)\.$/) { }
0 10 elsif ($ip =~ /^(\d+)\.(\d+)-(\d+)\.?$/ and $2 <= $3 and $3 < 256) { }
4 6 elsif ($ip =~ /^(\d+)-(\d+)\.?$/ and ($1 <= $2 and $2 < 256)) { }
1 5 elsif ($ip =~ /^(\d+)\.(\d+)\.$/) { }
1 4 elsif ($ip =~ /^(\d+)\.(\d+)\.(\d+)-(\d+)\.?$/ and $3 <= $4 and $4 < 256) { }
1 3 elsif ($ip =~ /^(\d+)\.(\d+)\.(\d+)\.$/) { }
0 3 elsif ($ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)-(\d+)$/ and $4 <= $5 and $5 < 256) { }
0 3 elsif ($ip =~ /^(\d+\.\d+\.\d+\.\d+) \s*-\s*(\d+\.\d+\.\d+\.\d+)$/x) { }
3 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) { }
926 0 0 unless defined($ip = $fip4{$ip})
930 0 4 $hasmask ? :
935 2 0 $hasmask ? :
954 0 0 if $ip < 0
996 0 0 if ($noctal) { }
997 0 0 unless $ip = inet_aton(_no_octal($1))
998 0 0 unless $tmp = inet_aton(_no_octal($2))
1000 0 0 unless $ip = inet_aton($1)
1001 0 0 unless $tmp = inet_aton($2)
1005 0 0 if ($tmp = unpack('N', $tmp) - unpack('N', $ip)) < 0
1009 0 0 if notcontiguous $mask
1011 0 0 if hasbits($ip & $tmp)
1026 0 0 if (length $ip == 4) { }
0 0 elsif (length $ip == 16) { }
1037 0 7000 unless defined($ip = inet_aton($ip))
1044 3 181 if $ip =~ /\[([^\]]+)\]/
1045 184 0 if (defined($tmp = ipv6_aton($ip)))
1049 0 0 if grep(($ip eq $_), ('default', 'any', 'loopback', 'unspecified')) and defined($ip = $fip6{$ip})
1054 2 7363 if notcontiguous $mask
1075 323 8544 unless $$ip{'isv6'}
1103 25128 75517 $_[0]{'isv6'} ? :
1116 0 4 if $_[0]{'isv6'}
1117 4 0 isIPv4($_[0]{'addr'}) ? :
1131 13 40531 unless $len
1132 24985 15546 if $_[0]{'isv6'}
1133 15546 0 isIPv4($_[0]{'addr'}) ? :
1145 0 0 $_[0]{'isv6'} ? :
1157 0 0 $$self{'isv6'} ? :
1182 0 0 if $_[0]{'isv6'}
1183 0 0 isIPv4($_[0]{'addr'}) ? :
1213 0 0 if (wantarray)
1214 0 0 if (not $_[0]{'isv6'} and isIPv4($_[0]{'addr'})) { }
1223 0 0 !$_[0]{'isv6'} && isIPv4($_[0]{'addr'}) ? :
1278 0 0 if $no_mbi_emu
0 0 if (eval { do { require Math::BigInt if $no_mbi_emu } }) { }
1289 0 0 unless $biloaded
1294 0 0 unless $biloaded
1300 0 0 if (wantarray) { }
1301 0 0 if (not $_[0]{'isv6'} and isIPv4($_[0]{'addr'})) { }
1302 0 0 $_[0]{'addr'} ? :
1305 0 0 $_[0]{'mask'} ? :
1310 0 0 $_[0]{'addr'} ? :
1313 0 0 $_[0]{'mask'} ? :
1321 0 0 if (not $_[0]{'isv6'} and isIPv4($_[0]{'addr'})) { }
1322 0 0 $_[0]{'addr'} ? :
1326 0 0 $_[0]{'addr'} ? :
1355 0 293787 unless hasbits($_[1]{'mask'})
1360 54288 239499 sub128($netme, $neto) && sub128($brdo, $brdme) ? :
1389 0 0 if sub128 $netme, $ip_10n and sub128 $ip_10b, $brdme
1390 0 0 if sub128 $netme, $ip_192n and sub128 $ip_192b, $brdme
1391 0 0 sub128($netme, $ip_172n) && sub128($ip_172b, $brdme) ? :
1405 16 0 if (hasbits($_[0]{'mask'} ^ $_cidr127)) { }
1421 3 0 if (hasbits($_[0]{'mask'} ^ $_cidr127)) { }
1481 0 0 if ($NetAddr::IP::Lite::Old_nth) { }
0 0 elsif ($slash31) { }
1482 0 0 if $slash31 and $count != 1
1483 0 0 if $count < 1 or $count > $self->num
1486 0 0 if $count and $count != 1
1489 0 0 if $count < 1 or $count > $self->num
1530 2304 2304 if ($NetAddr::IP::Lite::Old_nth) { }
1533 0 2304 if $net[0] or $net[1] or $net[2]
1534 0 2304 if $net[3]
1537 2304 0 unless hasbits $net
1539 0 0 unless hasbits $net
1540 0 0 unless $_[0]{'isv6'}
1568 0 31 if (grep {$_ eq ':aton';} @_)
1572 0 31 if (grep {$_ eq ':old_nth';} @_)
1576 0 31 if (grep {$_ eq ':lower';} @_)
1581 0 31 if (grep {$_ eq ':upper';} @_)
1586 0 31 if (grep {$_ eq ':nofqdn';} @_)