Cython has moved to github.
cython-devel
view tests/run/carrays.pyx @ 1622:4f0327bdebc9
test for temp allocation bug in call
| author | Robert Bradshaw <robertwb@math.washington.edu> |
|---|---|
| date | Sat Jan 17 01:25:34 2009 -0800 (3 years ago) |
| parents | 009d5a34760e |
| children | 0310198e281e |
line source
1 __doc__ = """
2 >>> test1()
3 2
4 >>> test2()
5 0
6 >>> test3()
7 (2, 3)
8 """
10 def test1():
11 cdef int x[2][2]
12 x[0][0] = 1
13 x[0][1] = 2
14 x[1][0] = 3
15 x[1][1] = 4
16 return f(x)[1]
18 cdef int* f(int x[2][2]):
19 return x[0]
22 def test2():
23 cdef int a1[5]
24 cdef int a2[2+3]
25 return sizeof(a1) - sizeof(a2)
27 cdef enum:
28 MY_SIZE_A = 2
29 MY_SIZE_B = 3
31 def test3():
32 cdef int a[MY_SIZE_A]
33 cdef int b[MY_SIZE_B]
34 return sizeof(a)/sizeof(int), sizeof(b)/sizeof(int)
