Skip to content

Commit

Permalink
t/05-diff.t: add a couple of tests for negative diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
pink-mist committed Nov 1, 2016
1 parent 09e4906 commit e5df626
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion t/05-diff.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use strict;
use warnings;

use Test::More tests => 31;
use Test::More tests => 35;

use Time::D;
use Time::C;
Expand Down Expand Up @@ -34,6 +34,12 @@ is ($d->to_string(3), "in 1 year, 1 month, and 1 day", "correct ->to_string(3)")
is ($d->to_string(4), "in 1 year, 1 month, 1 day, and 5 hours", "correct ->to_string(4)");
is ($d->to_string(5), "in 1 year, 1 month, 1 day, 5 hours, and 10 minutes", "correct ->to_string(5)");
is ($d->to_string(6), "in 1 year, 1 month, 1 day, 5 hours, 10 minutes, and 10 seconds", "correct ->to_string(6)");
is (Time::C->gmtime($d->comp), "1971-02-02T05:10:10Z", "correct time from ->comp");
$d->sign = '-';
is ($d->to_string(6), "1 year, 1 month, 2 days, 5 hours, 10 minutes, and 10 seconds ago", "correct ->to_string(6) after sign change");
is (Time::C->gmtime($d->comp), "1968-11-29T18:49:50Z", "correct time from ->comp after sign change");
$d->years = 0;
is ($d->to_string(6), "1 month, 2 days, 5 hours, 10 minutes, and 10 seconds ago", "correct ->to_string(6) after setting ->years = 0");

my $t_base = Time::C->new(2016,10,10,12,0,0);
my $t_after = Time::C->new(2017,10,13,12,15,0);
Expand Down

0 comments on commit e5df626

Please sign in to comment.