From: Robert Bradshaw Date: Thu, 15 Oct 2009 10:01:39 +0000 (-0700) Subject: short circut bug test #404 X-Git-Tag: 0.13.beta0~2^2~121^2~48^2~4 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=b1fbfb0eb4040557d82ce0216e2d8975ba35586c;p=cython.git short circut bug test #404 --- diff --git a/tests/run/short_circuit_T404.pyx b/tests/run/short_circuit_T404.pyx new file mode 100644 index 00000000..7ef2105b --- /dev/null +++ b/tests/run/short_circuit_T404.pyx @@ -0,0 +1,41 @@ +cdef long foo(long x): + print "foo(%s)" % x + return x + +def test_or(long a, long b): + """ + >>> test_or(1,2) + foo(1) + True + >>> test_or(1,0) + foo(1) + True + >>> test_or(0,2) + foo(0) + foo(2) + True + >>> test_or(0,0) + foo(0) + foo(0) + False + """ + print foo(a) or foo(b) + +def test_and(long a, long b): + """ + >>> test_and(1,2) + foo(1) + foo(2) + True + >>> test_and(1,0) + foo(1) + foo(0) + False + >>> test_and(0,2) + foo(0) + False + >>> test_and(0,0) + foo(0) + False + """ + print foo(a) and foo(b)