[pypy-svn] r53253 - pypy/branch/jit-hotpath/pypy/jit/rainbow/test

antocuni at codespeak.net antocuni at codespeak.net
Wed Apr 2 15:22:46 CEST 2008


Author: antocuni
Date: Wed Apr  2 15:22:45 2008
New Revision: 53253

Modified:
   pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_interpreter.py
Log:
one more test



Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_interpreter.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_interpreter.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_interpreter.py	Wed Apr  2 15:22:45 2008
@@ -711,6 +711,23 @@
         assert res == 72
         self.check_insns({})
 
+    def test_complex_struct(self):
+        S = self.GcStruct('S', ('n', lltype.Signed))
+        PTRS = self.Ptr(S)
+        T = self.GcStruct('T', ('s', PTRS), ('n', lltype.Signed))
+        malloc = self.malloc
+        
+        def ll_function(x, y):
+            t = malloc(T)
+            t.s = malloc(S)
+            t.s.n = y
+            t.n = x
+            return t.n + t.s.n
+
+        res = self.interpret(ll_function, [20, 22])
+        assert res == 42
+        self.check_insns({'int_add': 1})
+
     def test_simple_array(self):
         A = lltype.GcArray(lltype.Signed, 
                             hints={'immutable': True})
@@ -792,7 +809,6 @@
     def test_degenerated_before_return(self):
         S = lltype.GcStruct('S', ('n', lltype.Signed))
         T = lltype.GcStruct('T', ('s', S), ('n', lltype.Float))
-        malloc = self.malloc
 
         def ll_function(flag):
             t = lltype.malloc(T)


More information about the pypy-svn mailing list