diff options
| author | Alan Conway <aconway@apache.org> | 2008-01-18 21:44:55 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-01-18 21:44:55 +0000 |
| commit | 1ee12a31fc2a0e8f25860852f71ed3e1a9d38074 (patch) | |
| tree | bc084704bace0e3dfc006895049fa320acb139ab /cpp/src/tests/IList.cpp | |
| parent | b43036056e0dc7ad8fb919bd1f5b065ff01502c5 (diff) | |
| download | qpid-python-1ee12a31fc2a0e8f25860852f71ed3e1a9d38074.tar.gz | |
qpid/IList.h: Added public T* getNext(), T* getPrev() to IListNode so node subclasses
can follow their own links.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@613290 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/IList.cpp')
| -rw-r--r-- | cpp/src/tests/IList.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/cpp/src/tests/IList.cpp b/cpp/src/tests/IList.cpp index ed36228828..f5d7cd344e 100644 --- a/cpp/src/tests/IList.cpp +++ b/cpp/src/tests/IList.cpp @@ -49,7 +49,9 @@ struct TestNode { int TestNode::instances = 0; ostream& operator<<(ostream& o, const TestNode& n) { return o << n.id; } -struct SingleNode : public TestNode, public IListNode<> { SingleNode(char i) : TestNode(i) {} }; +struct SingleNode : public TestNode, public IListNode<SingleNode> { + SingleNode(char i) : TestNode(i) {} +}; typedef IList<SingleNode> TestList; struct Fixture { @@ -119,8 +121,16 @@ BOOST_FIXTURE_TEST_CASE(TestIterator, Fixture) { { TestList l; l.push_back(*a); + BOOST_CHECK(a->getNext() == 0); + BOOST_CHECK(a->getPrev() == 0); l.push_back(*b); + BOOST_CHECK(a->getNext() == b.get()); + BOOST_CHECK(a->getPrev() == 0); + BOOST_CHECK(b->getNext() == 0); + BOOST_CHECK(b->getPrev() == a.get()); l.push_back(*c); + BOOST_CHECK(b->getNext() == c.get()); + BOOST_CHECK(c->getPrev() == b.get()); TestList::iterator i = l.begin(); BOOST_CHECK_EQUAL(*i, *a); @@ -155,7 +165,11 @@ BOOST_FIXTURE_TEST_CASE(testOwnership, Fixture) { BOOST_CHECK_EQUAL(0, SingleNode::instances); } -struct MultiNode : public TestNode, public IListNode<0>, public IListNode<1>, public IListNode<2> { +struct MultiNode : public TestNode, + public IListNode<MultiNode, 0>, + public IListNode<MultiNode, 1>, + public IListNode<MultiNode, 2> +{ MultiNode(char c) : TestNode(c) {} }; |
