summaryrefslogtreecommitdiff
path: root/test/ruby/test_numeric.rb
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-10 17:24:24 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-10 17:24:24 +0000
commit00e41e7174f2ae3e280c23b8056f24ae1b85b8dc (patch)
tree1e825f6a823700b80df7622d63bdc752ec8fbdfd /test/ruby/test_numeric.rb
parentdcdf8e1c858fd427ea8d20d8641c9827654c977a (diff)
merge revision(s) r45207,r45208,r45209,r45210: [Backport #9575]
* numeric.c: Create var for rb_intern("<=>") * numeric.c: Fix Numeric#step with 0 unit [Bug #9575] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 f3fc663377..f5e97afec0 100644
--- a/test/ruby/test_numeric.rb
+++ b/test/ruby/test_numeric.rb
@@ -267,6 +267,7 @@ class TestNumeric < Test::Unit::TestCase
assert_step [], [2, 1, 3]
assert_step [], [-2, -1, -3]
assert_step [3, 3, 3, 3], [3, by: 0], inf: true
+ assert_step [3, 3, 3, 3], [3, by: 0, to: 42], inf: true
assert_step [10], [10, 1, -bignum]
assert_step [], [1, 0, Float::INFINITY]
@@ -276,6 +277,19 @@ class TestNumeric < Test::Unit::TestCase
assert_step [10, 11, 12, 13], [10], inf: true
assert_step [10, 9, 8, 7], [10, by: -1], inf: true
assert_step [10, 9, 8, 7], [10, by: -1, to: nil], inf: true
+
+ assert_step [42, 42, 42, 42], [42, by: 0, to: -Float::INFINITY], inf: true
+ assert_step [42, 42, 42, 42], [42, by: 0, to: 42.5], inf: true
+ assert_step [4.2, 4.2, 4.2, 4.2], [4.2, by: 0.0], inf: true
+ assert_step [4.2, 4.2, 4.2, 4.2], [4.2, by: -0.0], inf: true
+ assert_step [42.0, 42.0, 42.0, 42.0], [42, by: 0.0, to: 44], inf: true
+ assert_step [42.0, 42.0, 42.0, 42.0], [42, by: 0.0, to: 0], inf: true
+ assert_step [42.0, 42.0, 42.0, 42.0], [42, by: -0.0, to: 44], inf: true
+
+ assert_step [bignum]*4, [bignum, by: 0], inf: true
+ assert_step [bignum]*4, [bignum, by: 0.0], inf: true
+ assert_step [bignum]*4, [bignum, by: 0, to: bignum+1], inf: true
+ assert_step [bignum]*4, [bignum, by: 0, to: 0], inf: true
end
def test_num2long