Branch Coverage

blib/lib/Net/CIDR/Lite.pm
Criterion Covered Total %
branch 129 172 75.0


line true false branch
25 14 8 if (tr[/][])
26 2 6 if (tr/\-//)
27 0 6 if (UNIVERSAL::isa($_, "Net::CIDR::Lite"))
38 20 7 unless %$self
40 1 20 unless $mask =~ /^\d+$/ and $mask <= $self->{'NBITS'} - 8
42 0 20 unless my $start = $self->{'PACK'}->($ip) & $self->{'MASKS'}[$mask]
45 4 16 unless ++$self->{'RANGES'}{$start}
46 0 20 unless --$self->{'RANGES'}{$end}
52 3 6 unless $self->{'RANGES'}
57 0 8 ($total += $ranges->{$_}) ? :
8 8 if ($total) { }
65 1 4 unless $self->{'NBITS'}
70 4 4 unless $total
72 4 4 unless ($total)
80 5 112 if $end le $ip
87 4 0 wantarray ? :
95 3 3 unless $total
97 3 3 unless ($total)
103 3 0 wantarray ? :
115 6 6 unless $total
121 6 6 unless ($total)
126 3 7 if ($ip eq $start)
139 3 4 if ($ip eq ($start & $self->{'MASKS'}[32])) { }
151 3 0 wantarray ? :
158 13 12 if (_pack_ipv4($ip)) { }
5 7 elsif (_pack_ipv6($ip)) { }
182 7 65 unless @nums == 4
184 6 230 unless /^\d{1,3}$/ and not /^0\d{1,2}$/ and $_ <= 255
196 0 25 if $ip =~ /^:/ and not $ip =~ s/^::/:/
197 0 25 if $ip =~ /:$/ and not $ip =~ s/::$/:/
199 0 25 unless @nums <= 8
202 0 101 if $ipv4
203 78 23 if /^[a-fA-F\d]{1,4}$/
204 0 11 if $empty++
11 12 if $_ eq ""
205 9 3 if $ipv4 = _pack_ipv4($_)
208 0 22 if $ipv4 and @nums > 6
209 0 11 $ipv4 ? :
4 18 unless $empty or @nums == ($ipv4 ? 6 : 8)
210 9 2 $ipv4 ? :
11 7 if $empty
221 3 0 if (my(@runs) = $ip =~ /((?:(?:^|:)(?:0000))+:?)/g)
224 0 0 if length $max < length $_
236 3 3 unless %$self
237 0 5 unless my $start = $self->{'PACK'}->($ip)
239 1 4 unless ++$self->{'RANGES'}{$start}
240 0 5 unless --$self->{'RANGES'}{$end}
249 0 3 if defined $crud
250 2 1 unless %$self
252 0 3 unless my $start = $self->{'PACK'}->($ip_start)
254 0 3 unless my $end = $self->{'PACK'}->($ip_end)
256 0 3 if $start gt $end
258 0 3 unless ++$self->{'RANGES'}{$start}
259 0 3 unless --$self->{'RANGES'}{$end}
267 0 0 unless UNIVERSAL::isa($cidr, "Net::CIDR::Lite")
268 0 0 unless (%$self)
285 4 379 if $bits < 0
304 4 6 unless $self->{'FIND'}
305 0 10 unless @{$self->{'FIND'};} < $self->{'PCT'}
306 1 9 unless $self->{'PACK'}
311 6 11 if $this_ip lt $ip
320 1 3 unless $self->{'FIND'}
323 2 2 unless $ip ge $find->[$start] and $ip lt $find->[$end]
326 2 2 if ($start == $mid) { }
327 1 1 if ($find->[$end] eq $ip) { }
331 1 1 $find->[$mid] lt $ip ? :
370 2 1 if (@_ and not $self->{'PACK'})
372 0 2 unless ref $cidr
378 1 2 unless ref $cidr
393 2 2 unless $self->{'FIND'}
394 0 4 unless @_
395 1 3 unless @{$self->{'FIND'};}
396 1 2 if @_ / @{$self->{'FIND'};} < $self->{'PCT'}
397 0 3 unless &$pack($_)
400 3 2 if ($ips[0] lt $ip)
404 2 3 unless @ips
407 0 2 if (@ips)
416 0 1 unless @_
417 0 1 unless $self->{'FIND'}
418 0 1 unless @{$self->{'FIND'};}
423 0 1 unless &$pack($_)
425 0 1 unless $ip ge $find->[$start] and $ip lt $find->[$end]
429 1 1 if ($start == $mid) { }
430 1 0 if ($find->[$end] eq $ip) { }
434 0 1 $find->[$mid] lt $ip ? :
471 0 0 unless ($self->{'PACK'})