[pypy-svn] r25631 - pypy/dist/pypy/translator/c/test
arigo at codespeak.net
arigo at codespeak.net
Sun Apr 9 18:29:35 CEST 2006
Author: arigo
Date: Sun Apr 9 18:29:34 2006
New Revision: 25631
Modified:
pypy/dist/pypy/translator/c/test/test_lltyped.py
Log:
More tests. No code change (yet). This is known to break on gcc 4.0, though.
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 Sun Apr 9 18:29:34 2006
@@ -79,3 +79,37 @@
assert s == "HELLO"
fn = self.getcompiled(llf)
fn()
+
+ def test_call_with_fixedsizearray(self):
+ A = FixedSizeArray(Signed, 5)
+ S = GcStruct('s', ('a', Ptr(A)))
+ a = malloc(A, immortal=True)
+ a[1] = 123
+ def g(x):
+ return x[1]
+ def llf():
+ s = malloc(S)
+ s.a = a
+ return g(s.a)
+ fn = self.getcompiled(llf)
+ res = fn()
+ assert res == 123
+
+ def test_more_prebuilt_arrays(self):
+ A = FixedSizeArray(Signed, 5)
+ S = GcStruct('s', ('a1', Ptr(A)), ('a2', A))
+ s = malloc(S)
+ s.a1 = malloc(A, immortal=True)
+ s.a1[2] = 50
+ s.a2[2] = 60
+ def llf(n=int):
+ if n == 1:
+ a = s.a1
+ else:
+ a = s.a2
+ return a[2]
+ fn = self.getcompiled(llf)
+ res = fn(1)
+ assert res == 50
+ res = fn(2)
+ assert res == 60
More information about the Pypy-commit
mailing list