LeetSpeak: Updating tests for text template

master
Rob Emery 2016-05-16 13:18:14 +01:00
parent 8eeddb5c19
commit f4119f7fbf
1 changed files with 19 additions and 40 deletions

View File

@ -11,48 +11,27 @@ use utf8;
zci answer_type => 'leet_speak'; zci answer_type => 'leet_speak';
zci is_cached => 1; zci is_cached => 1;
sub build_test
{
my ($text, $title, $input) = @_;
return test_zci($text, structured_answer => {
data => {
title => $title,
subtitle => "Leet speak: $input",
},
templates => {
group => 'text'
}
});
}
ddg_goodie_test( ddg_goodie_test(
['DDG::Goodie::LeetSpeak'], ['DDG::Goodie::LeetSpeak'],
'leetspeak hello world !' => test_zci( 'leetspeak hello world !' => build_test('Leet Speak: |-|3|_|_0 \^/0|2|_|) !', '|-|3|_|_0 \^/0|2|_|) !', 'hello world !'),
'Leet Speak: |-|3|_|_0 \^/0|2|_|) !', 'l33tsp34k hElLo WORlD !' => build_test('Leet Speak: |-|3|_|_0 \^/0|2|_|) !', '|-|3|_|_0 \^/0|2|_|) !', 'hElLo WORlD !'),
structured_answer => { 'what is l33t' => build_test(q~Leet Speak: \^/|-|/-\'][' 15~, q~\^/|-|/-\'][' 15~, 'what is'),
input => ['hello world !'], 'leet speak leetspeak' => build_test(q~Leet Speak: |_33']['5|D3/-\|<~, q~|_33']['5|D3/-\|<~, 'leetspeak'),
operation => 'Leet speak', 'l33t sp34k /!§ ;€' => build_test(q~Leet Speak: /!§ ;€~, q~/!§ ;€~, '/!§ ;€'),
result => '|-|3|_|_0 \^/0|2|_|) !'
}
),
'l33tsp34k hElLo WORlD !' => test_zci(
'Leet Speak: |-|3|_|_0 \^/0|2|_|) !',
structured_answer => {
input => ['hElLo WORlD !'],
operation => 'Leet speak',
result => '|-|3|_|_0 \^/0|2|_|) !'
}
),
'what is l33t' => test_zci(
q~Leet Speak: \^/|-|/-\'][' 15~,
structured_answer => {
input => ['what is'],
operation => 'Leet speak',
result => q~\^/|-|/-\'][' 15~,
}
),
'leet speak leetspeak' => test_zci(
q~Leet Speak: |_33']['5|D3/-\|<~,
structured_answer => {
input => ['leetspeak'],
operation => 'Leet speak',
result => q~|_33']['5|D3/-\|<~,
}
),
'l33t sp34k /!§ ;€' => test_zci(
q~Leet Speak: /!§ ;€~,
structured_answer => {
input => ['/!§ ;€'],
operation => 'Leet speak',
result => q~/!§ ;€~,
}
),
'l33tsp34k' => undef, 'l33tsp34k' => undef,
); );