Branch Coverage

blib/lib/Locales.pm
Criterion Covered Total %
branch 268 354 75.7


line true false branch
15 2 428 if (exists $opt{'unicode'})
33 782 15 unless (exists $singleton_stash{$tag})
39 1 781 if (my $soft = tag_is_soft_locale($tag))
46 0 782 ref $class ? :
49 345 437 unless have_mod("${class}::DB::Language::$tag")
50 0 437 unless have_mod("${class}::DB::Territory::$tag")
84 5 645 if $_[0]{'soft_locale_fallback'}
97 15 0 ref $self ? :
98 3 12 unless (exists $$self{'native_data'})
99 0 3 unless have_mod("${class}::DB::Native")
110 0 15 unless defined $code
112 1 14 if $code eq $self->get_locale and $self->get_soft_locale_fallback
115 6 9 if (exists $$self{'native_data'}{'code_to_name'}{$code}) { }
9 0 elsif ($always_return) { }
121 7 2 defined $t ? :
123 4 2 unless $ln or $tn
125 5 0 if (defined $t)
127 3 2 if ($tmp)
128 1 2 if ($tmp->get_territory_from_code($t))
148 4 0 ref $self ? :
150 0 4 unless defined $$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_group'}
151 0 4 unless defined $$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_decimal'}
153 0 4 unless ($$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_group'} and $$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_decimal'})
154 0 0 if ($always_return)
155 0 0 if ($$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_group'} or not $$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_decimal'}) { }
0 0 elsif (not $$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_group'} or $$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_decimal'}) { }
156 0 0 if $$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_group'} eq '.'
160 0 0 if $$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_decimal'} eq ','
169 3 1 if ($$self{'language_data'}{'misc_info'}{'cldr_formats'}{'decimal'} eq '#,##0.###') { }
0 1 elsif ($always_return and $$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_group'} and $$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_decimal'}) { }
170 1 2 if ($$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_group'} eq ',' and $$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_decimal'} eq '.') { }
1 2 elsif ($$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_group'} eq '.' and $$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_decimal'} eq ',') { }
178 0 0 if $$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_decimal'} eq ','
179 0 0 if $$self{'language_data'}{'misc_info'}{'cldr_formats'}{'_decimal_format_group'} eq '.'
193 211 115510 unless ($get_locale_display_pattern_from_code_fast)
198 2 115719 if (@_ == 1 and ref $_[0])
207 115717 0 ref $self ? :
208 213 115504 unless (exists $$self{'locale_display_pattern_data'})
209 0 213 unless have_mod("${class}::DB::LocaleDisplayPattern")
221 0 115717 unless defined $code
223 1 115716 if $code eq $self->get_locale and $self->get_soft_locale_fallback
226 115716 1 if (exists $$self{'locale_display_pattern_data'}{'code_to_pattern'}{$code}) { }
1 0 elsif ($always_return) { }
231 1 0 if (exists $$self{'locale_display_pattern_data'}{'code_to_pattern'}{$l})
242 1 5 unless ($get_character_orientation_from_code_fast)
247 2 4 if (@_ == 1 and ref $_[0])
257 231427 0 ref $self ? :
258 213 231214 unless (exists $$self{'character_orientation_data'})
259 0 213 unless have_mod("${class}::DB::CharacterOrientation")
271 0 231427 unless defined $code
273 1 231426 if $code eq $self->get_locale and $self->get_soft_locale_fallback
276 231426 1 if (exists $$self{'character_orientation_data'}{'code_to_name'}{$code}) { }
1 0 elsif ($always_return) { }
281 1 0 if (exists $$self{'character_orientation_data'}{'code_to_name'}{$l})
294 1 2 if $_[0]->get_plural_form(0) eq 'other'
313 3 28 unless ($$self{'language_data'}{'misc_info'}{'plural_forms'}{'category_rules_function'})
315 0 3 unless (defined $$self{'language_data'}{'misc_info'}{'plural_forms'}{'category_rules_function'})
325 18 13 if (not @category_values) { }
333 6 7 if ($val_len == $cat_len + 1) { }
1 12 elsif ($cat_len != $val_len and $$self{'verbose'}) { }
342 20 11 if (not defined $category) { }
343 2 18 $has_extra_for_zero && $abs_n != 0 ? :
344 1 5 $has_extra_for_zero && $abs_n == 0 ? :
6 14 wantarray ? :
353 11 0 if ($cat eq $category)
359 0 11 if (not defined $cat_pos_in_list and $category ne 'other') { }
0 11 elsif (not defined $cat_pos_in_list) { }
366 0 0 $has_extra_for_zero && $abs_n != 0 ? :
367 0 0 $has_extra_for_zero && $abs_n == 0 ? :
0 0 wantarray ? :
370 0 11 if ($has_extra_for_zero and $category eq 'other') { }
371 0 0 $has_extra_for_zero && $abs_n == 0 ? :
372 0 0 $has_extra_for_zero && $abs_n == 0 ? :
0 0 wantarray ? :
375 3 8 wantarray ? :
388 2 21 unless @items
389 4 17 if @items == 1
390 2 15 if @items == 2
401 14 32 if (exists $$self{'misc'}{'list_quote_mode'} and $$self{'misc'}{'list_quote_mode'} ne 'none')
402 6 8 if ($$self{'misc'}{'list_quote_mode'} eq 'all') { }
6 2 elsif ($$self{'misc'}{'list_quote_mode'} eq 'some') { }
403 2 4 if @{$items_ar;} == 0
406 2 22 unless defined $$items_ar[$i]
412 2 4 if @{$items_ar;} == 0
415 2 22 unless defined $$items_ar[$i]
416 10 14 if ($$items_ar[$i] eq '' or $$items_ar[$i] =~ /\A(?: |\xc2\xa0)+\z/)
436 2 21 unless @items
437 4 17 if @items == 1
439 2 15 if (@items == 2) { }
451 15 25 if $i == $#items
470 0 35 unless defined $value
477 0 1 unless defined $value
512 0 49 unless defined $n
522 11 38 $n < 0 ? :
524 24 25 defined $max_decimal_places ? :
525 4 45 if $max_len > 14
527 12 37 if ($n > 10000000000 or $n < -10000000000) { }
530 2 10 if $n =~ /e/i
535 4 6 if ($n =~ /\.([0-9]{$max_len})([0-9])?/)
538 2 2 if (defined $2 and $2 > 4)
539 2 0 unless (($trim + 1) =~ /e/i)
553 0 37 if $n =~ /e/i
576 0 47 if ($err) { }
1 46 elsif ($is_negative and $negative_pat) { }
46 0 elsif ($zero_positive_pat) { }
590 0 47 if ($dec_sec_cnt != 1)
596 0 47 if (not defined $format or $format eq '' or $format =~ /^\s+$/)
608 44 3 if ($format eq '#,##0.###') { }
629 1 2 @i_pat == 1 ? :
647 8 22 if ($cur_idx == $#i_pat and not length $i_pat[$cur_idx])
651 1 29 unless (length $i_pat[$cur_idx])
652 1 0 if (defined $i_pat[$cur_idx + 1])
657 30 0 if (length $i_pat[$cur_idx])
660 0 30 if ($i_pat[$cur_idx] =~ /(\',\')$/)
667 0 30 if ($cur_pat ne '0' and $cur_pat ne '#')
673 7 23 !length($i_pat[$cur_idx]) && @i_pat != 1 ? :
675 2 3 if ($cur_idx == $#i_pat - 1 and $i_pat[$#i_pat] eq '#' and not length $i_pat[$cur_idx])
680 2 1 if (length $i_pat[$cur_idx])
684 0 3 if (substr($result, 0, 1) eq ',')
689 3 0 if (defined $decimals and length $decimals)
714 6 9 unless (length $d_pat[$cur_idx])
715 6 0 if (not defined $d_pat[$cur_idx + 1]) { }
724 9 6 if (length $d_pat[$cur_idx])
727 0 9 if ($d_pat[$cur_idx] =~ /^(\'.\')/)
732 0 9 if ($cur_pat ne '0' and $cur_pat ne '#')
740 0 3 if (substr($result, -1, 1) eq ',')
743 3 0 if (defined $d_pat[$cur_idx])
759 10 37 if ($is_negative and not $negative_pat)
788 1 11 unless defined $code
793 5 6 if (exists $$self{'territory_data'}{'code_to_name'}{$code}) { }
6 0 elsif (not defined $$self{'territory'} or $code ne $$self{'territory'}) { }
798 1 5 if ($t and exists $$self{'territory_data'}{'code_to_name'}{$t})
802 2 3 if $always_return
808 0 2 unless $name
810 1 1 if (exists $$self{'territory_data'}{'name_to_code'}{$key})
841 0 20 unless defined $code
843 1 19 if $code eq $self->get_locale and $self->get_soft_locale_fallback
846 5 15 if (exists $$self{'language_data'}{'code_to_name'}{$code}) { }
14 1 elsif ($always_return) { }
852 11 3 defined $t ? :
854 6 3 unless $ln or $tn
869 0 2 unless $name
871 1 1 if (exists $$self{'language_data'}{'name_to_code'}{$key})
889 0 782 unless defined $l
891 750 32 unless $t
892 29 3 if tag_is_loadable($tag)
893 2 1 unless territory_code_is_known($t)
894 0 1 unless tag_is_loadable($l)
900 0 50 unless have_mod('Locales::DB::Loadable')
902 10 40 if ($as_territory) { }
903 2 8 if exists $Locales::DB::Loadable::territory{$tag}
906 31 9 if exists $Locales::DB::Loadable::code{$tag}
913 0 1 unless have_mod('Locales::DB::Loadable')
928 1 1 if (substr($norm, 0, 2) eq 'i_') { }
950 1 2 if exists $non_locales{$tag}
960 1 2 if $tag eq 'en_us' or $tag eq 'i_default'
966 3 464143 unless defined $tag
979 0 2 unless defined $pre
981 1 1 if ($pst) { }
991 0 2 unless defined $pre
993 1 1 if ($pst) { }
1003 0 4 unless defined $key
1025 26 345 unless (defined $return)
1069 2 496 if ($copy eq $and) { }
1080 425 0 if ($and_exp)
1094 1 4 if (ref $$hr{'category_rules'} ne 'HASH') { }
1104 1 1 if $n == 1
1110 19 5 unless exists $$hr{'category_rules'}{$cat}
1111 4 1 if exists $$hr{'category_rules_compiled'}{$cat}
1120 109 33 unless exists $$hr{'category_rules_compiled'}{$cat}
1124 0 33 if (ref $$hr{'category_rules_compiled'}{$cat} ne 'CODE')
1130 11 22 if ($$hr{'category_rules_compiled'}{$cat}($n))
1136 11 20 if $match
1144 36 1 if $_[0]
1161 2 3 $super ne $$self{'locale'} && $super ne 'i' ? :
4 2 $n ? :
2 3 defined $special_lookup && ref $special_lookup eq 'CODE' ? :