Frequency: Refactor tests to remove duplication

master
sdua 2016-07-09 10:49:57 +00:00
parent 80d837cd65
commit 42e9e7d02f
1 changed files with 12 additions and 30 deletions

View File

@ -11,6 +11,12 @@ zci answer_type => 'frequency';
my $all_chars_subtitle = "Frequency of all characters";
my @test_response = ('e:1/4 s:1/4 t:2/4', "test", "$all_chars_subtitle", {
'e' => 1,
's' => 1,
't' => 2
}, ['e', 's', 't']);
sub build_structured_test {
my ($plaintext, $title, $subtitle, $record_data, $record_keys) = @_;
@ -40,41 +46,17 @@ ddg_goodie_test(
DDG::Goodie::Frequency
)],
"frequency of all in test" => build_test('e:1/4 s:1/4 t:2/4', "test", "$all_chars_subtitle", {
'e' => 1,
's' => 1,
't' => 2
}, ['e', 's', 't']),
"frequency of all in test" => build_test(@test_response),
'frequency of all letters in test' => build_test('e:1/4 s:1/4 t:2/4', "test", "$all_chars_subtitle", {
'e' => 1,
's' => 1,
't' => 2
}, ['e', 's', 't']),
'frequency of all letters in test' => build_test(@test_response),
'frequency of letters in test' => build_test('e:1/4 s:1/4 t:2/4', "test", "$all_chars_subtitle", {
'e' => 1,
's' => 1,
't' => 2
}, ['e', 's', 't']),
'frequency of letters in test' => build_test(@test_response),
'frequency of all characters in test' => build_test('e:1/4 s:1/4 t:2/4', "test", "$all_chars_subtitle", {
'e' => 1,
's' => 1,
't' => 2
}, ['e', 's', 't']),
'frequency of all characters in test' => build_test(@test_response),
'frequency of all alphabets in test' => build_test('e:1/4 s:1/4 t:2/4', "test", "$all_chars_subtitle", {
'e' => 1,
's' => 1,
't' => 2
}, ['e', 's', 't']),
'frequency of all alphabets in test' => build_test(@test_response),
'frequency of all chars in test' => build_test('e:1/4 s:1/4 t:2/4', "test", "$all_chars_subtitle", {
'e' => 1,
's' => 1,
't' => 2
}, ['e', 's', 't']),
'frequency of all chars in test' => build_test(@test_response),
'frequency of all in testing 1234 ABC!' => build_test('a:1/10 b:1/10 c:1/10 e:1/10 g:1/10 i:1/10 n:1/10 s:1/10 t:2/10', "testing 1234 ABC!", "$all_chars_subtitle", {
'a' => 1,