add C++ test for an additional level of template nesting
authorLisandro Dalcin <dalcinl@gmail.com>
Wed, 14 Apr 2010 15:18:21 +0000 (12:18 -0300)
committerLisandro Dalcin <dalcinl@gmail.com>
Wed, 14 Apr 2010 15:18:21 +0000 (12:18 -0300)
--HG--
extra : rebase_source : 1b2428d6eb5f92a0e0fd0818b71f7acdb57b15f4

tests/run/cpp_nested_templates.pyx
tests/run/cpp_templates_helper.h

index 85e7c4754a2e6ee8f9c365505f24fcc03bb71dda..ff3345dd13157f34ea9904cb728137019bbef7f7 100644 (file)
@@ -26,3 +26,20 @@ def test_wrap_pair(int i, double x):
         return wrap.get().first(), wrap.get().second(), deref(wrap) == deref(wrap)
     finally:
         del wrap
+
+def test_wrap_pair_pair(int i, int j, double x):
+    """
+    >>> test_wrap_pair_pair(1, 3, 1.5)
+    (1, 3, 1.5, True)
+    >>> test_wrap_pair_pair(2, 5, 2.25)
+    (2, 5, 2.25, True)
+    """
+    try:
+        wrap = new Wrap[Pair[int, Pair[int, double]]](
+                        Pair[int, Pair[int, double]](i,Pair[int, double](j, x)))
+        return (wrap.get().first(), 
+                wrap.get().second().first(),
+                wrap.get().second().second(), 
+                deref(wrap) == deref(wrap))
+    finally:
+        del wrap
index e8b8b8af4ca6f4321eacc8d9d2444a11664d8f14..f7dd4ba87eff1da99bad5109446cd0aa3df2cb63 100644 (file)
@@ -13,6 +13,7 @@ class Pair {
     T1 _first;
     T2 _second;
 public:
+    Pair() { }
     Pair(T1 u, T2 v) { _first = u; _second = v; }
     T1 first(void) { return _first; }
     T2 second(void) { return _second; }