Debian Codegraph @

t/base.calc_date_time.t

raw symbols SCIP
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5 use Test::Inter;
6 $::ti = new Test::Inter $0;
7 require "tests.pl";
8
9 our $dmt = new Date::Manip::TZ;
10 our $obj = $dmt->base();
11 $dmt->config("forcedate","now,America/New_York");
12
13 sub test {
14 my (@test)=@_;
15 my @ret = $obj->calc_date_time(@test);
16 return @ret;
17 }
18
19 my $tests="
20
21 [ 2000 01 15 12 00 00 ] [ 1 0 0 ] => [ 2000 1 15 13 0 0 ]
22
23 [ 2000 01 15 12 00 00 ] [ -1 0 0 ] => [ 2000 1 15 11 0 0 ]
24
25 [ 2000 01 15 12 00 00 ] [ 1 1 0 ] => [ 2000 1 15 13 1 0 ]
26
27 [ 2000 01 15 12 00 00 ] [ -1 -1 0 ] => [ 2000 1 15 10 59 0 ]
28
29 [ 2000 01 15 12 00 00 ] [ 1 1 1 ] => [ 2000 1 15 13 1 1 ]
30
31 [ 2000 01 15 12 00 00 ] [ -1 -1 -1 ] => [ 2000 1 15 10 58 59 ]
32
33 [ 2000 01 15 12 00 00 ] [ 0 1 0 ] => [ 2000 1 15 12 1 0 ]
34
35 [ 2000 01 15 12 00 00 ] [ 0 -1 0 ] => [ 2000 1 15 11 59 0 ]
36
37 [ 2000 01 15 12 00 00 ] [ 0 1 1 ] => [ 2000 1 15 12 1 1 ]
38
39 [ 2000 01 15 12 00 00 ] [ 0 -1 -1 ] => [ 2000 1 15 11 58 59 ]
40
41 [ 2000 01 15 12 00 00 ] [ 0 0 1 ] => [ 2000 1 15 12 0 1 ]
42
43 [ 2000 01 15 12 00 00 ] [ 0 0 -1 ] => [ 2000 1 15 11 59 59 ]
44
45 [ 2000 01 15 12 00 00 ] [ +24 0 0 ] => [ 2000 1 16 12 0 0 ]
46
47 [ 2000 01 15 12 00 00 ] [ -24 0 0 ] => [ 2000 1 14 12 0 0 ]
48
49 [ 1999 12 31 12 00 00 ] [ +24 0 0 ] => [ 2000 1 1 12 0 0 ]
50
51 [ 2000 01 01 12 00 00 ] [ -24 0 0 ] => [ 1999 12 31 12 0 0 ]
52
53 [ 2000 12 31 12 00 00 ] [ +24 0 0 ] => [ 2001 1 1 12 0 0 ]
54
55 [ 2000 01 15 12 00 00 ] [ +49 1 0 ] => [ 2000 1 17 13 1 0 ]
56
57 ";
58
59 $::ti->tests(func => \&test,
60 tests => $tests);
61 $::ti->done_testing();
62
63 #Local Variables:
64 #mode: cperl
65 #indent-tabs-mode: nil
66 #cperl-indent-level: 3
67 #cperl-continued-statement-offset: 2
68 #cperl-continued-brace-offset: 0
69 #cperl-brace-offset: 0
70 #cperl-brace-imaginary-offset: 0
71 #cperl-label-offset: 0
72 #End: