Commit 22e13080 authored by Stefan Behnel's avatar Stefan Behnel

loads of test cases

parent b4c9ca28
__doc__ = """
>>> flub(25)
25
>>> g()
0
"""
cdef extern from "altet1.h": cdef extern from "altet1.h":
ctypedef int blarg ctypedef int blarg
...@@ -7,3 +14,6 @@ def flub(blarg bobble): ...@@ -7,3 +14,6 @@ def flub(blarg bobble):
print bobble print bobble
globvar = 0 globvar = 0
def g():
return globvar
__doc__ = """
>>> test()
1
"""
cdef extern from "hinsen1.h": cdef extern from "hinsen1.h":
ctypedef class spam.Spam [object PySpamObject]: ctypedef class spam.Spam [object PySpamObject]:
...@@ -7,4 +12,9 @@ cdef extern from "hinsen1.h": ...@@ -7,4 +12,9 @@ cdef extern from "hinsen1.h":
cdef class SpamAndEggs(Spam): cdef class SpamAndEggs(Spam):
cdef cook(self): cdef cook(self):
pass return 1
def test():
cdef SpamAndEggs s
s = SpamAndEggs()
return s.cook()
cdef extern object g(int x) nogil cdef extern void g(int x) nogil
cdef void f(int x) nogil: cdef void f(int x) nogil:
cdef int y cdef int y
......
def f(obj1, obj2): __doc__ = """
>>> f(20)
'20'
>>> f('test')
"'test'"
>>> g()
'42'
"""
def f(obj2):
obj1 = `obj2` obj1 = `obj2`
obj1 = `42` return obj1
def g():
obj1 = `42`
return obj1
...@@ -2,8 +2,8 @@ __doc__ = """ ...@@ -2,8 +2,8 @@ __doc__ = """
>>> f(1.0, 2.95)[0] == f(1.0, 2.95)[1] >>> f(1.0, 2.95)[0] == f(1.0, 2.95)[1]
True True
>>> constant_py() >>> constant_py() == 2L ** 10
1024L True
>>> constant_long() == 2L ** 36 >>> constant_long() == 2L ** 36
True True
......
__doc__ = """
>>> f()
"""
cdef struct Spam: cdef struct Spam:
char *grail char *grail
cdef void f(): def f():
cdef int i, j, k cdef int i, j, k
cdef char *p cdef char *p
i = sizeof(p) i = sizeof(p)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment