zeroclickinfo-goodies/t/Kana.t

166 lines
4.9 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 DDG::Test::Goodie;
use utf8;
zci answer_type => 'kana';
zci is_cached => 1;
ddg_goodie_test(
['DDG::Goodie::Kana'],
# romaji -> hiragana
2015-02-12 07:09:33 -08:00
'ahiru in hiragana' => test_zci('1',
2015-02-12 18:36:57 -08:00
structured_answer => {
input => ['ahiru'],
operation => 'in hiragana from',
result => 'あひる'
}
2015-02-12 07:09:33 -08:00
),
2015-02-12 19:55:38 -08:00
'nihon no daigaku! to hiragana' => test_zci('1',
structured_answer => {
input => ['ahiru'],
operation => 'in hiragana from',
2015-02-12 19:55:38 -08:00
result => 'にほん の だいがく!'
}
),
# romaji -> katakana
2015-02-12 07:09:33 -08:00
'ahiru in katakana' => test_zci('1',
2015-02-12 18:36:57 -08:00
structured_answer => {
input => ['ahiru'],
operation => 'in katakana from',
result => 'アヒル'
2015-02-12 18:36:57 -08:00
}
2015-02-12 07:09:33 -08:00
),
'kirin, banana to katakana' => test_zci('1',
structured_answer => {
input => ['kirin, banana'],
operation => 'in katakana from',
result => 'キリン、 バナナ'
}
),
# katakana -> romaji
2015-02-12 07:09:33 -08:00
'アヒル to romaji' => test_zci('1',
2015-02-12 18:36:57 -08:00
structured_answer => {
input => ['アヒル'],
operation => 'in romaji from',
result => 'ahiru'
}
),
'キリン、 バナナ in romaji' => test_zci('1',
structured_answer => {
2015-02-12 19:55:38 -08:00
input => ['キリン、 バナナ'],
operation => 'in romaji from',
result => 'kiran, banana'
}
),
# hiragana -> romaji
2015-02-12 07:09:33 -08:00
'あひる in romaji' => test_zci('1',
2015-02-12 18:36:57 -08:00
structured_answer => {
input => ['あひる'],
operation => 'in romaji from',
result => 'ahiru'
}
),
'すみません、 いま なんじ ですか。 to romaji' => test_zci('1',
2015-02-12 18:36:57 -08:00
structured_answer => {
2015-02-12 19:55:38 -08:00
input => ['すみません、 いまなんじですか。'],
2015-02-12 18:36:57 -08:00
operation => 'in romaji from',
result => 'sumimasen, ima nanji desuka.'
}
),
# katakana -> hiragana
'はつしぐれさるもこみのをほしげなり to katakana' => test_zci('1',
structured_answer => {
input => ['はつしぐれさるもこみのをほしげなり'],
operation => 'in katana from',
result => 'ハツシグレサルモコミノヲホシゲナリ'
2015-02-12 18:36:57 -08:00
}
),
# hiragana -> katakana
'ハツシグレサルモコミノヲホシゲナリ to hiragana' => test_zci('1',
structured_answer => {
input => ['ハツシグレサルモコミノヲホシゲナリ'],
operation => 'in hiragana from',
result => 'はつしぐれさるもこみのをほしげなり'
}
),
# Mixed hiragana + katakana -> romaji
'ハンバーグ は たべもの です。' => test_zci('1',
structured_answer => {
input => ['ハンバーグ は たべもの です。'],
operation => 'in romaji from',
result => 'hambāgu ha tabemono desu.'
}
),
# Japanese puncuation -> romaji
'{[(?!。、『』「」,:)]} to romaji' => test_zci('1',
structured_answer => {
input => ['{[(?!。、『』「」,:)]}'],
operation => 'in romaji from',
result => '{[(?!.,""\'\',:)}'
}
),
'ええ! in romaji' => test_zci('1',
structured_answer => {
input => ['ええ!'],
operation => 'in romaji from',
result => 'ē!'
}
),
# Hiragana goodie tests
'a hiragana' => test_zci('1',
structured_answer => {
input => ['a'],
operation => 'in hiragana from',
result => 'あ'
}
),
2015-02-12 19:55:38 -08:00
'konnichiwa hiragana' => test_zci('1',
structured_answer => {
input => ['konnichiwa'],
operation => 'in hiragana from',
result => 'こんにちわ'
}
),
2015-02-12 21:20:36 -08:00
'nihon hiragana' => test_zci('1',
structured_answer => {
input => ['nihon'],
operation => 'in hiragana from',
result => 'にほん'
}
),
'tsukue no ue hiragana' => test_zci('1',
structured_answer => {
input => ['tsukue no ue'],
operation => 'in hiragana from',
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;