summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-22 02:28:03 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-22 02:28:03 (GMT)
commitb9fe5948f398d4365f0d10f14305613c84dc7427 (patch)
treed04723411e2304c997f76c7943110df233fc9c4f /test
parent45e3b48be5fe1faf46f8b0925b00d6cd8f2aa6e6 (diff)
move duplicate assertions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/-ext-/integer/test_integer.rb14
-rw-r--r--test/ruby/test_integer_comb.rb10
-rw-r--r--test/ruby/test_optimization.rb12
3 files changed, 14 insertions, 22 deletions
diff --git a/test/-ext-/integer/test_integer.rb b/test/-ext-/integer/test_integer.rb
new file mode 100644
index 0000000..6ea42e3
--- /dev/null
+++ b/test/-ext-/integer/test_integer.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: false
+require 'test/unit'
+
+class TestInteger < Test::Unit::TestCase
+ FIXNUM_MIN = Integer::FIXNUM_MIN
+ FIXNUM_MAX = Integer::FIXNUM_MAX
+
+ def test_fixnum_range
+ assert_bignum(FIXNUM_MIN-1)
+ assert_fixnum(FIXNUM_MIN)
+ assert_fixnum(FIXNUM_MAX)
+ assert_bignum(FIXNUM_MAX+1)
+ end
+end
diff --git a/test/ruby/test_integer_comb.rb b/test/ruby/test_integer_comb.rb
index 7e21279..80d08ca 100644
--- a/test/ruby/test_integer_comb.rb
+++ b/test/ruby/test_integer_comb.rb
@@ -110,16 +110,6 @@ class TestIntegerComb < Test::Unit::TestCase
#VS.concat VS.find_all {|v| Fixnum === v }.map {|v| 0x4000000000000000.coerce(v)[0] }
#VS.sort! {|a, b| a.abs <=> b.abs }
- FIXNUM_MIN = Integer::FIXNUM_MIN
- FIXNUM_MAX = Integer::FIXNUM_MAX
-
- def test_fixnum_range
- assert_bignum(FIXNUM_MIN-1)
- assert_fixnum(FIXNUM_MIN)
- assert_fixnum(FIXNUM_MAX)
- assert_bignum(FIXNUM_MAX+1)
- end
-
def test_aref
VS.each {|a|
100.times {|i|
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb
index 3b5e24f..bbd468d 100644
--- a/test/ruby/test_optimization.rb
+++ b/test/ruby/test_optimization.rb
@@ -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,21 +20,12 @@ 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