| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | use warnings; |
| 4 | use strict; |
| 5 | use Test::Inter; |
| 6 | $::ti = new Test::Inter $0; |
| 7 | require "tests.pl"; |
| 8 | |
| 9 | our $obj = new Date::Manip::Date; |
| 10 | $obj->config("forcedate","2000-01-01-00:00:00,America/New_York"); |
| 11 | $obj->config("ConfigFile","Holidays.2.cnf"); |
| 12 | |
| 13 | sub test { |
| 14 | my(@test)=@_; |
| 15 | my @date = $obj->list_holidays(@test); |
| 16 | my @ret = (); |
| 17 | foreach my $date (@date) { |
| 18 | my $val = $date->value(); |
| 19 | push(@ret,$val); |
| 20 | } |
| 21 | return @ret; |
| 22 | } |
| 23 | |
| 24 | my $tests=" |
| 25 | |
| 26 | # Test New Year's Day definition: |
| 27 | # Test Y, Y-1 with Y having Jan 1 on Mon (1990) |
| 28 | # Test Y, Y-1 with Y having Jan 1 on Tue (1980) |
| 29 | # Test Y, Y-1 with Y having Jan 1 on Fri (1999) |
| 30 | # Test Y, Y-1 with Y having Jan 1 on Sat (2000) |
| 31 | # Test Y, Y-1 with Y having Jan 1 on Sun (1989) |
| 32 | |
| 33 | # Test Christmas, Boxing Day definitions: |
| 34 | # Christmas on Sun (1988) |
| 35 | # Christmas on Mon (2000) |
| 36 | # Christmas on Fri (1998) |
| 37 | # Christmas on Sat (1999) |
| 38 | |
| 39 | 2000 |
| 40 | => |
| 41 | 2000122500:00:00 |
| 42 | 2000122600:00:00 |
| 43 | |
| 44 | 1999 |
| 45 | => |
| 46 | 1999010100:00:00 |
| 47 | 1999122700:00:00 |
| 48 | 1999122800:00:00 |
| 49 | 1999123100:00:00 |
| 50 | |
| 51 | 1998 |
| 52 | => |
| 53 | 1998010100:00:00 |
| 54 | 1998122500:00:00 |
| 55 | 1998122800:00:00 |
| 56 | |
| 57 | 1990 |
| 58 | => |
| 59 | 1990010100:00:00 |
| 60 | 1990122500:00:00 |
| 61 | 1990122600:00:00 |
| 62 | |
| 63 | 1989 |
| 64 | => |
| 65 | 1989010200:00:00 |
| 66 | 1989122500:00:00 |
| 67 | 1989122600:00:00 |
| 68 | |
| 69 | 1988 |
| 70 | => |
| 71 | 1988010100:00:00 |
| 72 | 1988122600:00:00 |
| 73 | 1988122700:00:00 |
| 74 | |
| 75 | 1980 |
| 76 | => |
| 77 | 1980010100:00:00 |
| 78 | 1980122500:00:00 |
| 79 | 1980122600:00:00 |
| 80 | |
| 81 | "; |
| 82 | |
| 83 | $::ti->tests(func => \&test, |
| 84 | tests => $tests); |
| 85 | $::ti->done_testing(); |
| 86 | |
| 87 | #Local Variables: |
| 88 | #mode: cperl |
| 89 | #indent-tabs-mode: nil |
| 90 | #cperl-indent-level: 3 |
| 91 | #cperl-continued-statement-offset: 2 |
| 92 | #cperl-continued-brace-offset: 0 |
| 93 | #cperl-brace-offset: 0 |
| 94 | #cperl-brace-imaginary-offset: 0 |
| 95 | #cperl-label-offset: 0 |
| 96 | #End: |