Kana: Updating tests for text template
parent
8eeddb5c19
commit
0ca397ab70
169
t/Kana.t
169
t/Kana.t
|
@ -9,162 +9,57 @@ use utf8;
|
||||||
zci answer_type => 'kana';
|
zci answer_type => 'kana';
|
||||||
zci is_cached => 1;
|
zci is_cached => 1;
|
||||||
|
|
||||||
|
sub build_test
|
||||||
|
{
|
||||||
|
my ($text, $title, $script, $subtitle) = @_;
|
||||||
|
return test_zci($text, structured_answer => {
|
||||||
|
data => {
|
||||||
|
title => $title,
|
||||||
|
subtitle => "Convert to $script: $subtitle",
|
||||||
|
},
|
||||||
|
templates => {
|
||||||
|
group => 'text'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ddg_goodie_test(
|
ddg_goodie_test(
|
||||||
['DDG::Goodie::Kana'],
|
['DDG::Goodie::Kana'],
|
||||||
|
|
||||||
# romaji -> hiragana
|
# romaji -> hiragana
|
||||||
'ahiru in hiragana' => test_zci(
|
'ahiru in hiragana' => build_test('ahiru converted to hiragana is あひる','あひる', "Hiragana", 'ahiru'),
|
||||||
'ahiru converted to hiragana is あひる',
|
'nihon no daigaku! to hiragana' => build_test('nihon no daigaku! converted to hiragana is にほん の だいがく!', 'にほん の だいがく!', 'Hiragana', 'nihon no daigaku!'),
|
||||||
structured_answer => {
|
|
||||||
input => ['ahiru'],
|
|
||||||
operation => 'Convert to Hiragana',
|
|
||||||
result => 'あひる'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
'nihon no daigaku! to hiragana' => test_zci(
|
|
||||||
'nihon no daigaku! converted to hiragana is にほん の だいがく!',
|
|
||||||
structured_answer => {
|
|
||||||
input => ['nihon no daigaku!'],
|
|
||||||
operation => 'Convert to Hiragana',
|
|
||||||
result => 'にほん の だいがく!'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
|
|
||||||
# romaji -> katakana
|
# romaji -> katakana
|
||||||
'ahiru in katakana' => test_zci(
|
'ahiru in katakana' => build_test('ahiru converted to katakana is アヒル', 'アヒル', "Katakana", "ahiru",),
|
||||||
'ahiru converted to katakana is アヒル',
|
'kirin, banana to katakana' => build_test('kirin, banana converted to katakana is キリン、 バナナ','キリン、 バナナ', "Katakana", 'kirin, banana'),
|
||||||
structured_answer => {
|
|
||||||
input => ['ahiru'],
|
|
||||||
operation => 'Convert to Katakana',
|
|
||||||
result => 'アヒル'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
'kirin, banana to katakana' => test_zci(
|
|
||||||
'kirin, banana converted to katakana is キリン、 バナナ',
|
|
||||||
structured_answer => {
|
|
||||||
input => ['kirin, banana'],
|
|
||||||
operation => 'Convert to Katakana',
|
|
||||||
result => 'キリン、 バナナ'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
|
|
||||||
# katakana -> romaji
|
# katakana -> romaji
|
||||||
'アヒル to romaji' => test_zci(
|
'アヒル to romaji' => build_test('アヒル converted to romaji is ahiru', 'ahiru', 'Romaji', 'アヒル'),
|
||||||
'アヒル converted to romaji is ahiru',
|
'キリン、 バナナ in romaji' => build_test('キリン、 バナナ converted to romaji is kirin, banana', 'kirin, banana', "Romaji", 'キリン、 バナナ'),
|
||||||
structured_answer => {
|
|
||||||
input => ['アヒル'],
|
|
||||||
operation => 'Convert to Romaji',
|
|
||||||
result => 'ahiru'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
'キリン、 バナナ in romaji' => test_zci(
|
|
||||||
'キリン、 バナナ converted to romaji is kirin, banana',
|
|
||||||
structured_answer => {
|
|
||||||
input => ['キリン、 バナナ'],
|
|
||||||
operation => 'Convert to Romaji',
|
|
||||||
result => 'kirin, banana'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
|
|
||||||
# hiragana -> romaji
|
# hiragana -> romaji
|
||||||
'あひる in romaji' => test_zci(
|
'あひる in romaji' => build_test('あひる converted to romaji is ahiru', "ahiru", "Romaji", 'あひる'),
|
||||||
'あひる converted to romaji is ahiru',
|
'すみません、 いま なんじ ですか。 to romaji' => build_test('すみません、 いま なんじ ですか。 converted to romaji is sumimasen, ima nanji desuka.', 'sumimasen, ima nanji desuka.', "Romaji", 'すみません、 いま なんじ ですか。'),
|
||||||
structured_answer => {
|
|
||||||
input => ['あひる'],
|
|
||||||
operation => 'Convert to Romaji',
|
|
||||||
result => 'ahiru'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
'すみません、 いま なんじ ですか。 to romaji' => test_zci(
|
|
||||||
'すみません、 いま なんじ ですか。 converted to romaji is sumimasen, ima nanji desuka.',
|
|
||||||
structured_answer => {
|
|
||||||
input => ['すみません、 いま なんじ ですか。'],
|
|
||||||
operation => 'Convert to Romaji',
|
|
||||||
result => 'sumimasen, ima nanji desuka.'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
|
|
||||||
# hiragana -> katakana
|
# hiragana -> katakana
|
||||||
'はつしぐれさるもこみのをほしげなり to katakana' => test_zci(
|
'はつしぐれさるもこみのをほしげなり to katakana' => build_test('はつしぐれさるもこみのをほしげなり converted to katakana is ハツシグレサルモコミノヲホシゲナリ', 'ハツシグレサルモコミノヲホシゲナリ', "Katakana", 'はつしぐれさるもこみのをほしげなり'),
|
||||||
'はつしぐれさるもこみのをほしげなり converted to katakana is ハツシグレサルモコミノヲホシゲナリ',
|
|
||||||
structured_answer => {
|
|
||||||
input => ['はつしぐれさるもこみのをほしげなり'],
|
|
||||||
operation => 'Convert to Katakana',
|
|
||||||
result => 'ハツシグレサルモコミノヲホシゲナリ'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
|
|
||||||
# katakana -> hirgana
|
# katakana -> hirgana
|
||||||
'ハツシグレサルモコミノヲホシゲナリ to hiragana' => test_zci(
|
'ハツシグレサルモコミノヲホシゲナリ to hiragana' => build_test('ハツシグレサルモコミノヲホシゲナリ converted to hiragana is はつしぐれさるもこみのをほしげなり', 'はつしぐれさるもこみのをほしげなり', "Hiragana", 'ハツシグレサルモコミノヲホシゲナリ'),
|
||||||
'ハツシグレサルモコミノヲホシゲナリ converted to hiragana is はつしぐれさるもこみのをほしげなり',
|
|
||||||
structured_answer => {
|
|
||||||
input => ['ハツシグレサルモコミノヲホシゲナリ'],
|
|
||||||
operation => 'Convert to Hiragana',
|
|
||||||
result => 'はつしぐれさるもこみのをほしげなり'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
|
|
||||||
# kana -> romaji
|
# kana -> romaji
|
||||||
'ハンバーガーはたべものです。 to romaji' => test_zci(
|
'ハンバーガーはたべものです。 to romaji' => build_test('ハンバーガーはたべものです。 converted to romaji is hambāgāhatabemonodesu.', 'hambāgāhatabemonodesu.', 'Romaji', 'ハンバーガーはたべものです。'),
|
||||||
'ハンバーガーはたべものです。 converted to romaji is hambāgāhatabemonodesu.',
|
|
||||||
structured_answer => {
|
|
||||||
input => ['ハンバーガーはたべものです。'],
|
|
||||||
operation => 'Convert to Romaji',
|
|
||||||
result => 'hambāgāhatabemonodesu.'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
|
|
||||||
# japanese puncuation -> romaji
|
# japanese puncuation -> romaji
|
||||||
'{[(?!。、『』あ「」,:)]} to romaji' => test_zci(
|
'{[(?!。、『』あ「」,:)]} to romaji' => build_test('{[(?!。、『』あ「」,:)]} converted to romaji is {[(?!.,""a\'\',:)]}', '{[(?!.,""a\'\',:)]}', 'Romaji', '{[(?!。、『』あ「」,:)]}'),
|
||||||
'{[(?!。、『』あ「」,:)]} converted to romaji is {[(?!.,""a\'\',:)]}',
|
'ええ! in romaji' => build_test('ええ! converted to romaji is ē!', 'ē!', 'Romaji', 'ええ!'),
|
||||||
structured_answer => {
|
|
||||||
input => ['{[(?!。、『』あ「」,:)]}'],
|
|
||||||
operation => 'Convert to Romaji',
|
|
||||||
result => '{[(?!.,""a\'\',:)]}'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
'ええ! in romaji' => test_zci(
|
|
||||||
'ええ! converted to romaji is ē!',
|
|
||||||
structured_answer => {
|
|
||||||
input => ['ええ!'],
|
|
||||||
operation => 'Convert to Romaji',
|
|
||||||
result => 'ē!'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
|
|
||||||
# Hiragana goodie tests
|
# Hiragana goodie tests
|
||||||
'a hiragana' => test_zci(
|
'a hiragana' => build_test('a converted to hiragana is あ', 'あ', 'Hiragana', 'a'),
|
||||||
'a converted to hiragana is あ',
|
'konnichiwa hiragana' => build_test('konnichiwa converted to hiragana is こんにちわ', 'こんにちわ', 'Hiragana', 'konnichiwa'),
|
||||||
structured_answer => {
|
'nihon hiragana' => build_test('nihon converted to hiragana is にほん', 'にほん', 'Hiragana', 'nihon'),
|
||||||
input => ['a'],
|
'tsukue no ue hiragana' => build_test('tsukue no ue converted to hiragana is つくえ の うえ', 'つくえ の うえ', 'Hiragana', 'tsukue no ue'),
|
||||||
operation => 'Convert to Hiragana',
|
|
||||||
result => 'あ'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
'konnichiwa hiragana' => test_zci(
|
|
||||||
'konnichiwa converted to hiragana is こんにちわ',
|
|
||||||
structured_answer => {
|
|
||||||
input => ['konnichiwa'],
|
|
||||||
operation => 'Convert to Hiragana',
|
|
||||||
result => 'こんにちわ'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
'nihon hiragana' => test_zci(
|
|
||||||
'nihon converted to hiragana is にほん',
|
|
||||||
structured_answer => {
|
|
||||||
input => ['nihon'],
|
|
||||||
operation => 'Convert to Hiragana',
|
|
||||||
result => 'にほん'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
'tsukue no ue hiragana' => test_zci(
|
|
||||||
'tsukue no ue converted to hiragana is つくえ の うえ',
|
|
||||||
structured_answer => {
|
|
||||||
input => ['tsukue no ue'],
|
|
||||||
operation => 'Convert to Hiragana',
|
|
||||||
result => 'つくえ の うえ'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
|
|
||||||
# Invalid inputs
|
# Invalid inputs
|
||||||
'romaji' => undef,
|
'romaji' => undef,
|
||||||
|
|
Loading…
Reference in New Issue