Commit 4fba3bc1 authored by Stefan Behnel's avatar Stefan Behnel

extended test case

parent f0ae7186
...@@ -2,9 +2,13 @@ cimport cython ...@@ -2,9 +2,13 @@ cimport cython
bytes_abc = b'abc' bytes_abc = b'abc'
bytes_ABC = b'ABC' bytes_ABC = b'ABC'
bytes_abc_null = b'a\0b\0c'
bytes_ABC_null = b'A\0B\0C'
unicode_abc = u'abc' unicode_abc = u'abc'
unicode_ABC = u'ABC' unicode_ABC = u'ABC'
unicode_abc_null = u'a\0b\0c'
unicode_ABC_null = u'A\0B\0C'
def for_in_bytes(bytes s): def for_in_bytes(bytes s):
...@@ -13,6 +17,10 @@ def for_in_bytes(bytes s): ...@@ -13,6 +17,10 @@ def for_in_bytes(bytes s):
'X' 'X'
>>> for_in_bytes(bytes_ABC) >>> for_in_bytes(bytes_ABC)
'C' 'C'
>>> for_in_bytes(bytes_abc_null)
'X'
>>> for_in_bytes(bytes_ABC_null)
'C'
""" """
for c in s: for c in s:
# Py2/Py3 # Py2/Py3
...@@ -29,6 +37,10 @@ def for_char_in_bytes(bytes s): ...@@ -29,6 +37,10 @@ def for_char_in_bytes(bytes s):
'X' 'X'
>>> for_char_in_bytes(bytes_ABC) >>> for_char_in_bytes(bytes_ABC)
'C' 'C'
>>> for_char_in_bytes(bytes_abc_null)
'X'
>>> for_char_in_bytes(bytes_ABC_null)
'C'
""" """
cdef char c cdef char c
for c in s: for c in s:
...@@ -45,6 +57,10 @@ def for_char_in_enumerate_bytes(bytes s): ...@@ -45,6 +57,10 @@ def for_char_in_enumerate_bytes(bytes s):
'X' 'X'
>>> for_char_in_enumerate_bytes(bytes_ABC) >>> for_char_in_enumerate_bytes(bytes_ABC)
2 2
>>> for_char_in_enumerate_bytes(bytes_abc_null)
'X'
>>> for_char_in_enumerate_bytes(bytes_ABC_null)
4
""" """
cdef char c cdef char c
cdef Py_ssize_t i cdef Py_ssize_t i
...@@ -62,6 +78,10 @@ def for_pyunicode_in_unicode(unicode s): ...@@ -62,6 +78,10 @@ def for_pyunicode_in_unicode(unicode s):
'X' 'X'
>>> for_pyunicode_in_unicode(unicode_ABC) >>> for_pyunicode_in_unicode(unicode_ABC)
'C' 'C'
>>> for_pyunicode_in_unicode(unicode_abc_null)
'X'
>>> for_pyunicode_in_unicode(unicode_ABC_null)
'C'
""" """
cdef Py_UNICODE c cdef Py_UNICODE c
for c in s: for c in s:
...@@ -78,6 +98,10 @@ def for_pyunicode_in_enumerate_unicode(unicode s): ...@@ -78,6 +98,10 @@ def for_pyunicode_in_enumerate_unicode(unicode s):
'X' 'X'
>>> for_pyunicode_in_enumerate_unicode(unicode_ABC) >>> for_pyunicode_in_enumerate_unicode(unicode_ABC)
2 2
>>> for_pyunicode_in_enumerate_unicode(unicode_abc_null)
'X'
>>> for_pyunicode_in_enumerate_unicode(unicode_ABC_null)
4
""" """
cdef Py_UNICODE c cdef Py_UNICODE c
cdef Py_ssize_t i cdef Py_ssize_t i
......
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