| 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 | |
| 15 | my $err = $obj->set(@test); |
| 16 | if ($err) { |
| 17 | return $obj->err(); |
| 18 | } else { |
| 19 | my $val = $obj->value(); |
| 20 | return $val; |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | my $tests=" |
| 25 | |
| 26 | delta [ 0 0 0 0 10 20 30 ] => 0:0:0:0:10:20:30 |
| 27 | |
| 28 | delta [ 0 0 0 0 10 20 30 ] nonormalize => 0:0:0:0:10:20:30 |
| 29 | |
| 30 | delta [ -10 20 30 ] => 0:0:0:0:-9:39:30 |
| 31 | |
| 32 | delta [ -10 20 30 ] nonormalize => 0:0:0:0:-10:+20:30 |
| 33 | |
| 34 | delta [ 10 -70 -130 +90 ] => 0:0:0:6:23:51:30 |
| 35 | |
| 36 | delta [ 10 -70 -130 +90 ] nonormalize => 0:0:0:10:-70:130:+90 |
| 37 | |
| 38 | delta [ 1 13 2 10 -70 -130 90 ] => 2:1:2:6:23:51:30 |
| 39 | |
| 40 | # |
| 41 | |
| 42 | business [ 0 0 0 0 10 20 30 ] => 0:0:0:1:1:20:30 |
| 43 | |
| 44 | business [ 0 0 0 0 10 20 30 ] nonormalize => 0:0:0:0:10:20:30 |
| 45 | |
| 46 | business [ 1 13 2 10 -70 -130 90 ] => 2:1:2:1:8:51:30 |
| 47 | |
| 48 | # |
| 49 | |
| 50 | standard [ 1 13 2 10 -70 -130 90 ] nonormalize => 1:13:2:10:-70:130:+90 |
| 51 | |
| 52 | m 25 nonormalize => 1:13:2:10:-70:+25:90 |
| 53 | |
| 54 | m -135 => 2:1:2:6:23:46:30 |
| 55 | |
| 56 | # |
| 57 | |
| 58 | standard [ 1 13 2 10 -70 -130 90 ] nonormalize => 1:13:2:10:-70:130:+90 |
| 59 | |
| 60 | M 14 => 2:2:2:6:23:51:30 |
| 61 | |
| 62 | "; |
| 63 | |
| 64 | $::ti->tests(func => \&test, |
| 65 | tests => $tests); |
| 66 | $::ti->done_testing(); |
| 67 | |
| 68 | #Local Variables: |
| 69 | #mode: cperl |
| 70 | #indent-tabs-mode: nil |
| 71 | #cperl-indent-level: 3 |
| 72 | #cperl-continued-statement-offset: 2 |
| 73 | #cperl-continued-brace-offset: 0 |
| 74 | #cperl-brace-offset: 0 |
| 75 | #cperl-brace-imaginary-offset: 0 |
| 76 | #cperl-label-offset: 0 |
| 77 | #End: |