1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-06-27 21:02:36 +02:00
parent c940397116
commit d80e44deec
157 changed files with 581 additions and 543 deletions

View file

@ -67,12 +67,15 @@ describe "Integer#round" do
25.round(-1, half: :up).should eql(30)
25.round(-1, half: :down).should eql(20)
25.round(-1, half: :even).should eql(20)
25.round(-1, half: nil).should eql(30)
35.round(-1, half: :up).should eql(40)
35.round(-1, half: :down).should eql(30)
35.round(-1, half: :even).should eql(40)
35.round(-1, half: nil).should eql(40)
(-25).round(-1, half: :up).should eql(-30)
(-25).round(-1, half: :down).should eql(-20)
(-25).round(-1, half: :even).should eql(-20)
(-25).round(-1, half: nil).should eql(-30)
end
ruby_version_is "2.4"..."2.5" do
@ -90,4 +93,9 @@ describe "Integer#round" do
35.round(1, half: :even).should eql(35)
end
end
it "raises ArgumentError for an unknown rounding mode" do
lambda { 42.round(-1, half: :foo) }.should raise_error(ArgumentError, /invalid rounding mode: foo/)
lambda { 42.round(1, half: :foo) }.should raise_error(ArgumentError, /invalid rounding mode: foo/)
end
end