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