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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
8babfd03
Commit
8babfd03
authored
Apr 25, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
additional test for arrays
parent
bfc918c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
1 deletion
+29
-1
tests/run/ctypedef_char_types.pyx
tests/run/ctypedef_char_types.pyx
+29
-1
No files found.
tests/run/ctypedef_char_types.pyx
View file @
8babfd03
...
...
@@ -16,14 +16,42 @@ def const_charptrs():
"""
cdef
object
obj
cdef
const_char
*
st
=
b'XYZ'
cdef
const_uchar
*
ust
=
b'XYZ'
cdef
const_uchar
*
ust
=
<
unsigned
char
*>
b'XYZ'
# needs cast to unsigned
assert
typeof
(
st
)
==
"const_char *"
,
typeof
(
st
)
my_st
=
st
assert
typeof
(
my_st
)
==
"const_char *"
,
typeof
(
my_st
)
obj
=
my_st
assert
obj
==
b'XYZ'
assert
typeof
(
ust
)
==
"const_uchar *"
,
typeof
(
ust
)
my_ust
=
ust
assert
typeof
(
my_ust
)
==
"const_uchar *"
,
typeof
(
my_ust
)
obj
=
my_ust
assert
obj
==
b'XYZ'
ctypedef
char
mychar
ctypedef
unsigned
char
myuchar
def
const_char_arrays
():
"""
>>> const_char_arrays()
"""
cdef
int
i
cdef
object
obj
cdef
mychar
[
4
]
st
cdef
myuchar
[
4
]
ust
i
=
0
for
ch
in
<
char
*>
b'XYZ
\
0
'
:
st
[
i
]
=
ch
ust
[
i
]
=
ch
i
+=
1
assert
typeof
(
st
)
==
"mychar [4]"
,
typeof
(
st
)
obj
=
st
assert
obj
==
b'XYZ'
assert
typeof
(
ust
)
==
"myuchar [4]"
,
typeof
(
ust
)
obj
=
ust
assert
obj
==
b'XYZ'
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