diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-02-15 19:42:59 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-02-15 19:42:59 +0000 |
commit | 2708fb6ba7636adf1d8263dd2654f257f8b76324 (patch) | |
tree | 44fb61b8aa8da6c28d81bf55c42fdb3c0db46fd6 /test | |
parent | 0e5f9aeaeafe2fa9189956010ba45fdd41d6076d (diff) | |
download | ruby-2708fb6ba7636adf1d8263dd2654f257f8b76324.tar.gz |
* insns.def (opt_plus): simply use LONG2NUM() instead of wrongly
complex overflow case.
* insns.def (opt_sub): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_fixnum.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_fixnum.rb b/test/ruby/test_fixnum.rb index b5b642504f..7e89caf0d2 100644 --- a/test/ruby/test_fixnum.rb +++ b/test/ruby/test_fixnum.rb @@ -37,10 +37,14 @@ class TestFixnum < Test::Unit::TestCase def test_plus assert_equal(0x40000000, 0x3fffffff+1) + assert_equal(0x7ffffffe, 0x3fffffff+0x3fffffff) assert_equal(0x4000000000000000, 0x3fffffffffffffff+1) + assert_equal(0x7ffffffffffffffe, 0x3fffffffffffffff+0x3fffffffffffffff) assert_equal(-0x40000001, (-0x40000000)+(-1)) assert_equal(-0x4000000000000001, (-0x4000000000000000)+(-1)) + assert_equal(-0x7ffffffe, (-0x3fffffff)+(-0x3fffffff)) assert_equal(-0x80000000, (-0x40000000)+(-0x40000000)) + assert_equal(-0x8000000000000000, (-0x4000000000000000)+(-0x4000000000000000)) end def test_sub @@ -49,6 +53,8 @@ class TestFixnum < Test::Unit::TestCase assert_equal(-0x40000001, (-0x40000000)-1) assert_equal(-0x4000000000000001, (-0x4000000000000000)-1) assert_equal(-0x80000000, (-0x40000000)-0x40000000) + assert_equal(0x7fffffffffffffff, 0x3fffffffffffffff-(-0x4000000000000000)) + assert_equal(-0x8000000000000000, -0x4000000000000000-0x4000000000000000) end def test_mult |