From: Lisandro Dalcin Date: Wed, 14 Apr 2010 15:18:21 +0000 (-0300) Subject: add C++ test for an additional level of template nesting X-Git-Tag: 0.13.beta0~215 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e18c8e7ac7ded53df9c687c9afd98565ea5b4f29;p=cython.git add C++ test for an additional level of template nesting --HG-- extra : rebase_source : 1b2428d6eb5f92a0e0fd0818b71f7acdb57b15f4 --- diff --git a/tests/run/cpp_nested_templates.pyx b/tests/run/cpp_nested_templates.pyx index 85e7c475..ff3345dd 100644 --- a/tests/run/cpp_nested_templates.pyx +++ b/tests/run/cpp_nested_templates.pyx @@ -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 diff --git a/tests/run/cpp_templates_helper.h b/tests/run/cpp_templates_helper.h index e8b8b8af..f7dd4ba8 100644 --- a/tests/run/cpp_templates_helper.h +++ b/tests/run/cpp_templates_helper.h @@ -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; }