Debian Codegraph @

t/date.week_of_year.0.t

raw
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 $obj = new Date::Manip::Date;
10 $obj->config("forcedate","now,America/New_York");
11
12 sub test {
13 my($date,$first) = @_;
14 $obj->set("date",$date);
15 return $obj->week_of_year($first);
16 }
17
18 my $tests="
19
20 # Date, FirstDate
21
22 [ 2008 01 01 00 00 00 ] 7 => 1
23
24 [ 2008 01 06 00 00 00 ] 7 => 2
25
26 [ 2008 12 23 00 00 00 ] 7 => 52
27
28 [ 2008 12 28 00 00 00 ] 7 => 53
29
30 [ 2008 01 01 00 00 00 ] 1 => 1
31
32 [ 2008 01 06 00 00 00 ] 1 => 1
33
34 [ 2008 12 23 00 00 00 ] 1 => 52
35
36 [ 2008 12 28 00 00 00 ] 1 => 52
37
38 [ 2008 12 29 00 00 00 ] 1 => 53
39
40 [ 2005 01 01 00 00 00 ] 7 => 0
41
42 [ 2005 01 06 00 00 00 ] 7 => 1
43
44 [ 2005 12 23 00 00 00 ] 7 => 51
45
46 [ 2005 12 28 00 00 00 ] 7 => 52
47
48 [ 2005 01 01 00 00 00 ] 1 => 0
49
50 [ 2005 01 06 00 00 00 ] 1 => 1
51
52 [ 2005 12 23 00 00 00 ] 1 => 51
53
54 [ 2005 12 28 00 00 00 ] 1 => 52
55
56 [ 2005 12 29 00 00 00 ] 1 => 52
57
58 ";
59
60 $::ti->tests(func => \&test,
61 tests => $tests);
62 $::ti->done_testing();
63
64 #Local Variables:
65 #mode: cperl
66 #indent-tabs-mode: nil
67 #cperl-indent-level: 3
68 #cperl-continued-statement-offset: 2
69 #cperl-continued-brace-offset: 0
70 #cperl-brace-offset: 0
71 #cperl-brace-imaginary-offset: 0
72 #cperl-label-offset: 0
73 #End: