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(@args) = @_;
14   if (@args == 1) {
15      my($type) = @args;
16      return $obj->type($type);
17   } else {
18      my($op,$val) = @args;
19      $obj->set($op,$val);
20      return 0
21   }
22}
23
24my $tests="
25
26standard [ 0 0 0 0 1 2 3 ] => 0
27
28business                   => 0
29
30standard                   => 1
31
32exact                      => 1
33
34semi                       => 0
35
36approx                     => 0
37
38###
39
40standard [ 0 0 1 2 1 2 3 ] => 0
41
42business                   => 0
43
44standard                   => 1
45
46exact                      => 0
47
48semi                       => 1
49
50approx                     => 0
51
52###
53
54delta [ 1 0 0 0 1 2 3 ]    => 0
55
56business                   => 0
57
58standard                   => 1
59
60exact                      => 0
61
62semi                       => 0
63
64approx                     => 1
65
66###
67
68business [ 0 0 0 0 1 2 3 ] => 0
69
70business                   => 1
71
72standard                   => 0
73
74exact                      => 1
75
76semi                       => 0
77
78approx                     => 0
79
80###
81
82business [ 0 0 0 1 1 2 3 ] => 0
83
84business                   => 1
85
86standard                   => 0
87
88exact                      => 1
89
90semi                       => 0
91
92approx                     => 0
93
94###
95
96business [ 0 0 1 2 1 2 3 ] => 0
97
98business                   => 1
99
100standard                   => 0
101
102exact                      => 0
103
104semi                       => 1
105
106approx                     => 0
107
108###
109
110delta [ 1 0 0 0 10 20 30 ] => 0
111
112business                   => 0
113
114standard                   => 1
115
116exact                      => 0
117
118semi                       => 0
119
120approx                     => 1
121
122###
123
124";
125
126$::ti->tests(func  => \&test,
127             tests => $tests);
128$::ti->done_testing();
129
130#Local Variables:
131#mode: cperl
132#indent-tabs-mode: nil
133#cperl-indent-level: 3
134#cperl-continued-statement-offset: 2
135#cperl-continued-brace-offset: 0
136#cperl-brace-offset: 0
137#cperl-brace-imaginary-offset: 0
138#cperl-label-offset: 0
139#End:
140