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
72cf1a61
Commit
72cf1a61
authored
May 27, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test for min/max builtins
parent
d1f76b27
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
0 deletions
+92
-0
tests/run/builtin_min_max.pyx
tests/run/builtin_min_max.pyx
+92
-0
No files found.
tests/run/builtin_min_max.pyx
0 → 100644
View file @
72cf1a61
cimport
cython
# min()
@
cython
.
test_assert_path_exists
(
"//IfStatNode"
)
@
cython
.
test_fail_if_path_exists
(
"//SimpleCallNode"
)
def
min3
(
a
,
b
,
c
):
"""
>>> min3(1,2,3)
1
>>> min3(2,3,1)
1
>>> min3(2,1,3)
1
>>> min3(3,1,2)
1
>>> min3(3,2,1)
1
"""
return
min
(
a
,
b
,
c
)
@
cython
.
test_assert_path_exists
(
"//IfStatNode"
)
@
cython
.
test_fail_if_path_exists
(
"//SimpleCallNode"
)
def
min3_typed
(
int
a
,
int
b
,
int
c
):
"""
>>> min3_typed(1,2,3)
1
>>> min3_typed(2,3,1)
1
>>> min3_typed(2,1,3)
1
>>> min3_typed(3,1,2)
1
>>> min3_typed(3,2,1)
1
"""
return
min
(
a
,
b
,
c
)
@
cython
.
test_assert_path_exists
(
"//IfStatNode"
)
@
cython
.
test_fail_if_path_exists
(
"//SimpleCallNode"
)
def
literal_min3
():
"""
>>> literal_min3()
(1, 1, 1, 1, 1)
"""
return
min
(
1
,
2
,
3
),
min
(
2
,
1
,
3
),
min
(
2
,
3
,
1
),
min
(
3
,
1
,
2
),
min
(
3
,
2
,
1
)
# max()
@
cython
.
test_assert_path_exists
(
"//IfStatNode"
)
@
cython
.
test_fail_if_path_exists
(
"//SimpleCallNode"
)
def
max3
(
a
,
b
,
c
):
"""
>>> max3(1,2,3)
3
>>> max3(2,3,1)
3
>>> max3(2,1,3)
3
>>> max3(3,1,2)
3
>>> max3(3,2,1)
3
"""
return
max
(
a
,
b
,
c
)
@
cython
.
test_assert_path_exists
(
"//IfStatNode"
)
@
cython
.
test_fail_if_path_exists
(
"//SimpleCallNode"
)
def
max3_typed
(
int
a
,
int
b
,
int
c
):
"""
>>> max3_typed(1,2,3)
3
>>> max3_typed(2,3,1)
3
>>> max3_typed(2,1,3)
3
>>> max3_typed(3,1,2)
3
>>> max3_typed(3,2,1)
3
"""
return
max
(
a
,
b
,
c
)
@
cython
.
test_assert_path_exists
(
"//IfStatNode"
)
@
cython
.
test_fail_if_path_exists
(
"//SimpleCallNode"
)
def
literal_max3
():
"""
>>> literal_max3()
(3, 3, 3, 3, 3)
"""
return
max
(
1
,
2
,
3
),
max
(
2
,
1
,
3
),
max
(
2
,
3
,
1
),
max
(
3
,
1
,
2
),
max
(
3
,
2
,
1
)
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