[pypy-commit] pypy jit-tagged-2: Add a test, which passes.
arigo
noreply at buildbot.pypy.org
Fri Oct 14 18:06:59 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: jit-tagged-2
Changeset: r48061:1ab0b8bf4eaa
Date: 2011-10-14 18:02 +0200
http://bitbucket.org/pypy/pypy/changeset/1ab0b8bf4eaa/
Log: Add a test, which passes.
diff --git a/pypy/jit/metainterp/test/test_ajit.py b/pypy/jit/metainterp/test/test_ajit.py
--- a/pypy/jit/metainterp/test/test_ajit.py
+++ b/pypy/jit/metainterp/test/test_ajit.py
@@ -3491,3 +3491,35 @@
pc += 1
return pc
res = self.meta_interp(main, [False, 100, True], taggedpointers=True)
+
+ def test_rerased(self):
+ from pypy.rlib.rerased import erase_int, unerase_int, new_erasing_pair
+ eraseX, uneraseX = new_erasing_pair("X")
+ #
+ class X:
+ def __init__(self, a, b):
+ self.a = a
+ self.b = b
+ #
+ def f(i, j):
+ # 'j' should be 0 or 1, not other values
+ if j > 0:
+ e = eraseX(X(i, j))
+ else:
+ try:
+ e = erase_int(i)
+ except OverflowError:
+ return -42
+ if j & 1:
+ x = uneraseX(e)
+ return x.a - x.b
+ else:
+ return unerase_int(e)
+ #
+ x = self.interp_operations(f, [-128, 0], taggedpointers=True)
+ assert x == -128
+ bigint = sys.maxint//2 + 1
+ x = self.interp_operations(f, [bigint, 0], taggedpointers=True)
+ assert x == -42
+ x = self.interp_operations(f, [1000, 1], taggedpointers=True)
+ assert x == 999
More information about the pypy-commit
mailing list