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;
|
|
|
|
|
|
|
|
my $zero_re = qr/0 \(Unix time\):.+Thu Jan 01 00:00:00 1970 UTC/;
|
|
|
|
my $now_re = qr/\d+ \(Unix time\):.+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-08-29 13:21:16 -07:00
|
|
|
'unix time 0000000000000' => test_zci($zero_re),
|
|
|
|
'epoch 0' => test_zci($zero_re),
|
|
|
|
'epoch 2147483647' => test_zci(qr/2147483647 \(Unix time\):.+Tue Jan 19 03:14:07 2038 UTC/),
|
|
|
|
'epoch' => test_zci($now_re),
|
|
|
|
'timestamp' => test_zci($now_re),
|
|
|
|
'datetime' => test_zci($now_re),
|
2012-04-23 20:05:49 -07:00
|
|
|
);
|
|
|
|
|
2012-04-23 21:52:16 -07:00
|
|
|
done_testing;
|