Commit | Line | Data |
---|---|---|
2857d2f7 JH |
1 | #!./perl |
2 | ||
bd3fc147 | 3 | use Test::More; |
2857d2f7 | 4 | |
461d5a49 | 5 | my(@times, @methods); |
2857d2f7 | 6 | BEGIN { |
fc003d4b | 7 | @times = (-2**55, -2**50, -2**33, -2**31-1, -1, 0, 1, 2**31-1, 2**33, 2**50, 2**55, time); |
4c91ace1 | 8 | @methods = qw(sec min hour mday mon year wday yday isdst); |
2857d2f7 | 9 | |
fc003d4b | 10 | plan tests => (@times * (@methods + 1)) + 1; |
2857d2f7 | 11 | |
4c91ace1 | 12 | use_ok Time::localtime; |
769448c3 | 13 | } |
2857d2f7 | 14 | |
4c91ace1 | 15 | for my $time (@times) { |
769448c3 MS |
16 | my $localtime = localtime $time; # This is the OO localtime. |
17 | my @localtime = CORE::localtime $time; # This is the localtime function | |
2857d2f7 | 18 | |
fc003d4b | 19 | is @localtime, 9, "localtime($time)"; |
4c91ace1 | 20 | for my $method (@methods) { |
769448c3 MS |
21 | is $localtime->$method, shift @localtime, "localtime($time)->$method"; |
22 | } | |
23 | } |