2013-07-19 19:46:17 -07:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
2016-05-16 06:07:57 -07:00
|
|
|
use Test::Deep;
|
2013-07-19 19:46:17 -07:00
|
|
|
use DDG::Test::Goodie;
|
|
|
|
|
|
|
|
zci answer_type => 'potus';
|
2014-10-07 01:45:04 -07:00
|
|
|
zci is_cached => 1;
|
2013-07-19 19:46:17 -07:00
|
|
|
|
2016-05-14 15:32:11 -07:00
|
|
|
sub build_test
|
|
|
|
{
|
|
|
|
my ($who, $article, $number) = @_;
|
|
|
|
|
|
|
|
return test_zci("$who $article the $number President of the United States.", structured_answer => {
|
|
|
|
data => {
|
|
|
|
title => $who,
|
|
|
|
subtitle => "$number President of the United States"
|
|
|
|
},
|
|
|
|
templates => {
|
|
|
|
group => 'text'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2013-07-19 19:46:17 -07:00
|
|
|
ddg_goodie_test(
|
2014-10-07 01:45:04 -07:00
|
|
|
[qw( DDG::Goodie::POTUS)],
|
2016-05-14 15:32:11 -07:00
|
|
|
'who is president of the united states' => build_test('Barack Obama', 'is',"44th"),
|
|
|
|
'who is the fourth president of the united states' => build_test('James Madison', 'was', '4th'),
|
|
|
|
'who is the nineteenth president of the united states' => build_test('Rutherford B. Hayes', 'was','19th'),
|
|
|
|
'who was the 1st president of the united states' => build_test('George Washington', 'was', '1st'),
|
|
|
|
'who was the 31 president of the united states' => build_test('Herbert Hoover', 'was', '31st'),
|
|
|
|
'who was the 22 president of the united states' => build_test('Grover Cleveland', 'was','22nd'),
|
|
|
|
'potus 11' => build_test('James K. Polk', 'was','11th'),
|
|
|
|
'POTUS 24' => build_test('Grover Cleveland', 'was', '24th'),
|
|
|
|
'who was the twenty-second POTUS?' => build_test('Grover Cleveland', 'was', '22nd'),
|
|
|
|
'potus 16' => build_test('Abraham Lincoln', 'was', '16th'),
|
2016-04-24 12:27:37 -07:00
|
|
|
'who is the vice president of the united states?' => undef,
|
2016-05-14 15:32:11 -07:00
|
|
|
'vice president of the united states' => undef,
|
|
|
|
'VPOTUS' => undef
|
2013-07-19 19:46:17 -07:00
|
|
|
);
|
|
|
|
|
2016-05-16 06:18:04 -07:00
|
|
|
done_testing;
|