diff options
author | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-21 00:03:39 +0000 |
---|---|---|
committer | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-21 00:03:39 +0000 |
commit | 09b3d38c724f8e12efe69ea5ee0942335b100764 (patch) | |
tree | 2e90bae85522063c406827b2c6791c6c18943e83 /test/ruby/test_arithmetic_sequence.rb | |
parent | ccdba542d3f765895a23f32fd2905add935b7a19 (diff) |
enumerator.c: Fix airth_seq_each for Rational
Fix the wrong uses of rb_int_ge in arith_seq_each.
[ruby-core:90648] [Bug #15444]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_arithmetic_sequence.rb')
-rw-r--r-- | test/ruby/test_arithmetic_sequence.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_arithmetic_sequence.rb b/test/ruby/test_arithmetic_sequence.rb index f4f47ea7a8..3a353adba9 100644 --- a/test/ruby/test_arithmetic_sequence.rb +++ b/test/ruby/test_arithmetic_sequence.rb @@ -228,6 +228,12 @@ class TestArithmeticSequence < Test::Unit::TestCase assert_equal([10.0, 8.0, 6.0, 4.0, 2.0], (10.0..1.0).step(-2.0).to_a) end + def test_to_a_bug15444 + seq = ((1/10r)..(1/2r)).step(1/10r) + assert_num_equal_type([1/10r, 1/5r, 3/10r, 2/5r, 1/2r], seq.to_a, + '[ruby-core:90648] [Bug #15444]') + end + def test_slice seq = 1.step(10, 2) assert_equal([[1, 3, 5], [7, 9]], seq.each_slice(3).to_a) @@ -284,6 +290,14 @@ class TestArithmeticSequence < Test::Unit::TestCase [10, 8, 6, 4, 2].each do |i| assert_equal(i, seq.next) end + + seq = ((1/10r)..(1/2r)).step(0) + assert_equal(1/10r, seq.next) + end + + def test_next_bug15444 + seq = ((1/10r)..(1/2r)).step(1/10r) + assert_equal(1/10r, seq.next, '[ruby-core:90648] [Bug #15444]') end def test_next_rewind |