Debian Codegraph @

t/date.nearest_business_day.t

raw
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","now,America/New_York");
11
12 sub test {
13 my($date,@test)=@_;
14 $obj->parse($date);
15 $obj->nearest_business_day(@test);
16 my $ret = $obj->value();
17 return $ret;
18 }
19
20 my $tests="
21
22 # July 2007
23 # Su Mo Tu We Th Fr Sa
24 # 1 2 3 4 5 6 7
25 # 8 9 10 11 12 13 14
26 # 15 16 17 18 19 20 21
27 # 22 23 24 25 26 27 28
28 # 29 30 31
29
30 'Jul 18 2007 12:00:00' => 2007071812:00:00
31
32 'Jul 21 2007 12:00:00' => 2007072012:00:00
33
34 'Jul 22 2007 12:00:00' => 2007072312:00:00
35
36
37 'Jul 4 2007 12:00:00' => 2007070412:00:00
38
39 'Jul 4 2007 12:00:00' 1 => 2007070412:00:00
40
41 'Jul 4 2007 12:00:00' 0 => 2007070412:00:00
42
43 ";
44
45 $::ti->tests(func => \&test,
46 tests => $tests);
47 $::ti->done_testing();
48
49 #Local Variables:
50 #mode: cperl
51 #indent-tabs-mode: nil
52 #cperl-indent-level: 3
53 #cperl-continued-statement-offset: 2
54 #cperl-continued-brace-offset: 0
55 #cperl-brace-offset: 0
56 #cperl-brace-imaginary-offset: 0
57 #cperl-label-offset: 0
58 #End: