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