summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-26 03:16:12 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-26 03:16:12 +0000
commit9be51267b54f923e9e95824984416eca9b95dd6c (patch)
treeefd6bb171fcdc6310fd7832c537f20ebf4f29ada /test/ruby
parent3a8100835485c64f97e10a3cd1624a1b33145326 (diff)
* bignum.c (bigand_int): Consider negative values.
(bigor_int): The allocated bignum should have enough size to store long. This fixes (bignum fits in a BDIGIT) | (fixnum bigger than BDIGIT) on platforms which SIZEOF_BDIGITS < SIZEOF_LONG, such as LP64 with 32bit BDIGIT (no int128). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_bignum.rb7
-rw-r--r--test/ruby/test_integer_comb.rb2
2 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_bignum.rb b/test/ruby/test_bignum.rb
index 9f709daa8a..f0d76c83bf 100644
--- a/test/ruby/test_bignum.rb
+++ b/test/ruby/test_bignum.rb
@@ -123,6 +123,12 @@ class TestBignum < Test::Unit::TestCase
T1024 = b.coerce(2**1024).first
T1024P = b.coerce(T1024 - 1).first
+ f = b
+ while Bignum === f-1
+ f = f >> 1
+ end
+ FIXNUM_MAX = f-1
+
def test_prepare
assert_instance_of(Bignum, T_ZERO)
assert_instance_of(Bignum, T_ONE)
@@ -454,6 +460,7 @@ class TestBignum < Test::Unit::TestCase
assert_equal(T32 + T31, T32 | T31)
assert_equal(-T31, (-T32) | (-T31))
assert_equal(T64 + T32, T32 | T64)
+ assert_equal(FIXNUM_MAX, T_ZERO | FIXNUM_MAX)
end
def test_xor
diff --git a/test/ruby/test_integer_comb.rb b/test/ruby/test_integer_comb.rb
index c057deb36f..3f5a0aa0a7 100644
--- a/test/ruby/test_integer_comb.rb
+++ b/test/ruby/test_integer_comb.rb
@@ -106,6 +106,8 @@ class TestIntegerComb < Test::Unit::TestCase
]
#VS.map! {|v| 0x4000000000000000.coerce(v)[0] }
+ #VS.concat VS.find_all {|v| Fixnum === v }.map {|v| 0x4000000000000000.coerce(v)[0] }
+ #VS.sort! {|a, b| a.abs <=> b.abs }
min = -1
min *= 2 while min.class == Fixnum