| 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 |
if ($test[0] eq "config") { |
| 16 |
$dmt->config("firstday",$test[2]); |
| 17 |
$dmt->config("week1ofyear",$test[1]); |
| 18 |
return 0; |
| 19 |
} |
| 20 |
my @ret = $obj->week_of_year(@test); |
| 21 |
return @ret; |
| 22 |
} |
| 23 |
|
| 24 |
my $tests=" |
| 25 |
config jan4 1 => 0 |
| 26 |
|
| 27 |
2006 4 => [ 2006 1 23 ] |
| 28 |
|
| 29 |
2007 4 => [ 2007 1 22 ] |
| 30 |
|
| 31 |
2002 4 => [ 2002 1 21 ] |
| 32 |
|
| 33 |
2003 4 => [ 2003 1 20 ] |
| 34 |
|
| 35 |
2004 4 => [ 2004 1 19 ] |
| 36 |
|
| 37 |
2010 4 => [ 2010 1 25 ] |
| 38 |
|
| 39 |
2000 4 => [ 2000 1 24 ] |
| 40 |
|
| 41 |
|
| 42 |
config jan4 7 => 0 |
| 43 |
|
| 44 |
2006 4 => [ 2006 1 22 ] |
| 45 |
|
| 46 |
2007 4 => [ 2007 1 21 ] |
| 47 |
|
| 48 |
2002 4 => [ 2002 1 20 ] |
| 49 |
|
| 50 |
2003 4 => [ 2003 1 19 ] |
| 51 |
|
| 52 |
2004 4 => [ 2004 1 25 ] |
| 53 |
|
| 54 |
2010 4 => [ 2010 1 24 ] |
| 55 |
|
| 56 |
2000 4 => [ 2000 1 23 ] |
| 57 |
|
| 58 |
|
| 59 |
config jan1 1 => 0 |
| 60 |
|
| 61 |
2006 4 => [ 2006 1 16 ] |
| 62 |
|
| 63 |
2007 4 => [ 2007 1 22 ] |
| 64 |
|
| 65 |
2002 4 => [ 2002 1 21 ] |
| 66 |
|
| 67 |
2003 4 => [ 2003 1 20 ] |
| 68 |
|
| 69 |
2004 4 => [ 2004 1 19 ] |
| 70 |
|
| 71 |
2010 4 => [ 2010 1 18 ] |
| 72 |
|
| 73 |
2000 4 => [ 2000 1 17 ] |
| 74 |
|
| 75 |
|
| 76 |
config jan1 7 => 0 |
| 77 |
|
| 78 |
2006 4 => [ 2006 1 22 ] |
| 79 |
|
| 80 |
2007 4 => [ 2007 1 21 ] |
| 81 |
|
| 82 |
2002 4 => [ 2002 1 20 ] |
| 83 |
|
| 84 |
2003 4 => [ 2003 1 19 ] |
| 85 |
|
| 86 |
2004 4 => [ 2004 1 18 ] |
| 87 |
|
| 88 |
2010 4 => [ 2010 1 17 ] |
| 89 |
|
| 90 |
2000 4 => [ 2000 1 16 ] |
| 91 |
|
| 92 |
config jan4 1 => 0 |
| 93 |
|
| 94 |
2007 02 => [ 2007 1 8 ] |
| 95 |
|
| 96 |
2008 02 => [ 2008 1 7 ] |
| 97 |
|
| 98 |
"; |
| 99 |
|
| 100 |
$::ti->tests(func => \&test, |
| 101 |
tests => $tests); |
| 102 |
$::ti->done_testing(); |
| 103 |
|
| 104 |
#Local Variables: |
| 105 |
#mode: cperl |
| 106 |
#indent-tabs-mode: nil |
| 107 |
#cperl-indent-level: 3 |
| 108 |
#cperl-continued-statement-offset: 2 |
| 109 |
#cperl-continued-brace-offset: 0 |
| 110 |
#cperl-brace-offset: 0 |
| 111 |
#cperl-brace-imaginary-offset: 0 |
| 112 |
#cperl-label-offset: 0 |
| 113 |
#End: |