Branch Coverage

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


line true false branch
71 1 1785 unless (@_)
75 5 1780 if (@_ == 1 and not $_[0] =~ /$classical_mode/)
76 2 3 $_[0] ? :
81 0 2663 unless ($arg =~ /$classical_mode/)
84 2657 6 if (@_ and not $_[0] =~ /$classical_mode/) { }
87 1769 894 if ($arg eq 'all')
88 885 884 $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)
775 0 6 if (not eval "'' =~ m/$_[0]/; 1;" or $@)
784 6 0 if (defined $_[1])
787 0 6 if (not eval "qq{$_[1]}; 1;" or $@)
836 8 36 if ($word =~ /^(?:$_[$i])$/i)
838 0 8 unless defined $_[$i + 1]
863 112 87 $classical{'all'} ? :
864 1184 9873 $orig =~ /^[A-Z]/ ? :
12 11057 $orig =~ /^[A-Z]+$/ ? :
10 11069 $orig =~ /^I$/ ? :
875 0 1898 unless $word
887 0 6973 unless $word
897 0 2102 unless $word
908 0 106 unless $word
914 60 3472 unless _PL_eq(@_, \&Lingua::EN::Inflect::PL_N) or _PL_eq(@_, \&Lingua::EN::Inflect::PL_V)
925 874 2838 if not $result and $word1 eq $word2
926 1144 2568 if not $result and $word1 eq &$PL($word2)
927 1144 2568 if not $result and &$PL($word1) eq $word2
929 185 3527 if not $result and $word1 eq &$PL($word2)
930 185 3527 if not $result and &$PL($word1) eq $word2
933 3532 180 if ($PL == \&Lingua::EN::Inflect::PL or $PL == \&Lingua::EN::Inflect::PL_N)
935 0 3532 if not $result and _PL_check_plurals_N($word1, $word2)
937 0 3532 if not $result and _PL_check_plurals_N($word2, $word1)
940 60 3652 if ($PL == \&Lingua::EN::Inflect::PL or $PL == \&Lingua::EN::Inflect::PL_ADJ)
942 0 60 if not $result and _PL_check_plurals_ADJ($word1, $word2, $PL)
957 0 2880 if $_ eq $pair
958 0 14160 if $_ eq $pair
960 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')
990 0 0 unless $word1a =~ s/'s?$//
991 0 0 unless $word2a =~ s/'s?$//
992 0 0 unless $word1b =~ s/s'$//
993 0 0 unless $word2b =~ s/s'$//
995 0 0 if ($word1a)
997 0 0 if $word2a and _PL_check_plurals_N($word1a, $word2a) || _PL_check_plurals_N($word2a, $word1a)
999 0 0 if $word2b and _PL_check_plurals_N($word1a, $word2b) || _PL_check_plurals_N($word2b, $word1a)
1002 0 0 if ($word1b)
1004 0 0 if $word2a and _PL_check_plurals_N($word1b, $word2a) || _PL_check_plurals_N($word2a, $word1b)
1006 0 0 if $word2b and _PL_check_plurals_N($word1b, $word2b) || _PL_check_plurals_N($word2b, $word1b)
1021 0 8899 if not defined $count and defined $persistent_count
1026 6 8893 defined $count && $count =~ /^($PL_count_one)$/io || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/io ? :
1030 6 8893 if $count == 1
1034 3 8890 if defined($value = ud_match($word, @PL_sb_user_defined))
1039 0 8890 if $word eq ''
1041 694 40 if $word =~ /^($PL_sb_uninflected)$/i and not exists $PL_sb_irregular{$word} and not $word =~ /^($PL_sb_lese_lesen)$/i
1044 42 8154 if $classical{'herd'} and $word =~ /^($PL_sb_uninflected_herd)$/i
1051 482 7672 if $word =~ /^($PL_sb_irregular)$/i
1053 0 7672 if $word =~ /(.*)\b($PL_sb_irregular)$/i
1058 60 7612 if $word =~ /^(?:$PL_sb_postfix_adj)$/i and $value = $2
1063 8 7604 if $word =~ /^(?:$PL_sb_prep_dual_compound)$/i and $value = [$2, $3]
1069 152 7452 if $word =~ /^(?:$PL_sb_prep_compound)$/i and $value = $2
1077 184 7268 if $word =~ /^((?:$PL_prep)\s+)($PL_pron_acc)$/i
1079 130 7138 if $value = $PL_pron_nom{lc $word}
1083 28 7110 if $word =~ /^($PL_pron_acc)$/i
1088 244 6866 if $word =~ /(.*$PL_sb_U_man_mans)$/i
1090 8 6858 if $word =~ /(\S*)quy$/i
1092 18 22 $classical{'persons'} ? :
40 6818 if $word =~ /(\S*)(person)$/i
1093 166 6652 if $word =~ /(.*)man$/i
1094 48 6604 if $word =~ /(.*[ml])ouse$/i
1095 8 6596 if $word =~ /(.*)goose$/i
1096 8 6588 if $word =~ /(.*)tooth$/i
1097 14 6574 if $word =~ /(.*)foot$/i
1101 4 6570 if $word =~ /(.*)ceps$/i
1102 24 6546 if $word =~ /(.*)zoon$/i
1103 32 6514 if $word =~ /(.*[csx])is$/i
1104 16 6498 if $word =~ /(.*$PL_sb_U_a_ata)a$/i
1105 8 6490 if $word =~ /(.*$PL_sb_U_is_ides)is$/i
1106 24 6466 if $word =~ /(.*$PL_sb_U_ch_chs)ch$/i
1107 24 6442 if $word =~ /(.*$PL_sb_U_ex_ices)ex$/i
1108 24 6418 if $word =~ /(.*$PL_sb_U_ix_ices)ix$/i
1109 120 6298 if $word =~ /(.*$PL_sb_U_um_a)um$/i
1110 112 6186 if $word =~ /(.*$PL_sb_U_us_i)us$/i
1111 96 6090 if $word =~ /(.*$PL_sb_U_on_a)on$/i
1112 32 6058 if $word =~ /(.*$PL_sb_U_a_ae)$/i
1113 32 6026 if $word =~ /(.*$PL_sb_lese_lesen)$/i
1117 4215 1811 if ($classical{'ancient'})
1119 35 4180 if $word =~ /(.*)trix$/i
1120 54 4126 if $word =~ /(.*)eau$/i
1121 12 4114 if $word =~ /(.*)ieu$/i
1122 24 4090 if $word =~ /(.{2,}[yia])nx$/i
1123 18 4072 if $word =~ /(.*$PL_sb_C_en_ina)en$/i
1124 53 4019 if $word =~ /(.*$PL_sb_C_ex_ices)ex$/i
1125 6 4013 if $word =~ /(.*$PL_sb_C_ix_ices)ix$/i
1126 173 3840 if $word =~ /(.*$PL_sb_C_um_a)um$/i
1127 78 3762 if $word =~ /(.*$PL_sb_C_us_i)us$/i
1128 28 3734 if $word =~ /(.*$PL_sb_C_us_us)$/i
1129 108 3626 if $word =~ /(.*$PL_sb_C_a_ae)$/i
1130 168 3458 if $word =~ /(.*$PL_sb_C_a_ata)a$/i
1131 66 3392 if $word =~ /(.*$PL_sb_C_is_ides)is$/i
1132 48 3344 if $word =~ /(.*$PL_sb_C_o_i)o$/i
1133 6 3338 if $word =~ /(.*$PL_sb_C_on_a)on$/i
1134 30 3308 if $word =~ /$PL_sb_C_im$/i
1135 12 3296 if $word =~ /$PL_sb_C_i$/i
1141 1354 3753 if $word =~ /^($PL_sb_singular_s)$/i
1142 58 0 if $word =~ /^([A-Z].*s)$/ and $classical{'names'}
1143 12 3683 if $word =~ /^($PL_sb_z_zes)$/i
1144 24 3659 if $word =~ /^(.*[^z])(z)$/i
1145 221 3438 if $word =~ /^(.*)([cs]h|x|zz|ss)$/i
1150 40 3398 if $word =~ /(.*[eao])lf$/i
1151 28 3370 if $word =~ /(.*[^d])eaf$/i
1152 44 3326 if $word =~ /(.*[nlw])ife$/i
1153 24 3302 if $word =~ /(.*)arf$/i
1157 60 3242 if $word =~ /(.*[aeiou])y$/i
1158 17 4 if $word =~ /([A-Z].*y)$/ and $classical{'names'}
1159 66 3159 if $word =~ /(.*)y$/i
1163 272 2887 if $word =~ /$PL_sb_U_o_os$/i
1164 72 2815 if $word =~ /[aeiou]o$/i
1165 88 2727 if $word =~ /o$/i
1177 0 3952 if not defined $count and defined $persistent_count
1180 0 3952 defined $count && $count =~ /^($PL_count_one)$/io || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/io ? :
1183 0 3952 if $count =~ /^($PL_count_one)$/io
1189 2 3950 if defined($value = ud_match($word, @PL_v_user_defined))
1194 128 3822 if $word =~ /^($PL_v_irregular_pres)((\s.*)?)$/i
1198 60 3762 if $word =~ /^($PL_v_irregular_non_pres)((\s.*)?)$/i
1204 30 3732 if $word =~ /^($PL_v_irregular_pres)(n't(\s.*)?)$/i
1206 8 3724 if $word =~ /^\S+n't\b/i
1211 648 3076 if $word =~ /^($PL_v_special_s)$/
1212 172 2904 if $word =~ /\s/
1213 4 2900 if $word =~ /^quizzes$/i
1217 16 2884 if $word =~ /^(.*)([cs]h|[x]|zz|ss)es$/i
1219 9 2875 if $word =~ /^(..+)ies$/i
1221 96 2779 if $word =~ /($PL_v_oes_oe)$/
1222 0 2779 if $word =~ /^(.+)oes$/i
1224 175 2604 if $word =~ /^(.*[^s])s$/i
1234 0 1726 if not defined $count and defined $persistent_count
1237 0 1726 defined $count && $count =~ /^($PL_count_one)$/io || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/io ? :
1240 0 1726 if $count =~ /^($PL_count_one)$/io
1245 4 1722 if $word =~ /^($PL_v_ambiguous_pres)((\s.*)?)$/i
1249 18 1704 if $word =~ /^($PL_v_ambiguous_non_pres)((\s.*)?)$/i
1261 0 2004 if not defined $count and defined $persistent_count
1264 5 1999 defined $count && $count =~ /^($PL_count_one)$/io || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/io ? :
1267 5 1999 if $count =~ /^($PL_count_one)$/io
1273 3 1996 if defined($value = ud_match($word, @PL_adj_user_defined))
1278 26 1970 if $word =~ /^($PL_adj_special)$/i
1283 38 1932 if $word =~ /^($PL_adj_poss)$/i
1285 72 1860 if ($word =~ /^(.*)'s?$/)
1286 44 28 $pl =~ /s$/ ? :
1335 0 0 unless $word
1345 0 0 if not defined $count and defined $persistent_count
1348 0 0 if defined $count and not $count =~ /^($PL_count_one)$/io
1354 0 0 if defined($value = ud_match($word, @A_a_user_defined))
1359 0 0 if $word =~ /^($A_ordinal_a)/i
1360 0 0 if $word =~ /^($A_ordinal_an)/i
1364 0 0 if $word =~ /^($A_explicit_an)/i
1365 0 0 if $word =~ /^[aefhilmnorsx]$/i
1366 0 0 if $word =~ /^[bcdgjkpqtuvwyz]$/i
1371 0 0 if $word =~ /^($A_abbrev)/ox
1372 0 0 if $word =~ /^[aefhilmnorsx][.-]/i
1373 0 0 if $word =~ /^[a-z][.-]/i
1377 0 0 if $word =~ /^[^aeiouy]/i
1381 0 0 if $word =~ /^e[uw]/i
1382 0 0 if $word =~ /^onc?e\b/i
1383 0 0 if $word =~ /^uni([^nmd]|mo)/i
1384 0 0 if $word =~ /^ut[th]/i
1385 0 0 if $word =~ /^u[bcfhjkqrst][aeiou]/i
1389 0 0 if $word =~ /^U[NK][AIEO]?/
1393 0 0 if $word =~ /^[aeiou]/i
1397 0 0 if $word =~ /^($A_y_cons)/io
1410 0 124 if not defined $count and defined $persistent_count
1412 3 121 unless $count
1414 3 121 if ($count =~ /^$PL_count_zero$/)
1421 27 94 defined $opt_ref->{'words_below'} && $count < $opt_ref->{'words_below'} ? :
1424 56 65 if (defined $opt_ref->{'comma'} or defined $opt_ref->{'comma_every'})
1425 40 16 unless defined $opt_ref->{'comma_every'}
1427 16 40 if not defined $opt_ref->{'comma'} or $opt_ref->{'comma'} =~ /^\d+$/
1437 0 56 unless defined $comma
1438 0 56 unless defined $comma
1451 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$/
1498 83 83 if ($num =~ /\d/) { }
1618 0 14855 if $ind > $#mill
1619 14855 0 $ind < @mill ? :
1625 3883 1071 $_[0] && $_[1] ? :
4954 1087 if $_[0] ne '1'
1632 2789 15 $_[1] || $_[2] ? :
2804 324 if $_[0]
1634 312 12 if $_[1] or $_[2]
1643 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) { }
1645 2652 345 $1 ? :
345 2997 $1 == 1 ? :
1649 3 7 $2 ? :
1592 10 $1 ? :
1650 24 6 $1 ? :
1654 830 105 $1 ? :
120 935 $1 == 1 ? :
106 9 $3 ? :
940 115 $2 ? :
1655 0 1 $2 ? :
22 1 $1 ? :
1656 14 7 $1 ? :
2 21 $1 == 1 ? :
1678 56 1259 if (@_ % 2 and require Carp)
1687 230 1029 if (exists $arg{'threshold'} and $num > $arg{'threshold'})
1690 220 10 unless $whole =~ s/ (\d) ( \d{3}(?:,|\z) ) /$1,$2/msx
1693 10 220 $frac ? :
1696 0 1029 unless $group =~ /\A[0-3]\Z/
1697 0 1029 $num =~ /\A\s*\-/ ? :
0 1029 $num =~ /\A\s*\+/ ? :
1707 168 861 $group ? :
1029 0 $arg{'decimal'} ? :
1712 7 1022 if ($chunks[0] eq '')
1717 55 1020 unless $_
1719 26 1049 if (not $group || $first) { }
1724 857 218 if not $group and $first
1727 1022 53 if $first
1731 7 1022 if ($first =~ /0/) { }
1740 52 977 if $ord and @numchunks
1749 0 1029 if (wantarray) { }
168 861 elsif ($group) { }
1751 0 0 if $sign
1756 0 168 $sign ? :
1760 0 861 $sign ? :
1764 22 3175 if (/\A$arg{'decimal'}\Z/) { }
3067 108 elsif ($first) { }
1789 24 77 if (ref $arg eq 'HASH') { }
1797 0 29 if @words == 0
1798 5 24 if @words == 1
1800 12 12 exists $opt{'conj'} ? :
1801 6 18 if (@words == 2)
1807 6 12 grep(/,/, @words) ? :
0 18 exists $opt{'sep'} ? :
1812 3 6 length $opt{'final_sep'} == 0 ? :
9 9 !exists $opt{'final_sep'} ? :