Branch Coverage

blib/lib/Net/CIDR/Lite.pm
Criterion Covered Total %
branch 120 168 71.4


line true false branch
25 8 7 if (tr[/][])
26 2 5 if (tr/\-//)
27 0 5 if (UNIVERSAL::isa($_, 'Net::CIDR::Lite'))
38 12 7 unless %$self
39 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 3 if (_pack_ipv4($ip)) { }
3 0 elsif (_pack_ipv6($ip)) { }
182 3 48 unless @nums == 4
184 0 192 unless /^\d{1,3}$/ and $_ <= 255
196 0 9 if $ip =~ /^:/ and not $ip =~ s/^::/:/
197 0 9 if $ip =~ /:$/ and not $ip =~ s/::$/:/
199 0 9 unless @nums <= 8
202 0 60 if $ipv4
203 58 2 if /^[a-fA-F\d]{1,4}$/
204 0 2 if $empty++
2 0 if $_ eq ''
205 0 0 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'})