2012-05-08 19:01:16 -07:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
|
|
|
use DDG::Test::Goodie;
|
|
|
|
|
|
|
|
zci answer_type => 'date_math';
|
|
|
|
zci is_cached => 1;
|
|
|
|
|
2012-05-09 19:23:15 -07:00
|
|
|
my $year = 1900 + ( localtime() )[5];
|
2012-05-08 19:01:16 -07:00
|
|
|
ddg_goodie_test(
|
|
|
|
[qw(
|
|
|
|
DDG::Goodie::DateMath
|
|
|
|
)],
|
2012-05-09 19:23:15 -07:00
|
|
|
'Jan 1 2012 plus 32 days' => test_zci( 'Jan 1 2012 plus 32 days is 2/2/2012' ),
|
|
|
|
'January 1 2012 plus 32 days' => test_zci( 'January 1 2012 plus 32 days is 2/2/2012' ),
|
|
|
|
'January 1, 2012 plus 32 days' => test_zci( 'January 1, 2012 plus 32 days is 2/2/2012' ),
|
|
|
|
'January 1st 2012 plus 32 days' => test_zci( 'January 1st 2012 plus 32 days is 2/2/2012' ),
|
2013-01-03 05:24:20 -08:00
|
|
|
'January 1st plus 32 days' => test_zci( "January 1st $year plus 32 days is 2/2/$year" ),
|
2012-05-09 19:23:15 -07:00
|
|
|
'1/1/2012 plus 32 days' => test_zci( '1/1/2012 plus 32 days is 2/2/2012' ),
|
2013-01-03 05:24:20 -08:00
|
|
|
'1/1 plus 32 days' => test_zci( "1/1/$year plus 32 days is 2/2/$year" ),
|
2012-05-09 19:23:15 -07:00
|
|
|
'1/1/2012 plus 5 weeks' => test_zci( '1/1/2012 plus 5 weeks is 2/5/2012' ),
|
|
|
|
'1/1/2012 plus 5 months' => test_zci( '1/1/2012 plus 5 months is 6/1/2012' ),
|
|
|
|
'1/1/2012 PLUS 5 years' => test_zci( '1/1/2012 plus 5 years is 1/1/2017' ),
|
|
|
|
'1/1/2012 plus 1 day' => test_zci( '1/1/2012 plus 1 day is 1/2/2012' ),
|
|
|
|
'1/1/2012 plus 1 days' => test_zci( '1/1/2012 plus 1 day is 1/2/2012' ),
|
2012-05-20 09:15:56 -07:00
|
|
|
'01/01/2012 + 1 day' => test_zci( '01/01/2012 + 1 day is 1/2/2012' ),
|
|
|
|
'1/1/2012 minus ten days' => test_zci( '1/1/2012 minus 10 days is 12/22/2011' ),
|
|
|
|
'January First plus ten days' => test_zci( "January 1 $year plus 10 days is 1/11/$year" ),
|
2012-05-08 19:01:16 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
done_testing;
|
|
|
|
|