added new failing C++ test for iterating over the pointer to a C++ vector
authorStefan Behnel <stefan_ml@behnel.de>
Sat, 11 Aug 2012 20:08:21 +0000 (22:08 +0200)
committerStefan Behnel <stefan_ml@behnel.de>
Sat, 11 Aug 2012 20:08:21 +0000 (22:08 +0200)
tests/run/cpp_iterators.pyx

index ceb25a8..2748f47 100644 (file)
@@ -48,3 +48,17 @@ def test_custom():
         return [x for x in iter[0]]
     finally:
         del iter
+
+def test_iteration_over_heap_vector(L):
+    """
+    >>> test_iteration_over_heap_vector([1,2])
+    (1, 2)
+    """
+    cdef int i
+    cdef vector[int] *vint = new vector[int]()
+    try:
+        for i in L:
+            vint.push_back(i)
+        return [ i for i in vint ]
+    finally:
+        del vint