File: orig.datecalc.date_delta.0.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 (132 lines) | stat: -rwxr-xr-x 3,250 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/usr/bin/perl

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

sub test {
   my($d1,$d2) = (@_);
   DateCalc($d1,$d2);
}

Date_Init("ForceDate=1997-03-08-12:30:00,America/New_York");
Date_Init("ConfigFile=Manip.cnf");

my $tests="

# Exact deltas

'Wed Feb 7 1996 8:00' +1:1:1:1 => 1996020809:01:01

'Wed Nov 20 1996 noon' +0:5:0:0 => 1996112017:00:00

'Wed Nov 20 1996 noon' +0:13:0:0 => 1996112101:00:00

'Wed Nov 20 1996 noon' +3:2:0:0 => 1996112314:00:00

'Wed Nov 20 1996 noon' -3:2:0:0 => 1996111710:00:00

'Wed Nov 20 1996 noon' +3:13:0:0 => 1996112401:00:00

'Wed Nov 20 1996 noon' +6:2:0:0 => 1996112614:00:00

'Dec 31 1996 noon' +1:2:0:0 => 1997010114:00:00

'Jan 31 1997 23:59:59' '+ 1 sec' => 1997020100:00:00

'20050215 13:59:11' -10h => 2005021503:59:11

2005021513:59:11 '-10h +0s' => 2005021503:59:11

# Approx deltas

'Wed Feb 7 1996 8:00' +1:1:1:1 => 1996020809:01:01

'Wed Nov 20 1996 noon' +0:5:0:0 => 1996112017:00:00

'Wed Nov 20 1996 noon' +0:13:0:0 => 1996112101:00:00

'Wed Nov 20 1996 noon' +3:2:0:0 => 1996112314:00:00

'Wed Nov 20 1996 noon' -3:2:0:0 => 1996111710:00:00

'Wed Nov 20 1996 noon' +3:13:0:0 => 1996112401:00:00

'Wed Nov 20 1996 noon' +6:2:0:0 => 1996112614:00:00

'Dec 31 1996 noon' +1:2:0:0 => 1997010114:00:00

'Jan 31 1997 23:59:59' '+ 1 sec' => 1997020100:00:00

# Business deltas

'Wed Nov 20 1996 noon' '+0:5:0:0 business' => 1996112108:00:00

'Wed Nov 20 1996 noon' '+0:2:0:0 business' => 1996112014:00:00

'Wed Nov 20 1996 noon' '+3:2:0:0 business' => 1996112514:00:00

'Wed Nov 20 1996 noon' '-3:2:0:0 business' => 1996111510:00:00

'Wed Nov 20 1996 noon' '+3:7:0:0 business' => 1996112610:00:00

'Wed Nov 20 1996 noon' '+6:2:0:0 business' => 1996120214:00:00

'Dec 31 1996 noon' '+1:2:0:0 business' => 1997010214:00:00

'Dec 30 1996 noon' '+1:2:0:0 business' => 1996123114:00:00

'Mar 31 1997 16:59:59' '+ 1 sec' => 1997033117:00:00

'Mar 31 1997 16:59:59' '+ 1 sec business' => 1997040108:00:00

'Wed Nov 20 1996 noon' +0:0:1:0:0:0:0 => 1996112712:00:00

2002120600:00:00 '- business 4 hours' => 2002120513:00:00

2002120600:00:01 '- business 4 hours' => 2002120513:00:00

2002120523:59:59 '- business 4 hours' => 2002120513:00:00

2002120602:00:00 '- business 4 hours' => 2002120513:00:00

2002120609:00:00 '- business 4 hours' => 2002120514:00:00

2002120609:00:10 '- business 4 hours' => 2002120514:00:10

2002120611:00:00 '- business 4 hours' => 2002120516:00:00

2002120612:00:00 '- business 4 hours' => 2002120608:00:00

2002120512:00:00 '+ business 4 hours' => 2002120516:00:00

2002120514:00:00 '+ business 4 hours' => 2002120609:00:00

2002120522:00:00 '+ business 4 hours' => 2002120612:00:00

2002120523:59:59 '+ business 4 hours' => 2002120612:00:00

2002120602:00:00 '+ business 4 hours' => 2002120612:00:00

2002120609:00:00 '+ business 4 hours' => 2002120613:00:00

20060616 '+1 business day' => 2006061908: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: