Branch Coverage

blib/lib/Lingua/EN/AddressParse.pm
Criterion Covered Total %
branch 88 122 72.1


line true false branch
447 0 4 unless (defined $args{'country'} and $args{'country'} =~ /^(AU|Australia|GB|United Kingdom|US|United States|CA|Canada)$/)
494 12 3 if ($address->{'auto_clean'})
511 2 13 if ($address->{'country_code'} ne 'US' and $address->{'input_string'} =~ m[^(\d{1,4}[A-Z]{0,2})[/| ](\d+[ \w-].*)$])
545 0 323 if ($uc_all)
552 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/) { }
555 1 186 if ($curr_key eq 'street_name' and $curr_value =~ /^US HIGHWAY (.*)/) { }
17 169 elsif ($curr_key eq 'sub_property_identifier') { }
569 0 5 if ($word =~ /^\d{1,3}(ST|ND|RD|TH)$/) { }
0 5 elsif (length $word > 1 and not $word =~ /\d/) { }
590 71 98 if ($curr_value) { }
605 1 33 if (length $curr_value == 1 or length $curr_value == 2) { }
0 33 elsif (length $curr_value > 2) { }
637 0 0 unless ($address->{'properties'}{'type'} eq 'unknown')
650 0 0 if ($address->{'country'} eq 'US') { }
667 0 0 if ($component_vals{$component})
674 0 0 if ($address->{'error'} and $address->{'force_case'})
708 0 0 if ($props{'type'})
726 0 0 if (defined $comps{$comp})
756 1 14 if ($pre_cursor) { }
765 1 14 if ($level) { }
774 1 14 if ($building) { }
784 1 14 if ($po_box_type) { }
795 1 14 if ($parsed_address->{'post_box'})
801 0 15 if ($parsed_address->{'road_box'})
807 1 14 if ($parsed_address->{'property_name'})
815 4 11 if ($parsed_address->{'sub_property'})
817 4 0 if ($parsed_address->{'sub_property'} =~ /^(#|[A-Z]{1,}) (.*)$/) { }
0 0 elsif ($parsed_address->{'sub_property'} =~ /^(\d\w\w) (.*)$/) { }
832 13 2 if ($parsed_address->{'property_identifier'})
840 0 15 if ($street_direction) { }
852 13 2 if ($parsed_address->{'street_name'})
855 0 13 if ($parsed_address->{'street_name'} eq 'THE ') { }
868 1 14 if ($parsed_address->{'street_direction_suffix'})
875 15 0 if ($parsed_address->{'suburb'})
881 15 0 if ($parsed_address->{'subcountry'})
886 7 8 if ($address->{'abbreviate_subcountry'}) { }
890 1 6 if ($code ne 'unknown') { }
907 15 0 if ($parsed_address->{'post_code'})
913 1 14 if ($parsed_address->{'country'})
921 1 14 if ($parsed_address->{'non_matching'})
941 2 13 unless ($street_name)
947 4 9 if (@words > 1)
949 0 4 if ($words[0] =~ /^(N|NE|NW|E|S|SE|SW|W|NORTH|EAST|SOUTH|WEST|NTH|STH)$/)
971 1 14 if ($address->{'properties'}{'non_matching'}) { }
978 0 14 if ($address->{'properties'}{'type'} eq 'unknown') { }
985 0 14 if ($address->{'force_post_code'} and not $address->{'components'}{'post_code'})
992 0 14 if ($address->{'input_string'} =~ m[[^"A-Z0-9'\-\.,&#/ ]])
999 12 2 if ($address->{'properties'}{'type'} eq 'suburban')
1002 11 1 unless ($street =~ /\d/)
1005 1 10 if (_check_vowel($address->{'components'}{'base_street_name'}))
1014 0 14 if (_check_vowel($address->{'components'}{'suburb'}))
1074 12 0 unless ($input =~ /^\d+ [A-Z] (ST|AVE)/)
1077 0 12 if ($address->{'country_code'} eq 'US') { }
1090 0 12 if ($address->{'country_code'} eq 'US') { }
1135 1 14 if ($input =~ m[^(C/O.*?|ATTN.*?) (\d+|PO BOX)( .*)]) { }
1158 1 14 if ($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}[/ -])])
1187 1 14 if ($input =~ / ?(($bld) ([A-Z]{1,2}|\d+) )/ or $input =~ / ?(($bld) \d{1,3}[A-Z] )/ or $input =~ / ?(($bld) [A-Z]\d{1,3} )/)
1213 1 14 if ($input =~ /^(.*?) (PRIVATE BOXES)( .*)$/) { }
1236 110 175 if ($address->{'components'}{$key})
1260 1 33 if (length $word > 1 and not $word =~ /[AEIOUY]|ST|MT|JN?R|SN?R/)