| 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 | my $obj = new Date::Manip::Delta; |
| 10 | $obj->config("forcedate","now,America/New_York"); |
| 11 | |
| 12 | sub test { |
| 13 | my(@test)=@_; |
| 14 | my $err = $obj->set(@test); |
| 15 | if ($err) { |
| 16 | return $obj->err(); |
| 17 | } else { |
| 18 | my @val = $obj->value(); |
| 19 | return @val; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | my $tests=" |
| 24 | |
| 25 | delta [ 0 0 0 0 10 20 30 ] => 0 0 0 0 10 20 30 |
| 26 | |
| 27 | delta [ 0 0 0 0 10 20 30 ] nonormalize => 0 0 0 0 10 20 30 |
| 28 | |
| 29 | delta [ 10 20 30 ] => 0 0 0 0 10 20 30 |
| 30 | |
| 31 | delta [ 10 20 30 ] nonormalize => 0 0 0 0 10 20 30 |
| 32 | |
| 33 | delta [ -10 20 30 ] => 0 0 0 0 -9 -39 -30 |
| 34 | |
| 35 | delta [ -10 20 30 ] nonormalize => 0 0 0 0 -10 20 30 |
| 36 | |
| 37 | delta [ 10 -70 -130 +90 ] => 0 0 0 6 23 51 30 |
| 38 | |
| 39 | delta [ 10 -70 -130 +90 ] nonormalize => 0 0 0 10 -70 -130 90 |
| 40 | |
| 41 | delta [ 1 13 2 10 -70 -130 90 ] => 2 1 2 6 23 51 30 |
| 42 | |
| 43 | # |
| 44 | |
| 45 | business [ 0 0 0 0 6 20 30 ] => 0 0 0 0 6 20 30 |
| 46 | |
| 47 | business [ 0 0 0 0 10 20 30 ] nonormalize => 0 0 0 0 10 20 30 |
| 48 | |
| 49 | business [ 0 0 0 3 10 20 30 ] => 0 0 0 4 1 20 30 |
| 50 | |
| 51 | business [ 1 13 2 10 -70 -130 90 ] => 2 1 2 1 8 51 30 |
| 52 | |
| 53 | # |
| 54 | |
| 55 | standard [ 1 13 2 10 -70 -130 90 ] nonormalize => 1 13 2 10 -70 -130 90 |
| 56 | |
| 57 | m 25 nonormalize => 1 13 2 10 -70 25 90 |
| 58 | |
| 59 | m -135 => 2 1 2 6 23 46 30 |
| 60 | |
| 61 | # |
| 62 | |
| 63 | standard [ 1 13 2 10 -70 -130 90 ] nonormalize => 1 13 2 10 -70 -130 90 |
| 64 | |
| 65 | M 14 => 2 2 2 6 23 51 30 |
| 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: |