2014-09-02 14:25:38 -07:00
|
|
|
#!/usr/bin/env perl
|
2014-08-21 14:11:55 -07:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
use Test::More;
|
2016-05-16 06:07:57 -07:00
|
|
|
use Test::Deep;
|
2014-08-21 14:11:55 -07:00
|
|
|
use DDG::Test::Goodie;
|
|
|
|
|
2014-10-07 01:58:48 -07:00
|
|
|
zci answer_type => "ultimate_answer";
|
2014-09-27 06:42:57 -07:00
|
|
|
zci is_cached => 1;
|
2014-08-21 14:11:55 -07:00
|
|
|
|
2016-01-27 19:45:46 -08:00
|
|
|
my $answer = 'Forty-two';
|
|
|
|
my $structuredAnswer = {
|
|
|
|
data => {
|
|
|
|
title => $answer,
|
2016-02-07 15:14:32 -08:00
|
|
|
subtitle => 'The Answer to the Ultimate Question of Life, the Universe, and Everything.'
|
2016-01-27 19:45:46 -08:00
|
|
|
},
|
|
|
|
meta => {
|
|
|
|
sourceName => 'Wikipedia',
|
|
|
|
sourceUrl => 'https://en.wikipedia.org/wiki/Phrases_from_The_Hitchhiker%27s_Guide_to_the_Galaxy#Answer_to_the_Ultimate_Question_of_Life.2C_the_Universe.2C_and_Everything_.2842.29'
|
|
|
|
},
|
|
|
|
templates => {
|
|
|
|
group => 'text'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-08-21 14:11:55 -07:00
|
|
|
ddg_goodie_test(
|
2014-10-07 01:58:48 -07:00
|
|
|
['DDG::Goodie::UltimateAnswer'],
|
2014-10-28 11:36:15 -07:00
|
|
|
|
2016-01-26 21:15:21 -08:00
|
|
|
'what is the answer to life the universe and everything' => test_zci(
|
2016-01-27 19:45:46 -08:00
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
|
|
|
),
|
2016-01-28 08:21:22 -08:00
|
|
|
'What is the Answer to Life the Universe and Everything' => test_zci(
|
2016-01-28 07:39:33 -08:00
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
|
|
|
),
|
2016-01-27 19:45:46 -08:00
|
|
|
'what is the answer to life the universe and everything?' => test_zci(
|
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
2016-01-26 21:15:21 -08:00
|
|
|
),
|
2016-01-26 06:50:34 -08:00
|
|
|
'answer to life the universe and everything' => test_zci(
|
2016-01-27 19:45:46 -08:00
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
2016-01-26 21:15:21 -08:00
|
|
|
),
|
|
|
|
'meaning of life the universe and everything' => test_zci(
|
2016-01-27 19:45:46 -08:00
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
2016-01-26 21:15:21 -08:00
|
|
|
),
|
|
|
|
'ultimate answer' => test_zci(
|
2016-01-27 19:45:46 -08:00
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
2016-01-26 21:15:21 -08:00
|
|
|
),
|
2016-01-28 07:39:33 -08:00
|
|
|
'Ultimate Answer' => test_zci(
|
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
|
|
|
),
|
2016-01-26 21:15:21 -08:00
|
|
|
'what is the ultimate answer' => test_zci(
|
2016-01-27 19:45:46 -08:00
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
|
|
|
),
|
|
|
|
'what is the ultimate answer?' => test_zci(
|
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
2016-01-26 21:15:21 -08:00
|
|
|
),
|
|
|
|
'what is the ultimate answer to life the universe and everything' => test_zci(
|
2016-01-27 19:45:46 -08:00
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
2016-01-26 21:15:21 -08:00
|
|
|
),
|
|
|
|
'answer to the ultimate question' => test_zci(
|
2016-01-27 19:45:46 -08:00
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
2016-01-28 07:39:33 -08:00
|
|
|
),
|
|
|
|
'Answer to the Ultimate Question' => test_zci(
|
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
2016-02-07 15:14:32 -08:00
|
|
|
),
|
|
|
|
'Answer to the Ultimate Question of Life, the Universe, and Everything' => test_zci(
|
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
|
|
|
),
|
|
|
|
'The Answer to the Ultimate Question of Life, the Universe, and Everything' => test_zci(
|
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
2016-01-26 21:15:21 -08:00
|
|
|
),
|
|
|
|
'what is the answer to the ultimate question' => test_zci(
|
2016-01-27 19:45:46 -08:00
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
|
|
|
),
|
|
|
|
'what is the answer to the ultimate question?' => test_zci(
|
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
2016-01-26 21:15:21 -08:00
|
|
|
),
|
|
|
|
'what is the answer to the ultimate question of life the universe and everything' => test_zci(
|
2016-01-27 19:45:46 -08:00
|
|
|
$answer,
|
|
|
|
structured_answer => $structuredAnswer
|
2016-01-26 21:15:21 -08:00
|
|
|
),
|
|
|
|
'life the universe and everything' => undef,
|
|
|
|
'life the universe and everything 42' => undef,
|
|
|
|
'blah life the universe and everything' => undef,
|
|
|
|
'ultimate answer to kings' => undef,
|
|
|
|
'blah ultimate answer' => undef,
|
|
|
|
'answer to the ultimate question of life' => undef,
|
|
|
|
'blah answer to the ultimate question' => undef,
|
2014-08-21 14:11:55 -07:00
|
|
|
'what is the answer to my homework question' => undef,
|
2014-10-07 01:58:48 -07:00
|
|
|
'why?' => undef,
|
2014-08-21 14:11:55 -07:00
|
|
|
);
|
|
|
|
|
2016-05-16 06:18:04 -07:00
|
|
|
done_testing;
|