From 289430e8eceaa8a9f541e455f0ffb8186ba06acd Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 15 Feb 2002 04:43:58 +0000 Subject: * bignum.c (rb_big_rshift): should properly convert the nagative value to 2's compliment. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'sample') diff --git a/sample/test.rb b/sample/test.rb index d3773fe688..9778b6e4ca 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -809,6 +809,19 @@ b = 14269972710765292560 test_ok(a % b == 0) test_ok(-a % b == 0) +def shift_test(a) + b = a / (2 ** 32) + c = a >> 32 + test_ok(b == c) + + b = a * (2 ** 32) + c = a << 32 + test_ok(b == c) +end + +shift_test(-4518325415524767873) +shift_test(-0xfffffffffffffffff) + test_check "string & char" test_ok("abcd" == "abcd") -- cgit v1.2.3