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
|
#!/usr/bin/perl
use warnings;
use strict;
use Test::Inter;
$::ti = new Test::Inter $0;
require "tests.pl";
our $dmt = new Date::Manip::TZ;
our $obj = $dmt->base();
$dmt->config("forcedate","now,America/New_York");
sub test {
my(@test)=@_;
my @ret = $obj->join(@test);
return @ret;
}
my $tests="
date [ 1996 1 1 12 0 0 ] => 1996010112:00:00
############
offset [ 10 0 0 ] => +10:00:00
offset [ 10 0 ] => +10:00:00
offset [ 10 ] => +10:00:00
offset [ 10 70 ] => __undef__
offset [ 10 -30 ] => __undef__
offset [ 1 2 3 4 ] => __undef__
offset [ -10 -20 0 ] => -10:20:00
############
hms [ 10 0 0 ] => 10:00:00
hms [ 10 0 ] => 10:00:00
hms [ 10 ] => 10:00:00
hms [ 10 70 ] => __undef__
hms [ 1 2 3 4 ] => __undef__
hms [ -10 30 ] => __undef__
############
time [ 10 -70 ] => 0:8:50
time [ 1 2 3 4 ] => __undef__
time [ 10 70 ] => 0:11:10
time [ 0 0 5 ] => 0:0:5
time [ 0 5 ] => 0:0:5
time [ 5 ] => 0:0:5
time [ 0 5 30 ] => 0:5:30
time [ 0 0 -5 ] => 0:0:-5
time [ 0 -5 -30 ] => 0:-5:30
time [ -5 -30 -45 ] => -5:30:45
time [ 0 10 70 ] => 0:11:10
time [ 0 10 70 ] 1 => 0:10:70
time [ 0 10 70 ] { nonorm 1 } => 0:10:70
############
delta [ 0 0 0 0 0 0 10 ] => 0:0:0:0:0:0:10
delta [ 0 0 0 0 10 ] => 0:0:0:0:0:0:10
delta [ 0 0 10 ] => 0:0:0:0:0:0:10
delta [ 10 ] => 0:0:0:0:0:0:10
delta [ 0 0 0 0 0 10 -70 ] nonormalize => 0:0:0:0:0:10:-70
delta [ 0 0 0 0 0 10 -70 ] => 0:0:0:0:0:8:50
delta [ 0 0 0 0 0 10 70 ] => 0:0:0:0:0:11:10
delta [ 10 -70 -130 90 ] => 0:0:0:6:23:51:30
delta [ -1 -13 -2 -10 70 -130 -90 ] => -2:1:3:0:4:11:30
delta [ 1 13 2 10 -70 -130 90 ] => 2:1:2:6:23:51:30
############
business [ 0 0 0 0 0 0 10 ] => 0:0:0:0:0:0:10
business [ 0 0 0 0 10 ] => 0:0:0:0:0:0:10
business [ 0 0 10 ] => 0:0:0:0:0:0:10
business [ 10 ] => 0:0:0:0:0:0:10
business [ 0 0 0 0 0 10 -70 ] => 0:0:0:0:0:8:50
business [ 0 0 0 0 0 10 70 ] => 0:0:0:0:0:11:10
business [ 10 -70 -130 -90 ] => 0:0:0:1:8:48:30
business [ -1 -13 -2 -10 25 -130 -90 ] => -2:1:3:2:4:11:30
business [ 1 13 2 10 -25 -130 90 ] => 2:1:3:1:8:51:30
";
$::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:
|