2014-06-07 06:02:01 -07:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
|
|
|
use DDG::Test::Goodie;
|
2014-06-23 03:46:03 -07:00
|
|
|
use utf8;
|
2014-06-07 06:02:01 -07:00
|
|
|
|
|
|
|
zci answer_type => 'chinesezodiac';
|
|
|
|
zci is_cached => 1;
|
|
|
|
|
|
|
|
ddg_goodie_test(
|
|
|
|
[qw(
|
|
|
|
DDG::Goodie::ChineseZodiac
|
|
|
|
)],
|
|
|
|
|
|
|
|
#Primary example
|
|
|
|
'chinese zodiac for 1969' => test_zci('Rooster', html => qr/Rooster/),
|
|
|
|
|
|
|
|
#Secondary examples
|
|
|
|
'2004 chinese zodiac animal' => test_zci('Monkey', html => qr/Monkey/),
|
|
|
|
'what was the chinese zodiac animal in 1992' => test_zci('Monkey', html => qr/Monkey/),
|
|
|
|
'what will the chinese zodiac animal be for 2056' => test_zci('Rat', html => qr/Rat/),
|
2014-06-08 02:05:42 -07:00
|
|
|
'last year\'s chinese zodiac' => test_zci(qr/./, html => qr/./),
|
2014-06-07 06:02:01 -07:00
|
|
|
|
|
|
|
#Primary example with different query formats
|
|
|
|
'1969 chinese zodiac animal' => test_zci('Rooster', html => qr/Rooster/),
|
|
|
|
'what was the chinese zodiac animal for 1969' => test_zci('Rooster', html => qr/Rooster/),
|
|
|
|
'what will the chinese zodiac animal be for people born in the year 1969' => test_zci('Rooster', html => qr/Rooster/),
|
|
|
|
'chinese zodiac for a person born in 1969' => test_zci('Rooster', html => qr/Rooster/),
|
|
|
|
'chinese zodiac of 1969' => test_zci('Rooster', html => qr/Rooster/),
|
|
|
|
|
2014-06-23 03:46:03 -07:00
|
|
|
#Alternative triggers
|
|
|
|
'1969 shēngxiào' => test_zci('Rooster', html => qr/Rooster/),
|
|
|
|
'shengxiao animal 1969' => test_zci('Rooster', html => qr/Rooster/),
|
|
|
|
'shēng xiào for 1969' => test_zci('Rooster', html => qr/Rooster/),
|
|
|
|
'i was born in 1969 what is my sheng xiao' => test_zci('Rooster', html => qr/Rooster/),
|
|
|
|
|
2014-06-07 06:02:01 -07:00
|
|
|
#Test some different years
|
|
|
|
# Taken from http://www.chinesezodiac.com/calculator.php
|
|
|
|
'chinese zodiac animal for 1924' => test_zci('Rat', html => qr/Rat/),
|
|
|
|
'chinese zodiac animal for 1929' => test_zci('Snake', html => qr/Snake/),
|
|
|
|
'chinese zodiac animal for 1934' => test_zci('Dog', html => qr/Dog/),
|
|
|
|
'chinese zodiac animal for 1939' => test_zci('Rabbit', html => qr/Rabbit/),
|
|
|
|
'chinese zodiac animal for 1944' => test_zci('Monkey', html => qr/Monkey/),
|
|
|
|
'chinese zodiac animal for 1949' => test_zci('Ox', html => qr/Ox/),
|
|
|
|
'chinese zodiac animal for 1954' => test_zci('Horse', html => qr/Horse/),
|
|
|
|
'chinese zodiac animal for 1959' => test_zci('Pig', html => qr/Pig/),
|
|
|
|
'chinese zodiac animal for 1964' => test_zci('Dragon', html => qr/Dragon/),
|
|
|
|
'chinese zodiac animal for 1969' => test_zci('Rooster', html => qr/Rooster/),
|
|
|
|
'chinese zodiac animal for 1974' => test_zci('Tiger', html => qr/Tiger/),
|
|
|
|
'chinese zodiac animal for 2027' => test_zci('Goat', html => qr/Goat/),
|
|
|
|
'chinese zodiac animal for 2040' => test_zci('Monkey', html => qr/Monkey/),
|
|
|
|
|
|
|
|
#Test for correct date ranges
|
|
|
|
# Taken from http://www.chinesezodiac.com/calculator.php
|
|
|
|
'chinese zodiac animal for 1925' => test_zci('Ox', html => qr/Jan\s24,\s1925.Feb\s12,\s1926/),
|
|
|
|
'chinese zodiac animal for 1937' => test_zci('Ox', html => qr/Feb\s11,\s1937.Jan\s30,\s1938/),
|
|
|
|
'chinese zodiac animal for 1953' => test_zci('Snake', html => qr/Feb\s14,\s1953.Feb\s2,\s1954/),
|
|
|
|
'chinese zodiac animal for 1973' => test_zci('Ox', html => qr/Feb\s3,\s1973.Jan\s22,\s1974/),
|
|
|
|
'chinese zodiac animal for 1997' => test_zci('Ox', html => qr/Feb\s7,\s1997.Jan\s27,\s1998/),
|
|
|
|
'chinese zodiac animal for 2013' => test_zci('Snake', html => qr/Feb\s10,\s2013.Jan\s30,\s2014/),
|
|
|
|
'chinese zodiac animal for 2017' => test_zci('Rooster', html => qr/Jan\s28,\s2017.Feb\s15,\s2018/),
|
|
|
|
'chinese zodiac animal for 2041' => test_zci('Rooster', html => qr/Feb\s1,\s2041.Jan\s21,\s2042/),
|
|
|
|
|
2014-06-08 02:05:42 -07:00
|
|
|
#Should not trigger
|
2014-06-08 02:25:59 -07:00
|
|
|
'wikipedia chinese zodiac' => undef,
|
2014-06-08 02:05:42 -07:00
|
|
|
'what is my zodiac sign' => undef,
|
|
|
|
'what is the chinese word for duck' => undef,
|
|
|
|
'buy an inflatable zodiac chinese online store' => undef,
|
2014-06-20 20:15:25 -07:00
|
|
|
'chinese zodiac 20 march 1997' => undef,
|
|
|
|
'chinese zodiac 1997-03-20' => undef,
|
|
|
|
'what was the chinese zodiac animal on the 3rd of april 1945' => undef,
|
2014-06-08 02:05:42 -07:00
|
|
|
|
2014-06-12 20:32:24 -07:00
|
|
|
#No support currently for years outside 1900--2069
|
|
|
|
'chinese zodiac 1899' => undef,
|
|
|
|
'chinese zodiac 1900' => test_zci('Rat', html => qr/Rat/),
|
|
|
|
'chinese zodiac 2069' => test_zci('Ox', html => qr/Ox/),
|
|
|
|
'chinese zodiac 2070' => undef,
|
2014-06-20 18:57:48 -07:00
|
|
|
'chinese zodiac 2000000000000' => undef,
|
2014-06-12 20:32:24 -07:00
|
|
|
|
2014-06-07 06:02:01 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
done_testing;
|
|
|
|
|