Skip to content

Commit

Permalink
Add specs for [Bug #20654]
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzhu2118 authored and eregon committed Jul 28, 2024
1 parent ddef3c0 commit 1bd7ae7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/integer/shared/integer_ceil_precision.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,12 @@
send(@method, -123).ceil(-2).should.eql?(-100)
send(@method, -123).ceil(-3).should.eql?(0)
end

ruby_bug "#20654", ""..."3.4" do
it "returns 10**precision.abs when precision.abs is larger than the number digits of self" do
send(@method, 123).ceil(-20).should.eql?(100000000000000000000)
send(@method, 123).ceil(-50).should.eql?(100000000000000000000000000000000000000000000000000)
end
end
end
end
7 changes: 7 additions & 0 deletions core/integer/shared/integer_floor_precision.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,12 @@
send(@method, -123).floor(-2).should.eql?(-200)
send(@method, -123).floor(-3).should.eql?(-1000)
end

ruby_bug "#20654", ""..."3.4" do
it "returns -(10**precision.abs) when self is negative and precision.abs is larger than the number digits of self" do
send(@method, -123).floor(-20).should.eql?(-100000000000000000000)
send(@method, -123).floor(-50).should.eql?(-100000000000000000000000000000000000000000000000000)
end
end
end
end

0 comments on commit 1bd7ae7

Please sign in to comment.