mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 09:04:05 +02:00
move duplicate assertions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
45e3b48be5
commit
b9fe5948f3
3 changed files with 14 additions and 22 deletions
|
@ -3,9 +3,6 @@ require 'test/unit'
|
|||
require 'objspace'
|
||||
|
||||
class TestRubyOptimization < Test::Unit::TestCase
|
||||
FIXNUM_MAX = Integer::FIXNUM_MAX
|
||||
FIXNUM_MIN = Integer::FIXNUM_MIN
|
||||
|
||||
def assert_redefine_method(klass, method, code, msg = nil)
|
||||
assert_separately([], <<-"end;")# do
|
||||
class #{klass}
|
||||
|
@ -23,20 +20,11 @@ class TestRubyOptimization < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_fixnum_plus
|
||||
a, b = 1, 2
|
||||
assert_equal 3, a + b
|
||||
assert_fixnum FIXNUM_MAX
|
||||
assert_bignum FIXNUM_MAX + 1
|
||||
|
||||
assert_equal 21, 10 + 11
|
||||
assert_redefine_method('Integer', '+', 'assert_equal 11, 10 + 11')
|
||||
end
|
||||
|
||||
def test_fixnum_minus
|
||||
assert_equal 5, 8 - 3
|
||||
assert_fixnum FIXNUM_MIN
|
||||
assert_bignum FIXNUM_MIN - 1
|
||||
|
||||
assert_equal 5, 8 - 3
|
||||
assert_redefine_method('Integer', '-', 'assert_equal 3, 8 - 3')
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue