tests for inc/dec and deref
authorRobert Bradshaw <robertwb@math.washington.edu>
Thu, 14 Jan 2010 23:41:41 +0000 (15:41 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Thu, 14 Jan 2010 23:41:41 +0000 (15:41 -0800)
tests/run/unop_extras.pyx [new file with mode: 0644]

diff --git a/tests/run/unop_extras.pyx b/tests/run/unop_extras.pyx
new file mode 100644 (file)
index 0000000..1c15d46
--- /dev/null
@@ -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