aboutsummaryrefslogtreecommitdiffstats
path: root/test/-ext-/bignum
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-20 13:05:27 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-20 13:05:27 +0000
commit6ea1aee76e2642aa0d532a00e0b971dede02d818 (patch)
tree3b502465724e5269184ee37fafd636f6fded4cb3 /test/-ext-/bignum
parentbf017de1f3cefd4adef07a4ee4b0332d14438a21 (diff)
downloadruby-6ea1aee76e2642aa0d532a00e0b971dede02d818.tar.gz
* bignum.c (bary_unpack_internal): Return -2 when negative overflow.
(bary_unpack): Set the overflowed bit if an extra BDIGIT exists. (rb_integer_unpack): Set the overflowed bit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/-ext-/bignum')
-rw-r--r--test/-ext-/bignum/test_pack.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/-ext-/bignum/test_pack.rb b/test/-ext-/bignum/test_pack.rb
index 093c9bd212..c2c19a32a2 100644
--- a/test/-ext-/bignum/test_pack.rb
+++ b/test/-ext-/bignum/test_pack.rb
@@ -194,5 +194,10 @@ class TestBignum < Test::Unit::TestCase
assert_equal( -1, Integer.test_unpack("\xFF", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE))
end
+ def test_unpack2comp_negative_zero
+ 0.upto(100) {|n|
+ assert_equal(-(256**n), Integer.test_unpack("\x00"*n, n, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE))
+ }
+ end
end
end