Skip to content

Commit ea701e8

Browse files
committed
[instants-and-durations.t] test Durations with integers to avoid occasional test failures due to FP errors
1 parent 1c3c6f7 commit ea701e8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

S02-builtin_data_types/instants-and-durations.t

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use v6;
22
use Test;
33

4-
plan 13;
4+
plan 12;
55

66
# L<S02/Immutable types/'term now'>
77

@@ -17,16 +17,16 @@ isa_ok eval('now +300'), Instant, 'now is a term, not a function';
1717
# L<S02/Immutable types/'you may not add two instants'>
1818

1919
{
20-
my $t0 = now;
21-
sleep 2;
22-
my $t1 = now;
20+
my $t0 = Instant.from-posix(1295002122);
21+
22+
my $t1 = Instant.from-posix(1303059935);
23+
2324
my $d = $t1 - $t0;
2425

2526
ok $t0 < $t1, 'later Instants are greater';
2627
dies_ok { $t0 + $t1 }, 'Instant + Instant is illegal';
2728
isa_ok $d, Duration, 'Instant - Instant ~~ Duration';
2829
ok $d ~~ Real, 'Durations are Real';
29-
ok 1 < +$d < 3, 'Instant subtraction yields sane results';
3030
isa_ok $d + $t0, Instant, 'Instant + Duration ~~ Instant';
3131
isa_ok $d + $t0, Instant, 'Duration + Instant ~~ Instant';
3232
isa_ok $t0 - $d, Instant, 'Instant - Duration ~~ Instant';

0 commit comments

Comments
 (0)