[pypy-svn] r33665 - in pypy/branch/factor-long-out/pypy/rpython: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Tue Oct 24 18:22:55 CEST 2006


Author: cfbolz
Date: Tue Oct 24 18:22:54 2006
New Revision: 33665

Modified:
   pypy/branch/factor-long-out/pypy/rpython/rlong.py
   pypy/branch/factor-long-out/pypy/rpython/test/test_rlong.py
Log:
fix typo


Modified: pypy/branch/factor-long-out/pypy/rpython/rlong.py
==============================================================================
--- pypy/branch/factor-long-out/pypy/rpython/rlong.py	(original)
+++ pypy/branch/factor-long-out/pypy/rpython/rlong.py	Tue Oct 24 18:22:54 2006
@@ -1467,7 +1467,7 @@
     else:
         maska = 0
     if b.sign < 0:
-        b.invert()
+        b = b.invert()
         maskb = MASK
     else:
         maskb = 0

Modified: pypy/branch/factor-long-out/pypy/rpython/test/test_rlong.py
==============================================================================
--- pypy/branch/factor-long-out/pypy/rpython/test/test_rlong.py	(original)
+++ pypy/branch/factor-long-out/pypy/rpython/test/test_rlong.py	Tue Oct 24 18:22:54 2006
@@ -289,6 +289,18 @@
                 assert res1 == x << y
                 assert res2 == x >> y
 
+    def test_bitwise(self):
+        for x in gen_signs([0, 1, 5, 11, 42, 43, 3 ** 30]):
+            for y in gen_signs([0, 1, 5, 11, 42, 43, 3 ** 30, 3 ** 31]):
+                lx = rlong.fromlong(x)
+                ly = rlong.fromlong(y)
+                for mod in "xor and_ or_".split():
+                    res1 = getattr(lx, mod)(ly).tolong()
+                    res2 = getattr(operator, mod)(x, y)
+                    assert res1 == res2
+
+
+
 class TestInternalFunctions(object):
     def test__inplace_divrem1(self):
         # signs are not handled in the helpers!
@@ -396,3 +408,4 @@
                     rlong.fromrarith_int(r_uint(0)),
                     rlong.fromrarith_int(r_uint(17)))
         interpret(fn, [])
+



More information about the Pypy-commit mailing list