From 2bc8d9cbf2820b8e7e193d15127125ffb5006641 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Thu, 14 Jan 2010 15:41:41 -0800 Subject: [PATCH] tests for inc/dec and deref --- tests/run/unop_extras.pyx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/run/unop_extras.pyx 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 -- 2.26.2