Author: Carl Friedrich Bolz-Tereick <cfb...@gmx.de>
Branch: 
Changeset: r93752:a52fa839d674
Date: 2018-02-04 13:50 +0100
http://bitbucket.org/pypy/pypy/changeset/a52fa839d674/

Log:    improve coverage of bitwise operators

diff --git a/rpython/rlib/rbigint.py b/rpython/rlib/rbigint.py
--- a/rpython/rlib/rbigint.py
+++ b/rpython/rlib/rbigint.py
@@ -2548,6 +2548,8 @@
             maska ^= MASK
             maskb ^= MASK
             negz = -1
+    else:
+        assert 0, "unreachable"
 
     # JRH: The original logic here was to allocate the result value (z)
     # as the longer of the two operands.  However, there are some cases
diff --git a/rpython/rlib/test/test_rbigint.py 
b/rpython/rlib/test/test_rbigint.py
--- a/rpython/rlib/test/test_rbigint.py
+++ b/rpython/rlib/test/test_rbigint.py
@@ -588,8 +588,8 @@
 
     def test_bitwise(self):
         for x in gen_signs(long_vals):
-            for y in gen_signs([0, 1, 5, 11, 42, 43, 3 ** 30, 3 ** 31]):
-                lx = rbigint.fromlong(x)
+            lx = rbigint.fromlong(x)
+            for y in gen_signs(long_vals):
                 ly = rbigint.fromlong(y)
                 for mod in "xor and_ or_".split():
                     res1 = getattr(lx, mod)(ly).tolong()
@@ -597,11 +597,9 @@
                     assert res1 == res2
 
     def test_int_bitwise(self):
-        for x in gen_signs([0, 1, 5, 11, 42, 43, 2 ** 30]):
-            for y in gen_signs([0, 1, 5, 11, 42, 43, 3 ** 30, 2 ** 31]):
-                if y != intmask(y):
-                    continue      # skip 'y' too large for 32-bit
-                lx = rbigint.fromlong(x)
+        for x in gen_signs(long_vals):
+            lx = rbigint.fromlong(x)
+            for y in signed_int_vals:
                 for mod in "xor and_ or_".split():
                     res1 = getattr(lx, 'int_' + mod)(y).tolong()
                     res2 = getattr(operator, mod)(x, y)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to