Debian Codegraph @

t/date.calc.date_delta_business.0.t

raw symbols SCIP
1 #!/usr/bin/perl
2
3 use warningsscip-perl cpan Date-Manip 6.99 warnings/;
4 use strictscip-perl cpan Date-Manip 6.99 strict/;
5 use Test::Interscip-perl cpan Date-Manip 6.99 Test/Inter/;
6 $::tiscip-perl cpan Date-Manip 6.99 main/`$::ti`. = new Test::Inter $0scip-perl cpan Date-Manip 6.99 main/$0.;
7 requirescip-perl cpan Date-Manip 6.99 main/require(). "tests.pl";
8
9 our $obj1scip-perl cpan Date-Manip 6.99 main/$obj1. = new Date::Manip::Date;
10 $obj1scip-perl cpan Date-Manip 6.99 main/$obj1.->configscip-perl cpan Date-Manip 6.99 main/config().("forcedate","now,America/New_York");
11 our $obj2scip-perl cpan Date-Manip 6.99 main/$obj2. = $obj1scip-perl cpan Date-Manip 6.99 main/$obj1.->new_deltascip-perl cpan Date-Manip 6.99 main/new_delta().();
12
13 sub testscip-perl cpan Date-Manip 6.99 main/test(). {
14 my(@test)=@_scip-perl cpan Date-Manip 6.99 main/`@_`.;
15
16 my $err = $obj1scip-perl cpan Date-Manip 6.99 main/$obj1.->parsescip-perl cpan Date-Manip 6.99 main/parse().(shiftscip-perl cpan Date-Manip 6.99 main/shift().(@test));
17 return $$obj1scip-perl cpan Date-Manip 6.99 main/$obj1.{"err"} if ($err);
18 $err = $obj2scip-perl cpan Date-Manip 6.99 main/$obj2.->parsescip-perl cpan Date-Manip 6.99 main/parse().(shiftscip-perl cpan Date-Manip 6.99 main/shift().(@test));
19 return $$obj2scip-perl cpan Date-Manip 6.99 main/$obj2.{"err"} if ($err);
20
21 my $obj3 = $obj1scip-perl cpan Date-Manip 6.99 main/$obj1.->calcscip-perl cpan Date-Manip 6.99 main/calc().($obj2scip-perl cpan Date-Manip 6.99 main/$obj2.,@test);
22 return if (! definedscip-perl cpan Date-Manip 6.99 main/defined(). $obj3);
23 $err = $obj3->errscip-perl cpan Date-Manip 6.99 main/err().();
24 return $err if ($err);
25 my $ret = $obj3->valuescip-perl cpan Date-Manip 6.99 main/value().();
26 return $ret;
27 }
28
29 my $tests="
30
31 'Wed Nov 20 1996 noon' 'business +0:5:0:0' => 1996112108:00:00
32
33 'Wed Nov 20 1996 noon' 'business -0:5:0:0' 1 => 1996112108:00:00
34
35 'Wed Nov 20 1996 noon' 'business +0:2:0:0' => 1996112014:00:00
36
37 'Wed Nov 20 1996 noon' 'business -0:2:0:0' 1 => 1996112014:00:00
38
39 'Wed Nov 20 1996 noon' 'business +3:2:0:0' => 1996112514:00:00
40
41 'Wed Nov 20 1996 noon' 'business 3:2:0:0' 1 => 1996111510:00:00
42
43 'Wed Nov 20 1996 noon' 'business -3:2:0:0' => 1996111510:00:00
44
45 'Wed Nov 20 1996 noon' 'business +3:7:0:0' => 1996112610:00:00
46
47 'Wed Nov 20 1996 noon' 'business +6:2:0:0' => 1996112814:00:00
48
49 'Dec 31 1996 noon' 'business +1:2:0:0' => 1997010114:00:00
50
51 'Dec 30 1996 noon' 'business +1:2:0:0' => 1996123114:00:00
52
53 'Mar 31 1997 16:59:59' 'business + 1 sec' => 1997040108:00:00
54
55 'Wed Nov 20 1996 noon' 'business +0:0:1:0:0:0:0' => 1996112712:00:00
56
57 2002120600:00:00 '- business 4 hours' => 2002120513:00:00
58
59 2002120600:00:01 '- business 4 hours' => 2002120513:00:00
60
61 2002120523:59:59 '- business 4 hours' => 2002120513:00:00
62
63 2002120602:00:00 '- business 4 hours' => 2002120513:00:00
64
65 2002120609:00:00 '- business 4 hours' => 2002120514:00:00
66
67 2002120609:00:10 '- business 4 hours' => 2002120514:00:10
68
69 2002120611:00:00 '- business 4 hours' => 2002120516:00:00
70
71 2002120612:00:00 '- business 4 hours' => 2002120608:00:00
72
73 2002120512:00:00 '+ business 4 hours' => 2002120516:00:00
74
75 2002120514:00:00 '+ business 4 hours' => 2002120609:00:00
76
77 2002120522:00:00 '+ business 4 hours' => 2002120612:00:00
78
79 2002120523:59:59 '+ business 4 hours' => 2002120612:00:00
80
81 2002120602:00:00 '+ business 4 hours' => 2002120612:00:00
82
83 2002120609:00:00 '+ business 4 hours' => 2002120613:00:00
84
85 1998010500:00:00 '0:1:1:0:0:0:0 business' 0 => 1998021208:00:00
86
87 1998010500:00:00 '0:1:1:0:0:0:0 business' 1 => 1997112808:00:00
88
89 1998010500:00:00 '0:1:1:0:0:0:0 business' 2 => '[calc] Unable to perform calculation'
90
91 1998010400:00:00 '0:1:1:0:0:0:0 business' 0 => 1998021108:00:00
92
93 1998010400:00:00 '0:1:1:0:0:0:0 business' 1 => 1997112708:00:00
94
95 1998010400:00:00 '0:1:1:0:0:0:0 business' 2 => '[calc] Unable to perform calculation'
96
97 ";
98
99 $::tiscip-perl cpan Date-Manip 6.99 main/`$::ti`.->testsscip-perl cpan Date-Manip 6.99 main/tests().(func => \&testscip-perl cpan Date-Manip 6.99 main/test().,
100 tests => $tests);
101 $::tiscip-perl cpan Date-Manip 6.99 main/`$::ti`.->done_testingscip-perl cpan Date-Manip 6.99 main/done_testing().();
102
103 #Local Variables:
104 #mode: cperl
105 #indent-tabs-mode: nil
106 #cperl-indent-level: 3
107 #cperl-continued-statement-offset: 2
108 #cperl-continued-brace-offset: 0
109 #cperl-brace-offset: 0
110 #cperl-brace-imaginary-offset: 0
111 #cperl-label-offset: 0
112 #End: