Skip to content

Commit

Permalink
no floating point drifts in degenerate Ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Oct 13, 2017
1 parent bcaaad4 commit bfc143e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion S02-types/range.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 190;
plan 191;

# basic Range
# L<S02/Immutable types/A pair of Ordered endpoints>
Expand Down Expand Up @@ -441,4 +441,20 @@ subtest 'no .int-bounds for Infs and NaN as Range endpoints' => {
'Range.new with wrong args does not claim it takes only named args';
}

# RT #125336
subtest 'no floating point drifts in degenerate Ranges' => {
plan 3;
(NaN..NaN).map: {
next unless $++ > 1050;
is-deeply $_, NaN, 'NaN..NaN range keeps producing NaN ad infinitum';
last;
}
(-Inf..0).map: {
next unless $++ > 1050;
is-deeply $_, -Inf, '-Inf..Inf range keeps producing -Inf ad infinitum';
last;
}
is-deeply (Inf..0).elems, 0, 'Inf..0 Range has zero elems'
}

# vim:set ft=perl6

0 comments on commit bfc143e

Please sign in to comment.