Branch Coverage

blib/lib/Lingua/EN/AddressParse.pm
Criterion Covered Total %
branch 90 124 72.5


line true false branch
467 0 4 unless (defined $args{'country'} and $args{'country'} =~ /^(AU|Australia|GB|United Kingdom|US|United States|CA|Canada)$/)
512 12 3 if ($address->{'auto_clean'})
529 2 13 if ($address->{'country_code'} ne 'US' and $address->{'input_string'} =~ m[^(\d{1,4}[A-Z]{0,2})[/| ](\d+[ \w-].*)$])
562 129 194 if ($orig_components{$curr_key}) { }
572 0 323 if ($uc_all)
579 187 136 if ($curr_key =~ /^(base_street_name|street_name|street_type|suburb|property_name|sub_property|pre_cursor|po_box_type|level|building)/) { }
34 102 elsif ($curr_key =~ /street_direction/) { }
582 1 186 if ($curr_key eq 'street_name' and $curr_value =~ /^US HIGHWAY (.*)/) { }
17 169 elsif ($curr_key eq 'sub_property_identifier') { }
596 0 5 if ($word =~ /^\d{1,3}(ST|ND|RD|TH)$/) { }
0 5 elsif (length $word > 1 and not $word =~ /\d/) { }
617 71 98 if ($curr_value) { }
632 1 33 if (length $curr_value == 1 or length $curr_value == 2) { }
0 33 elsif (length $curr_value > 2) { }
664 0 0 unless ($address->{'properties'}{'type'} eq 'unknown')
677 0 0 if ($address->{'country'} eq 'US') { }
694 0 0 if ($component_vals{$component})
701 0 0 if ($address->{'error'} and $address->{'force_case'})
735 0 0 if ($props{'type'})
753 0 0 if (defined $comps{$comp})
783 1 14 if ($pre_cursor) { }
792 1 14 if ($level) { }
801 1 14 if ($building) { }
811 1 14 if ($po_box_type) { }
822 1 14 if ($parsed_address->{'post_box'})
828 0 15 if ($parsed_address->{'road_box'})
834 1 14 if ($parsed_address->{'property_name'})
842 4 11 if ($parsed_address->{'sub_property'})
844 4 0 if ($parsed_address->{'sub_property'} =~ /^(#|[A-Z]{1,}) (.*)$/) { }
0 0 elsif ($parsed_address->{'sub_property'} =~ /^(\d\w\w) (.*)$/) { }
859 13 2 if ($parsed_address->{'property_identifier'})
868 13 2 if ($parsed_address->{'street_name'})
871 0 13 if ($parsed_address->{'street_name'} eq 'THE ') { }
883 1 14 if ($parsed_address->{'street_direction_suffix'})
890 15 0 if ($parsed_address->{'suburb'})
896 15 0 if ($parsed_address->{'subcountry'})
901 7 8 if ($address->{'abbreviate_subcountry'}) { }
905 1 6 if ($code ne 'unknown') { }
922 15 0 if ($parsed_address->{'post_code'})
928 1 14 if ($parsed_address->{'country'})
936 1 14 if ($parsed_address->{'non_matching'})
956 2 13 unless ($street_name)
962 4 9 if (@words > 1) { }
964 0 4 if ($words[0] =~ /^(N|NE|NW|E|S|SE|SW|W|NORTH|EAST|SOUTH|WEST|NTH|STH)$/) { }
996 1 14 if ($address->{'properties'}{'non_matching'}) { }
1003 0 14 if ($address->{'properties'}{'type'} eq 'unknown') { }
1010 0 14 if ($address->{'force_post_code'} and not $address->{'components'}{'post_code'})
1017 0 14 if ($address->{'input_string'} =~ m[[^"A-Z0-9'\-\.,&#/ ]])
1024 12 2 if ($address->{'properties'}{'type'} eq 'suburban')
1027 11 1 unless ($street =~ /\d/)
1030 1 10 if (_check_vowel($address->{'components'}{'base_street_name'}))
1039 0 14 if (_check_vowel($address->{'components'}{'suburb'}))
1101 12 0 unless ($input =~ /^\d+ [A-Z] (ST|AVE)/)
1104 0 12 if ($address->{'country_code'} eq 'US') { }
1117 0 12 if ($address->{'country_code'} eq 'US') { }
1164 1 14 if ($input =~ m[^(C/O.*?|ATTN.*?) (\d+|PO BOX)( .*)]) { }
1187 1 14 if ($input =~ / ?((GROUND|FIRST|SECOND|THIRD|FOURTH|FIFTH|SIXTH) (FLOOR|FLR|FL) )/ or $input =~ / ?(\d{1,2}(ST|ND|RD|TH) (FLOOR|FLR|FL) )/ or $input =~ m[ ?(LEVEL (\d{1,2}|[GM])[/ -])] or $input =~ m[ ?((FLOOR|FLR|FL) \d{1,2}[/ -])])
1219 1 14 if ($input =~ /^($building_label $id) / or $input =~ / ($building_label $id) /)
1236 0 15 if ($input =~ /^(($name )?$name HOUSE) /)
1256 1 14 if ($input =~ /^(.*?) (PRIVATE BOXES)( .*)$/) { }
1279 110 175 if ($address->{'components'}{$key})
1302 1 33 if (length $word > 1 and not $word =~ /[AEIOUY]|ST|MT|DR|JN?R|SN?R/)