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
|
#!/usr/bin/perl
use warnings;
use strict;
use Test::Inter;
$::ti = new Test::Inter $0;
require "tests.pl";
our $obj1 = new Date::Manip::Date;
$obj1->config("forcedate","now,America/New_York");
$obj1->config("ConfigFile","Manip.cnf");
our $obj2 = $obj1->new_date();
sub test {
my(@test)=@_;
my $err = $obj1->parse(shift(@test));
return $$obj1{"err"} if ($err);
$err = $obj2->parse(shift(@test));
return $$obj2{"err"} if ($err);
push(@test,"bsemi");
my $obj3 = $obj1->calc($obj2,@test);
return if (! defined $obj3);
my $ret = $obj3->value();
return $ret;
}
my $tests="
'Jun 1 1999' 'Jun 4 1999' => 0:0:0:2:0:0:0
'Jun 1 1999' 'Jun 4 1999' 1 => 0:0:0:-2:0:0:0
'Jun 4 1999' 'Jun 1 1999' => 0:0:0:-2:0:0:0
'Jun 3 1999' 'Jun 8 1999' => 0:0:0:3:0:0:0
'Jun 3 1999' 'Jun 8 1999' 1 => 0:0:0:-3:0:0:0
'Jun 8 1999' 'Jun 3 1999' => 0:0:0:-3:0:0:0
'Wed Jan 10 1996 noon' 'Wed Feb 7 1996 noon' => 0:0:4:0:0:0:0
'Wed Jan 10 1996 noon' 'Wed Feb 7 1996 noon' 1 => 0:0:-4:0:0:0:0
'Wed Feb 7 1996 noon' 'Wed Jan 10 1996 noon' => 0:0:-4:0:0:0:0
'Tue Jan 9 1996 12:00:00' 'Tue Jan 9 1996 14:30:30' => 0:0:0:0:2:30:30
'Tue Jan 9 1996 12:00:00' 'Tue Jan 9 1996 14:30:30' 1 => 0:0:0:0:-2:30:30
'Tue Jan 9 1996 14:30:30' 'Tue Jan 9 1996 12:00:00' => 0:0:0:0:-2:30:30
'Tue Jan 9 1996 12:00:00' 'Wed Jan 10 1996 14:30:30' => 0:0:0:1:2:30:30
'Tue Jan 9 1996 12:00:00' 'Wed Jan 10 1996 14:30:30' 1 => 0:0:0:-1:2:30:30
'Wed Jan 10 1996 14:30:30' 'Tue Jan 9 1996 12:00:00' => 0:0:0:-1:2:30:30
'Mon Dec 30 1996 noon' 'Mon Jan 6 1997 noon' => 0:0:1:0:0:0:0
'Mon Dec 30 1996 noon' 'Mon Jan 6 1997 noon' 1 => 0:0:-1:0:0:0:0
'Mon Jan 6 1997 noon' 'Mon Dec 30 1996 noon' => 0:0:-1:0:0:0:0
'Tue Jan 9 1996 12:00:00' 'Wed Jan 10 1996 10:30:30' => 0:0:0:0:7:30:30
'Tue Jan 9 1996 12:00:00' 'Wed Jan 10 1996 10:30:30' 1 => 0:0:0:0:-7:30:30
'Wed Jan 10 1996 10:30:30' 'Tue Jan 9 1996 12:00:00' => 0:0:0:0:-7:30:30
'Wed Jan 10 1996 05:00:00' 'Wed Jan 10 1996 05:00:00' => 0:0:0:0:0:0:0
'Wed Jan 10 1996 05:00:00' 'Wed Jan 10 1996 05:00:00' 1 => 0:0:0:0:0:0:0
'Wed Jan 10 1996 05:00:00' 'Wed Jan 10 1996 10:00:00' => 0:0:0:0:2:0:0
'Wed Jan 10 1996 05:00:00' 'Wed Jan 10 1996 20:00:00' => 0:0:0:1:0:0:0
'Wed Jan 10 1996 05:00:00' 'Fri Jan 12 1996 05:00:00' => 0:0:0:2:0:0:0
'Wed Jan 10 1996 05:00:00' 'Fri Jan 12 1996 10:00:00' => 0:0:0:2:2:0:0
'Wed Jan 10 1996 05:00:00' 'Fri Jan 12 1996 20:00:00' => 0:0:0:3:0:0:0
'Wed Jan 10 1996 05:00:00' 'Sat Jan 13 1996 12:00:00' => 0:0:0:3:0:0:0
'Wed Jan 10 1996 10:00:00' 'Wed Jan 10 1996 10:00:00' => 0:0:0:0:0:0:0
'Wed Jan 10 1996 10:00:00' 'Wed Jan 10 1996 20:00:00' => 0:0:0:0:7:0:0
'Wed Jan 10 1996 10:00:00' 'Fri Jan 12 1996 05:00:00' => 0:0:0:1:7:0:0
'Wed Jan 10 1996 10:00:00' 'Fri Jan 12 1996 10:00:00' => 0:0:0:2:0:0:0
'Wed Jan 10 1996 10:00:00' 'Fri Jan 12 1996 20:00:00' => 0:0:0:2:7:0:0
'Wed Jan 10 1996 10:00:00' 'Sat Jan 13 1996 12:00:00' => 0:0:0:2:7:0:0
'Wed Jan 10 1996 20:00:00' 'Wed Jan 10 1996 20:00:00' => 0:0:0:0:0:0:0
'Wed Jan 10 1996 20:00:00' 'Fri Jan 12 1996 05:00:00' => 0:0:0:1:0:0:0
'Wed Jan 10 1996 20:00:00' 'Fri Jan 12 1996 10:00:00' => 0:0:0:1:2:0:0
'Wed Jan 10 1996 20:00:00' 'Fri Jan 12 1996 20:00:00' => 0:0:0:2:0:0:0
'Wed Jan 10 1996 20:00:00' 'Sat Jan 13 1996 12:00:00' => 0:0:0:2:0:0:0
'Fri Jan 12 1996 05:00:00' 'Fri Jan 12 1996 05:00:00' => 0:0:0:0:0:0:0
'Fri Jan 12 1996 05:00:00' 'Fri Jan 12 1996 10:00:00' => 0:0:0:0:2:0:0
'Fri Jan 12 1996 05:00:00' 'Fri Jan 12 1996 20:00:00' => 0:0:0:1:0:0:0
'Fri Jan 12 1996 05:00:00' 'Sat Jan 13 1996 12:00:00' => 0:0:0:1:0:0:0
'Fri Jan 12 1996 10:00:00' 'Fri Jan 12 1996 10:00:00' => 0:0:0:0:0:0:0
'Fri Jan 12 1996 10:00:00' 'Fri Jan 12 1996 20:00:00' => 0:0:0:0:7:0:0
'Fri Jan 12 1996 10:00:00' 'Sat Jan 13 1996 12:00:00' => 0:0:0:0:7:0:0
'Fri Jan 12 1996 20:00:00' 'Fri Jan 12 1996 20:00:00' => 0:0:0:0:0:0:0
'Fri Jan 12 1996 20:00:00' 'Sat Jan 13 1996 12:00:00' => 0:0:0:0:0:0:0
'Sat Jan 13 1996 12:00:00' 'Sat Jan 13 1996 12:00:00' => 0:0:0:0:0:0:0
";
$::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:
|