| 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 |
|
| 12 |
sub test { |
| 13 |
my(@test)=@_; |
| 14 |
|
| 15 |
if ($test[0] eq 'configfile') { |
| 16 |
$obj->config('EraseHolidays',1, |
| 17 |
'ConfigFile',"$test[1]"); |
| 18 |
return (); |
| 19 |
} |
| 20 |
|
| 21 |
my @ret = (); |
| 22 |
my($y0,$y1) = @test; |
| 23 |
foreach my $y ($y0..$y1) { |
| 24 |
my @date = $obj->list_holidays($y); |
| 25 |
foreach my $date (@date) { |
| 26 |
my $d = $date->value(); |
| 27 |
push(@ret,$d); |
| 28 |
} |
| 29 |
} |
| 30 |
return @ret; |
| 31 |
} |
| 32 |
|
| 33 |
my $tests=" |
| 34 |
|
| 35 |
configfile New_Years.1.cnf => |
| 36 |
|
| 37 |
2000 2015 => |
| 38 |
2000010100:00:00 |
| 39 |
2001010100:00:00 |
| 40 |
2002010100:00:00 |
| 41 |
2003010100:00:00 |
| 42 |
2004010100:00:00 |
| 43 |
2005010100:00:00 |
| 44 |
2006010100:00:00 |
| 45 |
2007010100:00:00 |
| 46 |
2008010100:00:00 |
| 47 |
2009010100:00:00 |
| 48 |
2010010100:00:00 |
| 49 |
2011010100:00:00 |
| 50 |
2012010100:00:00 |
| 51 |
2013010100:00:00 |
| 52 |
2014010100:00:00 |
| 53 |
2015010100:00:00 |
| 54 |
|
| 55 |
configfile New_Years.2.cnf => |
| 56 |
|
| 57 |
2000 2015 => |
| 58 |
2001010100:00:00 |
| 59 |
2002010100:00:00 |
| 60 |
2003010100:00:00 |
| 61 |
2004010100:00:00 |
| 62 |
2004123100:00:00 |
| 63 |
2006010200:00:00 |
| 64 |
2007010100:00:00 |
| 65 |
2008010100:00:00 |
| 66 |
2009010100:00:00 |
| 67 |
2010010100:00:00 |
| 68 |
2010123100:00:00 |
| 69 |
2012010200:00:00 |
| 70 |
2013010100:00:00 |
| 71 |
2014010100:00:00 |
| 72 |
2015010100:00:00 |
| 73 |
|
| 74 |
configfile New_Years.3.cnf => |
| 75 |
|
| 76 |
2000 2015 => |
| 77 |
2000010100:00:00 |
| 78 |
2001010100:00:00 |
| 79 |
2002010100:00:00 |
| 80 |
2003010100:00:00 |
| 81 |
2004010100:00:00 |
| 82 |
2005010100:00:00 |
| 83 |
2006010200:00:00 |
| 84 |
2007010100:00:00 |
| 85 |
2008010100:00:00 |
| 86 |
2009010100:00:00 |
| 87 |
2010010100:00:00 |
| 88 |
2011010100:00:00 |
| 89 |
2012010200:00:00 |
| 90 |
2013010100:00:00 |
| 91 |
2014010100:00:00 |
| 92 |
2015010100:00:00 |
| 93 |
|
| 94 |
configfile New_Years.4.cnf => |
| 95 |
|
| 96 |
2000 2015 => |
| 97 |
2000010100:00:00 |
| 98 |
2001010100:00:00 |
| 99 |
2002010100:00:00 |
| 100 |
2003010100:00:00 |
| 101 |
2004010100:00:00 |
| 102 |
2005010100:00:00 |
| 103 |
2006010200:00:00 |
| 104 |
2007010100:00:00 |
| 105 |
2008010100:00:00 |
| 106 |
2009010100:00:00 |
| 107 |
2010010100:00:00 |
| 108 |
2011010100:00:00 |
| 109 |
2012010200:00:00 |
| 110 |
2013010100:00:00 |
| 111 |
2014010100:00:00 |
| 112 |
2015010100:00:00 |
| 113 |
|
| 114 |
"; |
| 115 |
|
| 116 |
$::ti->tests(func => \&test, |
| 117 |
tests => $tests); |
| 118 |
$::ti->done_testing(); |
| 119 |
|
| 120 |
#Local Variables: |
| 121 |
#mode: cperl |
| 122 |
#indent-tabs-mode: nil |
| 123 |
#cperl-indent-level: 3 |
| 124 |
#cperl-continued-statement-offset: 2 |
| 125 |
#cperl-continued-brace-offset: 0 |
| 126 |
#cperl-brace-offset: 0 |
| 127 |
#cperl-brace-imaginary-offset: 0 |
| 128 |
#cperl-label-offset: 0 |
| 129 |
#End: |