From: Stefan Behnel Date: Thu, 29 Oct 2009 15:55:00 +0000 (+0100) Subject: extended test case X-Git-Tag: 0.12.alpha0~8^2~14 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9765cf3c0e4d7c6c25872202ee4f8806a20d0ba2;p=cython.git extended test case --- diff --git a/tests/run/carray_slicing.pyx b/tests/run/carray_slicing.pyx index 3f855f9f..b9430961 100644 --- a/tests/run/carray_slicing.pyx +++ b/tests/run/carray_slicing.pyx @@ -75,6 +75,42 @@ def slice_charptr_for_loop_c(): print [ chr(c) for c in cstring[1:5] ] print [ chr(c) for c in cstring[4:9] ] +## @cython.test_assert_path_exists("//ForFromStatNode", +## "//ForFromStatNode//IndexNode") +## @cython.test_fail_if_path_exists("//ForInStatNode") +## def slice_charptr_for_loop_c_step(): +## """ +## >>> slice_charptr_for_loop_c() +## ['c', 'b', 'a'] +## ['b', 'c', 'A', 'B'] +## ['p', 't', 'q', 'C', 'B'] +## """ +## cdef char c +## print [ chr(c) for c in cstring[:3:-1] ] +## print [ chr(c) for c in cstring[1:5:2] ] +## print [ chr(c) for c in cstring[4:9:-1] ] + +@cython.test_assert_path_exists("//ForFromStatNode", + "//ForFromStatNode//IndexNode") +@cython.test_fail_if_path_exists("//ForInStatNode") +def slice_charptr_for_loop_c_dynamic_bounds(): + """ + >>> slice_charptr_for_loop_c() + ['a', 'b', 'c'] + ['b', 'c', 'A', 'B'] + ['B', 'C', 'q', 't', 'p'] + """ + cdef char c + print [ chr(c) for c in cstring[0:return3()] ] + print [ chr(c) for c in cstring[return1():return5()] ] + print [ chr(c) for c in cstring[return4():return9()] ] + +cdef return1(): return 1 +cdef return3(): return 3 +cdef return4(): return 4 +cdef return5(): return 5 +cdef return9(): return 9 + @cython.test_assert_path_exists("//ForFromStatNode", "//ForFromStatNode//SliceIndexNode") @cython.test_fail_if_path_exists("//ForInStatNode")