1ccd7fb826f2744d3c6a6031516b04099b933910
[p5sagit/p5-mst-13.2.git] / lib / Time / gmtime.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6
7     require "./test.pl";
8 }
9
10 my(@times, @methods);
11 BEGIN {
12     @times   = (-2**33, -2**31-1, 0, 2**31-1, 2**33, time);
13     @methods = qw(sec min hour mday mon year wday yday isdst);
14
15     plan tests => (@times * @methods) + 1;
16
17     use_ok Time::gmtime;
18 }
19
20 # Perl has its own gmtime() so it's safe to do negative times.
21 for my $time (@times) {
22     my $gmtime = gmtime $time;          # This is the OO gmtime.
23     my @gmtime = CORE::gmtime $time;    # This is the gmtime function
24
25     for my $method (@methods) {
26         is $gmtime->$method, shift @gmtime, "gmtime($time)->$method";
27     }
28 }