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

afa at codespeak.net afa at codespeak.net
Tue Oct 11 17:13:36 CEST 2005


Author: afa
Date: Tue Oct 11 17:13:35 2005
New Revision: 18413

Modified:
   pypy/dist/pypy/translator/c/test/test_standalone.py
Log:
(valentino, afa): stackless: more tests


Modified: pypy/dist/pypy/translator/c/test/test_standalone.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_standalone.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_standalone.py	Tue Oct 11 17:13:35 2005
@@ -64,6 +64,39 @@
     data = wrap_stackless_function(fn)
     assert data.strip() == '10'
 
+def test_stackless_manytimes():
+    def f(n):
+        if n > 0:
+            stack_frames_depth()
+            res = f(n-1)
+        else:
+            res = stack_frames_depth(), 1
+        return res
+
+    def fn():
+        count0, _ = f(0)
+        count10, _ = f(100)
+        return count10 - count0
+
+    data = wrap_stackless_function(fn)
+    assert data.strip() == '100'
+
+def test_stackless_arguments():
+    def f(n, d, t):
+        if n > 0:
+            res = f(n-1, d, t)
+        else:
+            res = stack_frames_depth(), d, t
+        return res
+
+    def fn():
+        count0, d, t = f(0, 5.5, (1, 2))
+        count10, d, t = f(10, 5.5, (1, 2))
+        return "[" + str(count10 - count0) + ", " + str(d) + ", " + str(t[0]) + ", " + str(t[1]) + "]"
+
+    data = wrap_stackless_function(fn)
+    assert eval(data) == [10, 5.500000, 1, 2]
+
 
 def test_stack_too_big():
     def f(n):



More information about the Pypy-commit mailing list