Branch Coverage

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


line true false branch
86 1 20 unless ($file and -f $file)
124 0 0 unless ($convert_type)
132 0 0 unless ($in)
137 0 0 if (@{$in;} == 1)
141 0 0 if ($convert_type eq 'all') { }
0 0 elsif ($convert_type eq 'first') { }
0 0 elsif ($convert_type eq 'random') { }
159 8 0 unless ($table)
167 8 0 if (length_one(@keys)) { }
172 2 6 if (length_one(@values) and unambiguous($table)) { }
181 6 0 if (unambiguous($conv->{'in2out'})) { }
196 0 0 if (unambiguous($conv->{'in2out'}))
205 8 0 if ($sub_out2in)
208 0 8 if ($@)
386 9 176 unless ($options)
394 26 159 if ($options->{'style'})
396 1 25 if ($style eq 'kunrei')
399 0 26 if ($style eq 'passport')
402 18 8 if ($style eq 'hepburn')
405 6 20 if ($style eq 'common')
409 0 1 if (not $kunrei || $passport || $hepburn and $style ne 'nihon' and $style ne 'nippon')
415 158 27 if ($options->{'wapuro'})
419 24 161 if ($hepburn or $passport)
422 2 183 if (defined $options->{'use_m'})
426 24 161 if ($hepburn)
429 158 27 if ($wapuro)
432 0 185 if ($passport)
437 10 175 if ($options->{'ve_type'})
440 0 185 unless ($chouonhyouki{$ve_type})
445 1 184 if ($options->{'wo'})
452 22 163 if ($use_m)
457 24 161 if ($hepburn)
461 167 18 if ($ve_type eq 'wapuro')
464 1 184 if ($ve_type eq 'none')
472 185 925 if ($vowel eq 'ou') { }
482 740 370 if ($y)
483 96 644 if ($hepburn)
488 48 96 if ($hepburn and $hep_vowel{$vowel})
495 24 161 if ($hepburn) { }
1 160 elsif ($kunrei) { }
503 1 184 if ($wo) { }
512 24 161 if ($hepburn) { }
1 160 elsif ($kunrei) { }
520 6 179 if ($common)
533 50 3 unless ($options)
557 0 1 if (not defined $check) { }
562 1 1 if ($check eq $style->{'abbrev'})
583 1 0 if (not defined $check) { }
602 8 355 unless (defined $romaji2katakana)
610 269 94 if ($options)
615 0 363 unless (defined $input)
620 269 94 if ($wapuro) { }
634 3 360 if ($ime) { }
664 360 3 unless ($ime)
666 266 94 if ($wapuro) { }
682 2 0 if (is_kana($sound)) { }
0 0 elsif (my $romaji = is_romaji($sound)) { }
690 1 1 if ($sound =~ /^[aiueogzbpmnry]/) { }
701 0 218 if (length $romaji == 0)
706 4 214 if ($romaji =~ /[^\sa-z\x{101}\x{12b}\x{16b}\x{113}\x{14d}\342\356\373\352\364'-]|^-/i)
710 143 71 if ($kana =~ /^[\x{30a2}-\x{30f3}\x{30c3}\x{30fc}\s]+$/)
720 34 60 unless (is_romaji($romaji))
723 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)
763 34 73 unless ($canonical)
767 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)
779 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)
837 0 203 unless (@input)
841 203 0 if ($_)
845 0 203 wantarray ? :
852 0 57 wantarray ? :
879 0 1 if (not $kata2hw)
889 3 0 unless ($kana2hw)
905 5 3 unless ($kata2hw)
963 1 1 if (not $kana2morse)
1007 1 1 if (not $kana2braille)
1025 5 2 if ($may_be_kana =~ /^[\x{3042}-\x{3093}\x{30a2}-\x{30f3}]+$/)
1034 1 1 if ($may_be_kana =~ /^[\x{3042}-\x{3093}]+$/)
1139 2 198 if ($input =~ /\p{InHankakuKatakana}/)
1177 1 1 if (not $circled_conv)
1221 0 1 unless ($new2old_kanji)
1231 1 0 unless ($new2old_kanji)
1250 1 3 unless ($katakana2cyrillic)
1268 0 6 unless ($katakana2cyrillic)
1295 1 1 unless ($first2hangul)
1320 1 0 unless ($firsth2k)
1355 1 3 unless ($circled2kanji)
1360 0 4 if (not $circled2kanji)
1383 1 1 if (not $bracketed2kanji)
1445 1 1 if (not $square2katakana)
1471 3 1 if ($nf)
1475 1 3 if ($hf)
1479 1 0 if (@nigori)
1526 1 0 unless ($hendat)
1536 0 2 unless ($hendat)
1550 0 1 unless ($hendat)
1561 0 1 unless ($hendat)
1584 7 3 if ($kana ne $orig)
1593 0 3 unless ($kana)
1596 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) { }
1619 0 2 unless open my $in, '<:encoding(utf8)', $bkfile
1627 0 2 unless close $in
1644 1 4 if (length $kana < 1)
1648 1 3 unless ($first =~ /\p{InKana}/)
1653 1 2 if (defined $not)