1#!/usr/bin/perl 2 3use warnings; 4use strict; 5use Test::Inter; 6$::ti = new Test::Inter $0; 7require "tests.pl"; 8 9our $obj = new Date::Manip::Date; 10$obj->config("forcedate","now,America/New_York"); 11 12sub test { 13 my($date,@test)=@_; 14 $obj->parse($date); 15 $obj->prev_business_day(@test); 16 my $ret = $obj->value(); 17 return $ret; 18} 19 20my $tests=" 21 22# August 2009 23# Su Mo Tu We Th Fr Sa 24# 1 25# 2 3 4 5 6 7 8 26# 9 10 11 12 13 14 15 27# 16 17 18 19 20 21 22 28# 23 24 25 26 27 28 29 29# 30 31 30 31#### Day 0, no timecheck 32 33'Aug 18 2009 12:00:00' 0 0 => 2009081812:00:00 34 35'Aug 18 2009 05:00:00' 0 0 => 2009081805:00:00 36 37'Aug 16 2009 12:00:00' 0 0 => 2009081712:00:00 38 39 40#### Day 0, timecheck 41 42'Aug 18 2009 12:00:00' 0 1 => 2009081812:00:00 43 44'Aug 18 2009 05:00:00' 0 1 => 2009081808:00:00 45 46'Aug 16 2009 12:00:00' 0 1 => 2009081708:00:00 47 48 49#### Day 2, no timecheck 50 51'Aug 18 2009 12:00:00' 2 0 => 2009081412:00:00 52 53'Aug 18 2009 05:00:00' 2 0 => 2009081405:00:00 54 55'Aug 16 2009 12:00:00' 2 0 => 2009081312:00:00 56 57 58#### Day 2, timecheck 59 60'Aug 18 2009 12:00:00' 2 1 => 2009081412:00:00 61 62'Aug 18 2009 05:00:00' 2 1 => 2009081408:00:00 63 64'Aug 16 2009 12:00:00' 2 1 => 2009081308:00:00 65 66 67"; 68 69$::ti->tests(func => \&test, 70 tests => $tests); 71$::ti->done_testing(); 72 73#Local Variables: 74#mode: cperl 75#indent-tabs-mode: nil 76#cperl-indent-level: 3 77#cperl-continued-statement-offset: 2 78#cperl-continued-brace-offset: 0 79#cperl-brace-offset: 0 80#cperl-brace-imaginary-offset: 0 81#cperl-label-offset: 0 82#End: 83