1#!/usr/bin/perl 2 3use warnings; 4use strict; 5use Test::Inter; 6$::ti = new Test::Inter $0; 7require "tests.pl"; 8 9our $dmt = new Date::Manip::TZ; 10our $obj = $dmt->base(); 11$dmt->config("forcedate","now,America/New_York"); 12 13sub test { 14 my (@test)=@_; 15 if ($test[0] eq "config") { 16 $dmt->config("jan1week1",$test[1]); 17 $dmt->config("firstday",$test[2]); 18 return 0; 19 } 20 my @ret = $obj->week_of_year(@test); 21 return @ret; 22} 23 24my $tests=" 25config 0 1 => 0 26 27[ 2006 1 23 ] => 2006 4 28 29[ 2007 1 22 ] => 2007 4 30 31[ 2002 1 21 ] => 2002 4 32 33[ 2003 1 20 ] => 2003 4 34 35[ 2004 1 19 ] => 2004 4 36 37[ 2010 1 25 ] => 2010 4 38 39[ 2000 1 24 ] => 2000 4 40 41 42config 0 7 => 0 43 44[ 2006 1 22 ] => 2006 4 45 46[ 2007 1 21 ] => 2007 4 47 48[ 2002 1 20 ] => 2002 4 49 50[ 2003 1 19 ] => 2003 4 51 52[ 2004 1 25 ] => 2004 4 53 54[ 2010 1 24 ] => 2010 4 55 56[ 2000 1 23 ] => 2000 4 57 58 59config 1 1 => 0 60 61[ 2006 1 16 ] => 2006 4 62 63[ 2007 1 22 ] => 2007 4 64 65[ 2002 1 21 ] => 2002 4 66 67[ 2003 1 20 ] => 2003 4 68 69[ 2004 1 19 ] => 2004 4 70 71[ 2010 1 18 ] => 2010 4 72 73[ 2000 1 17 ] => 2000 4 74 75 76config 1 7 => 0 77 78[ 2006 1 22 ] => 2006 4 79 80[ 2007 1 21 ] => 2007 4 81 82[ 2002 1 20 ] => 2002 4 83 84[ 2003 1 19 ] => 2003 4 85 86[ 2004 1 18 ] => 2004 4 87 88[ 2010 1 17 ] => 2010 4 89 90[ 2000 1 16 ] => 2000 4 91 92 93config 0 7 => 0 94 95[ 2006 1 1 ] => 2006 1 96 97[ 2006 1 2 ] => 2006 1 98 99[ 2006 1 7 ] => 2006 1 100 101[ 2006 1 8 ] => 2006 2 102 103[ 2006 12 30 ] => 2006 52 104 105[ 2006 12 31 ] => 2007 1 106 107[ 2009 1 1 ] => 2008 53 108 109[ 2009 1 2 ] => 2008 53 110 111[ 2009 1 3 ] => 2008 53 112 113[ 2009 1 4 ] => 2009 1 114 115"; 116 117$::ti->tests(func => \&test, 118 tests => $tests); 119$::ti->done_testing(); 120 121#Local Variables: 122#mode: cperl 123#indent-tabs-mode: nil 124#cperl-indent-level: 3 125#cperl-continued-statement-offset: 2 126#cperl-continued-brace-offset: 0 127#cperl-brace-offset: 0 128#cperl-brace-imaginary-offset: 0 129#cperl-label-offset: 0 130#End: 131