Branch Coverage

blib/lib/Lingua/JA/Moji.pm
Criterion Covered Total %
branch 160 210 76.1


line true false branch
85 1 20 unless ($file and -f $file)
123 0 0 unless ($convert_type)
131 0 0 unless ($in)
136 0 0 if (@{$in;} == 1)
140 0 0 if ($convert_type eq 'all') { }
0 0 elsif ($convert_type eq 'first') { }
0 0 elsif ($convert_type eq 'random') { }
158 8 0 unless ($table)
166 8 0 if (length_one(@keys)) { }
171 2 6 if (length_one(@values) and unambiguous($table)) { }
180 6 0 if (unambiguous($conv->{'in2out'})) { }
195 0 0 if (unambiguous($conv->{'in2out'}))
204 8 0 if ($sub_out2in)
207 0 8 if ($@)
385 9 176 unless ($options)
393 26 159 if ($options->{'style'})
395 1 25 if ($style eq 'kunrei')
398 0 26 if ($style eq 'passport')
401 18 8 if ($style eq 'hepburn')
404 6 20 if ($style eq 'common')
408 0 1 if (not $kunrei || $passport || $hepburn and $style ne 'nihon' and $style ne 'nippon')
414 158 27 if ($options->{'wapuro'})
418 24 161 if ($hepburn or $passport)
421 2 183 if (defined $options->{'use_m'})
425 24 161 if ($hepburn)
428 158 27 if ($wapuro)
431 0 185 if ($passport)
436 10 175 if ($options->{'ve_type'})
439 0 185 unless ($chouonhyouki{$ve_type})
444 1 184 if ($options->{'wo'})
451 22 163 if ($use_m)
456 24 161 if ($hepburn)
460 167 18 if ($ve_type eq 'wapuro')
463 1 184 if ($ve_type eq 'none')
471 185 925 if ($vowel eq 'ou') { }
481 740 370 if ($y)
482 96 644 if ($hepburn)
487 48 96 if ($hepburn and $hep_vowel{$vowel})
494 24 161 if ($hepburn) { }
1 160 elsif ($kunrei) { }
502 1 184 if ($wo) { }
511 24 161 if ($hepburn) { }
1 160 elsif ($kunrei) { }
519 6 179 if ($common)
532 50 3 unless ($options)
556 0 1 if (not defined $check) { }
561 1 1 if ($check eq $style->{'abbrev'})
582 1 0 if (not defined $check) { }
601 8 355 unless (defined $romaji2katakana)
609 269 94 if ($options)
614 0 363 unless (defined $input)
619 269 94 if ($wapuro) { }
633 3 360 if ($ime) { }
663 360 3 unless ($ime)
665 266 94 if ($wapuro) { }
681 2 0 if (is_kana($sound)) { }
0 0 elsif (my $romaji = is_romaji($sound)) { }
689 1 1 if ($sound =~ /^[aiueogzbpmnry]/) { }
700 0 218 if (length $romaji == 0)
705 4 214 if ($romaji =~ /[^\sa-z\x{101}\x{12b}\x{16b}\x{113}\x{14d}\342\356\373\352\364'-]|^-/i)
709 143 71 if ($kana =~ /^[\x{30a2}-\x{30f3}\x{30c3}\x{30fc}\s]+$/)
719 34 60 unless (is_romaji($romaji))
722 51 9 if ($romaji =~ / # Don't allow small vowels, small tsu, or fya, # fye etc. (fy|l|x|v)y?($vowel_re|ts?u|wa|ka|ke) | # Don't allow hyi, hye, yi, ye. [zh]?y[ie\352\356\x{113}] | # Don't allow tye ty[e\352\x{113}] | # Don't allow wh-, kw-, gw-, dh-, etc. (wh|kw|gw|dh|thy)$vowel_re | # Don't allow "t'i" [dt]'(i|y?$u_re) | # Don't allow dwu, twu [dt](w$u_re) | hwy$u_re | # Don't allow "wi" or "we". w(i|e) | # Don't allow some non-Japanese double consonants. (?:rr|yy) | # Don't allow 'thi' thi /xi)
762 34 73 unless ($canonical)
766 6 67 if ($kana =~ / # Don't allow tanggono \x{30f3}\x{30c3} | # Don't allow "nmichi". ^\x{30f3} | # Don't allow ffun etc. ^\x{30c3} /x)
778 64 3 if ($romaji =~ m[ (fy|l|x|v)y?($vowel_re|ts?u|wa|ka|ke) | # Don't allow hyi, hye, yi, ye. [zh]?y[ie\352\356\x{113}] | # Don't allow tye ty[e\352\x{113}] | # Don't allow wh-, kw-, gw-, dh-, etc. (wh|kw|gw|dh|thy)$vowel_re | # Don't allow tsa, tsi, tse, tso, fa, fe, fi, fo. (ts|f)$no_u_vowel_re | # Don't allow "t'i" [dt]'(i|y?$u_re) | # Don't allow dwu, twu [dt](w$u_re) | hwy$u_re | # Don't allow "wi" or "we". w(i|e) | # Don't allow 'je', 'che', 'she' (?:[cs]h|j)e | # Don't allow some non-Japanese double consonants. (?:rr|yy) | # Don't allow 'thi'/'thu' th[iu] | # Don't allow 'johann' nn$ | # Don't allow 'ridzuan' etc. dz | # Qs are out. q | # Double ws, hs, etc. are out ww|hh|bb | # This is allowed by IMEs as "\343\201\241\343\202\203" etc. cy ]xi)
836 0 203 unless (@input)
840 203 0 if ($_)
844 0 203 wantarray ? :
851 0 57 wantarray ? :
878 0 1 if (not $kata2hw)
888 3 0 unless ($kana2hw)
904 5 3 unless ($kata2hw)
962 1 1 if (not $kana2morse)
1006 1 1 if (not $kana2braille)
1024 5 2 if ($may_be_kana =~ /^[\x{3042}-\x{3093}\x{30a2}-\x{30f3}]+$/)
1033 1 1 if ($may_be_kana =~ /^[\x{3042}-\x{3093}]+$/)
1130 2 198 if ($input =~ /\p{InHankakuKatakana}/)
1168 1 1 if (not $circled_conv)
1212 0 1 unless ($new2old_kanji)
1222 1 0 unless ($new2old_kanji)
1241 1 3 unless ($katakana2cyrillic)
1259 0 6 unless ($katakana2cyrillic)
1286 1 1 unless ($first2hangul)
1311 1 0 unless ($firsth2k)
1346 1 3 unless ($circled2kanji)
1351 0 4 if (not $circled2kanji)
1374 1 1 if (not $bracketed2kanji)
1436 1 1 if (not $square2katakana)
1462 3 1 if ($nf)
1466 1 3 if ($hf)
1470 1 0 if (@nigori)
1517 1 0 unless ($hendat)
1527 0 2 unless ($hendat)
1541 0 1 unless ($hendat)
1552 0 1 unless ($hendat)
1575 7 3 if ($kana ne $orig)
1584 0 3 unless ($kana)
1587 1 2 if ($kana =~ /[\x{ff01}-\x{ff5e}]/) { }
0 2 elsif ($kana =~ /[a-z\342\356\373\352\364\364\x{101}\x{16b}\x{113}\x{14d}]/i) { }
1610 0 2 unless open my $in, '<:encoding(utf8)', $bkfile
1618 0 2 unless close $in
1635 1 4 if (length $kana < 1)
1639 1 3 unless ($first =~ /\p{InKana}/)
1644 1 2 if (defined $not)