Branch Coverage

blib/lib/Lingua/JA/Moji.pm
Criterion Covered Total %
branch 154 204 75.4


line true false branch
84 1 20 unless ($file and -f $file)
122 0 0 unless ($convert_type)
130 0 0 unless ($in)
135 0 0 if (@{$in;} == 1)
139 0 0 if ($convert_type eq 'all') { }
0 0 elsif ($convert_type eq 'first') { }
0 0 elsif ($convert_type eq 'random') { }
157 8 0 unless ($table)
165 8 0 if (length_one(@keys)) { }
170 2 6 if (length_one(@values) and unambiguous($table)) { }
179 6 0 if (unambiguous($conv->{'in2out'})) { }
194 0 0 if (unambiguous($conv->{'in2out'}))
203 8 0 if ($sub_out2in)
206 0 8 if ($@)
384 9 176 unless ($options)
392 26 159 if ($options->{'style'})
394 1 25 if ($style eq 'kunrei')
397 0 26 if ($style eq 'passport')
400 18 8 if ($style eq 'hepburn')
403 6 20 if ($style eq 'common')
407 0 1 if (not $kunrei || $passport || $hepburn and $style ne 'nihon' and $style ne 'nippon')
413 158 27 if ($options->{'wapuro'})
417 24 161 if ($hepburn or $passport)
420 2 183 if (defined $options->{'use_m'})
424 24 161 if ($hepburn)
427 158 27 if ($wapuro)
430 0 185 if ($passport)
435 10 175 if ($options->{'ve_type'})
438 0 185 unless ($chouonhyouki{$ve_type})
443 1 184 if ($options->{'wo'})
450 22 163 if ($use_m)
455 24 161 if ($hepburn)
459 167 18 if ($ve_type eq 'wapuro')
462 1 184 if ($ve_type eq 'none')
470 185 925 if ($vowel eq 'ou') { }
480 740 370 if ($y)
481 96 644 if ($hepburn)
486 48 96 if ($hepburn and $hep_vowel{$vowel})
493 24 161 if ($hepburn) { }
1 160 elsif ($kunrei) { }
501 1 184 if ($wo) { }
510 24 161 if ($hepburn) { }
1 160 elsif ($kunrei) { }
518 6 179 if ($common)
531 50 3 unless ($options)
555 0 1 if (not defined $check) { }
560 1 1 if ($check eq $style->{'abbrev'})
581 1 0 if (not defined $check) { }
600 8 355 unless (defined $romaji2katakana)
608 269 94 if ($options)
613 0 363 unless (defined $input)
618 269 94 if ($wapuro) { }
632 3 360 if ($ime) { }
662 360 3 unless ($ime)
664 266 94 if ($wapuro) { }
680 2 0 if (is_kana($sound)) { }
0 0 elsif (my $romaji = is_romaji($sound)) { }
688 1 1 if ($sound =~ /^[aiueogzbpmnry]/) { }
699 0 218 if (length $romaji == 0)
704 4 214 if ($romaji =~ /[^\sa-z\x{101}\x{12b}\x{16b}\x{113}\x{14d}\342\356\373\352\364'-]|^-/i)
708 143 71 if ($kana =~ /^[\x{30a2}-\x{30f3}\x{30c3}\x{30fc}\s]+$/)
718 34 60 unless (is_romaji($romaji))
721 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)
761 34 73 unless ($canonical)
765 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)
777 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)
835 0 200 unless (@input)
839 200 0 if ($_)
843 0 200 wantarray ? :
850 0 57 wantarray ? :
877 0 1 if (not $kata2hw)
887 3 0 unless ($kana2hw)
903 5 3 unless ($kata2hw)
961 1 1 if (not $kana2morse)
1005 1 1 if (not $kana2braille)
1023 5 2 if ($may_be_kana =~ /^[\x{3042}-\x{3093}\x{30a2}-\x{30f3}]+$/)
1032 1 1 if ($may_be_kana =~ /^[\x{3042}-\x{3093}]+$/)
1129 2 195 if ($input =~ /\p{InHankakuKatakana}/)
1167 1 1 if (not $circled_conv)
1211 0 1 unless ($new2old_kanji)
1221 1 0 unless ($new2old_kanji)
1240 1 3 unless ($katakana2cyrillic)
1258 0 6 unless ($katakana2cyrillic)
1285 1 1 unless ($first2hangul)
1310 1 0 unless ($firsth2k)
1345 1 3 unless ($circled2kanji)
1350 0 4 if (not $circled2kanji)
1373 1 1 if (not $bracketed2kanji)
1435 1 1 if (not $square2katakana)
1461 3 1 if ($nf)
1465 1 3 if ($hf)
1469 1 0 if (@nigori)
1516 1 0 unless ($hendat)
1526 0 2 unless ($hendat)
1540 0 1 unless ($hendat)
1551 0 1 unless ($hendat)
1574 7 3 if ($kana ne $orig)
1583 0 3 unless ($kana)
1586 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) { }
1609 0 2 unless open my $in, '<:encoding(utf8)', $bkfile
1617 0 2 unless close $in