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   my $err = $obj->set(@test);
15   if ($err) {
16      return $obj->err();
17   } else {
18      my @val = $obj->value();
19      return @val;
20   }
21}
22
23my $tests="
24
25delta    [ 0 0 0 0 10 20 30 ]                   => 0 0 0 0 10 20 30
26
27delta    [ 0 0 0 0 10 20 30 ]      nonormalize  => 0 0 0 0 10 20 30
28
29delta    [ 10 20 30 ]                           => 0 0 0 0 10 20 30
30
31delta    [ 10 20 30 ]              nonormalize  => 0 0 0 0 10 20 30
32
33delta    [ -10 20 30 ]                          => 0 0 0 0 -9 -39 -30
34
35delta    [ -10 20 30 ]             nonormalize  => 0 0 0 0 -10 20 30
36
37delta    [ 10 -70 -130 +90 ]                    => 0 0 0 6 23 51 30
38
39delta    [ 10 -70 -130 +90 ]       nonormalize  => 0 0 0 10 -70 -130 90
40
41delta    [ 1 13 2 10 -70 -130 90 ]              => 2 1 2 6 23 51 30
42
43#
44
45business [ 0 0 0 0 6 20 30 ]                    => 0 0 0 0 6 20 30
46
47business [ 0 0 0 0 10 20 30 ]      nonormalize  => 0 0 0 0 10 20 30
48
49business [ 0 0 0 3 10 20 30 ]                   => 0 0 0 4 1 20 30
50
51business [ 1 13 2 10 -70 -130 90 ]              => 2 1 2 1 8 51 30
52
53#
54
55standard [ 1 13 2 10 -70 -130 90 ] nonormalize  => 1 13 2 10 -70 -130 90
56
57m        25                        nonormalize  => 1 13 2 10 -70 25 90
58
59m        -135                                   => 2 1 2 6 23 46 30
60
61#
62
63standard [ 1 13 2 10 -70 -130 90 ] nonormalize  => 1 13 2 10 -70 -130 90
64
65M        14                                     => 2 2 2 6 23 51 30
66
67";
68
69$::ti->tests(func  => \&test,
70             tests => $tests);
71$::ti->done_testing();
72
73#Local Variables:
74#mode: cperl
75#indent-tabs-mode: nil
76#cperl-indent-level: 3
77#cperl-continued-statement-offset: 2
78#cperl-continued-brace-offset: 0
79#cperl-brace-offset: 0
80#cperl-brace-imaginary-offset: 0
81#cperl-label-offset: 0
82#End:
83