projects
/
cython.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
extended 'if' test case that enforces heavy temp usage
[cython.git]
/
tests
/
run
/
if.pyx
1
__doc__ = u"""
2
>>> f(0,0)
3
0
4
>>> f(1,2)
5
2
6
>>> f(1,-1)
7
1
8
9
>>> g(1,2)
10
1
11
>>> g(0,2)
12
2
13
>>> g(0,0)
14
0
15
16
>>> h(1,2)
17
1
18
>>> h(0,2)
19
2
20
>>> h(0,0)
21
3
22
23
>>> i(1,2)
24
1
25
>>> i(2,2)
26
2
27
>>> i(2,1)
28
0
29
"""
30
31
def f(a, b):
32
x = 0
33
if a:
34
x = 1
35
if a+b:
36
x = 2
37
return x
38
39
def g(a, b):
40
x = 0
41
if a:
42
x = 1
43
elif b:
44
x = 2
45
return x
46
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
56
57
def i(a, b):
58
x = 0
59
if str(a).upper() == u"1":
60
x = 1
61
if str(a+b).lower() not in (u"1", u"3"):
62
x = 2
63
return x