[pypy-svn] r78192 - pypy/branch/ootype-virtualrefs/pypy/rlib/test
dan at codespeak.net
dan at codespeak.net
Fri Oct 22 10:46:09 CEST 2010
Author: dan
Date: Fri Oct 22 10:46:07 2010
New Revision: 78192
Modified:
pypy/branch/ootype-virtualrefs/pypy/rlib/test/test__jit_vref.py
Log:
Made tests run on both lltypesystem and ootypesystem.
Modified: pypy/branch/ootype-virtualrefs/pypy/rlib/test/test__jit_vref.py
==============================================================================
--- pypy/branch/ootype-virtualrefs/pypy/rlib/test/test__jit_vref.py (original)
+++ pypy/branch/ootype-virtualrefs/pypy/rlib/test/test__jit_vref.py Fri Oct 22 10:46:07 2010
@@ -8,6 +8,7 @@
from pypy.rpython.lltypesystem.rclass import OBJECTPTR
from pypy.rpython.lltypesystem import lltype
+from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
class X(object):
pass
@@ -79,37 +80,44 @@
assert s.s_instance.can_be_None
assert s.s_instance.classdef == a.bookkeeper.getuniqueclassdef(X)
-def test_rtype_1():
- def f():
- return virtual_ref(X())
- x = interpret(f, [])
- assert lltype.typeOf(x) == OBJECTPTR
+class BaseTestVRef(BaseRtypingTest):
+ def test_rtype_1(self):
+ def f():
+ return virtual_ref(X())
+ x = self.interpret(f, [])
+ self.is_of_instance_type(x)
-def test_rtype_2():
- def f():
- x1 = X()
- vref = virtual_ref(x1)
- x2 = vref()
- virtual_ref_finish(x2)
- return x2
- x = interpret(f, [])
- assert lltype.castable(OBJECTPTR, lltype.typeOf(x)) > 0
+ def test_rtype_2(self):
+ def f():
+ x1 = X()
+ vref = virtual_ref(x1)
+ x2 = vref()
+ virtual_ref_finish(x2)
+ return x2
+ x = self.interpret(f, [])
+ assert lltype.castable(OBJECTPTR, lltype.typeOf(x)) > 0
+
+ def test_rtype_3(self):
+ def f(n):
+ if n > 0:
+ return virtual_ref(Y())
+ else:
+ return non_virtual_ref(Z())
+ x = self.interpret(f, [-5])
+ assert lltype.typeOf(x) == OBJECTPTR
+
+ def test_rtype_4(self):
+ def f(n):
+ if n > 0:
+ return virtual_ref(X())
+ else:
+ return vref_None
+ x = self.interpret(f, [-5])
+ assert lltype.typeOf(x) == OBJECTPTR
+ assert not x
-def test_rtype_3():
- def f(n):
- if n > 0:
- return virtual_ref(Y())
- else:
- return non_virtual_ref(Z())
- x = interpret(f, [-5])
- assert lltype.typeOf(x) == OBJECTPTR
+class TestLLtype(BaseTestVRef, LLRtypeMixin):
+ pass
-def test_rtype_4():
- def f(n):
- if n > 0:
- return virtual_ref(X())
- else:
- return vref_None
- x = interpret(f, [-5])
- assert lltype.typeOf(x) == OBJECTPTR
- assert not x
+class TestOOtype(BaseTestVRef, OORtypeMixin):
+ pass
More information about the Pypy-commit
mailing list