summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-15 13:50:55 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-15 13:50:55 +0000
commit412b023742171585b123cf20fcbb9b94476582ac (patch)
treef4839c7206cf01409fd0ebbe6bd06e2e5719388c /test
parent768801b020d2ec28af2bb719cadf5bc3c126c3d6 (diff)
* range.c (range_bsearch): fix some bugs: a documentation bug, a wrong
condition, missed break in switch/case, and workaround for GCC optimization. See [ruby-core:49364] in detail. A great patch from Heesob Park. [Bug #7352] [Feature #4766] * array.c (rb_ary_bsearch): fix similar bug (missed break). * test/ruby/test_range.rb: add two test cases for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_range.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb
index 0600f694f75..ca0e155f3dc 100644
--- a/test/ruby/test_range.rb
+++ b/test/ruby/test_range.rb
@@ -417,6 +417,9 @@ class TestRange < Test::Unit::TestCase
v = (-inf..0).bsearch {|x| x > -Float::MAX }
assert_operator(-Float::MAX, :<, v)
assert_equal(nil, v.infinite?)
+
+ assert_in_delta(1.0, (0.0..inf).bsearch {|x| Math.log(x) >= 0 })
+ assert_in_delta(7.0, (0.0..10).bsearch {|x| 7.0 - x })
end
def test_bsearch_for_bignum