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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
|
#!/usr/bin/perl
use warnings;
use strict;
use Test::Inter;
$::ti = new Test::Inter $0;
require "tests.pl";
sub test {
return DateCalc(@_);
}
Date_Init("ForceDate=1997-03-08-12:30:00,America/New_York");
Date_Init("ConfigFile=Manip.cnf");
my $tests="
# Exact
'Jan 1 1996 12:00:00' 'Jan 1 1996 14:30:30' => 0:0:0:0:2:30:30
'Jan 1 1996 14:30:30' 'Jan 1 1996 12:00:00' => 0:0:0:0:-2:30:30
'Jan 1 1996 12:00:00' 'Jan 2 1996 14:30:30' => 0:0:0:0:26:30:30
'Jan 2 1996 14:30:30' 'Jan 1 1996 12:00:00' => 0:0:0:0:-26:30:30
'Jan 1 1996 12:00:00' 'Jan 2 1996 10:30:30' => 0:0:0:0:22:30:30
'Jan 2 1996 10:30:30' 'Jan 1 1996 12:00:00' => 0:0:0:0:-22:30:30
'Jan 1 1996 12:00:00' 'Jan 2 1997 10:30:30' => 0:0:0:0:8806:30:30
'Jan 2 1997 10:30:30' 'Jan 1 1996 12:00:00' => 0:0:0:0:-8806:30:30
'Jan 1st 1997 00:00:01' 'Feb 1st 1997 00:00:00' => 0:0:0:0:743:59:59
'Jan 1st 1997 00:00:01' 'Mar 1st 1997 00:00:00' => 0:0:0:0:1415:59:59
'Jan 1st 1997 00:00:01' 'Mar 1st 1998 00:00:00' => 0:0:0:0:10175:59:59
# Approximate
'Wed Jan 10 1996 noon' 'Wed Jan 7 1998 noon' 1 => 2:0:0:-3:0:0:0
'Wed Jan 7 1998 noon' 'Wed Jan 10 1996 noon' 1 => -2:0:0:+3:0:0:0
'Wed Jan 10 1996 noon' 'Wed Jan 8 1997 noon' 1 => 1:0:0:-2:0:0:0
'Wed Jan 8 1997 noon' 'Wed Jan 10 1996 noon' 1 => -1:0:0:+2:0:0:0
'Wed May 8 1996 noon' 'Wed Apr 9 1997 noon' 1 => 0:11:0:1:0:0:0
'Wed Apr 9 1997 noon' 'Wed May 8 1996 noon' 1 => 0:-11:0:1:0:0:0
'Wed Apr 10 1996 noon' 'Wed May 14 1997 noon' 1 => 1:1:0:4:0:0:0
'Wed May 14 1997 noon' 'Wed Apr 10 1996 noon' 1 => -1:1:0:4:0:0:0
'Wed Jan 10 1996 noon' 'Wed Feb 7 1996 noon' 1 => 0:1:0:-3:0:0:0
'Wed Feb 7 1996 noon' 'Wed Jan 10 1996 noon' 1 => 0:-1:0:+3:0:0:0
'Mon Jan 8 1996 noon' 'Fri Feb 9 1996 noon' 1 => 0:1:0:1:0:0:0
'Fri Feb 9 1996 noon' 'Mon Jan 8 1996 noon' 1 => 0:-1:0:1:0:0:0
'Jan 1 1996 12:00:00' 'Jan 1 1996 14:30:30' 1 => 0:0:0:0:2:30:30
'Jan 1 1996 14:30:30' 'Jan 1 1996 12:00:00' 1 => 0:0:0:0:-2:30:30
'Jan 1 1996 12:00:00' 'Jan 2 1996 14:30:30' 1 => 0:0:0:1:2:30:30
'Jan 2 1996 14:30:30' 'Jan 1 1996 12:00:00' 1 => 0:0:0:-1:2:30:30
'Jan 1 1996 12:00:00' 'Jan 2 1996 10:30:30' 1 => 0:0:0:0:22:30:30
'Jan 2 1996 10:30:30' 'Jan 1 1996 12:00:00' 1 => 0:0:0:0:-22:30:30
'Jan 1 1996 12:00:00' 'Jan 2 1997 10:30:30' 1 => 1:0:0:0:22:30:30
'Jan 2 1997 10:30:30' 'Jan 1 1996 12:00:00' 1 => -1:0:0:0:22:30:30
'Jan 31 1996 12:00:00' 'Feb 28 1997 10:30:30' 1 => 1:1:0:0:-1:29:30
'Feb 28 1997 10:30:30' 'Jan 31 1996 12:00:00' 1 => -1:1:0:+3:1:29:30
'Jan 1st 1997 00:00:01' 'Feb 1st 1997 00:00:00' 1 => 0:1:0:0:0:0:-1
'Jan 1st 1997 00:00:01' 'Mar 1st 1997 00:00:00' 1 => 0:2:0:0:0:0:-1
'Jan 1st 1997 00:00:01' 'Mar 1st 1998 00:00:00' 1 => 1:2:0:0:0:0:-1
# Business approximate
'Jun 1 1999' 'Jun 4 1999' 2 => 0:0:0:2:0:0:0
'Wed Jan 10 1996 noon' 'Wed Jan 7 1998 noon' 2 => 2:0:0:-2:5:0:0
'Wed Jan 7 1998 noon' 'Wed Jan 10 1996 noon' 2 => -2:0:0:+2:4:0:0
'Wed Jan 10 1996 noon' 'Wed Jan 8 1997 noon' 2 => 1:0:0:-2:0:0:0
'Wed Jan 8 1997 noon' 'Wed Jan 10 1996 noon' 2 => -1:0:0:+2:0:0:0
'Wed May 8 1996 noon' 'Wed Apr 9 1997 noon' 2 => 0:11:0:1:0:0:0
'Wed Apr 9 1997 noon' 'Wed May 8 1996 noon' 2 => 0:-11:0:1:0:0:0
'Wed Apr 10 1996 noon' 'Wed May 14 1997 noon' 2 => 1:1:0:2:4:0:0
'Wed May 14 1997 noon' 'Wed Apr 10 1996 noon' 2 => -1:1:0:2:5:0:0
'Wed Jan 10 1996 noon' 'Wed Feb 7 1996 noon' 2 => 0:1:0:-2:5:0:0
'Wed Feb 7 1996 noon' 'Wed Jan 10 1996 noon' 2 => 0:-1:0:+2:4:0:0
'Mon Jan 8 1996 noon' 'Fri Feb 9 1996 noon' 2 => 0:1:0:1:0:0:0
'Fri Feb 9 1996 noon' 'Mon Jan 8 1996 noon' 2 => 0:-1:0:1:0:0:0
'Tue Jan 9 1996 12:00:00' 'Tue Jan 9 1996 14:30:30' 2 => 0:0:0:0:2:30:30
'Tue Jan 9 1996 14:30:30' 'Tue Jan 9 1996 12:00:00' 2 => 0:0:0:0:-2:30:30
'Tue Jan 9 1996 12:00:00' 'Wed Jan 10 1996 14:30:30' 2 => 0:0:0:1:2:30:30
'Wed Jan 10 1996 14:30:30' 'Tue Jan 9 1996 12:00:00' 2 => 0:0:0:-1:2:30:30
'Tue Jan 9 1996 12:00:00' 'Wed Jan 10 1996 10:30:30' 2 => 0:0:0:0:7:30:30
'Wed Jan 10 1996 10:30:30' 'Tue Jan 9 1996 12:00:00' 2 => 0:0:0:0:-7:30:30
'Tue Jan 9 1996 12:00:00' 'Fri Jan 10 1997 10:30:30' 2 => 1:0:0:0:7:30:30
'Fri Jan 10 1997 10:30:30' 'Tue Jan 9 1996 12:00:00' 2 => -1:0:0:0:7:30:30
'Mon Dec 30 1996 noon' 'Mon Jan 6 1997 noon' 2 => 0:1:-3:3:0:0:0
'Mon Jan 6 1997 noon' 'Mon Dec 30 1996 noon' 2 => 0:-1:+3:1:0:0:0
# Business exact
'Wed Jan 10 1996 noon' 'Wed Feb 7 1996 noon' 3 => 0:0:0:19:0:0:0
'Wed Feb 7 1996 noon' 'Wed Jan 10 1996 noon' 3 => 0:0:0:-19:0:0:0
'Tue Jan 9 1996 12:00:00' 'Tue Jan 9 1996 14:30:30' 3 => 0:0:0:0:2:30:30
'Tue Jan 9 1996 14:30:30' 'Tue Jan 9 1996 12:00:00' 3 => 0:0:0:0:-2:30:30
'Tue Jan 9 1996 12:00:00' 'Wed Jan 10 1996 14:30:30' 3 => 0:0:0:1:2:30:30
'Wed Jan 10 1996 14:30:30' 'Tue Jan 9 1996 12:00:00' 3 => 0:0:0:-1:2:30:30
'Tue Jan 9 1996 12:00:00' 'Wed Jan 10 1996 10:30:30' 3 => 0:0:0:0:7:30:30
'Wed Jan 10 1996 10:30:30' 'Tue Jan 9 1996 12:00:00' 3 => 0:0:0:0:-7:30:30
'Mon Dec 30 1996 noon' 'Mon Jan 6 1997 noon' 3 => 0:0:0:4:0:0:0
'Mon Jan 6 1997 noon' 'Mon Dec 30 1996 noon' 3 => 0:0:0:-4:0:0:0
'Fri Feb 11 2005 16:00:43' 'Fri Feb 11 2005 16:44:09' 3 => 0:0:0:0:0:43:26
'02/11/2005 04:00:43 PM' '02/11/2005 04:44:09 PM' 3 => 0:0:0:0:0:43:26
";
$::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:
|