[pypy-svn] r32559 - pypy/dist/pypy/jit/timeshifter/test
ac at codespeak.net
ac at codespeak.net
Thu Sep 21 12:01:48 CEST 2006
Author: ac
Date: Thu Sep 21 12:01:45 2006
New Revision: 32559
Modified:
pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py
Log:
(arigo, arre)
Add tests for recursive calls of which one doesn't work yet.
Modified: pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py (original)
+++ pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py Thu Sep 21 12:01:45 2006
@@ -911,3 +911,25 @@
res = self.timeshift(ll_function, [-70], [])
assert res == 23
self.check_insns({'int_gt': 1})
+
+
+ def test_recursive_call(self):
+ def ll_pseudo_factorial(n, fudge):
+ k = hint(n, concrete=True)
+ if n <= 0:
+ return 1
+ return n * ll_pseudo_factorial(n - 1, fudge + n) - fudge
+ res = self.timeshift(ll_pseudo_factorial, [4, 2], [0])
+ expected = ll_pseudo_factorial(4, 2)
+ assert res == expected
+
+ def test_recursive_with_red_termination_condition(self):
+ py.test.skip('Does not terminate')
+ def ll_factorial(n):
+ if n <= 0:
+ return 1
+ return n * ll_factorial(n - 1)
+
+ res = self.timeshift(ll_factorial, [5], [])
+ assert res == 120
+
More information about the Pypy-commit
mailing list