File: date.list_holidays.2.t

package info (click to toggle)
libdate-manip-perl 6.98-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,928 kB
  • sloc: perl: 222,846; sh: 54; ansic: 26; makefile: 8
file content (96 lines) | stat: -rwxr-xr-x 1,712 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/perl

use warnings;
use strict;
use Test::Inter;
$::ti = new Test::Inter $0;
require "tests.pl";

our $obj = new Date::Manip::Date;
$obj->config("forcedate","2000-01-01-00:00:00,America/New_York");
$obj->config("ConfigFile","Holidays.2.cnf");

sub test {
   my(@test)=@_;
   my @date = $obj->list_holidays(@test);
   my @ret  = ();
   foreach my $date (@date) {
      my $val = $date->value();
      push(@ret,$val);
   }
   return @ret;
}

my $tests="

# Test New Year's Day definition:
# Test Y, Y-1 with Y having Jan 1 on Mon (1990)
# Test Y, Y-1 with Y having Jan 1 on Tue (1980)
# Test Y, Y-1 with Y having Jan 1 on Fri (1999)
# Test Y, Y-1 with Y having Jan 1 on Sat (2000)
# Test Y, Y-1 with Y having Jan 1 on Sun (1989)

# Test Christmas, Boxing Day definitions:
# Christmas on Sun (1988)
# Christmas on Mon (2000)
# Christmas on Fri (1998)
# Christmas on Sat (1999)

2000
   =>
   2000122500:00:00
   2000122600:00:00

1999
   =>
   1999010100:00:00
   1999122700:00:00
   1999122800:00:00
   1999123100:00:00

1998
   =>
   1998010100:00:00
   1998122500:00:00
   1998122800:00:00

1990
   =>
   1990010100:00:00
   1990122500:00:00
   1990122600:00:00

1989
   =>
   1989010200:00:00
   1989122500:00:00
   1989122600:00:00

1988
   =>
   1988010100:00:00
   1988122600:00:00
   1988122700:00:00

1980
   =>
   1980010100:00:00
   1980122500:00:00
   1980122600:00:00

";

$::ti->tests(func  => \&test,
             tests => $tests);
$::ti->done_testing();

#Local Variables:
#mode: cperl
#indent-tabs-mode: nil
#cperl-indent-level: 3
#cperl-continued-statement-offset: 2
#cperl-continued-brace-offset: 0
#cperl-brace-offset: 0
#cperl-brace-imaginary-offset: 0
#cperl-label-offset: 0
#End: