| 1 |
#!./perl |
| 2 |
|
| 3 |
use Test::More; |
| 4 |
|
| 5 |
my(@times, @methods); |
| 6 |
BEGIN { |
| 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 |
use_ok Time::localtime; |
| 11 |
} |
| 12 |
|
| 13 |
for my $time (@times) { |
| 14 |
my $localtime = localtime $time; # This is the OO localtime. |
| 15 |
my @localtime = CORE::localtime $time; # This is the localtime function |
| 16 |
|
| 17 |
is @localtime, 9, "localtime($time)"; |
| 18 |
for my $method (@methods) { |
| 19 |
is $localtime->$method, shift @localtime, "localtime($time)->$method"; |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
done_testing(); |