| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | use warningsscip-perl cpan Date-Manip 6.99 warnings/; |
| 4 | use strictscip-perl cpan Date-Manip 6.99 strict/; |
| 5 | use Test::Interscip-perl cpan Date-Manip 6.99 Test/Inter/; |
| 6 | $::tiscip-perl cpan Date-Manip 6.99 main/`$::ti`. = new Test::Inter $0scip-perl cpan Date-Manip 6.99 main/$0.; |
| 7 | requirescip-perl cpan Date-Manip 6.99 main/require(). "tests.pl"; |
| 8 | |
| 9 | our $dmtscip-perl cpan Date-Manip 6.99 main/$dmt. = new Date::Manip::TZ; |
| 10 | our $objscip-perl cpan Date-Manip 6.99 main/$obj. = $dmtscip-perl cpan Date-Manip 6.99 main/$dmt.->basescip-perl cpan Date-Manip 6.99 main/base().(); |
| 11 | $dmtscip-perl cpan Date-Manip 6.99 main/$dmt.->configscip-perl cpan Date-Manip 6.99 main/config().("forcedate","now,America/New_York"); |
| 12 | |
| 13 | sub testscip-perl cpan Date-Manip 6.99 main/test(). { |
| 14 | my(@test)=@_scip-perl cpan Date-Manip 6.99 main/`@_`.; |
| 15 | my @ret = $objscip-perl cpan Date-Manip 6.99 main/$obj.->day_of_yearscip-perl cpan Date-Manip 6.99 main/day_of_year().(@test); |
| 16 | foreach my $ret (@ret) { |
| 17 | if (refscip-perl cpan Date-Manip 6.99 main/ref().($ret)) { |
| 18 | foreach my $val (@$ret) { |
| 19 | if ($val =~ /\./) { |
| 20 | $val = sprintfscip-perl cpan Date-Manip 6.99 main/sprintf().("%.2f",$val); |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | } elsif ($ret =~ /\./) { |
| 25 | $ret = sprintfscip-perl cpan Date-Manip 6.99 main/sprintf().("%.2f",$ret); |
| 26 | } |
| 27 | } |
| 28 | return @ret; |
| 29 | } |
| 30 | |
| 31 | my $tests=" |
| 32 | |
| 33 | 1997 10 => [ 1997 1 10 ] |
| 34 | |
| 35 | [ 1997 1 10 ] => 10 |
| 36 | |
| 37 | |
| 38 | 1997 10.5 => [ 1997 1 10 12 0 0 ] |
| 39 | |
| 40 | [ 1997 1 10 12 0 0 ] => 10.50 |
| 41 | |
| 42 | |
| 43 | 1997 10.510763888888889 => [ 1997 1 10 12 15 30.00 ] |
| 44 | |
| 45 | [ 1997 1 10 12 15 30.00 ] => 10.51 |
| 46 | |
| 47 | 1997 10.510770138888889 => [ 1997 1 10 12 15 30.54 ] |
| 48 | |
| 49 | [ 1997 1 10 12 15 30.54 ] => 10.51 |
| 50 | |
| 51 | |
| 52 | 2000 31 => [ 2000 1 31 ] |
| 53 | |
| 54 | 2000 31.5 => [ 2000 1 31 12 0 0 ] |
| 55 | |
| 56 | 2000 31.0 => [ 2000 1 31 0 0 0 ] |
| 57 | |
| 58 | 2000 32 => [ 2000 2 1 ] |
| 59 | |
| 60 | "; |
| 61 | |
| 62 | $::tiscip-perl cpan Date-Manip 6.99 main/`$::ti`.->testsscip-perl cpan Date-Manip 6.99 main/tests().(func => \&testscip-perl cpan Date-Manip 6.99 main/test()., |
| 63 | tests => $tests); |
| 64 | $::tiscip-perl cpan Date-Manip 6.99 main/`$::ti`.->done_testingscip-perl cpan Date-Manip 6.99 main/done_testing().(); |
| 65 | |
| 66 | #Local Variables: |
| 67 | #mode: cperl |
| 68 | #indent-tabs-mode: nil |
| 69 | #cperl-indent-level: 3 |
| 70 | #cperl-continued-statement-offset: 2 |
| 71 | #cperl-continued-brace-offset: 0 |
| 72 | #cperl-brace-offset: 0 |
| 73 | #cperl-brace-imaginary-offset: 0 |
| 74 | #cperl-label-offset: 0 |
| 75 | #End: |