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

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

0.02

  • 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 => 28;
3
4 use Date::Simple;
5 use Date::Range::Birth;
6
7 my @tests = (
8     [ 2000, 11, 11 ], 20, [ "1979 11 12", "1980 11 11" ],
9     [ 2001, 12, 8 ], [ 24, 25 ], [ "1975 12 09", "1977 12 08" ],
10     [ 2001, 12, 8 ], 50, [ "1950 12 09", "1951 12 08" ],
11     [ 2001, 12, 8 ], [ 50, 50 ], [ "1950 12 09", "1951 12 08" ],
12     [ 2001, 12, 8 ], [ 50, 60 ], [ "1940 12 09", "1951 12 08" ],
13     [ 2001, 12, 8 ], [ 60, 50 ], [ "1940 12 09", "1951 12 08" ],
14     [ 2001, 12, 31 ], 20, [ "1981 01 01", "1981 12 31" ],
15 );
16
17 while (my($date, $age, $test) = splice(@tests, 0, 3)) {
18     my $range = Date::Range::Birth->new($age, Date::Simple->new(@$date));
19     isa_ok $range, 'Date::Range';
20     isa_ok $range, 'Date::Range::Birth';
21     is $range->start->format("%Y %m %d"), $test->[0], "format: $test->[0]";
22     is $range->end->format("%Y %m %d"), $test->[1], "format: $test->[1]";
23 }
24
Note: See TracBrowser for help on using the browser.