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
Kirill Smelkov
cython
Commits
f3fd7f91
Commit
f3fd7f91
authored
Nov 04, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests for ticket #446.
parent
e2c691d3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
tests/run/complex_int_T446.pyx
tests/run/complex_int_T446.pyx
+46
-0
No files found.
tests/run/complex_int_T446.pyx
0 → 100644
View file @
f3fd7f91
import
cython
def
test_arith
(
int
complex
a
,
int
complex
b
):
"""
>>> test_arith(4, 2)
((-4+0j), (6+0j), (2+0j), (8+0j), (2+0j))
>>> test_arith(6+9j, 3j)
((-6-9j), (6+12j), (6+6j), (-27+18j), (3-2j))
>>> test_arith(29+11j, 5+7j)
((-29-11j), (34+18j), (24+4j), (68+258j), (3-2j))
"""
return
-
a
,
a
+
b
,
a
-
b
,
a
*
b
,
a
/
b
@
cython
.
cdivision
(
False
)
def
test_div_by_zero
(
long
complex
z
):
"""
>>> test_div_by_zero(4j)
-25j
>>> test_div_by_zero(0)
Traceback (most recent call last):
...
ZeroDivisionError: float division
"""
return
100
/
z
def
test_coercion
(
int
a
,
long
b
,
int
complex
c
):
"""
>>> test_coercion(1, -2, 3-3j)
(1+0j)
(-2+0j)
(3-3j)
(5-6j)
"""
cdef
double
complex
z
z
=
a
;
print
z
z
=
b
;
print
z
z
=
c
;
print
z
return
z
+
a
+
b
+
c
def
test_conjugate
(
long
complex
z
):
"""
>>> test_conjugate(2+3j)
(2-3j)
"""
return
z
.
conjugate
()
\ No newline at end of file
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