Permalink
Browse files

[instants-and-durations.t] test Durations with integers to avoid occa…

…sional test failures due to FP errors
  • Loading branch information...
1 parent 1c3c6f7 commit ea701e84be132a668a20e215086d2b195d1ebcbe @moritz moritz committed Apr 17, 2011
Showing with 5 additions and 5 deletions.
  1. +5 −5 S02-builtin_data_types/instants-and-durations.t
@@ -1,7 +1,7 @@
use v6;
use Test;
-plan 13;
+plan 12;
# L<S02/Immutable types/'term now'>
@@ -17,16 +17,16 @@ isa_ok eval('now +300'), Instant, 'now is a term, not a function';
# L<S02/Immutable types/'you may not add two instants'>
{
- my $t0 = now;
- sleep 2;
- my $t1 = now;
+ my $t0 = Instant.from-posix(1295002122);
+
+ my $t1 = Instant.from-posix(1303059935);
+
my $d = $t1 - $t0;
ok $t0 < $t1, 'later Instants are greater';
dies_ok { $t0 + $t1 }, 'Instant + Instant is illegal';
isa_ok $d, Duration, 'Instant - Instant ~~ Duration';
ok $d ~~ Real, 'Durations are Real';
- ok 1 < +$d < 3, 'Instant subtraction yields sane results';
isa_ok $d + $t0, Instant, 'Instant + Duration ~~ Instant';
isa_ok $d + $t0, Instant, 'Duration + Instant ~~ Instant';
isa_ok $t0 - $d, Instant, 'Instant - Duration ~~ Instant';

0 comments on commit ea701e8

Please sign in to comment.