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
85fea391
Commit
85fea391
authored
Jun 20, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
additional test case for union assignments
parent
ea8e64b9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
tests/run/struct_conversion.pyx
tests/run/struct_conversion.pyx
+15
-0
No files found.
tests/run/struct_conversion.pyx
View file @
85fea391
...
@@ -39,6 +39,21 @@ cdef union int_or_float:
...
@@ -39,6 +39,21 @@ cdef union int_or_float:
int
n
int
n
double
x
double
x
def
test_union_constructor
(
n
,
x
):
"""
>>> test_union_constructor(1, None)
1
>>> test_union_constructor(None, 2.0)
2.0
"""
cdef
int_or_float
u
if
n
is
None
:
u
=
int_or_float
(
x
=
x
)
return
u
.
x
else
:
u
=
int_or_float
(
n
=
n
)
return
u
.
n
cdef
struct
with_pointers
:
cdef
struct
with_pointers
:
bint
is_integral
bint
is_integral
int_or_float
data
int_or_float
data
...
...
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