[pypy-commit] pypy dynamic-specialized-tuple: add tests for C backend

fijal noreply at buildbot.pypy.org
Tue Apr 17 18:01:49 CEST 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: dynamic-specialized-tuple
Changeset: r54479:1046cc37c7ce
Date: 2012-04-17 18:00 +0200
http://bitbucket.org/pypy/pypy/changeset/1046cc37c7ce/

Log:	add tests for C backend

diff --git a/pypy/rlib/test/test_rerased_raw.py b/pypy/rlib/test/test_rerased_raw.py
--- a/pypy/rlib/test/test_rerased_raw.py
+++ b/pypy/rlib/test/test_rerased_raw.py
@@ -57,7 +57,7 @@
         storage = rerased_raw.UntypedStorage("ooi")
         assert storage.getshape() == "ooi"
 
-class TestUntypedStorageLLType(LLRtypeMixin, BaseRtypingTest):
+class BaseTestUntypedStorage(BaseRtypingTest):
     def test_int(self):
         def f(x):
             storage = rerased_raw.UntypedStorage("i")
@@ -164,7 +164,7 @@
             return storage.getshape()
 
         llres = self.interpret(f, [])
-        assert hlstr(llres) == "ooi"
+        assert self.ll_to_string(llres) == "ooi"
 
     def test_const(self):
         class A(object):
@@ -183,3 +183,6 @@
 
         res = self.interpret(f, [0])
         assert res == 21
+
+class TestUntypedStorageLLtype(LLRtypeMixin, BaseTestUntypedStorage):
+    pass
diff --git a/pypy/translator/c/test/test_genc.py b/pypy/translator/c/test/test_genc.py
--- a/pypy/translator/c/test/test_genc.py
+++ b/pypy/translator/c/test/test_genc.py
@@ -534,3 +534,4 @@
     else:
         assert 0, "the call was not found in the C source"
     assert 'PYPY_INHIBIT_TAIL_CALL();' in lines[i+1]
+
diff --git a/pypy/translator/c/test/test_untyped_storage.py b/pypy/translator/c/test/test_untyped_storage.py
new file mode 100644
--- /dev/null
+++ b/pypy/translator/c/test/test_untyped_storage.py
@@ -0,0 +1,14 @@
+
+from pypy.rlib.test.test_rerased_raw import BaseTestUntypedStorage
+from pypy.translator.c.test.test_genc import compile
+
+class CCompiledMixin(object):
+    def interpret(self, f, args):
+        fn = compile(f, [type(arg) for arg in args], gcpolicy='boehm')
+        return fn(*args)
+
+    def ll_to_string(self, x):
+        return x
+
+class TestUntypedStorage(CCompiledMixin, BaseTestUntypedStorage):
+    pass


More information about the pypy-commit mailing list