[pypy-svn] r28644 - pypy/dist/pypy/translator/c/test

arigo at codespeak.net arigo at codespeak.net
Sat Jun 10 20:05:24 CEST 2006


Author: arigo
Date: Sat Jun 10 20:05:23 2006
New Revision: 28644

Modified:
   pypy/dist/pypy/translator/c/test/test_lltyped.py
Log:
A test for PyStruct in genc.


Modified: pypy/dist/pypy/translator/c/test/test_lltyped.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_lltyped.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_lltyped.py	Sat Jun 10 20:05:23 2006
@@ -195,3 +195,16 @@
         fn = self.getcompiled(llf)
         res = fn()
         assert res == 8765
+
+    def test_pystruct(self):
+        PS1 = PyStruct('PS1', ('head', PyObject), ('x', Signed))
+        class mytype(object):
+            pass
+        mytype_ptr = pyobjectptr(mytype)
+        def llf():
+            p = malloc(PS1, flavor='cpy', extra_args=(mytype_ptr,))
+            return cast_pointer(Ptr(PyObject), p)
+
+        fn = self.getcompiled(llf)
+        res = fn()
+        assert type(res).__name__.endswith('mytype')



More information about the Pypy-commit mailing list