Branch Coverage

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


line true false branch
70 1 1801 unless (@_)
74 5 1796 if (@_ == 1 and not $_[0] =~ /$classical_mode/)
75 2 3 $_[0] ? :
80 0 2687 unless ($arg =~ /$classical_mode/)
83 2681 6 if (@_ and not $_[0] =~ /$classical_mode/) { }
86 1785 902 if ($arg eq 'all')
87 893 892 $classical{'all'} ? :
96 0 0 if (defined $_[0]) { }
99 0 0 if not defined $_[1] or $_[1]
121 0 0 unless (s/NUM\(\s*?(?:([^),]*)(?:,([^)]*))?)?\)/NUM($1, $2);/ex)
778 0 6 if (not eval "'' =~ m/$_[0]/; 1;" or $@)
787 6 0 if (defined $_[1])
790 0 6 if (not eval "qq{$_[1]}; 1;" or $@)
839 8 36 if ($word =~ /^(?:$_[$i])$/i)
841 0 8 unless defined $_[$i + 1]
866 112 87 $classical{'all'} ? :
867 1200 9957 $orig =~ /^[A-Z]/ ? :
12 11157 $orig =~ /^[A-Z]+$/ ? :
10 11169 $orig =~ /^I$/ ? :
878 0 1914 unless $word
890 0 7041 unless $word
900 0 2118 unless $word
911 0 106 unless $word
917 60 3504 unless _PL_eq(@_, \&Lingua::EN::Inflect::PL_N) or _PL_eq(@_, \&Lingua::EN::Inflect::PL_V)
928 874 2870 if not $result and $word1 eq $word2
929 1159 2585 if not $result and $word1 eq &$PL($word2)
930 1159 2585 if not $result and &$PL($word1) eq $word2
932 186 3558 if not $result and $word1 eq &$PL($word2)
933 186 3558 if not $result and &$PL($word1) eq $word2
936 3564 180 if ($PL == \&Lingua::EN::Inflect::PL or $PL == \&Lingua::EN::Inflect::PL_N)
938 0 3564 if not $result and _PL_check_plurals_N($word1, $word2)
940 0 3564 if not $result and _PL_check_plurals_N($word2, $word1)
943 60 3684 if ($PL == \&Lingua::EN::Inflect::PL or $PL == \&Lingua::EN::Inflect::PL_ADJ)
945 0 60 if not $result and _PL_check_plurals_ADJ($word1, $word2, $PL)
960 0 3840 if $_ eq $pair
961 0 15120 if $_ eq $pair
963 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')
993 0 0 unless $word1a =~ s/'s?$//
994 0 0 unless $word2a =~ s/'s?$//
995 0 0 unless $word1b =~ s/s'$//
996 0 0 unless $word2b =~ s/s'$//
998 0 0 if ($word1a)
1000 0 0 if $word2a and _PL_check_plurals_N($word1a, $word2a) || _PL_check_plurals_N($word2a, $word1a)
1002 0 0 if $word2b and _PL_check_plurals_N($word1a, $word2b) || _PL_check_plurals_N($word2b, $word1a)
1005 0 0 if ($word1b)
1007 0 0 if $word2a and _PL_check_plurals_N($word1b, $word2a) || _PL_check_plurals_N($word2a, $word1b)
1009 0 0 if $word2b and _PL_check_plurals_N($word1b, $word2b) || _PL_check_plurals_N($word2b, $word1b)
1024 0 8983 if not defined $count and defined $persistent_count
1029 6 8977 defined $count && $count =~ /^($PL_count_one)$/io || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/io ? :
1033 6 8977 if $count == 1
1037 3 8974 if defined($value = ud_match($word, @PL_sb_user_defined))
1042 0 8974 if $word eq ''
1044 694 40 if $word =~ /^($PL_sb_uninflected)$/i and not exists $PL_sb_irregular{$word} and not $word =~ /^($PL_sb_lese_lesen)$/i
1047 42 8238 if $classical{'herd'} and $word =~ /^($PL_sb_uninflected_herd)$/i
1054 506 7732 if $word =~ /^($PL_sb_irregular)$/i
1056 0 7732 if $word =~ /(.*)\b($PL_sb_irregular)$/i
1061 60 7672 if $word =~ /^(?:$PL_sb_postfix_adj)$/i and $value = $2
1066 8 7664 if $word =~ /^(?:$PL_sb_prep_dual_compound)$/i and $value = [$2, $3]
1072 152 7512 if $word =~ /^(?:$PL_sb_prep_compound)$/i and $value = $2
1080 184 7328 if $word =~ /^((?:$PL_prep)\s+)($PL_pron_acc)$/i
1082 130 7198 if $value = $PL_pron_nom{lc $word}
1086 28 7170 if $word =~ /^($PL_pron_acc)$/i
1091 244 6926 if $word =~ /(.*$PL_sb_U_man_mans)$/i
1093 8 6918 if $word =~ /(\S*)quy$/i
1095 18 22 $classical{'persons'} ? :
40 6878 if $word =~ /(\S*)(person)$/i
1096 166 6712 if $word =~ /(.*)man$/i
1097 48 6664 if $word =~ /(.*[ml])ouse$/i
1098 8 6656 if $word =~ /(.*)goose$/i
1099 8 6648 if $word =~ /(.*)tooth$/i
1100 14 6634 if $word =~ /(.*)foot$/i
1104 4 6630 if $word =~ /(.*)ceps$/i
1105 24 6606 if $word =~ /(.*)zoon$/i
1106 32 6574 if $word =~ /(.*[csx])is$/i
1107 16 6558 if $word =~ /(.*$PL_sb_U_a_ata)a$/i
1108 8 6550 if $word =~ /(.*$PL_sb_U_is_ides)is$/i
1109 24 6526 if $word =~ /(.*$PL_sb_U_ch_chs)ch$/i
1110 24 6502 if $word =~ /(.*$PL_sb_U_ex_ices)ex$/i
1111 24 6478 if $word =~ /(.*$PL_sb_U_ix_ices)ix$/i
1112 120 6358 if $word =~ /(.*$PL_sb_U_um_a)um$/i
1113 112 6246 if $word =~ /(.*$PL_sb_U_us_i)us$/i
1114 96 6150 if $word =~ /(.*$PL_sb_U_on_a)on$/i
1115 32 6118 if $word =~ /(.*$PL_sb_U_a_ae)$/i
1116 32 6086 if $word =~ /(.*$PL_sb_lese_lesen)$/i
1120 4262 1824 if ($classical{'ancient'})
1122 35 4227 if $word =~ /(.*)trix$/i
1123 54 4173 if $word =~ /(.*)eau$/i
1124 12 4161 if $word =~ /(.*)ieu$/i
1125 24 4137 if $word =~ /(.{2,}[yia])nx$/i
1126 18 4119 if $word =~ /(.*$PL_sb_C_en_ina)en$/i
1127 53 4066 if $word =~ /(.*$PL_sb_C_ex_ices)ex$/i
1128 6 4060 if $word =~ /(.*$PL_sb_C_ix_ices)ix$/i
1129 173 3887 if $word =~ /(.*$PL_sb_C_um_a)um$/i
1130 78 3809 if $word =~ /(.*$PL_sb_C_us_i)us$/i
1131 28 3781 if $word =~ /(.*$PL_sb_C_us_us)$/i
1132 108 3673 if $word =~ /(.*$PL_sb_C_a_ae)$/i
1133 168 3505 if $word =~ /(.*$PL_sb_C_a_ata)a$/i
1134 66 3439 if $word =~ /(.*$PL_sb_C_is_ides)is$/i
1135 48 3391 if $word =~ /(.*$PL_sb_C_o_i)o$/i
1136 6 3385 if $word =~ /(.*$PL_sb_C_on_a)on$/i
1137 30 3355 if $word =~ /$PL_sb_C_im$/i
1138 12 3343 if $word =~ /$PL_sb_C_i$/i
1144 1371 3796 if $word =~ /^($PL_sb_singular_s)$/i
1145 59 0 if $word =~ /^([A-Z].*s)$/ and $classical{'names'}
1146 12 3725 if $word =~ /^($PL_sb_z_zes)$/i
1147 24 3701 if $word =~ /^(.*[^z])(z)$/i
1148 221 3480 if $word =~ /^(.*)([cs]h|x|zz|ss)$/i
1153 40 3440 if $word =~ /(.*[eao])lf$/i
1154 28 3412 if $word =~ /(.*[^d])eaf$/i
1155 44 3368 if $word =~ /(.*[nlw])ife$/i
1156 24 3344 if $word =~ /(.*)arf$/i
1160 60 3284 if $word =~ /(.*[aeiou])y$/i
1161 23 8 if $word =~ /([A-Z].*y)$/ and $classical{'names'}
1162 102 3159 if $word =~ /(.*)y$/i
1166 272 2887 if $word =~ /$PL_sb_U_o_os$/i
1167 72 2815 if $word =~ /[aeiou]o$/i
1168 88 2727 if $word =~ /o$/i
1180 0 3984 if not defined $count and defined $persistent_count
1183 0 3984 defined $count && $count =~ /^($PL_count_one)$/io || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/io ? :
1186 0 3984 if $count =~ /^($PL_count_one)$/io
1192 2 3982 if defined($value = ud_match($word, @PL_v_user_defined))
1197 128 3854 if $word =~ /^($PL_v_irregular_pres)((\s.*)?)$/i
1201 60 3794 if $word =~ /^($PL_v_irregular_non_pres)((\s.*)?)$/i
1207 30 3764 if $word =~ /^($PL_v_irregular_pres)(n't(\s.*)?)$/i
1209 8 3756 if $word =~ /^\S+n't\b/i
1214 660 3096 if $word =~ /^($PL_v_special_s)$/
1215 172 2924 if $word =~ /\s/
1216 4 2920 if $word =~ /^quizzes$/i
1220 16 2904 if $word =~ /^(.*)([cs]h|[x]|zz|ss)es$/i
1222 9 2895 if $word =~ /^(..+)ies$/i
1224 96 2799 if $word =~ /($PL_v_oes_oe)$/
1225 0 2799 if $word =~ /^(.+)oes$/i
1227 175 2624 if $word =~ /^(.*[^s])s$/i
1237 0 1742 if not defined $count and defined $persistent_count
1240 0 1742 defined $count && $count =~ /^($PL_count_one)$/io || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/io ? :
1243 0 1742 if $count =~ /^($PL_count_one)$/io
1248 4 1738 if $word =~ /^($PL_v_ambiguous_pres)((\s.*)?)$/i
1252 18 1720 if $word =~ /^($PL_v_ambiguous_non_pres)((\s.*)?)$/i
1264 0 2020 if not defined $count and defined $persistent_count
1267 5 2015 defined $count && $count =~ /^($PL_count_one)$/io || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/io ? :
1270 5 2015 if $count =~ /^($PL_count_one)$/io
1276 3 2012 if defined($value = ud_match($word, @PL_adj_user_defined))
1281 26 1986 if $word =~ /^($PL_adj_special)$/i
1286 38 1948 if $word =~ /^($PL_adj_poss)$/i
1288 72 1876 if ($word =~ /^(.*)'s?$/)
1289 44 28 $pl =~ /s$/ ? :
1338 0 0 unless $word
1348 0 0 if not defined $count and defined $persistent_count
1351 0 0 if defined $count and not $count =~ /^($PL_count_one)$/io
1357 0 0 if defined($value = ud_match($word, @A_a_user_defined))
1362 0 0 if $word =~ /^($A_ordinal_a)/i
1363 0 0 if $word =~ /^($A_ordinal_an)/i
1367 0 0 if $word =~ /^($A_explicit_an)/i
1368 0 0 if $word =~ /^[aefhilmnorsx]$/i
1369 0 0 if $word =~ /^[bcdgjkpqtuvwyz]$/i
1374 0 0 if $word =~ /^($A_abbrev)/ox
1375 0 0 if $word =~ /^[aefhilmnorsx][.-]/i
1376 0 0 if $word =~ /^[a-z][.-]/i
1380 0 0 if $word =~ /^[^aeiouy]/i
1384 0 0 if $word =~ /^e[uw]/i
1385 0 0 if $word =~ /^onc?e\b/i
1386 0 0 if $word =~ /^uni([^nmd]|mo)/i
1387 0 0 if $word =~ /^ut[th]/i
1388 0 0 if $word =~ /^u[bcfhjkqrst][aeiou]/i
1392 0 0 if $word =~ /^U[NK][AIEO]?/
1396 0 0 if $word =~ /^[aeiou]/i
1400 0 0 if $word =~ /^($A_y_cons)/io
1413 0 124 if not defined $count and defined $persistent_count
1415 3 121 unless $count
1417 3 121 if ($count =~ /^$PL_count_zero$/)
1424 27 94 defined $opt_ref->{'words_below'} && $count < $opt_ref->{'words_below'} ? :
1427 56 65 if (defined $opt_ref->{'comma'} or defined $opt_ref->{'comma_every'})
1428 40 16 unless defined $opt_ref->{'comma_every'}
1430 16 40 if not defined $opt_ref->{'comma'} or $opt_ref->{'comma'} =~ /^\d+$/
1440 0 56 unless defined $comma
1441 0 56 unless defined $comma
1454 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$/
1501 83 83 if ($num =~ /\d/) { }
1621 0 14855 if $ind > $#mill
1622 14855 0 $ind < @mill ? :
1628 3883 1071 $_[0] && $_[1] ? :
4954 1087 if $_[0] ne '1'
1635 2789 15 $_[1] || $_[2] ? :
2804 324 if $_[0]
1637 312 12 if $_[1] or $_[2]
1646 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) { }
1648 2652 345 $1 ? :
345 2997 $1 == 1 ? :
1652 3 7 $2 ? :
1592 10 $1 ? :
1653 24 6 $1 ? :
1657 830 105 $1 ? :
120 935 $1 == 1 ? :
106 9 $3 ? :
940 115 $2 ? :
1658 0 1 $2 ? :
22 1 $1 ? :
1659 14 7 $1 ? :
2 21 $1 == 1 ? :
1681 56 1259 if (@_ % 2 and require Carp)
1690 230 1029 if (exists $arg{'threshold'} and $num > $arg{'threshold'})
1693 220 10 unless $whole =~ s/ (\d) ( \d{3}(?:,|\z) ) /$1,$2/msx
1696 10 220 $frac ? :
1699 0 1029 unless $group =~ /\A[0-3]\Z/
1700 0 1029 $num =~ /\A\s*\-/ ? :
0 1029 $num =~ /\A\s*\+/ ? :
1710 168 861 $group ? :
1029 0 $arg{'decimal'} ? :
1715 7 1022 if ($chunks[0] eq '')
1720 55 1020 unless $_
1722 26 1049 if (not $group || $first) { }
1727 857 218 if not $group and $first
1730 1022 53 if $first
1734 7 1022 if ($first =~ /0/) { }
1743 52 977 if $ord and @numchunks
1752 0 1029 if (wantarray) { }
168 861 elsif ($group) { }
1754 0 0 if $sign
1759 0 168 $sign ? :
1763 0 861 $sign ? :
1767 22 3175 if (/\A$arg{'decimal'}\Z/) { }
3067 108 elsif ($first) { }
1792 24 77 if (ref $arg eq 'HASH') { }
1800 0 29 if @words == 0
1801 5 24 if @words == 1
1803 12 12 exists $opt{'conj'} ? :
1804 6 18 if (@words == 2)
1810 6 12 grep(/,/, @words) ? :
0 18 exists $opt{'sep'} ? :
1815 3 6 length $opt{'final_sep'} == 0 ? :
9 9 !exists $opt{'final_sep'} ? :