From 3b44dbd87c8c64cde4e8f9c3271afd2e54534f8a Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 28 Apr 2010 13:34:36 +0200 Subject: [PATCH] extended test case --- tests/run/for_in_string.pyx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/run/for_in_string.pyx b/tests/run/for_in_string.pyx index 477b56d0..d8bc91a9 100644 --- a/tests/run/for_in_string.pyx +++ b/tests/run/for_in_string.pyx @@ -70,6 +70,36 @@ def for_char_in_enumerate_bytes(bytes s): else: return 'X' +@cython.test_assert_path_exists("//ForFromStatNode") +@cython.test_fail_if_path_exists("//ForInStatNode") +def for_pyvar_in_char_ptr(char* c_string): + """ + >>> for_pyvar_in_char_ptr( (bytes_abc+bytes_ABC) * 2 ) + [True, True, True, False, False, False, True, True, True, False] + >>> for_pyvar_in_char_ptr( bytes_abc_null * 2 ) + [True, False, True, False, True, True, False, True, False, True] + """ + in_test = [] + cdef object c + for c in c_string[:10]: + in_test.append( c in b'abc' ) + return in_test + +@cython.test_assert_path_exists("//ForFromStatNode") +@cython.test_fail_if_path_exists("//ForInStatNode") +def for_char_in_char_ptr(char* c_string): + """ + >>> for_char_in_char_ptr( (bytes_abc+bytes_ABC) * 2 ) + [True, True, True, False, False, False, True, True, True, False] + >>> for_char_in_char_ptr( bytes_abc_null * 2 ) + [True, False, True, False, True, True, False, True, False, True] + """ + in_test = [] + cdef char c + for c in c_string[:10]: + in_test.append( c in b'abc' ) + return in_test + @cython.test_assert_path_exists("//ForFromStatNode") @cython.test_fail_if_path_exists("//ForInStatNode") def for_pyunicode_in_unicode(unicode s): -- 2.26.2