Skip to content

Commit

Permalink
Make Integer#round spec work regardless of pointer size
Browse files Browse the repository at this point in the history
The spec is actually testing a behaviour stemming from NUM2INT(), and
since `sizeof(long)>=sizeof(int)`, `min_long-1` always makes NUM2INT()
raise `RangeError`.
  • Loading branch information
XrXr committed Jul 23, 2024
1 parent 40adc63 commit fddb332
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions spec/ruby/core/integer/round_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
(-25 * 10**70).round(-71).should eql(-30 * 10**70)
end

platform_is_not wordsize: 32 do
it "raises a RangeError when passed a big negative value" do
-> { 42.round(fixnum_min) }.should raise_error(RangeError)
end
it "raises a RangeError when passed a big negative value" do
-> { 42.round(min_long - 1) }.should raise_error(RangeError)
end

it "raises a RangeError when passed Float::INFINITY" do
Expand Down

0 comments on commit fddb332

Please sign in to comment.