1#!/usr/bin/perl 2 3use warnings; 4use strict; 5use Test::Inter; 6$::ti = new Test::Inter $0; 7require "tests.pl"; 8 9my $obj = new Date::Manip::Delta; 10$obj->config("forcedate","now,America/New_York"); 11 12sub test { 13 my($delta,@test)=@_; 14 $obj->parse($delta); 15 return $obj->printf(@test); 16} 17 18my $tests=" 19 201:2:3:4:5:6:7 21'|A %% B|' 22 => 23 '|A % B|' 24 251:2:3:4:5:6:7 26'|Month: %Mv|' 27 => 28 '|Month: 2|' 29 301:2:3:4:5:6:7 31'|Day: %+05dv|' 32 => 33 '|Day: +0004|' 34 351:2:3:4:5:6:7 36'|Day: %+<5dv|' 37 => 38 '|Day: +4|' 39 401:2:3:4:5:6:7 41'|Day: %>5sv|' 42 => 43 '|Day: 7 |' 44 451:2:3:4:5:6:7 46'|%yv %Mv %wv %dv %hv %mv %sv|' 47 => 48 '|1 2 3 4 5 6 7|' 49 501:2:3:4:5:6:7 51'|%.4yyM %.4MMM %.4wws %.4dds %.4hhs %.4mms %.4sss|' 52 => 53 '|1.1667 2.0000 3.6018 4.2126 5.1019 6.1167 7.0000|' 54 551:2:3:4:5:6:7 56'|%.4Myw|' 57 => 58 '|14.6900|' 59 601:2:3:4:5:6:7 61'|%yyy %MyM %www %dwd %hwh %mwm %sws|' 62 => 63 '|1 14 3 25 605 36306 2178367|' 64 651:2:3:4:5:6:7 66'|%.4yyM %.4MyM %.4wws %.4dws %.4hws %.4mws %.4sws|' 67 => 68 '|1.1667 14.0000 3.6018 25.2126 605.1019 36306.1167 2178367.0000|' 69 701:2:3:4:5:6:7 71'|%>8.3yyM %>8.3MyM %>8.3wws %>8.3dws %>8.3hws %>8.3mws %>8.3sws|' 72 => 73 '|1.167 14.000 3.602 25.213 605.102 36306.117 2178367.000|' 74 751:2:3:4:5:6:7 76'|%<8.3yyM %<8.3MyM %<8.3wws %<8.3dws %<8.3hws %<8.3mws %<8.3sws|' 77 => 78 '| 1.167 14.000 3.602 25.213 605.102 36306.117 2178367.000|' 79 801:2:3:4:5:6:7 81'|%08.3yyM %08.3MyM %08.3wws %08.3dws %08.3hws %08.3mws %08.3sws|' 82 => 83 '|0001.167 0014.000 0003.602 0025.213 0605.102 36306.117 2178367.000|' 84 851:2:3:4:5:6:7 86'|%+<8.3yyM %+<8.3MyM %+<8.3wws %+<8.3dws %+<8.3hws %+<8.3mws %+<8.3sws|' 87 => 88 '| +1.167 +14.000 +3.602 +25.213 +605.102 +36306.117 +2178367.000|' 89 901:2:3:4:5:6:7 91'|%+08.3yyM %+08.3MyM %+08.3wws %+08.3dws %+08.3hws %+08.3mws %+08.3sws|' 92 => 93 '|+001.167 +014.000 +003.602 +025.213 +605.102 +36306.117 +2178367.000|' 94 951:2:3:4:5:6:7 96'|%.4yys %.4MMs %.4wws %.4dds %.4hhs %.4mms %.4sss|' 97 => 98 '|1.2357 2.8284 3.6018 4.2126 5.1019 6.1167 7.0000|' 99 1001:2:3:4:5:6:7 101'|%.3yyy %.3MyM %.3wyw %.3dyd %.3hyh %.3mym %.3sys|' 102 => 103 '|1.000 14.000 63.874 451.116 10831.790 649913.400 38994811.000|' 104 1051:2:3:4:5:6:7 106'|%.4yys %.4Mys %.4wys %.4dys %.4hys %.4mys %.4sys|' 107 => 108 '|1.2357 14.8284 64.4755 451.3288 10831.8919 649913.5167 38994811.0000|' 109 110'1:2:3:4:5:6:7 business' 111'|%.4yys %.4Mys %.4wys %.4dys %.4hys %.4mys %.4sys|' 112 => 113 '|1.2417 14.9000 64.7871 323.9356 2915.4207 174925.2417 10495514.5000|' 114 1151:2:3:4:5:6:0 116'|%Dt|' 117 => 118 '|+1:2:+3:4:+5:6:0|' 119 120'1:2:3:4:5:6:0 business' 121'|%Dt|' 122 => 123 '|+1:2:+3:+4:5:6:0|' 124 125-1:2:3:4:5:6:0 126'|%Dt|' 127 => 128 '|-1:2:-3:4:-5:6:0|' 129 1301:2:3:4:5:6:0 131'|%+Dt|' 132 => 133 '|+1:+2:+3:+4:+5:+6:+0|' 134 135-1:2:3:4:5:6:0 136'|%+Dt|' 137 => 138 '|-1:-2:-3:-4:-5:-6:-0|' 139 1401:2:3:4:5:6:0 141'|%Dyy|' 142 => 143 '|+1|' 144 1451:2:3:4:5:6:0 146'|%DyM|' 147 => 148 '|+1:2|' 149 1501:2:3:4:5:6:0 151'|%Dyd|' 152 => 153 '|+1:2:+3:4|' 154 155'1:2:3:4:5:6:0 business' 156'|%Dyy|' 157 => 158 '|+1|' 159 160'1:2:3:4:5:6:0 business' 161'|%DyM|' 162 => 163 '|+1:2|' 164 165'1:2:3:4:5:6:0 business' 166'|%Dyd|' 167 => 168 '|+1:2:+3:+4|' 169 1701:2:3:4:5:6:0 171'|%+Dyd|' 172 => 173 '|+1:+2:+3:+4|' 174 1751:2:3:4:5:6:0 176'|%+>10Dyd|' 177 => 178 '|+1:+2:+3:+4|' 179 1801:2:3:4:5:6:0 181'|%+>18Dyd|' 182 => 183 '|+1:+2:+3:+4 |' 184 1851:2:3:4:5:6:0 186'|%+18Dyd|' 187 => 188 '| +1:+2:+3:+4|' 189 1901:2:3:4:5:6:0 191'|%+<18Dyd|' 192 => 193 '| +1:+2:+3:+4|' 194 1951:2:3:4:5:6:0 %DyM %Dyd %Dyy => +1:2 +1:2:+3:4 +1 196 1970:0:0:0:-720:0:0 198'|%Dt|' 199 => 200 '|+0:0:+0:0:-720:0:0|' 201 202'1:2:3:4:5:6:7' 203'|%Ddm|' 204 => 205 '|+4:+5:6|' 206 207'1:2:3:4:5:6:7 business' 208'|%Dhm|' 209 => 210 '|+5:6|' 211"; 212 213$::ti->tests(func => \&test, 214 tests => $tests); 215$::ti->done_testing(); 216 217#Local Variables: 218#mode: cperl 219#indent-tabs-mode: nil 220#cperl-indent-level: 3 221#cperl-continued-statement-offset: 2 222#cperl-continued-brace-offset: 0 223#cperl-brace-offset: 0 224#cperl-brace-imaginary-offset: 0 225#cperl-label-offset: 0 226#End: 227