diff --git a/ChangeLog b/ChangeLog index 2ea6f3b050..6d58663af8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Mon May 2 01:00:04 2016 Tanaka Akira + + * test/lib/test/unit/assertions.rb (assert_fixnum): Defined. + (assert_bignum): Defined. + + * test/ruby/test_bignum.rb: Use assert_bignum. + + * test/ruby/test_integer_comb.rb: Use assert_fixnum and assert_bignum. + + * test/ruby/test_optimization.rb: Ditto. + Mon May 2 00:41:53 2016 Tanaka Akira * vm_trace.c (recalc_remove_ruby_vm_event_flags): Add a cast to diff --git a/test/lib/test/unit/assertions.rb b/test/lib/test/unit/assertions.rb index fd51012fb5..1df3453bc6 100644 --- a/test/lib/test/unit/assertions.rb +++ b/test/lib/test/unit/assertions.rb @@ -771,6 +771,14 @@ eom values end + def assert_fixnum(v, msg=nil) + assert_instance_of(Fixnum, v, msg) + end + + def assert_bignum(v, msg=nil) + assert_instance_of(Bignum, v, msg) + end + class << (AssertFile = Struct.new(:failure_message).new) include Assertions def assert_file_predicate(predicate, *args) diff --git a/test/ruby/test_bignum.rb b/test/ruby/test_bignum.rb index f80828a7a1..762368fda4 100644 --- a/test/ruby/test_bignum.rb +++ b/test/ruby/test_bignum.rb @@ -51,18 +51,18 @@ class TestBignum < Test::Unit::TestCase end def test_prepare - assert_instance_of(Bignum, @big) - assert_instance_of(Bignum, T_ZERO) - assert_instance_of(Bignum, T_ONE) - assert_instance_of(Bignum, T_MONE) - assert_instance_of(Bignum, T31) - assert_instance_of(Bignum, T31P) - assert_instance_of(Bignum, T32) - assert_instance_of(Bignum, T32P) - assert_instance_of(Bignum, T64) - assert_instance_of(Bignum, T64P) - assert_instance_of(Bignum, T1024) - assert_instance_of(Bignum, T1024P) + assert_bignum(@big) + assert_bignum(T_ZERO) + assert_bignum(T_ONE) + assert_bignum(T_MONE) + assert_bignum(T31) + assert_bignum(T31P) + assert_bignum(T32) + assert_bignum(T32P) + assert_bignum(T64) + assert_bignum(T64P) + assert_bignum(T1024) + assert_bignum(T1024P) end def test_bignum @@ -469,7 +469,7 @@ class TestBignum < Test::Unit::TestCase assert_raise(TypeError, ArgumentError) { T32**"foo" } feature3429 = '[ruby-core:30735]' - assert_instance_of(Bignum, (2 ** 7830457), feature3429) + assert_bignum((2 ** 7830457), feature3429) end def test_and diff --git a/test/ruby/test_integer_comb.rb b/test/ruby/test_integer_comb.rb index b18de94feb..8c5cba2b1e 100644 --- a/test/ruby/test_integer_comb.rb +++ b/test/ruby/test_integer_comb.rb @@ -114,17 +114,17 @@ class TestIntegerComb < Test::Unit::TestCase FIXNUM_MAX = Integer::FIXNUM_MAX def test_fixnum_range - assert_instance_of(Bignum, FIXNUM_MIN-1) - assert_instance_of(Fixnum, FIXNUM_MIN) - assert_instance_of(Fixnum, FIXNUM_MAX) - assert_instance_of(Bignum, FIXNUM_MAX+1) + assert_bignum(FIXNUM_MIN-1) + assert_fixnum(FIXNUM_MIN) + assert_fixnum(FIXNUM_MAX) + assert_bignum(FIXNUM_MAX+1) end def check_class(n) if FIXNUM_MIN <= n && n <= FIXNUM_MAX - assert_instance_of(Fixnum, n) + assert_fixnum(n) else - assert_instance_of(Bignum, n) + assert_bignum(n) end end diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index 6412d1f45e..8fd9e208e5 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -25,8 +25,8 @@ class TestRubyOptimization < Test::Unit::TestCase def test_fixnum_plus a, b = 1, 2 assert_equal 3, a + b - assert_instance_of Fixnum, FIXNUM_MAX - assert_instance_of Bignum, FIXNUM_MAX + 1 + assert_fixnum FIXNUM_MAX + assert_bignum FIXNUM_MAX + 1 assert_equal 21, 10 + 11 assert_redefine_method('Fixnum', '+', 'assert_equal 11, 10 + 11') @@ -34,8 +34,8 @@ class TestRubyOptimization < Test::Unit::TestCase def test_fixnum_minus assert_equal 5, 8 - 3 - assert_instance_of Fixnum, FIXNUM_MIN - assert_instance_of Bignum, FIXNUM_MIN - 1 + assert_fixnum FIXNUM_MIN + assert_bignum FIXNUM_MIN - 1 assert_equal 5, 8 - 3 assert_redefine_method('Fixnum', '-', 'assert_equal 3, 8 - 3')