[pypy-svn] r57901 - pypy/dist/pypy/translator/c/test
pedronis at codespeak.net
pedronis at codespeak.net
Sat Sep 6 20:37:33 CEST 2008
Author: pedronis
Date: Sat Sep 6 20:37:31 2008
New Revision: 57901
Modified:
pypy/dist/pypy/translator/c/test/test_typed.py
Log:
move the recursion tests together again
Modified: pypy/dist/pypy/translator/c/test/test_typed.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_typed.py (original)
+++ pypy/dist/pypy/translator/c/test/test_typed.py Sat Sep 6 20:37:31 2008
@@ -656,18 +656,6 @@
for args in [2, 7, 0], [7, 2, 0], [10, 50, 7], [50, -10, -3]:
assert f(*args) == intmask(fn(*args))
- def test_recursion_detection(self):
- def f(n, accum):
- if n == 0:
- return accum
- else:
- return f(n-1, accum*n)
- fn = self.getcompiled(f, [int, int])
- assert fn(7, 1) == 5040
- assert fn(7, 1) == 5040 # detection must work several times, too
- assert fn(7, 1) == 5040
- py.test.raises(RuntimeError, fn, -1, 0)
-
def test_list_len_is_true(self):
class X(object):
@@ -695,6 +683,18 @@
fn = self.getcompiled(f)
assert fn() == 1
+ def test_recursion_detection(self):
+ def f(n, accum):
+ if n == 0:
+ return accum
+ else:
+ return f(n-1, accum*n)
+ fn = self.getcompiled(f, [int, int])
+ assert fn(7, 1) == 5040
+ assert fn(7, 1) == 5040 # detection must work several times, too
+ assert fn(7, 1) == 5040
+ py.test.raises(RuntimeError, fn, -1, 0)
+
def test_infinite_recursion(self):
def f(x):
if x:
More information about the Pypy-commit
mailing list