root/Date-Range-Birth/trunk/t/01_range.t

Revision 365 (checked in by miyagawa, 18 years ago)

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 use strict;
2 use Test::More tests => 8;
3
4 use Date::Simple;
5 use Date::Range::Birth;
6
7 {
8     my $date  = Date::Simple->new(2000, 11, 11);
9     my $range = Date::Range::Birth->new(20, $date);
10     is $range->start->format("%Y %m %d"), "1979 11 12", 'start';
11     is $range->end->format("%Y %m %d"), "1980 11 11", 'start';
12 }
13
14 {
15     my $date  = Date::Simple->new(2001, 12, 8);
16     my $range = Date::Range::Birth->new([24, 25], $date);
17     is $range->start->format("%Y %m %d"), "1975 12 09";
18     is $range->end->format("%Y %m %d"), "1977 12 08";
19 }
20
21 {
22     my $date  = Date::Simple->new(2001, 12, 8);
23     my $range = Date::Range::Birth->new(50, $date);
24     is $range->start->format("%Y %m %d"), "1950 12 09";
25     is $range->end->format("%Y %m %d"), "1951 12 08";
26 }
27
28 {
29     my $date  = Date::Simple->new(2001, 12, 8);
30     my $range = Date::Range::Birth->new([50, 60], $date);
31     is $range->start->format("%Y %m %d"), "1940 12 09";
32     is $range->end->format("%Y %m %d"), "1951 12 08";
33 }
34
Note: See TracBrowser for help on using the browser.