Branch Coverage

blib/lib/Lingua/EN/Inflect.pm
Criterion Covered Total %
branch 358 470 76.1


line true false branch
71 1 1801 unless (@_)
75 5 1796 if (@_ == 1 and not $_[0] =~ /$classical_mode/)
76 2 3 $_[0] ? :
81 0 2687 unless ($arg =~ /$classical_mode/)
84 2681 6 if (@_ and not $_[0] =~ /$classical_mode/) { }
87 1785 902 if ($arg eq 'all')
88 893 892 $classical{'all'} ? :
97 0 0 if (defined $_[0]) { }
100 0 0 if not defined $_[1] or $_[1]
122 0 0 unless (s/NUM\(\s*?(?:([^),]*)(?:,([^)]*))?)?\)/NUM($1, $2);/ex)
779 0 6 if (not eval "'' =~ m/$_[0]/; 1;" or $@)
788 6 0 if (defined $_[1])
791 0 6 if (not eval "qq{$_[1]}; 1;" or $@)
840 8 36 if ($word =~ /^(?:$_[$i])$/i)
842 0 8 unless defined $_[$i + 1]
867 112 87 $classical{'all'} ? :
868 1200 9957 $orig =~ /^[A-Z]/ ? :
12 11157 $orig =~ /^[A-Z]+$/ ? :
10 11169 $orig =~ /^I$/ ? :
879 0 1914 unless $word
891 0 7041 unless $word
901 0 2118 unless $word
912 0 106 unless $word
918 60 3504 unless _PL_eq(@_, \&Lingua::EN::Inflect::PL_N) or _PL_eq(@_, \&Lingua::EN::Inflect::PL_V)
929 874 2870 if not $result and $word1 eq $word2
930 1159 2585 if not $result and $word1 eq &$PL($word2)
931 1159 2585 if not $result and &$PL($word1) eq $word2
933 186 3558 if not $result and $word1 eq &$PL($word2)
934 186 3558 if not $result and &$PL($word1) eq $word2
937 3564 180 if ($PL == \&Lingua::EN::Inflect::PL or $PL == \&Lingua::EN::Inflect::PL_N)
939 0 3564 if not $result and _PL_check_plurals_N($word1, $word2)
941 0 3564 if not $result and _PL_check_plurals_N($word2, $word1)
944 60 3684 if ($PL == \&Lingua::EN::Inflect::PL or $PL == \&Lingua::EN::Inflect::PL_ADJ)
946 0 60 if not $result and _PL_check_plurals_ADJ($word1, $word2, $PL)
961 0 3840 if $_ eq $pair
962 0 15120 if $_ eq $pair
964 0 240 if _PL_reg_plurals($pair, $PL_sb_U_a_ata, 'as', 'ata') or _PL_reg_plurals($pair, $PL_sb_C_a_ata, 'as', 'ata') or _PL_reg_plurals($pair, $PL_sb_U_is_ides, 'is', 'ides') or _PL_reg_plurals($pair, $PL_sb_C_is_ides, 'is', 'ides') or _PL_reg_plurals($pair, $PL_sb_C_a_ae, 's', 'e') or _PL_reg_plurals($pair, $PL_sb_C_en_ina, 'ens', 'ina') or _PL_reg_plurals($pair, $PL_sb_C_um_a, 'ums', 'a') or _PL_reg_plurals($pair, $PL_sb_C_us_i, 'uses', 'i') or _PL_reg_plurals($pair, $PL_sb_C_on_a, 'ons', 'a') or _PL_reg_plurals($pair, $PL_sb_C_o_i, 'os', 'i') or _PL_reg_plurals($pair, $PL_sb_C_ex_ices, 'exes', 'ices') or _PL_reg_plurals($pair, $PL_sb_C_ix_ices, 'ixes', 'ices') or _PL_reg_plurals($pair, $PL_sb_C_i, 's', 'i') or _PL_reg_plurals($pair, $PL_sb_C_im, 's', 'im') or _PL_reg_plurals($pair, '.*eau', 's', 'x') or _PL_reg_plurals($pair, '.*ieu', 's', 'x') or _PL_reg_plurals($pair, '.*tri', 'xes', 'ces') or _PL_reg_plurals($pair, '.{2,}[yia]n', 'xes', 'ges')
994 0 0 unless $word1a =~ s/'s?$//
995 0 0 unless $word2a =~ s/'s?$//
996 0 0 unless $word1b =~ s/s'$//
997 0 0 unless $word2b =~ s/s'$//
999 0 0 if ($word1a)
1001 0 0 if $word2a and _PL_check_plurals_N($word1a, $word2a) || _PL_check_plurals_N($word2a, $word1a)
1003 0 0 if $word2b and _PL_check_plurals_N($word1a, $word2b) || _PL_check_plurals_N($word2b, $word1a)
1006 0 0 if ($word1b)
1008 0 0 if $word2a and _PL_check_plurals_N($word1b, $word2a) || _PL_check_plurals_N($word2a, $word1b)
1010 0 0 if $word2b and _PL_check_plurals_N($word1b, $word2b) || _PL_check_plurals_N($word2b, $word1b)
1025 0 8983 if not defined $count and defined $persistent_count
1030 6 8977 defined $count && $count =~ /^($PL_count_one)$/io || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/io ? :
1034 6 8977 if $count == 1
1038 3 8974 if defined($value = ud_match($word, @PL_sb_user_defined))
1043 0 8974 if $word eq ''
1045 694 40 if $word =~ /^($PL_sb_uninflected)$/i and not exists $PL_sb_irregular{$word} and not $word =~ /^($PL_sb_lese_lesen)$/i
1048 42 8238 if $classical{'herd'} and $word =~ /^($PL_sb_uninflected_herd)$/i
1055 506 7732 if $word =~ /^($PL_sb_irregular)$/i
1057 0 7732 if $word =~ /(.*)\b($PL_sb_irregular)$/i
1062 60 7672 if $word =~ /^(?:$PL_sb_postfix_adj)$/i and $value = $2
1067 8 7664 if $word =~ /^(?:$PL_sb_prep_dual_compound)$/i and $value = [$2, $3]
1073 152 7512 if $word =~ /^(?:$PL_sb_prep_compound)$/i and $value = $2
1081 184 7328 if $word =~ /^((?:$PL_prep)\s+)($PL_pron_acc)$/i
1083 130 7198 if $value = $PL_pron_nom{lc $word}
1087 28 7170 if $word =~ /^($PL_pron_acc)$/i
1092 244 6926 if $word =~ /(.*$PL_sb_U_man_mans)$/i
1094 8 6918 if $word =~ /(\S*)quy$/i
1096 18 22 $classical{'persons'} ? :
40 6878 if $word =~ /(\S*)(person)$/i
1097 166 6712 if $word =~ /(.*)man$/i
1098 48 6664 if $word =~ /(.*[ml])ouse$/i
1099 8 6656 if $word =~ /(.*)goose$/i
1100 8 6648 if $word =~ /(.*)tooth$/i
1101 14 6634 if $word =~ /(.*)foot$/i
1105 4 6630 if $word =~ /(.*)ceps$/i
1106 24 6606 if $word =~ /(.*)zoon$/i
1107 32 6574 if $word =~ /(.*[csx])is$/i
1108 16 6558 if $word =~ /(.*$PL_sb_U_a_ata)a$/i
1109 8 6550 if $word =~ /(.*$PL_sb_U_is_ides)is$/i
1110 24 6526 if $word =~ /(.*$PL_sb_U_ch_chs)ch$/i
1111 24 6502 if $word =~ /(.*$PL_sb_U_ex_ices)ex$/i
1112 24 6478 if $word =~ /(.*$PL_sb_U_ix_ices)ix$/i
1113 120 6358 if $word =~ /(.*$PL_sb_U_um_a)um$/i
1114 112 6246 if $word =~ /(.*$PL_sb_U_us_i)us$/i
1115 96 6150 if $word =~ /(.*$PL_sb_U_on_a)on$/i
1116 32 6118 if $word =~ /(.*$PL_sb_U_a_ae)$/i
1117 32 6086 if $word =~ /(.*$PL_sb_lese_lesen)$/i
1121 4262 1824 if ($classical{'ancient'})
1123 35 4227 if $word =~ /(.*)trix$/i
1124 54 4173 if $word =~ /(.*)eau$/i
1125 12 4161 if $word =~ /(.*)ieu$/i
1126 24 4137 if $word =~ /(.{2,}[yia])nx$/i
1127 18 4119 if $word =~ /(.*$PL_sb_C_en_ina)en$/i
1128 53 4066 if $word =~ /(.*$PL_sb_C_ex_ices)ex$/i
1129 6 4060 if $word =~ /(.*$PL_sb_C_ix_ices)ix$/i
1130 173 3887 if $word =~ /(.*$PL_sb_C_um_a)um$/i
1131 78 3809 if $word =~ /(.*$PL_sb_C_us_i)us$/i
1132 28 3781 if $word =~ /(.*$PL_sb_C_us_us)$/i
1133 108 3673 if $word =~ /(.*$PL_sb_C_a_ae)$/i
1134 168 3505 if $word =~ /(.*$PL_sb_C_a_ata)a$/i
1135 66 3439 if $word =~ /(.*$PL_sb_C_is_ides)is$/i
1136 48 3391 if $word =~ /(.*$PL_sb_C_o_i)o$/i
1137 6 3385 if $word =~ /(.*$PL_sb_C_on_a)on$/i
1138 30 3355 if $word =~ /$PL_sb_C_im$/i
1139 12 3343 if $word =~ /$PL_sb_C_i$/i
1145 1371 3796 if $word =~ /^($PL_sb_singular_s)$/i
1146 59 0 if $word =~ /^([A-Z].*s)$/ and $classical{'names'}
1147 12 3725 if $word =~ /^($PL_sb_z_zes)$/i
1148 24 3701 if $word =~ /^(.*[^z])(z)$/i
1149 221 3480 if $word =~ /^(.*)([cs]h|x|zz|ss)$/i
1154 40 3440 if $word =~ /(.*[eao])lf$/i
1155 28 3412 if $word =~ /(.*[^d])eaf$/i
1156 44 3368 if $word =~ /(.*[nlw])ife$/i
1157 24 3344 if $word =~ /(.*)arf$/i
1161 60 3284 if $word =~ /(.*[aeiou])y$/i
1162 23 8 if $word =~ /([A-Z].*y)$/ and $classical{'names'}
1163 102 3159 if $word =~ /(.*)y$/i
1167 272 2887 if $word =~ /$PL_sb_U_o_os$/i
1168 72 2815 if $word =~ /[aeiou]o$/i
1169 88 2727 if $word =~ /o$/i
1181 0 3984 if not defined $count and defined $persistent_count
1184 0 3984 defined $count && $count =~ /^($PL_count_one)$/io || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/io ? :
1187 0 3984 if $count =~ /^($PL_count_one)$/io
1193 2 3982 if defined($value = ud_match($word, @PL_v_user_defined))
1198 128 3854 if $word =~ /^($PL_v_irregular_pres)((\s.*)?)$/i
1202 60 3794 if $word =~ /^($PL_v_irregular_non_pres)((\s.*)?)$/i
1208 30 3764 if $word =~ /^($PL_v_irregular_pres)(n't(\s.*)?)$/i
1210 8 3756 if $word =~ /^\S+n't\b/i
1215 660 3096 if $word =~ /^($PL_v_special_s)$/
1216 172 2924 if $word =~ /\s/
1217 4 2920 if $word =~ /^quizzes$/i
1221 16 2904 if $word =~ /^(.*)([cs]h|[x]|zz|ss)es$/i
1223 9 2895 if $word =~ /^(..+)ies$/i
1225 96 2799 if $word =~ /($PL_v_oes_oe)$/
1226 0 2799 if $word =~ /^(.+)oes$/i
1228 175 2624 if $word =~ /^(.*[^s])s$/i
1238 0 1742 if not defined $count and defined $persistent_count
1241 0 1742 defined $count && $count =~ /^($PL_count_one)$/io || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/io ? :
1244 0 1742 if $count =~ /^($PL_count_one)$/io
1249 4 1738 if $word =~ /^($PL_v_ambiguous_pres)((\s.*)?)$/i
1253 18 1720 if $word =~ /^($PL_v_ambiguous_non_pres)((\s.*)?)$/i
1265 0 2020 if not defined $count and defined $persistent_count
1268 5 2015 defined $count && $count =~ /^($PL_count_one)$/io || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/io ? :
1271 5 2015 if $count =~ /^($PL_count_one)$/io
1277 3 2012 if defined($value = ud_match($word, @PL_adj_user_defined))
1282 26 1986 if $word =~ /^($PL_adj_special)$/i
1287 38 1948 if $word =~ /^($PL_adj_poss)$/i
1289 72 1876 if ($word =~ /^(.*)'s?$/)
1290 44 28 $pl =~ /s$/ ? :
1339 0 0 unless $word
1349 0 0 if not defined $count and defined $persistent_count
1352 0 0 if defined $count and not $count =~ /^($PL_count_one)$/io
1358 0 0 if defined($value = ud_match($word, @A_a_user_defined))
1363 0 0 if $word =~ /^($A_ordinal_a)/i
1364 0 0 if $word =~ /^($A_ordinal_an)/i
1368 0 0 if $word =~ /^($A_explicit_an)/i
1369 0 0 if $word =~ /^[aefhilmnorsx]$/i
1370 0 0 if $word =~ /^[bcdgjkpqtuvwyz]$/i
1375 0 0 if $word =~ /^($A_abbrev)/ox
1376 0 0 if $word =~ /^[aefhilmnorsx][.-]/i
1377 0 0 if $word =~ /^[a-z][.-]/i
1381 0 0 if $word =~ /^[^aeiouy]/i
1385 0 0 if $word =~ /^e[uw]/i
1386 0 0 if $word =~ /^onc?e\b/i
1387 0 0 if $word =~ /^uni([^nmd]|mo)/i
1388 0 0 if $word =~ /^ut[th]/i
1389 0 0 if $word =~ /^u[bcfhjkqrst][aeiou]/i
1393 0 0 if $word =~ /^U[NK][AIEO]?/
1397 0 0 if $word =~ /^[aeiou]/i
1401 0 0 if $word =~ /^($A_y_cons)/io
1414 0 124 if not defined $count and defined $persistent_count
1416 3 121 unless $count
1418 3 121 if ($count =~ /^$PL_count_zero$/)
1425 27 94 defined $opt_ref->{'words_below'} && $count < $opt_ref->{'words_below'} ? :
1428 56 65 if (defined $opt_ref->{'comma'} or defined $opt_ref->{'comma_every'})
1429 40 16 unless defined $opt_ref->{'comma_every'}
1431 16 40 if not defined $opt_ref->{'comma'} or $opt_ref->{'comma'} =~ /^\d+$/
1441 0 56 unless defined $comma
1442 0 56 unless defined $comma
1455 4 1 unless s/ie$/y/ or s/ue$/u/ or s/([auy])e$/$1/ or s/ski$/ski/ or s/[^b]i$// or s/^(are|were)$/be/ or s/^(had)$/hav/ or s/(hoe)$/$1/ or s/([^e])e$/$1/ or /er$/
1502 83 83 if ($num =~ /\d/) { }
1622 0 14855 if $ind > $#mill
1623 14855 0 $ind < @mill ? :
1629 3883 1071 $_[0] && $_[1] ? :
4954 1087 if $_[0] ne '1'
1636 2789 15 $_[1] || $_[2] ? :
2804 324 if $_[0]
1638 312 12 if $_[1] or $_[2]
1647 90 985 if ($group == 1) { }
64 921 elsif ($group == 2) { }
64 857 elsif ($group == 3) { }
49 808 elsif ($num + 0 == 0) { }
45 763 elsif ($num + 0 == 1) { }
1649 2652 345 $1 ? :
345 2997 $1 == 1 ? :
1653 3 7 $2 ? :
1592 10 $1 ? :
1654 24 6 $1 ? :
1658 830 105 $1 ? :
120 935 $1 == 1 ? :
106 9 $3 ? :
940 115 $2 ? :
1659 0 1 $2 ? :
22 1 $1 ? :
1660 14 7 $1 ? :
2 21 $1 == 1 ? :
1682 56 1259 if (@_ % 2 and require Carp)
1691 230 1029 if (exists $arg{'threshold'} and $num > $arg{'threshold'})
1694 220 10 unless $whole =~ s/ (\d) ( \d{3}(?:,|\z) ) /$1,$2/msx
1697 10 220 $frac ? :
1700 0 1029 unless $group =~ /\A[0-3]\Z/
1701 0 1029 $num =~ /\A\s*\-/ ? :
0 1029 $num =~ /\A\s*\+/ ? :
1711 168 861 $group ? :
1029 0 $arg{'decimal'} ? :
1716 7 1022 if ($chunks[0] eq '')
1721 55 1020 unless $_
1723 26 1049 if (not $group || $first) { }
1728 857 218 if not $group and $first
1731 1022 53 if $first
1735 7 1022 if ($first =~ /0/) { }
1744 52 977 if $ord and @numchunks
1753 0 1029 if (wantarray) { }
168 861 elsif ($group) { }
1755 0 0 if $sign
1760 0 168 $sign ? :
1764 0 861 $sign ? :
1768 22 3175 if (/\A$arg{'decimal'}\Z/) { }
3067 108 elsif ($first) { }
1793 24 77 if (ref $arg eq 'HASH') { }
1801 0 29 if @words == 0
1802 5 24 if @words == 1
1804 12 12 exists $opt{'conj'} ? :
1805 6 18 if (@words == 2)
1811 6 12 grep(/,/, @words) ? :
0 18 exists $opt{'sep'} ? :
1816 3 6 length $opt{'final_sep'} == 0 ? :
9 9 !exists $opt{'final_sep'} ? :