1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2017-07-27 12:10:41 +00:00
parent 819977e410
commit 0cb5fa5877
21 changed files with 329 additions and 461 deletions

View file

@ -65,6 +65,10 @@ describe "Numeric#step" do
describe "when no block is given" do
describe "returned Enumerator" do
describe "size" do
it "should return infinity_value when limit is nil" do
1.step(by: 42).size.should == infinity_value
end
it "should return infinity_value when step is 0" do
1.step(to: 5, by: 0).size.should == infinity_value
end
@ -73,13 +77,21 @@ describe "Numeric#step" do
1.step(to: 2, by: 0.0).size.should == infinity_value
end
it "should return infinity_value when the limit is Float::INFINITY" do
it "should return infinity_value when ascending towards a limit of Float::INFINITY" do
1.step(to: Float::INFINITY, by: 42).size.should == infinity_value
end
it "should return infinity_value when decending towards a limit of -Float::INFINITY" do
1.step(to: -Float::INFINITY, by: -42).size.should == infinity_value
end
it "should return 1 when the both limit and step are Float::INFINITY" do
1.step(to: Float::INFINITY, by: Float::INFINITY).size.should == 1
end
it "should return 1 when the both limit and step are -Float::INFINITY" do
1.step(to: -Float::INFINITY, by: -Float::INFINITY).size.should == 1
end
end
end
end