Branch Coverage

blib/lib/Net/IP/Lite.pm
Criterion Covered Total %
branch 235 242 97.1


line true false branch
22 11 682 unless defined $addr
28 0 42 unless defined $addr
34 2 210 unless defined $net
40 17 10651 unless defined $addr
44 3087 7564 if ($addr =~ /:/) { }
5205 2359 elsif ($addr =~ /\./) { }
604 1755 elsif ($addr =~ /^0[0-7]+$/) { }
1151 604 elsif ($addr =~ /^\d+$/) { }
544 60 elsif ($addr =~ /^0x[0-9a-f]+$/i) { }
47 487 2600 if $addr eq '::'
49 230 2370 if $addr =~ s/^:// and not $addr =~ /^:/
50 141 2229 if $addr =~ s/:$// and not $addr =~ /:$/
56 458 1771 if $addr =~ /\./
62 318 11523 if ($word =~ /\./) { }
1336 10187 elsif (not length $word) { }
10110 77 elsif ($word =~ /^[0-9a-f]+$/i) { }
64 100 218 if $i != scalar @words or $bin ne '000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111'
66 20 198 if scalar @octets != 4
68 40 752 if not $octet =~ /^\d+$/ or $octet > 255
73 138 1198 if $reduct
76 25 1173 unless $len
80 183 9927 if length $word > 4
86 0 11100 if length $bin > 128
88 25 1463 if length $bin < 128
92 23 5182 if scalar @octets > 4
97 2297 17508 if ($octet =~ /^0[0-7]+$/) { }
15736 1772 elsif ($octet =~ /^\d+$/) { }
1617 155 elsif ($octet =~ /^0x[0-9a-f]+$/i) { }
100 0 2297 if length $octet > 3
104 23 15713 if length $octet > 3
109 23 1594 if length $octet > 2
114 23 19581 if $dec > 255
115 336 19245 if ($i == scalar @octets and $i < 4)
124 23 581 if $addr > 37777777777
129 23 1128 if $addr > 4294967295
134 23 521 if length $addr > 8
183 200 440 if ($short)
187 1120 408 if (not $chunk =~ /1/) { }
190 174 234 if defined $zero_chunks[$i]
194 188 12 if scalar @zero_chunks
198 4120 840 unless $lead_zeros
202 188 452 if $short_len > 1
203 576 64 unless $result =~ /::$/
213 72 658 if ($format =~ /^(D|O|X)$/) { }
221 24 48 if $format eq 'O'
222 8 40 if $format eq 'X' and $lead_zeros
223 20 20 if $format eq 'X'
228 40 618 if ($format eq 'o') { }
48 570 elsif ($format eq 'x') { }
231 16 32 $lead_zeros ? :
238 452 2180 if ($short)
239 210 100 if not $octet and $i and $i < 3
240 10 232 if $i == 2
242 128 2294 if ($format eq 'o') { }
158 2136 elsif ($format eq 'x') { }
256 210 142 _ip_is_ipv4($bin) ? :
270 36 668 if ($convert_to eq 'ipv4' and _ip_is_ipv6ipv4($bin))
275 136 568 if ($convert_to eq 'ipv6' || $convert_to eq 'ipv6ipv4' and _ip_is_ipv4($bin))
280 80 624 if ($convert_to eq 'ipv6ipv4' and _ip_is_ipv6ipv4($bin)) { }
283 40 40 if $$opts{'reverse'}
286 312 312 if $$opts{'reverse'}
290 366 338 if (length $bin > 32)
293 80 286 if ($ipv4)
299 418 286 if (length $bin == 32)
301 80 338 if ($ipv6) { }
315 1 415 unless ref $opts eq 'HASH'
318 63 352 unless _ip_validate($bin)
332 63 94 unless _ip_validate($bin1)
333 63 31 unless _ip_validate($bin2)
340 21 72 if _ip_is_ipv6ipv4($bin1)
341 24 69 if _ip_is_ipv6ipv4($bin2)
350 0 177 unless _ip_validate($bin1)
351 126 51 unless _ip_validate($bin2)
353 11 40 if (_ip_is_ipv6($bin1) and not _ip_is_ipv6ipv4($bin1))
357 9 31 if (_ip_is_ipv6($bin2) and not _ip_is_ipv6ipv4($bin2))
366 72 42 if _ip_is_ipv4($bin1)
367 69 45 if _ip_is_ipv4($bin2)
376 0 164 unless _ip_validate($bin1)
377 126 38 unless _ip_validate($bin2)
404 796 1302 if ($net =~ m[^(.+)/(\d+)$]) { }
474 828 elsif ($net =~ /^(\S+)\s+(\S+)$/) { }
407 0 796 unless _ip_validate($bin_net)
409 606 190 _ip_is_ipv4($bin_net) ? :
410 4 792 if $mask > $mask_len
418 554 274 _ip_is_ipv4($bin_net) ? :
421 80 1888 unless (_ip_validate($bin_net) and _ip_validate($bin_mask) and _ip_type_equal($bin_net, $bin_mask))
425 18 1870 unless _ip_type_equal($bin_addr, $bin_net)
433 1 1402 unless defined $range
435 410 992 if (ref $range eq 'ARRAY')
437 303 314 if ip_in_range($addr, $net)
443 63 929 unless _ip_validate($bin_addr)
452 162 4371 unless _ip_validate($bin)
497 1 352 unless ref $opts eq 'HASH'
504 31 94 if (blessed $addr and $addr->isa('Net::IP::Lite'))
509 63 31 unless _ip_validate($bin2)
517 31 116 blessed $addr && $addr->isa('Net::IP::Lite') ? :
518 63 84 unless _ip_validate($bin2)
520 13 71 if ($self->is_ipv6 and not $self->is_ipv6ipv4)
524 9 62 if (_ip_is_ipv6($bin2) and not _ip_is_ipv6ipv4($bin2))
534 38 101 blessed $addr && $addr->isa('Net::IP::Lite') ? :
536 63 76 unless _ip_validate($bin2)
544 1 2233 unless defined $range
546 650 1583 if (ref $range eq 'ARRAY')
548 423 674 if $self->in_range($net)
553 414 1169 if (blessed $range and $range->isa('Net::IP::Lite::Net'))
569 1 1103 unless defined $net
574 511 592 if ($net =~ m[^(.+)/(\d+)$]) { }
454 138 elsif ($net =~ /^(\S+)\s+(\S+)$/) { }
578 261 250 $self->is_ipv4 ? :
579 2 509 if $mask > $mask_len
584 1 453 unless $self
588 61 77 unless $self
589 52 25 $self->is_ipv4 ? :
592 586 453 if ($bin_mask)
593 312 274 if (length $bin_mask == 32) { }
600 37 1002 unless $$self{'mask'}
603 3 287 unless $self->is_ipv4 and $ipv4_mask or $self->is_ipv6 and not $ipv4_mask
622 414 414 if (blessed $addr and $addr->isa('Net::IP::Lite')) { }
623 8 406 unless Net::IP::Lite::_ip_type_equal($self->binary, $addr->binary)
627 0 414 unless Net::IP::Lite::_ip_validate($bin_addr)
628 8 406 unless Net::IP::Lite::_ip_type_equal($self->binary, $bin_addr)