Commit e18c8e7a authored by Lisandro Dalcin's avatar Lisandro Dalcin

add C++ test for an additional level of template nesting

--HG--
extra : rebase_source : 1b2428d6eb5f92a0e0fd0818b71f7acdb57b15f4
parent 7c016d54
...@@ -26,3 +26,20 @@ def test_wrap_pair(int i, double x): ...@@ -26,3 +26,20 @@ def test_wrap_pair(int i, double x):
return wrap.get().first(), wrap.get().second(), deref(wrap) == deref(wrap) return wrap.get().first(), wrap.get().second(), deref(wrap) == deref(wrap)
finally: finally:
del wrap 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
...@@ -13,6 +13,7 @@ class Pair { ...@@ -13,6 +13,7 @@ class Pair {
T1 _first; T1 _first;
T2 _second; T2 _second;
public: public:
Pair() { }
Pair(T1 u, T2 v) { _first = u; _second = v; } Pair(T1 u, T2 v) { _first = u; _second = v; }
T1 first(void) { return _first; } T1 first(void) { return _first; }
T2 second(void) { return _second; } T2 second(void) { return _second; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment