1#!/usr/bin/perl
2
3use warnings;
4use strict;
5use Test::Inter;
6$::ti = new Test::Inter $0;
7require "tests.pl";
8
9my $obj = new Date::Manip::Delta;
10$obj->config("forcedate","now,America/New_York");
11
12sub test {
13   my(@test)=@_;
14
15   my $err = $obj->set(@test);
16   if ($err) {
17      return $obj->err();
18   } else {
19      my $val = $obj->value();
20      return $val;
21   }
22}
23
24my $tests="
25
26delta    [ 0 0 0 0 10 20 30 ]                   => 0:0:0:0:10:20:30
27
28delta    [ 0 0 0 0 10 20 30 ]      nonormalize  => 0:0:0:0:10:20:30
29
30delta    [ -10 20 30 ]                          => 0:0:0:0:-9:39:30
31
32delta    [ -10 20 30 ]             nonormalize  => 0:0:0:0:-10:+20:30
33
34delta    [ 10 -70 -130 +90 ]                    => 0:0:0:6:23:51:30
35
36delta    [ 10 -70 -130 +90 ]       nonormalize  => 0:0:0:10:-70:130:+90
37
38delta    [ 1 13 2 10 -70 -130 90 ]              => 2:1:2:6:23:51:30
39
40#
41
42business [ 0 0 0 0 10 20 30 ]                   => 0:0:0:1:1:20:30
43
44business [ 0 0 0 0 10 20 30 ]      nonormalize  => 0:0:0:0:10:20:30
45
46business [ 1 13 2 10 -70 -130 90 ]              => 2:1:2:1:8:51:30
47
48#
49
50standard [ 1 13 2 10 -70 -130 90 ] nonormalize  => 1:13:2:10:-70:130:+90
51
52m        25                        nonormalize  => 1:13:2:10:-70:+25:90
53
54m        -135                                   => 2:1:2:6:23:46:30
55
56#
57
58standard [ 1 13 2 10 -70 -130 90 ] nonormalize  => 1:13:2:10:-70:130:+90
59
60M        14                                     => 2:2:2:6:23:51:30
61
62";
63
64$::ti->tests(func  => \&test,
65             tests => $tests);
66$::ti->done_testing();
67
68#Local Variables:
69#mode: cperl
70#indent-tabs-mode: nil
71#cperl-indent-level: 3
72#cperl-continued-statement-offset: 2
73#cperl-continued-brace-offset: 0
74#cperl-brace-offset: 0
75#cperl-brace-imaginary-offset: 0
76#cperl-label-offset: 0
77#End:
78