| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | use warnings; |
| 4 | use strict; |
| 5 | use Test::Inter; |
| 6 | $::ti = new Test::Inter $0; |
| 7 | require "tests-dm5.pl"; |
| 8 | |
| 9 | Date_Init("TZ=EST"); |
| 10 | |
| 11 | my $tests=" |
| 12 | |
| 13 | # Test weeks |
| 14 | |
| 15 | '+ 4 week 3 day' => +0:0:4:3:0:0:0 |
| 16 | |
| 17 | '+ 4 wk 3 day 20:30' => +0:0:4:3:0:20:30 |
| 18 | |
| 19 | '+ 15mn' => +0:0:0:0:0:15:0 |
| 20 | |
| 21 | '+ 15 mn' => +0:0:0:0:0:15:0 |
| 22 | |
| 23 | '15 mn' => +0:0:0:0:0:15:0 |
| 24 | |
| 25 | '+15 mn' => +0:0:0:0:0:15:0 |
| 26 | |
| 27 | +15mn => +0:0:0:0:0:15:0 |
| 28 | |
| 29 | '+ 35 y 10 month 15mn' => +35:10:0:0:0:15:0 |
| 30 | |
| 31 | '+ 35 y 10m15mn' => +35:10:0:0:0:15:0 |
| 32 | |
| 33 | '+ 35year 10:0:0:0:15:0' => +35:10:0:0:0:15:0 |
| 34 | |
| 35 | '+ 35 y -10 month 15mn' => +34:2:-0:0:0:15:0 |
| 36 | |
| 37 | +35:-10:0:0:0:15:0 => +34:2:-0:0:0:15:0 |
| 38 | |
| 39 | '+ 35 y10 month12:40' => +35:10:0:0:0:12:40 |
| 40 | |
| 41 | '+35 y 10 month 1:12:40' => +35:10:0:0:1:12:40 |
| 42 | |
| 43 | '+35x 10 month' => '' |
| 44 | |
| 45 | '+ 35 y -10 month 1:12:40' => +34:2:-0:0:1:12:40 |
| 46 | |
| 47 | 1:2:3:4:5:6:7 => +1:2:3:4:5:6:7 |
| 48 | |
| 49 | 'in 1:2:3:4:5:6:7' => +1:2:3:4:5:6:7 |
| 50 | |
| 51 | '1:2:3:4:5:6:7 ago' => -1:2:3:4:5:6:7 |
| 52 | |
| 53 | -1:2:3:4:5:6:7 => -1:2:3:4:5:6:7 |
| 54 | |
| 55 | 1::3:4:5:6:7ago => -1:0:3:4:5:6:7 |
| 56 | |
| 57 | # Test normalization of deltas |
| 58 | |
| 59 | +1:+1:+1:+1 => +0:0:0:1:1:1:1 |
| 60 | |
| 61 | +1:+1:+1:-1 => +0:0:0:1:1:0:59 |
| 62 | |
| 63 | +1:+1:-1:+1 => +0:0:0:1:0:59:1 |
| 64 | |
| 65 | +1:-1:+1:+1 => +0:0:0:0:23:1:1 |
| 66 | |
| 67 | +1:+1:-1:-1 => +0:0:0:1:0:58:59 |
| 68 | |
| 69 | +1:-1:+1:-1 => +0:0:0:0:23:0:59 |
| 70 | |
| 71 | +1:-1:-1:+1 => +0:0:0:0:22:59:1 |
| 72 | |
| 73 | -0:1:+0:0:0:0:0 => -0:1:0:0:0:0:0 |
| 74 | |
| 75 | -0:0:1:+0:-0:0:0 => -0:0:1:0:0:0:0 |
| 76 | "; |
| 77 | |
| 78 | $::ti->tests(func => \&ParseDateDelta, |
| 79 | tests => $tests); |
| 80 | $::ti->done_testing(); |
| 81 | |
| 82 | #Local Variables: |
| 83 | #mode: cperl |
| 84 | #indent-tabs-mode: nil |
| 85 | #cperl-indent-level: 3 |
| 86 | #cperl-continued-statement-offset: 2 |
| 87 | #cperl-continued-brace-offset: 0 |
| 88 | #cperl-brace-offset: 0 |
| 89 | #cperl-brace-imaginary-offset: 0 |
| 90 | #cperl-label-offset: 0 |
| 91 | #End: |