xref: /openbsd-src/gnu/usr.bin/perl/lib/Time/gmtime.t (revision 4c1e55dc91edd6e69ccc60ce855900fbc12cf34f)
1#!./perl
2
3BEGIN {
4    chdir 't' if -d 't';
5    @INC = '../lib';
6
7    require "./test.pl";
8}
9
10my(@times, @methods);
11BEGIN {
12    @times   = (-2**55, -2**50, -2**33, -2**31-1, -1, 0, 1, 2**31-1, 2**33, 2**50, 2**55, time);
13    @methods = qw(sec min hour mday mon year wday yday isdst);
14
15    plan tests => (@times * (@methods + 1)) + 1;
16
17    use_ok Time::gmtime;
18}
19
20for my $time (@times) {
21    my $gmtime = gmtime $time;          # This is the OO gmtime.
22    my @gmtime = CORE::gmtime $time;    # This is the gmtime function
23
24    is @gmtime, 9, "gmtime($time)";
25    for my $method (@methods) {
26        is $gmtime->$method, shift @gmtime, "gmtime($time)->$method";
27    }
28}
29