This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl 5.22.1-RC4 today
[perl5.git] / lib / Time / gmtime.t
... / ...
CommitLineData
1#!./perl
2
3use Test::More;
4
5my(@times, @methods);
6BEGIN {
7 @times = (-2**55, -2**50, -2**33, -2**31-1, -1, 0, 1, 2**31-1, 2**33, 2**50, 2**55, time);
8 @methods = qw(sec min hour mday mon year wday yday isdst);
9
10 plan tests => (@times * (@methods + 1)) + 1;
11
12 use_ok Time::gmtime;
13}
14
15for my $time (@times) {
16 my $gmtime = gmtime $time; # This is the OO gmtime.
17 my @gmtime = CORE::gmtime $time; # This is the gmtime function
18
19 is @gmtime, 9, "gmtime($time)";
20 for my $method (@methods) {
21 is $gmtime->$method, shift @gmtime, "gmtime($time)->$method";
22 }
23}