Branch Coverage

blib/lib/Net/CIDR/Lite.pm
Criterion Covered Total %
branch 124 168 73.8


line true false branch
25 9 7 if (tr[/][])
26 2 5 if (tr/\-//)
27 0 5 if (UNIVERSAL::isa($_, 'Net::CIDR::Lite'))
38 15 7 unless %$self
40 1 18 unless $mask =~ /^\d+$/ and $mask <= $self->{'NBITS'} - 8
42 0 18 unless my $start = $self->{'PACK'}->($ip) & $self->{'MASKS'}[$mask]
45 4 14 unless ++$self->{'RANGES'}{$start}
46 0 18 unless --$self->{'RANGES'}{$end}
52 3 4 unless $self->{'RANGES'}
57 0 6 ($total += $ranges->{$_}) ? :
6 6 $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 6 if (_pack_ipv4($ip)) { }
3 3 elsif (_pack_ipv6($ip)) { }
182 3 54 unless @nums == 4
184 6 194 unless /^\d{1,3}$/ and not /^0\d{1,2}$/ and $_ <= 255
196 0 12 if $ip =~ /^:/ and not $ip =~ s/^::/:/
197 0 12 if $ip =~ /:$/ and not $ip =~ s/::$/:/
199 0 12 unless @nums <= 8
202 0 63 if $ipv4
203 58 5 if /^[a-fA-F\d]{1,4}$/
204 0 2 if $empty++
2 3 if $_ eq ''
205 0 3 if $ipv4 = _pack_ipv4($_)
208 0 9 if $ipv4 and @nums > 6
209 0 2 $ipv4 ? :
2 7 if $empty
220 3 0 if (my(@runs) = $ip =~ /((?:(?:^|:)(?:0000))+:?)/g)
223 0 0 if length $max < length $_
235 2 3 unless %$self
236 0 5 unless my $start = $self->{'PACK'}->($ip)
238 1 4 unless ++$self->{'RANGES'}{$start}
239 0 5 unless --$self->{'RANGES'}{$end}
248 0 3 if defined $crud
249 2 1 unless %$self
251 0 3 unless my $start = $self->{'PACK'}->($ip_start)
253 0 3 unless my $end = $self->{'PACK'}->($ip_end)
255 0 3 if $start gt $end
257 0 3 unless ++$self->{'RANGES'}{$start}
258 0 3 unless --$self->{'RANGES'}{$end}
266 0 0 unless UNIVERSAL::isa($cidr, 'Net::CIDR::Lite')
267 0 0 unless (%$self)
284 4 378 if $bits < 0
303 2 3 unless $self->{'FIND'}
304 0 5 unless @{$self->{'FIND'};} < $self->{'PCT'}
305 1 4 unless $self->{'PACK'}
310 3 4 if $this_ip lt $ip
319 1 3 unless $self->{'FIND'}
322 2 2 unless $ip ge $find->[$start] and $ip lt $find->[$end]
325 2 2 if ($start == $mid) { }
326 1 1 if ($find->[$end] eq $ip) { }
330 1 1 $find->[$mid] lt $ip ? :
369 2 1 if (@_ and not $self->{'PACK'})
371 0 2 unless ref $cidr
377 1 2 unless ref $cidr
392 2 2 unless $self->{'FIND'}
393 0 4 unless @_
394 1 3 unless @{$self->{'FIND'};}
395 1 2 if @_ / @{$self->{'FIND'};} < $self->{'PCT'}
396 0 3 unless &$pack($_)
399 3 2 if ($ips[0] lt $ip)
403 2 3 unless @ips
406 0 2 if (@ips)
415 0 1 unless @_
416 0 1 unless $self->{'FIND'}
417 0 1 unless @{$self->{'FIND'};}
422 0 1 unless &$pack($_)
424 0 1 unless $ip ge $find->[$start] and $ip lt $find->[$end]
428 1 1 if ($start == $mid) { }
429 1 0 if ($find->[$end] eq $ip) { }
433 0 1 $find->[$mid] lt $ip ? :
470 0 0 unless ($self->{'PACK'})