From: Robert Bradshaw Date: Thu, 14 Jan 2010 23:41:41 +0000 (-0800) Subject: tests for inc/dec and deref X-Git-Tag: 0.13.beta0~353^2~22 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2bc8d9cbf2820b8e7e193d15127125ffb5006641;p=cython.git tests for inc/dec and deref --- diff --git a/tests/run/unop_extras.pyx b/tests/run/unop_extras.pyx new file mode 100644 index 00000000..1c15d466 --- /dev/null +++ b/tests/run/unop_extras.pyx @@ -0,0 +1,22 @@ +cimport cython + +def test_deref(int x): + """ + >>> test_deref(3) + 3 + >>> test_deref(5) + 5 + """ + cdef int* x_ptr = &x + return cython.dereference(x_ptr) + +def increment_decrement(int x): + """ + >>> increment_decrement(10) + 11 11 12 + 11 11 10 + 10 + """ + print cython.preincrement(x), cython.postincrement(x), x + print cython.predecrement(x), cython.postdecrement(x), x + return x