Branch Coverage

blib/lib/Lingua/JA/Moji.pm
Criterion Covered Total %
branch 170 224 75.8


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 ($@)
390 10 180 unless ($options)
398 29 161 if ($options->{'style'})
400 2 27 if ($style eq "kunrei")
403 0 29 if ($style eq "passport")
406 18 11 if ($style eq "hepburn")
409 8 21 if ($style eq "common")
413 0 1 if (not $kunrei || $passport || $hepburn and $style ne "nihon" and $style ne "nippon")
419 158 32 if ($options->{'wapuro'})
423 1 189 if ($options->{'wikipedia'})
427 1 189 if ($options->{'truck'})
431 26 164 if ($hepburn or $passport)
434 2 188 if (defined $options->{'use_m'})
438 26 164 if ($hepburn)
441 158 32 if ($wapuro)
444 0 190 if ($passport)
449 10 180 if ($options->{'ve_type'})
452 0 190 unless ($chouonhyouki{$ve_type})
457 1 189 if ($options->{'wo'})
465 24 166 if ($use_m)
470 26 164 if ($hepburn)
474 167 23 if ($ve_type eq "wapuro")
477 1 189 if ($ve_type eq "none")
485 190 950 if ($vowel eq 'ou') { }
495 760 380 if ($y)
496 104 656 if ($hepburn)
499 8 752 if ($kunrei)
504 52 104 if ($hepburn and $hep_vowel{$vowel})
511 26 164 if ($hepburn) { }
2 162 elsif ($kunrei) { }
519 1 189 if ($wo) { }
528 26 164 if ($hepburn) { }
2 162 elsif ($kunrei) { }
536 8 182 if ($common)
543 1 189 if ($wikipedia)
546 1 189 if ($truck)
555 50 3 unless ($options)
579 0 1 if (not defined $check) { }
584 1 1 if ($check eq $style->{'abbrev'})
605 1 0 if (not defined $check) { }
624 8 355 unless (defined $romaji2katakana)
632 269 94 if ($options)
637 0 363 unless (defined $input)
642 269 94 if ($wapuro) { }
656 3 360 if ($ime) { }
686 360 3 unless ($ime)
688 266 94 if ($wapuro) { }
704 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}]/)
714 2 0 if (is_kana($sound)) { }
0 0 elsif (my $romaji = is_romaji($sound)) { }
722 1 1 if ($sound =~ /^[aiueogzbpmnry]/) { }
733 0 218 if (length $romaji == 0)
738 4 214 if ($romaji =~ /[^\sa-z\x{101}\x{12b}\x{16b}\x{113}\x{14d}\342\356\373\352\364'-]|^-/i)
742 143 71 if ($kana =~ /^[\x{30a2}-\x{30f3}\x{30c3}\x{30fc}\s]+$/)
752 34 60 unless (is_romaji($romaji))
755 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)
795 34 73 unless ($canonical)
799 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)
811 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)
869 0 208 unless (@input)
873 208 0 if ($_)
877 0 208 wantarray ? :
884 0 57 wantarray ? :
913 0 1 if (not $kata2hw)
923 3 0 unless ($kana2hw)
939 5 3 unless ($kata2hw)
997 1 1 if (not $kana2morse)
1041 1 1 if (not $kana2braille)
1059 5 2 if ($may_be_kana =~ /^[\x{3042}-\x{3093}\x{30a2}-\x{30f3}]+$/)
1068 0 0 if ($may_be_kana =~ /^[\x{30a2}-\x{30f3}]+$/)
1077 1 1 if ($may_be_kana =~ /^[\x{3042}-\x{3093}]+$/)
1182 2 203 if ($input =~ /\p{InHankakuKatakana}/)
1220 1 1 if (not $circled_conv)
1265 0 1 unless ($new2old_kanji)
1275 1 0 unless ($new2old_kanji)
1294 1 3 unless ($katakana2cyrillic)
1312 0 6 unless ($katakana2cyrillic)
1339 1 1 unless ($first2hangul)
1364 1 0 unless ($firsth2k)
1399 1 3 unless ($circled2kanji)
1404 0 4 if (not $circled2kanji)
1427 1 1 if (not $bracketed2kanji)
1489 1 1 if (not $square2katakana)
1515 3 1 if ($nf)
1519 1 3 if ($hf)
1523 1 0 if (@nigori)
1570 1 0 unless ($hendat)
1580 0 2 unless ($hendat)
1594 0 1 unless ($hendat)
1605 0 1 unless ($hendat)
1628 7 3 if ($kana ne $orig)
1637 0 3 unless ($kana)
1640 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) { }
1663 0 2 unless open my $in, "<:encoding(utf8)", $bkfile
1671 0 2 unless close $in
1688 1 4 if (length $kana < 1)
1692 1 3 unless ($first =~ /\p{InKana}/)
1697 1 2 if (defined $not)