1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
mame 2012-11-15 13:50:55 +00:00
parent 768801b020
commit 412b023742
4 changed files with 23 additions and 9 deletions

View file

@ -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