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
Boxiang Sun
cython
Commits
45271704
Commit
45271704
authored
Aug 15, 2008
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More inplace operator testcases
parent
ff7fc826
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
tests/run/inplace.pyx
tests/run/inplace.pyx
+41
-0
No files found.
tests/run/inplace.pyx
View file @
45271704
...
...
@@ -10,6 +10,12 @@ __doc__ = u"""
>>> arrays()
19
>>> attributes()
26 26 26
>>> smoketest()
10
"""
def
f
(
a
,
b
):
...
...
@@ -42,3 +48,38 @@ def arrays():
buf
[
j
]
-=
1
print
buf
[
2
]
stdlib
.
free
(
buf
)
cdef
class
A
:
cdef
attr
cdef
int
attr2
cdef
char
*
buf
def
__init__
(
self
):
self
.
attr
=
3
self
.
attr2
=
3
class
B
:
attr
=
3
def
attributes
():
cdef
A
a
=
A
()
b
=
B
()
a
.
attr
+=
10
a
.
attr
*=
2
a
.
attr2
+=
10
a
.
attr2
*=
2
b
.
attr
+=
10
b
.
attr
*=
2
print
a
.
attr
,
a
.
attr2
,
b
.
attr
def
get_2
():
return
2
cdef
int
identity
(
int
value
):
return
value
def
smoketest
():
cdef
char
*
buf
=
<
char
*>
stdlib
.
malloc
(
10
)
cdef
A
a
=
A
()
a
.
buf
=
buf
a
.
buf
[
identity
(
1
)]
=
0
(
a
.
buf
+
identity
(
4
)
-
<
int
>
(
2
*
get_2
()
-
1
))[
get_2
()
-
2
*
identity
(
1
)]
+=
10
print
a
.
buf
[
1
]
stdlib
.
free
(
buf
)
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