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
988c3f64
Commit
988c3f64
authored
Feb 10, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compile time IF/DEF tests
parent
04794cd7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
3 deletions
+99
-3
tests/run/ct_DEF.pyx
tests/run/ct_DEF.pyx
+84
-0
tests/run/ct_IF.pyx
tests/run/ct_IF.pyx
+15
-3
No files found.
tests/
compile
/ct_DEF.pyx
→
tests/
run
/ct_DEF.pyx
View file @
988c3f64
__doc__
=
"""
>>> c()
120
>>> i()
42
>>> l()
666
>>> f()
12.5
>>> s()
'spam'
>>> two()
2
>>> five()
5
>>> true()
True
>>> false()
False
"""
DEF
TUPLE
=
(
1
,
2
,
"buckle my shoe"
)
DEF
TRUE_FALSE
=
(
True
,
False
)
DEF
CHAR
=
c
'x'
DEF
CHAR
=
c
'x'
DEF
INT
=
42
DEF
INT
=
42
DEF
LONG
=
666L
DEF
LONG
=
666L
DEF
FLOAT
=
1
7.88
DEF
FLOAT
=
1
2.5
DEF
STR
=
"spam"
DEF
STR
=
"spam"
DEF
TUPLE
=
(
1
,
2
,
"buckle my shoe"
)
DEF
TWO
=
TUPLE
[
1
]
DEF
TWO
=
TUPLE
[
1
]
DEF
FIVE
=
TWO
+
3
DEF
FIVE
=
TWO
+
3
DEF
TRUE
=
TRUE_FALSE
[
0
]
DEF
FALSE
=
TRUE_FALSE
[
1
]
cdef
void
f
():
def
c
():
cdef
char
c
cdef
char
c
cdef
int
i
cdef
long
l
cdef
float
f
cdef
char
*
s
cdef
int
two
cdef
int
five
c
=
CHAR
c
=
CHAR
return
c
def
i
():
cdef
int
i
i
=
INT
i
=
INT
return
i
def
l
():
cdef
long
l
l
=
LONG
l
=
LONG
return
l
def
f
():
cdef
float
f
f
=
FLOAT
f
=
FLOAT
return
f
def
s
():
cdef
char
*
s
s
=
STR
s
=
STR
return
s
# this does not work!
#def t():
# cdef object t
# t = TUPLE
# return t
def
two
():
cdef
int
two
two
=
TWO
two
=
TWO
return
two
def
five
():
cdef
int
five
five
=
FIVE
five
=
FIVE
return
five
def
true
():
cdef
bint
true
true
=
TRUE
return
true
def
false
():
cdef
bint
false
false
=
FALSE
return
false
tests/
broke
n/ct_IF.pyx
→
tests/
ru
n/ct_IF.pyx
View file @
988c3f64
__doc__
=
"""
>>> f()
1
>>> g()
2
>>> h()
3
"""
DEF
NO
=
0
DEF
NO
=
0
DEF
YES
=
1
DEF
YES
=
1
cdef
void
f
():
def
f
():
cdef
int
i
cdef
int
i
IF
YES
:
IF
YES
:
i
=
1
i
=
1
...
@@ -9,8 +18,9 @@ cdef void f():
...
@@ -9,8 +18,9 @@ cdef void f():
i
=
2
i
=
2
ELSE
:
ELSE
:
i
=
3
i
=
3
return
i
cdef
void
g
():
def
g
():
cdef
int
i
cdef
int
i
IF
NO
:
IF
NO
:
i
=
1
i
=
1
...
@@ -18,8 +28,9 @@ cdef void g():
...
@@ -18,8 +28,9 @@ cdef void g():
i
=
2
i
=
2
ELSE
:
ELSE
:
i
=
3
i
=
3
return
i
cdef
void
h
():
def
h
():
cdef
int
i
cdef
int
i
IF
NO
:
IF
NO
:
i
=
1
i
=
1
...
@@ -27,3 +38,4 @@ cdef void h():
...
@@ -27,3 +38,4 @@ cdef void h():
i
=
2
i
=
2
ELSE
:
ELSE
:
i
=
3
i
=
3
return
i
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