zeroclickinfo-goodies/t/UnixTime.t

27 lines
714 B
Perl
Raw Normal View History

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';
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
ddg_goodie_test([qw(
DDG::Goodie::UnixTime
)
],
'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
);
done_testing;