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