Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
d319ed83
Commit
d319ed83
authored
Aug 06, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modernise test
parent
bf43cd24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
22 deletions
+37
-22
tests/run/charptr_len.pyx
tests/run/charptr_len.pyx
+37
-22
No files found.
tests/run/charptr_len.pyx
View file @
d319ed83
__doc__
=
"""
>>> lentest_char()
7
>>> lentest_char_c()
7
>>> lentest_char_c_short()
7
>>> lentest_char_c_float()
7.0
>>> lentest_uchar()
7
>>> lentest_uchar_c()
7
>>> lentest_py()
7
>>> lentest_py_c()
7
"""
cimport
cython
cimport
cython
cdef
char
*
s
=
b"abcdefg"
cdef
char
*
s
=
b"abcdefg"
...
@@ -31,26 +9,45 @@ cdef bytes pystr = b"abcdefg"
...
@@ -31,26 +9,45 @@ cdef bytes pystr = b"abcdefg"
"//PythonCapiCallNode"
,
"//PythonCapiCallNode"
,
)
)
def
lentest_char
():
def
lentest_char
():
"""
>>> lentest_char()
7
"""
return
len
(
s
)
return
len
(
s
)
@
cython
.
test_assert_path_exists
(
@
cython
.
test_assert_path_exists
(
"//PythonCapiCallNode"
,
"//PythonCapiCallNode"
,
)
)
def
lentest_char_c
():
def
lentest_char_c
():
"""
>>> lentest_char_c()
7
"""
cdef
Py_ssize_t
l
=
len
(
s
)
cdef
Py_ssize_t
l
=
len
(
s
)
return
l
return
l
@
cython
.
test_assert_path_exists
(
@
cython
.
test_assert_path_exists
(
"//PythonCapiCallNode"
,
"//PythonCapiCallNode"
,
)
)
def
lentest_char_c_short
():
def
lentest_char_c_short
():
"""
>>> lentest_char_c_short()
7
"""
cdef
short
l
=
len
(
s
)
cdef
short
l
=
len
(
s
)
return
l
return
l
@
cython
.
test_assert_path_exists
(
@
cython
.
test_assert_path_exists
(
"//PythonCapiCallNode"
,
"//PythonCapiCallNode"
,
)
)
def
lentest_char_c_float
():
def
lentest_char_c_float
():
"""
>>> lentest_char_c_float()
7.0
"""
cdef
float
l
=
len
(
s
)
cdef
float
l
=
len
(
s
)
return
l
return
l
...
@@ -59,19 +56,37 @@ def lentest_char_c_float():
...
@@ -59,19 +56,37 @@ def lentest_char_c_float():
"//PythonCapiCallNode"
,
"//PythonCapiCallNode"
,
)
)
def
lentest_uchar
():
def
lentest_uchar
():
"""
>>> lentest_uchar()
7
"""
return
len
(
us
)
return
len
(
us
)
@
cython
.
test_assert_path_exists
(
@
cython
.
test_assert_path_exists
(
"//PythonCapiCallNode"
,
"//PythonCapiCallNode"
,
)
)
def
lentest_uchar_c
():
def
lentest_uchar_c
():
"""
>>> lentest_uchar_c()
7
"""
cdef
Py_ssize_t
l
=
len
(
us
)
cdef
Py_ssize_t
l
=
len
(
us
)
return
l
return
l
def
lentest_py
():
def
lentest_py
():
"""
>>> lentest_py()
7
"""
return
len
(
pystr
)
return
len
(
pystr
)
def
lentest_py_c
():
def
lentest_py_c
():
"""
>>> lentest_py_c()
7
"""
cdef
Py_ssize_t
l
=
len
(
pystr
)
cdef
Py_ssize_t
l
=
len
(
pystr
)
return
l
return
l
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment