add test for temp type adaptation from C array to C pointer type
authorStefan Behnel <stefan_ml@behnel.de>
Sun, 18 Nov 2012 06:16:45 +0000 (07:16 +0100)
committerStefan Behnel <stefan_ml@behnel.de>
Sun, 18 Nov 2012 06:16:45 +0000 (07:16 +0100)
--HG--
extra : transplant_source : %08%F6%88rE%C7%F5%CD.%9Ad%244m%0Cw%8C%25g%C0

tests/run/cascaded_typed_assignments_T466.pyx

index 0e34c12..5ae0d85 100644 (file)
@@ -2,6 +2,8 @@
 # ticket: 466
 # extension to T409
 
+cimport cython
+
 def simple_parallel_typed():
     """
     >>> simple_parallel_typed()
@@ -67,3 +69,23 @@ def non_simple_rhs_malloc():
     # check copied values
     assert x[0] == c'X'
     assert x[1] == c'\0'
+
+@cython.test_assert_path_exists(
+    '//CascadedAssignmentNode',
+    '//CascadedAssignmentNode//CoerceToTempNode',
+    '//CascadedAssignmentNode//CoerceToTempNode[@type.is_ptr]')
+def assign_carray():
+    """
+    assign_carray()
+    (1, 2, 3)
+    """
+    cdef int *b, *c
+    cdef int[3] a
+    a[0] = 1
+    a[1] = 2
+    a[2] = 3
+
+    b = c = a+1
+    assert b[0] == 2
+    assert c[1] == 3
+    return a[0], b[0], c[1]