Commit | Line | Data |
124e6c84 |
1 | use Test::More tests => 13; |
2 | |
3 | BEGIN { use_ok('Time::Piece'); } |
4 | |
5 | ok(1); |
6 | |
7 | my $t = gmtime(951827696); # 2000-02-29T12:34:56 |
8 | |
9 | is($t->mon, 2); |
10 | is($t->mday, 29); |
11 | |
12 | my $t2 = $t->add_months(1); |
13 | is($t2->year, 2000); |
14 | is($t2->mon, 3); |
15 | is($t2->mday, 29); |
16 | |
17 | my $t3 = $t->add_months(-1); |
18 | is($t3->year, 2000); |
19 | is($t3->mon, 1); |
20 | is($t3->mday, 29); |
21 | |
22 | # this one wraps around to March because of the leap year |
23 | my $t4 = $t->add_years(1); |
24 | is($t4->year, 2001); |
25 | is($t4->mon, 3); |
26 | is($t4->mday, 1); |