summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-15 19:42:59 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-15 19:42:59 +0000
commit2708fb6ba7636adf1d8263dd2654f257f8b76324 (patch)
tree44fb61b8aa8da6c28d81bf55c42fdb3c0db46fd6 /test/ruby
parent0e5f9aeaeafe2fa9189956010ba45fdd41d6076d (diff)
* 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/ruby')
-rw-r--r--test/ruby/test_fixnum.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_fixnum.rb b/test/ruby/test_fixnum.rb
index b5b6425..7e89caf 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