zeroclickinfo-goodies/t/Kana.t

183 lines
6.2 KiB
Perl
Raw Normal View History

2015-02-12 07:09:33 -08:00
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Deep;
2015-02-12 07:09:33 -08:00
use DDG::Test::Goodie;
use utf8;
zci answer_type => 'kana';
zci is_cached => 1;
ddg_goodie_test(
['DDG::Goodie::Kana'],
# romaji -> hiragana
2015-02-13 05:33:50 -08:00
'ahiru in hiragana' => test_zci(
2015-02-13 06:31:04 -08:00
'ahiru converted to hiragana is あひる',
2015-02-12 18:36:57 -08:00
structured_answer => {
input => ['ahiru'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Hiragana',
2015-02-12 18:36:57 -08:00
result => 'あひる'
}
2015-02-12 07:09:33 -08:00
),
2015-02-13 05:33:50 -08:00
'nihon no daigaku! to hiragana' => test_zci(
'nihon no daigaku! converted to hiragana is にほん の だいがく!',
structured_answer => {
2015-02-13 06:05:39 -08:00
input => ['nihon no daigaku!'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Hiragana',
2015-02-12 19:55:38 -08:00
result => 'にほん の だいがく!'
}
),
# romaji -> katakana
2015-02-13 05:33:50 -08:00
'ahiru in katakana' => test_zci(
'ahiru converted to katakana is アヒル',
2015-02-12 18:36:57 -08:00
structured_answer => {
input => ['ahiru'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Katakana',
result => 'アヒル'
2015-02-12 18:36:57 -08:00
}
2015-02-12 07:09:33 -08:00
),
2015-02-13 05:33:50 -08:00
'kirin, banana to katakana' => test_zci(
'kirin, banana converted to katakana is キリン、 バナナ',
structured_answer => {
input => ['kirin, banana'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Katakana',
result => 'キリン、 バナナ'
}
),
# katakana -> romaji
2015-02-13 05:33:50 -08:00
'アヒル to romaji' => test_zci(
'アヒル converted to romaji is ahiru',
2015-02-12 18:36:57 -08:00
structured_answer => {
input => ['アヒル'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Romaji',
2015-02-12 18:36:57 -08:00
result => 'ahiru'
}
),
2015-02-13 05:33:50 -08:00
'キリン、 バナナ in romaji' => test_zci(
2015-02-13 06:05:39 -08:00
'キリン、 バナナ converted to romaji is kirin, banana',
structured_answer => {
2015-02-12 19:55:38 -08:00
input => ['キリン、 バナナ'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Romaji',
2015-02-13 06:05:39 -08:00
result => 'kirin, banana'
}
),
# hiragana -> romaji
2015-02-13 05:33:50 -08:00
'あひる in romaji' => test_zci(
'あひる converted to romaji is ahiru',
2015-02-12 18:36:57 -08:00
structured_answer => {
input => ['あひる'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Romaji',
2015-02-12 18:36:57 -08:00
result => 'ahiru'
}
),
2015-02-13 05:33:50 -08:00
'すみません、 いま なんじ ですか。 to romaji' => test_zci(
'すみません、 いま なんじ ですか。 converted to romaji is sumimasen, ima nanji desuka.',
2015-02-12 18:36:57 -08:00
structured_answer => {
2015-02-13 06:31:04 -08:00
input => ['すみません、 いま なんじ ですか。'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Romaji',
result => 'sumimasen, ima nanji desuka.'
}
),
2015-02-13 06:05:39 -08:00
# hiragana -> katakana
2015-02-13 05:33:50 -08:00
'はつしぐれさるもこみのをほしげなり to katakana' => test_zci(
2015-02-13 06:05:39 -08:00
'はつしぐれさるもこみのをほしげなり converted to katakana is ハツシグレサルモコミノヲホシゲナリ',
structured_answer => {
input => ['はつしぐれさるもこみのをほしげなり'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Katakana',
result => 'ハツシグレサルモコミノヲホシゲナリ'
2015-02-12 18:36:57 -08:00
}
),
2015-02-13 06:05:39 -08:00
# katakana -> hirgana
2015-02-13 05:33:50 -08:00
'ハツシグレサルモコミノヲホシゲナリ to hiragana' => test_zci(
2015-02-13 06:05:39 -08:00
'ハツシグレサルモコミノヲホシゲナリ converted to hiragana is はつしぐれさるもこみのをほしげなり',
structured_answer => {
input => ['ハツシグレサルモコミノヲホシゲナリ'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Hiragana',
result => 'はつしぐれさるもこみのをほしげなり'
}
),
# kana -> romaji
'ハンバーガーはたべものです。 to romaji' => test_zci(
'ハンバーガーはたべものです。 converted to romaji is hambāgāhatabemonodesu.',
structured_answer => {
input => ['ハンバーガーはたべものです。'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Romaji',
result => 'hambāgāhatabemonodesu.'
}
),
# japanese puncuation -> romaji
2015-02-14 07:13:10 -08:00
'{[(?!。、『』あ「」,:)]} to romaji' => test_zci(
'{[(?!。、『』あ「」,:)]} converted to romaji is {[(?!.,""a\'\',:)]}',
structured_answer => {
2015-02-14 07:13:10 -08:00
input => ['{[(?!。、『』あ「」,:)]}'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Romaji',
result => '{[(?!.,""a\'\',:)]}'
}
),
2015-02-13 05:33:50 -08:00
'ええ! in romaji' => test_zci(
'ええ! converted to romaji is ē!',
structured_answer => {
input => ['ええ!'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Romaji',
result => 'ē!'
}
),
# Hiragana goodie tests
2015-02-13 05:33:50 -08:00
'a hiragana' => test_zci(
'a converted to hiragana is あ',
structured_answer => {
input => ['a'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Hiragana',
result => 'あ'
}
),
2015-02-13 05:33:50 -08:00
'konnichiwa hiragana' => test_zci(
'konnichiwa converted to hiragana is こんにちわ',
structured_answer => {
input => ['konnichiwa'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Hiragana',
result => 'こんにちわ'
}
),
2015-02-13 05:33:50 -08:00
'nihon hiragana' => test_zci(
'nihon converted to hiragana is にほん',
structured_answer => {
input => ['nihon'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Hiragana',
result => 'にほん'
}
),
2015-02-13 05:33:50 -08:00
'tsukue no ue hiragana' => test_zci(
'tsukue no ue converted to hiragana is つくえ の うえ',
structured_answer => {
input => ['tsukue no ue'],
2015-03-07 08:33:09 -08:00
operation => 'Convert to Hiragana',
2015-02-13 06:05:39 -08:00
result => 'つくえ の うえ'
}
),
# Invalid inputs
'romaji' => undef,
'hiragana' => undef,
'katakana' => undef,
'what is hiragana?' => undef,
'abc in katakana' => undef,
'abc in hiragana' => undef,
'ho abc hi to katakana' => undef,
'ho abc hi to hiragana' => undef,
'えego to romaji' => undef,
'ハ.ツha.tsu in romaji' => undef,
2015-02-12 07:09:33 -08:00
);
done_testing;