[pypy-commit] lang-smalltalk default: mark integer wrapping test as skipped on 64 bit machines

krono noreply at buildbot.pypy.org
Thu Feb 14 13:51:26 CET 2013


Author: Tobias Pape <tobias at netshed.de>
Branch: 
Changeset: r21:45c9ef36a50c
Date: 2013-01-24 17:17 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/45c9ef36a50c/

Log:	mark integer wrapping test as skipped on 64 bit machines

diff --git a/spyvm/objspace.py b/spyvm/objspace.py
--- a/spyvm/objspace.py
+++ b/spyvm/objspace.py
@@ -167,7 +167,7 @@
     def wrap_uint(self, val):
         if val < 0:
             raise WrappingError("negative integer")
-        if intmask(val) > 0:
+        if intmask(val) >= 0:
             try:
                 return self.wrap_int(intmask(val))
             except WrappingError:
diff --git a/spyvm/test/test_objectspace.py b/spyvm/test/test_objectspace.py
--- a/spyvm/test/test_objectspace.py
+++ b/spyvm/test/test_objectspace.py
@@ -1,4 +1,5 @@
 import py
+import sys
 from spyvm import objspace
 
 space = objspace.ObjSpace()
@@ -28,16 +29,24 @@
 
 def test_ruint():
     from rpython.rlib.rarithmetic import r_uint
-    import sys
-    for num in [0, 1, 41, 100, 2**31, sys.maxint + 1]:
+    for num in [0, 1, 41, 100, 2**31]:
         num = r_uint(num)
         assert space.unwrap_uint(space.wrap_uint(num)) == num
-    for num in [-1, -100, -sys.maxint]:
+    for num in [-1, -100]:
         py.test.raises(objspace.WrappingError, space.wrap_uint, num)
     for obj in [space.wrap_char('a'), space.wrap_int(-1)]:
         py.test.raises(objspace.UnwrappingError, space.unwrap_uint, obj)
     byteobj = space.wrap_uint(sys.maxint + 1)
     byteobj.bytes.append('\x01')
     py.test.raises(objspace.UnwrappingError, space.unwrap_uint, byteobj)
+
+ at py.test.skipif("sys.maxint > 2147483647")
+def test_ruint_max():
+    from rpython.rlib.rarithmetic import r_uint
+    num = r_uint(sys.maxint + 1)
+    assert space.unwrap_uint(space.wrap_uint(num)) == num
+    num = -sys.maxint
+    py.test.raises(objspace.WrappingError, space.wrap_uint, num)
+
     
 


More information about the pypy-commit mailing list