46 CPPUNIT_ASSERT(parentParent == 0);
54 CPPUNIT_ASSERT(parent == p);
62 CPPUNIT_ASSERT( child1->
isSibling(child2) ==
true);
63 CPPUNIT_ASSERT( child2->
isSibling(child1) ==
true);
92 CPPUNIT_ASSERT( child1Ref->getIndex() == child1->
getIndex());
93 CPPUNIT_ASSERT( child2Ref->getIndex() == child2->
getIndex());
106 CPPUNIT_ASSERT( child1->getChildrenCount() == 0);
109 child1->disconnect();
132 CPPUNIT_ASSERT(item->getIndex() == indexes[idx]);
161 std::size_t count = 0;
165 CPPUNIT_ASSERT(count == 11);
179 CPPUNIT_ASSERT(c0->getIndex() == child0->
getIndex());
180 CPPUNIT_ASSERT(c1->getIndex() == child1->
getIndex());
202 CPPUNIT_ASSERT(c0->getIndex() == node1->
getIndex());
203 CPPUNIT_ASSERT(c1->getIndex() == (*node0)->getIndex());
228 CPPUNIT_ASSERT(child4->
getIndex() == child->getIndex());
240 parent->
swap(child0, child1);
245 CPPUNIT_ASSERT(c0->getIndex() == i1);
246 CPPUNIT_ASSERT(c1->getIndex() == i0);
260 child0->
swap(child1);
265 CPPUNIT_ASSERT(c0->getIndex() == i1);
266 CPPUNIT_ASSERT(c1->getIndex() == i0);
CPPUNIT_TEST_SUITE_REGISTRATION(TsTreeItem)
const TreeItemPtr & getChild(std::size_t i) const
It returns the n-th child.
std::size_t getChildrenCount() const
It returns the number of children of this node.
void swap(const TreeItemPtr &firstChild, const TreeItemPtr &secondChild)
It swaps the position of the given children.
bool isSibling(const TreeItem *item) const
It checks if the given layer is sibling of this one.
This abstract class describes a basic item to be organized in a tree-oriented way.
std::size_t getIndex() const
It returns the index of this item in the list of children of its parent item.
void add(const TreeItemPtr &childItem)
It adds (appends) the item to the end of the children's list.
void parentChildConnection()
boost::intrusive_ptr< TreeItem > TreeItemPtr
TreeItemPtr remove(std::size_t i)
It removes the i-th child.
const_iterator begin() const
It returns the constant iterator associated to the first child of this item.
void getChildAndCheckItsIndex()
const_iterator end() const
It returns the constant iterator that refers to one past the end of the children of this item...
Test suite for the TreeItem.
TreeItem * getParent() const
It returns a pointer to the parent of this node.
void checkNumberOfChildren()
Test suite for the TreeItem.
This file contains include headers for the TerraLib Common Runtime module.
void getDescendantsCount(std::size_t &count) const
It returns the number of nodes that descends from this node.
std::list< TreeItemPtr >::const_iterator const_iterator
void insert(std::size_t i, const TreeItemPtr &childItem)
It inserts an item in the informed position.