[pypy-commit] pypy ootype-rerased: Added test for oo{, un}box_integer. Currently fails.

ademan noreply at buildbot.pypy.org
Thu Jul 21 21:13:41 CEST 2011


Author: Daniel Roberts <Ademan555 at gmail.com>
Branch: ootype-rerased
Changeset: r45842:3af86a0633cc
Date: 2011-07-21 12:12 -0700
http://bitbucket.org/pypy/pypy/changeset/3af86a0633cc/

Log:	Added test for oo{,un}box_integer. Currently fails.

diff --git a/pypy/rpython/lltypesystem/lloperation.py b/pypy/rpython/lltypesystem/lloperation.py
--- a/pypy/rpython/lltypesystem/lloperation.py
+++ b/pypy/rpython/lltypesystem/lloperation.py
@@ -585,6 +585,8 @@
     'classof':              LLOp(oo=True, canfold=True),
     'subclassof':           LLOp(oo=True, canfold=True),
     'oostring':             LLOp(oo=True, sideeffects=False),
+    'oobox_int':            LLOp(oo=True, sideeffects=False),
+    'oounbox_int':          LLOp(oo=True, sideeffects=False),
     'ooparse_int':          LLOp(oo=True, canraise=(ValueError,)),
     'ooparse_float':        LLOp(oo=True, canraise=(ValueError,)),
     'oounicode':            LLOp(oo=True, canraise=(UnicodeDecodeError,)),
diff --git a/pypy/translator/oosupport/test_template/operations.py b/pypy/translator/oosupport/test_template/operations.py
--- a/pypy/translator/oosupport/test_template/operations.py
+++ b/pypy/translator/oosupport/test_template/operations.py
@@ -1,3 +1,6 @@
+from pypy.rpython.lltypesystem.lloperation import llop
+from pypy.rpython.lltypesystem import lltype
+from pypy.rpython.ootypesystem import ootype
 from pypy.rlib.rarithmetic import r_uint, r_ulonglong, r_longlong, ovfcheck
 from pypy.rlib import rstack
 from pypy.annotation import model as annmodel
@@ -204,6 +207,13 @@
             return bool(x)
         self._check_all(fn)
 
+    def test_box(self):
+        def f():
+            x = 42
+            y = llop.oobox_int(ootype.Object, x)
+            return llop.oounbox_int(lltype.Signed, y)
+        assert self.interpret(f, []) == 42
+
     def test_ullong_rshift(self):
         def f(x):
             return x >> 1


More information about the pypy-commit mailing list