mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 22:14:37 +02:00
* range.c: Support for range.step.size
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
28d8bf902d
commit
faed90d814
2 changed files with 30 additions and 1 deletions
|
@ -536,6 +536,12 @@ class TestEnumerator < Test::Unit::TestCase
|
|||
assert_equal 1, 42.step(Float::INFINITY, Float::INFINITY).size
|
||||
assert_equal 14, 0.1.step(4.2, 0.3).size
|
||||
assert_equal Float::INFINITY, 42.step(Float::INFINITY, 2).size
|
||||
|
||||
assert_equal 10, (1..10).step.size
|
||||
assert_equal 4, (1..10).step(3).size
|
||||
assert_equal 3, (1...10).step(3).size
|
||||
assert_equal Float::INFINITY, (42..Float::INFINITY).step(2).size
|
||||
assert_raise(ArgumentError){ (1..10).step(-2).size }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue