summaryrefslogtreecommitdiffstats
path: root/sample
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-02-15 04:43:58 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-02-15 04:43:58 +0000
commitd78d84f82ffd78c0d08496649a13b4fb0c35dc53 (patch)
treeb20c78bfd137e6f2760e957348d6c7e926a36a7a /sample
parent059aa1951c21a33b3ba7f7bb6c6d22c437c17f91 (diff)
downloadruby-d78d84f82ffd78c0d08496649a13b4fb0c35dc53.tar.gz
ruby-d78d84f82ffd78c0d08496649a13b4fb0c35dc53.tar.xz
ruby-d78d84f82ffd78c0d08496649a13b4fb0c35dc53.zip
* bignum.c (rb_big_rshift): should properly convert the nagative
value to 2's compliment. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
-rw-r--r--sample/test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/sample/test.rb b/sample/test.rb
index d3773fe68..9778b6e4c 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")