Branch Coverage

lib/Geo/Address/Formatter.pm
Criterion Covered Total %
branch 180 228 78.9


line true false branch
35 1 0 if (defined $params{'no_warnings'} and $params{'no_warnings'})
46 0 17 if $debug
48 16 1 if ($self->_read_configuration($conf_path))
58 0 17 unless -e $path
84 1 16 if $loaded == 0
88 0 16 if $debug
91 0 16 if ($debug)
96 234 0 if (defined $rh_c->{'name'})
97 128 106 if (defined $rh_c->{'aliases'}) { }
109 128 106 if (defined $rh_c->{'aliases'})
116 0 16 if ($debug)
133 42 6 if (-e $yfile)
148 236 0 if ($abbrv_file =~ m[/(\w\w)\.yaml$])
165 5 1 if (defined $self->{'final_components'})
168 1 0 if $show_warnings
181 0 449 if ($debug)
196 445 4 if ($cc)
206 2 447 if (defined $rh_options->{'only_address'})
210 0 449 if ($debug)
228 2805 727 if defined $self->{'component_aliases'}{$c}
232 494 233 if (defined $self->{'component2type'}{$c})
235 395 99 unless (defined $rh_components->{$ptype})
247 318 38 if (scalar @aliases == 1)
255 38 6 if (defined $rh_components->{$c})
262 0 449 if ($debug)
269 0 449 if ($debug)
278 2 447 if (defined $rh_options->{'address_template'}) { }
283 445 2 if (defined $rh_config->{'address_template'}) { }
2 0 elsif (defined $self->{'templates'}{'default'}{'address_template'}) { }
291 48 399 unless ($self->_minimal_components($rh_components))
292 0 48 if $debug
293 33 15 if (defined $rh_config->{'fallback_template'}) { }
14 1 elsif (defined $self->{'templates'}{'default'}{'fallback_template'}) { }
303 0 449 if $debug
307 0 449 if ($debug)
313 0 449 if ($debug)
319 0 449 if ($debug)
325 0 449 if ($debug)
330 3 446 if ($oa) { }
331 0 3 if ($debug)
338 0 446 if ($debug)
342 223 223 if (scalar @$ra_unknown)
345 0 223 if ($debug)
352 5 444 if ($abbrv)
363 0 449 if ($debug)
372 0 449 if ($debug)
395 0 451 if ($debug)
406 553 4 if (lc $piece ne "new york")
407 1 552 if $seen{$piece} > 1
423 45 460 if ($replacement =~ /\$\d/)
424 20 25 if ($text =~ /$regexp/)
446 309 141 if (defined $rh_components->{'postcode'})
447 1 308 if (length $rh_components->{'postcode'} > 20) { }
1 307 elsif ($rh_components->{'postcode'} =~ /\d+;\d+/) { }
1 306 elsif ($rh_components->{'postcode'} =~ /^(\d{5}),\d{5}/) { }
460 0 3888 if (not defined $rh_components->{$c}) { }
1 3887 elsif (not $rh_components->{$c} =~ /\w/) { }
1 3886 elsif ($rh_components->{$c} =~ m[https?://]) { }
483 203 691 unless defined $rh_components->{$c}
484 48 846 if $missing == $minimal_threshold
499 4 446 unless defined $rh_components->{'country_code'}
501 446 0 if (my $cc = lc $rh_components->{'country_code'})
504 0 446 unless $cc =~ /^[a-z][a-z]$/
505 0 446 if $cc eq "uk"
513 49 397 if (defined $self->{'templates'}{$cc} and defined $self->{'templates'}{$cc}{'use_country'})
518 36 13 if (defined $self->{'templates'}{$old_cc}{'change_country'})
521 2 34 if ($new_country =~ /\$(\w*)/)
523 2 0 if (defined $rh_components->{$component}) { }
531 12 37 if (defined $self->{'templates'}{$old_cc}{'add_component'})
535 11 1 if (defined $valid_replacement_components{$k})
541 5 441 if ($cc eq "NL")
542 5 0 if (defined $rh_components->{'state'})
543 1 4 if ($rh_components->{'state'} eq "Cura\347ao") { }
0 4 elsif ($rh_components->{'state'} =~ /^sint maarten/i) { }
1 3 elsif ($rh_components->{'state'} =~ /^Aruba/i) { }
567 446 3 if (defined $rh_components->{'country'})
568 1 445 if (&looks_like_number($rh_components->{'country'}))
569 1 0 if (defined $rh_components->{'state'})
596 9 895 unless $rh_components->{'country_code'}
597 336 559 unless $rh_components->{$keyname}
601 22 537 if (defined $rh_components->{$code})
605 21 1 if ($rh_components->{$code} ne $rh_components->{$keyname})
614 282 256 if (my $mapping = $$self{$code . "s"}{$cc})
624 766 5810 if (XXX) { }
631 180 7178 if ($uc_name eq uc $confname)
641 6 7172 if ($uc_name eq $abbrv)
651 253 29 if ($keyname eq "state")
652 80 173 unless (defined $rh_components->{'state_code'})
653 2 78 if ($cc eq "US")
654 0 2 if ($rh_components->{'state'} =~ /^united states/i)
658 0 0 if (uc $state eq uc $k)
664 2 0 if ($rh_components->{'state'} =~ /^washington,? d\.?c\.?/i)
681 0 452 if ($debug)
691 82 8039 if ($ra_fromto->[0] =~ /^$component=/) { }
694 5 77 if ($rh_components->{$component} eq $from) { }
702 8116 5 if (defined $regexp)
720 2 5 unless (defined $rh_comp->{'country_code'})
721 1 1 if ($show_warnings)
723 1 0 if (defined $rh_comp->{'country'})
735 5 0 if (defined $self->{'country2lang'}{$cc})
741 6 3 if (defined $self->{'abbreviations'}{$lang}) { }
745 0 10 unless defined $rh_comp->{$comp_name}
764 0 903 if ($debug)
793 18 3475 if $seen_lines{$line} > 1
801 3665 10 if (lc $w ne "new york")
804 1 3674 if defined $seen_words{$w} and $seen_words{$w} > 1
826 0 450 if $debug
831 0 450 if $debug
836 2 448 unless ($output =~ /\w/)
838 0 2 if (scalar @comps == 1)
872 668 98 scalar @a_parts ? :
896 445 0 if (defined $cc)
898 221 224 if defined $self->{'set_district_alias'}{$ucc}
903 0 224 if (defined $small_district{$cc}) { }