File: date.next.t

package info (click to toggle)
libdate-manip-perl 6.98-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,928 kB
  • sloc: perl: 222,846; sh: 54; ansic: 26; makefile: 8
file content (126 lines) | stat: -rwxr-xr-x 4,441 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl

use warnings;
use strict;
use Test::Inter;
$::ti = new Test::Inter $0;
require "tests.pl";

our $obj = new Date::Manip::Date;
$obj->config("forcedate","now,America/New_York");

sub test {
   my(@test)=@_;
   my $date = shift(@test);
   $obj->set("date",$date);
   my $err = $obj->next(@test);
   if ($err) {
      return $obj->err();
   } else {
      return [ $obj->value() ];
   }
}

my $tests="

[ 1996 11 22 17 49 30 ] 6         0                            => [ 1996 11 23 17 49 30 ]

[ 1996 11 22 17 49 30 ] 6         1                            => [ 1996 11 23 17 49 30 ]

[ 1996 11 22 17 49 30 ] 5         0                            => [ 1996 11 29 17 49 30 ]

[ 1996 11 22 17 49 30 ] 5         0                            => [ 1996 11 29 17 49 30 ]

[ 1996 11 22 17 49 30 ] 5         1                            => [ 1996 11 22 17 49 30 ]


[ 1996 11 22 17 49 30 ] 5         0 [ 18 30 ]                  => [ 1996 11 29 18 30 0 ]


[ 1996 11 22 17 49 30 ] 5         0 [ 18 30 45 ]               => [ 1996 11 29 18 30 45 ]

[ 1996 11 22 17 49 30 ] 5         1 [ 14 30 45 ]               => [ 1996 11 22 14 30 45 ]

[ 1996 11 22 17 49 30 ] 5         2 [ 14 30 45 ]               => [ 1996 11 29 14 30 45 ]


[ 1996 11 22 17 49 30 ] __undef__ 0 [ 18 __undef__ __undef__ ] => [ 1996 11 22 18 0 0 ]

[ 1996 11 22 17 49 33 ] __undef__ 0 [ 18 30 __undef__ ]        => [ 1996 11 22 18 30 0 ]

[ 1996 11 22 17 49 33 ] __undef__ 0 [ 18 30 45 ]               => [ 1996 11 22 18 30 45 ]

[ 1996 11 22 17 49 33 ] __undef__ 0 [ 18 __undef__ 45 ]        => [ 1996 11 22 18 0 45 ]


[ 1996 11 22 17 0 0 ]   __undef__ 0 [ 17 __undef__ __undef__ ] => [ 1996 11 23 17 0 0 ]

[ 1996 11 22 17 0 0 ]   __undef__ 1 [ 17 0 0 ]                 => [ 1996 11 22 17 0 0 ]

[ 1996 11 22 17 49 0 ]  __undef__ 0 [ 17 49 0 ]                => [ 1996 11 23 17 49 0 ]

[ 1996 11 22 17 49 0 ]  __undef__ 1 [ 17 49 0 ]                => [ 1996 11 22 17 49 0 ]

[ 1996 11 22 17 49 33 ] __undef__ 0 [ 17 49 33 ]               => [ 1996 11 23 17 49 33 ]

[ 1996 11 22 17 49 33 ] __undef__ 1 [ 17 49 33 ]               => [ 1996 11 22 17 49 33 ]

[ 1996 11 22 17 0 33 ]  __undef__ 0 [ 17 __undef__ 33 ]        => [ 1996 11 23 17 0 33 ]

[ 1996 11 22 17 0 33 ]  __undef__ 1 [ 17 __undef__ 33 ]        => [ 1996 11 22 17 0 33 ]

[ 1996 11 22 17 49 30 ] __undef__ 0 [ __undef__ 30 0 ]         => [ 1996 11 22 18 30 0 ]

[ 1996 11 22 17 49 30 ] __undef__ 0 [ __undef__ 30 45 ]        => [ 1996 11 22 18 30 45 ]

[ 1996 11 22 17 49 30 ] __undef__ 0 [ __undef__ __undef__ 30 ] => [ 1996 11 22 17 50 30 ]

[ 1996 11 22 17 30 0 ]  __undef__ 0 [ __undef__ 30 0 ]         => [ 1996 11 22 18 30 0 ]

[ 1996 11 22 17 30 0 ]  __undef__ 1 [ __undef__ 30 0 ]         => [ 1996 11 22 17 30 0 ]

[ 1996 11 22 17 30 45 ] __undef__ 0 [ __undef__ 30 45 ]        => [ 1996 11 22 18 30 45 ]

[ 1996 11 22 17 30 45 ] __undef__ 1 [ __undef__ 30 45 ]        => [ 1996 11 22 17 30 45 ]

[ 1996 11 22 17 30 45 ] __undef__ 0 [ __undef__ __undef__ 45 ] => [ 1996 11 22 17 31 45 ]

[ 1996 11 22 17 30 45 ] __undef__ 1 [ __undef__ __undef__ 45 ] => [ 1996 11 22 17 30 45 ]

[ 2002 11 22 18 15 0 ]  4         0                            => [ 2002 11 28 18 15 0 ]

[ 2002 11 22 18 15 0 ]  4         0 [ 12 30 ]                  => [ 2002 11 28 12 30 0 ]

[ 2002 11 22 18 15 0 ]  5         0                            => [ 2002 11 29 18 15 0 ]

[ 2002 11 22 18 15 0 ]  5         1                            => [ 2002 11 22 18 15 0 ]

[ 2002 11 22 18 15 0 ]  5         2                            => [ 2002 11 29 18 15 0 ]

[ 2002 11 22 18 15 0 ]  5         0 [ 12 30 ]                  => [ 2002 11 29 12 30 0 ]

[ 2002 11 22 18 15 0 ]  5         1 [ 12 30 ]                  => [ 2002 11 22 12 30 0 ]

[ 2002 11 22 18 15 0 ]  5         2 [ 12 30 ]                  => [ 2002 11 29 12 30 0 ]

[ 2002 11 22 18 15 0 ]  5         0 [ 19 30 ]                  => [ 2002 11 29 19 30 0 ]

[ 2002 11 22 18 15 0 ]  5         1 [ 19 30 ]                  => [ 2002 11 22 19 30 0 ]

[ 2002 11 22 18 15 0 ]  5         2 [ 19 30 ]                  => [ 2002 11 22 19 30 0 ]
";

$::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: