Branch Coverage

blib/lib/Lingua/JA/Moji.pm
Criterion Covered Total %
branch 160 214 74.7


line true false branch
88 1 20 unless ($file and -f $file)
126 0 0 unless ($convert_type)
134 0 0 unless ($in)
139 0 0 if (@{$in;} == 1)
143 0 0 if ($convert_type eq 'all') { }
0 0 elsif ($convert_type eq 'first') { }
0 0 elsif ($convert_type eq 'random') { }
161 8 0 unless ($table)
169 8 0 if (length_one(@keys)) { }
174 2 6 if (length_one(@values) and unambiguous($table)) { }
183 6 0 if (unambiguous($conv->{'in2out'})) { }
198 0 0 if (unambiguous($conv->{'in2out'}))
207 8 0 if ($sub_out2in)
210 0 8 if ($@)
388 9 176 unless ($options)
396 26 159 if ($options->{'style'})
398 1 25 if ($style eq "kunrei")
401 0 26 if ($style eq "passport")
404 18 8 if ($style eq "hepburn")
407 6 20 if ($style eq "common")
411 0 1 if (not $kunrei || $passport || $hepburn and $style ne "nihon" and $style ne "nippon")
417 158 27 if ($options->{'wapuro'})
421 24 161 if ($hepburn or $passport)
424 2 183 if (defined $options->{'use_m'})
428 24 161 if ($hepburn)
431 158 27 if ($wapuro)
434 0 185 if ($passport)
439 10 175 if ($options->{'ve_type'})
442 0 185 unless ($chouonhyouki{$ve_type})
447 1 184 if ($options->{'wo'})
454 22 163 if ($use_m)
459 24 161 if ($hepburn)
463 167 18 if ($ve_type eq "wapuro")
466 1 184 if ($ve_type eq "none")
474 185 925 if ($vowel eq 'ou') { }
484 740 370 if ($y)
485 96 644 if ($hepburn)
490 48 96 if ($hepburn and $hep_vowel{$vowel})
497 24 161 if ($hepburn) { }
1 160 elsif ($kunrei) { }
505 1 184 if ($wo) { }
514 24 161 if ($hepburn) { }
1 160 elsif ($kunrei) { }
522 6 179 if ($common)
535 50 3 unless ($options)
559 0 1 if (not defined $check) { }
564 1 1 if ($check eq $style->{'abbrev'})
585 1 0 if (not defined $check) { }
604 8 355 unless (defined $romaji2katakana)
612 269 94 if ($options)
617 0 363 unless (defined $input)
622 269 94 if ($wapuro) { }
636 3 360 if ($ime) { }
666 360 3 unless ($ime)
668 266 94 if ($wapuro) { }
684 0 0 if ($input =~ /[\x{3041}\x{3043}\x{3045}\x{3047}\x{3049}\x{3063}\x{3083}\x{3085}\x{3087}\x{3095}\x{3096}\x{308e}\x{30ee}\x{30a1}\x{30a3}\x{30a5}\x{30a7}\x{30a9}\x{30c3}\x{30e3}\x{30e5}\x{30e7}\x{30f5}\x{30f6}]/)
694 2 0 if (is_kana($sound)) { }
0 0 elsif (my $romaji = is_romaji($sound)) { }
702 1 1 if ($sound =~ /^[aiueogzbpmnry]/) { }
713 0 218 if (length $romaji == 0)
718 4 214 if ($romaji =~ /[^\sa-z\x{101}\x{12b}\x{16b}\x{113}\x{14d}\342\356\373\352\364'-]|^-/i)
722 143 71 if ($kana =~ /^[\x{30a2}-\x{30f3}\x{30c3}\x{30fc}\s]+$/)
732 34 60 unless (is_romaji($romaji))
735 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)
775 34 73 unless ($canonical)
779 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)
791 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)
849 0 203 unless (@input)
853 203 0 if ($_)
857 0 203 wantarray ? :
864 0 57 wantarray ? :
893 0 1 if (not $kata2hw)
903 3 0 unless ($kana2hw)
919 5 3 unless ($kata2hw)
977 1 1 if (not $kana2morse)
1021 1 1 if (not $kana2braille)
1039 5 2 if ($may_be_kana =~ /^[\x{3042}-\x{3093}\x{30a2}-\x{30f3}]+$/)
1048 0 0 if ($may_be_kana =~ /^[\x{30a2}-\x{30f3}]+$/)
1057 1 1 if ($may_be_kana =~ /^[\x{3042}-\x{3093}]+$/)
1162 2 198 if ($input =~ /\p{InHankakuKatakana}/)
1200 1 1 if (not $circled_conv)
1245 0 1 unless ($new2old_kanji)
1255 1 0 unless ($new2old_kanji)
1274 1 3 unless ($katakana2cyrillic)
1292 0 6 unless ($katakana2cyrillic)
1319 1 1 unless ($first2hangul)
1344 1 0 unless ($firsth2k)
1379 1 3 unless ($circled2kanji)
1384 0 4 if (not $circled2kanji)
1407 1 1 if (not $bracketed2kanji)
1469 1 1 if (not $square2katakana)
1495 3 1 if ($nf)
1499 1 3 if ($hf)
1503 1 0 if (@nigori)
1550 1 0 unless ($hendat)
1560 0 2 unless ($hendat)
1574 0 1 unless ($hendat)
1585 0 1 unless ($hendat)
1608 7 3 if ($kana ne $orig)
1617 0 3 unless ($kana)
1620 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) { }
1643 0 2 unless open my $in, "<:encoding(utf8)", $bkfile
1651 0 2 unless close $in
1668 1 4 if (length $kana < 1)
1672 1 3 unless ($first =~ /\p{InKana}/)
1677 1 2 if (defined $not)