2012-04-23 20:05:49 -07:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
|
|
|
use DDG::Test::Goodie;
|
|
|
|
|
|
|
|
zci answer_type => 'time_conversion';
|
2014-08-29 13:21:16 -07:00
|
|
|
zci is_cached => 0;
|
|
|
|
|
2014-09-25 08:44:03 -07:00
|
|
|
my @zero = (qr/Thu Jan 01 00:00:00 1970 UTC/, html => qr/Thu Jan 01 00:00:00 1970 UTC/);
|
|
|
|
my @now = (qr/Unix Epoch.+UTC/, html => qr/UTC/);
|
|
|
|
my @then = (qr/Tue Nov 18 00:28:30 1930 UTC/, html => qr/Tue Nov 18 00:28:30 1930 UTC/);
|
2014-09-20 14:40:02 -07:00
|
|
|
my @later = (qr/Tue Jan 19 03:14:07 2038 UTC/, html => qr/Tue Jan 19 03:14:07 2038 UTC/);
|
2012-04-23 20:05:49 -07:00
|
|
|
|
2014-08-22 08:37:06 -07:00
|
|
|
ddg_goodie_test([qw(
|
|
|
|
DDG::Goodie::UnixTime
|
|
|
|
)
|
|
|
|
],
|
2014-09-12 05:02:11 -07:00
|
|
|
'unix time 0000000000000' => test_zci(@zero),
|
|
|
|
'epoch 0' => test_zci(@zero),
|
2014-11-24 10:35:27 -08:00
|
|
|
'utc time 0' => test_zci(@zero),
|
2014-09-12 05:02:11 -07:00
|
|
|
'epoch 2147483647' => test_zci(@later),
|
2014-09-25 08:44:03 -07:00
|
|
|
'2147483647 epoch' => test_zci(@later),
|
2014-09-12 05:02:11 -07:00
|
|
|
'timestamp 2147483647' => test_zci(@later),
|
2014-11-24 10:35:27 -08:00
|
|
|
'utc time 2147483647' => test_zci(@later),
|
2014-09-12 05:02:11 -07:00
|
|
|
'datetime' => test_zci(@now),
|
|
|
|
'unix time' => test_zci(@now),
|
|
|
|
'unix epoch' => test_zci(@now),
|
2014-11-24 10:35:27 -08:00
|
|
|
'utc time' => test_zci(@now),
|
|
|
|
'utc now' => test_zci(@now),
|
|
|
|
'current utc' => test_zci(@now),
|
2015-09-18 08:08:35 -07:00
|
|
|
'time since epoch' => test_zci(@now),
|
2014-09-25 08:44:03 -07:00
|
|
|
'epoch -1234567890' => test_zci(@then),
|
|
|
|
'-1234567890 epoch' => test_zci(@then),
|
|
|
|
'timestamp -1234567890' => test_zci(@then),
|
2014-11-24 10:35:27 -08:00
|
|
|
'utc time -1234567890' => test_zci(@then),
|
2014-09-09 08:57:17 -07:00
|
|
|
'timestamp' => undef,
|
2014-08-25 11:01:55 -07:00
|
|
|
'time' => undef,
|
2014-09-09 08:57:17 -07:00
|
|
|
'epoch' => undef,
|
2012-04-23 20:05:49 -07:00
|
|
|
);
|
|
|
|
|
2012-04-23 21:52:16 -07:00
|
|
|
done_testing;
|