Cython has moved to github.

cython-devel

view tests/run/if.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 2e63fb93de7c
children 82d312a9f1fc
line source
1 __doc__ = u"""
2 >>> f(0,0)
3 0
4 >>> f(1,2)
5 2
6 >>> f(1,-1)
7 1
9 >>> g(1,2)
10 1
11 >>> g(0,2)
12 2
13 >>> g(0,0)
14 0
16 >>> h(1,2)
17 1
18 >>> h(0,2)
19 2
20 >>> h(0,0)
21 3
23 >>> i(1,2)
24 1
25 >>> i(2,2)
26 2
27 >>> i(2,1)
28 0
29 """
31 def f(a, b):
32 x = 0
33 if a:
34 x = 1
35 if a+b:
36 x = 2
37 return x
39 def g(a, b):
40 x = 0
41 if a:
42 x = 1
43 elif b:
44 x = 2
45 return x
47 def h(a, b):
48 x = 0
49 if a:
50 x = 1
51 elif b:
52 x = 2
53 else:
54 x = 3
55 return x
57 try:
58 import __builtin__ as builtins
59 except ImportError:
60 import builtins
62 def i(a, b):
63 x = 0
64 if builtins.str(a).upper() == u"1":
65 x = 1
66 if builtins.str(a+b).lower() not in (u"1", u"3"):
67 x = 2
68 return x