Commit a2e62213 authored by Stefan Behnel's avatar Stefan Behnel

extended test case

parent 371b92f2
cimport cython
@cython.test_assert_path_exists('//ForFromStatNode',
"//InlinedGeneratorExpressionNode")
@cython.test_fail_if_path_exists('//SimpleCallNode',
'//ForInStatNode')
def range_sum(int N): def range_sum(int N):
""" """
>>> sum(range(10)) >>> sum(range(10))
...@@ -9,6 +15,10 @@ def range_sum(int N): ...@@ -9,6 +15,10 @@ def range_sum(int N):
result = sum(i for i in range(N)) result = sum(i for i in range(N))
return result return result
@cython.test_assert_path_exists('//ForFromStatNode',
"//InlinedGeneratorExpressionNode")
@cython.test_fail_if_path_exists('//SimpleCallNode',
'//ForInStatNode')
def return_range_sum(int N): def return_range_sum(int N):
""" """
>>> sum(range(10)) >>> sum(range(10))
...@@ -18,6 +28,10 @@ def return_range_sum(int N): ...@@ -18,6 +28,10 @@ def return_range_sum(int N):
""" """
return sum(i for i in range(N)) return sum(i for i in range(N))
@cython.test_assert_path_exists('//ForFromStatNode',
"//InlinedGeneratorExpressionNode")
@cython.test_fail_if_path_exists('//SimpleCallNode',
'//ForInStatNode')
def return_range_sum_squares(int N): def return_range_sum_squares(int N):
""" """
>>> sum([i*i for i in range(10)]) >>> sum([i*i for i in range(10)])
...@@ -32,6 +46,9 @@ def return_range_sum_squares(int N): ...@@ -32,6 +46,9 @@ def return_range_sum_squares(int N):
""" """
return sum(i*i for i in range(N)) return sum(i*i for i in range(N))
@cython.test_assert_path_exists('//ForInStatNode',
"//InlinedGeneratorExpressionNode")
@cython.test_fail_if_path_exists('//SimpleCallNode')
def return_sum_squares(seq): def return_sum_squares(seq):
""" """
>>> sum([i*i for i in range(10)]) >>> sum([i*i for i in range(10)])
...@@ -46,6 +63,9 @@ def return_sum_squares(seq): ...@@ -46,6 +63,9 @@ def return_sum_squares(seq):
""" """
return sum(i*i for i in seq) return sum(i*i for i in seq)
@cython.test_assert_path_exists('//ForInStatNode',
"//InlinedGeneratorExpressionNode")
@cython.test_fail_if_path_exists('//SimpleCallNode')
def return_sum_squares_start(seq, int start): def return_sum_squares_start(seq, int start):
""" """
>>> sum([i*i for i in range(10)], -1) >>> sum([i*i for i in range(10)], -1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment