summaryrefslogtreecommitdiff
path: root/test/ruby/test_numeric.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_numeric.rb')
-rw-r--r--test/ruby/test_numeric.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_numeric.rb b/test/ruby/test_numeric.rb
index e48c3448e8..f48bce5411 100644
--- a/test/ruby/test_numeric.rb
+++ b/test/ruby/test_numeric.rb
@@ -339,6 +339,20 @@ class TestNumeric < Test::Unit::TestCase
assert_step [bignum]*4, [bignum, by: 0, to: 0], inf: true
end
+ def test_step_bug15537
+ assert_step [10.0, 8.0, 6.0, 4.0, 2.0], [10.0, 1, -2]
+ assert_step [10.0, 8.0, 6.0, 4.0, 2.0], [10.0, to: 1, by: -2]
+ assert_step [10.0, 8.0, 6.0, 4.0, 2.0], [10.0, 1, -2]
+ assert_step [10.0, 8.0, 6.0, 4.0, 2.0], [10, to: 1.0, by: -2]
+ assert_step [10.0, 8.0, 6.0, 4.0, 2.0], [10, 1.0, -2]
+
+ assert_step [10.0, 9.0, 8.0, 7.0], [10, by: -1.0], inf: true
+ assert_step [10.0, 9.0, 8.0, 7.0], [10, by: -1.0, to: nil], inf: true
+ assert_step [10.0, 9.0, 8.0, 7.0], [10, nil, -1.0], inf: true
+ assert_step [10.0, 9.0, 8.0, 7.0], [10.0, by: -1], inf: true
+ assert_step [10.0, 9.0, 8.0, 7.0], [10.0, nil, -1], inf: true
+ end
+
def test_num2long
assert_raise(TypeError) { 1 & nil }
assert_raise(TypeError) { 1 & 1.0 }