#include #include #include struct foo { }; int main() { using std::cout; using namespace origin; using namespace origin::trees; // Just checking... BOOST_ASSERT(sizeof(tree_::node) < sizeof(tree_::node)); typedef tree_::node Node; Node n[5]; Node* root = &n[0]; Node *a = &n[1], *b = &n[2], *c = &n[3]; BOOST_ASSERT(root->parent() == 0); BOOST_ASSERT(root->first_child() == 0); BOOST_ASSERT(root->last_child() == 0); BOOST_ASSERT(root->prev_sibling() == 0); BOOST_ASSERT(root->next_sibling() == 0); root->prepend_child(a); BOOST_ASSERT(a->parent() == root); BOOST_ASSERT(a->prev_sibling() == 0); BOOST_ASSERT(a->next_sibling() == 0); BOOST_ASSERT(root->first_child() == a); BOOST_ASSERT(root->last_child() == a); root->append_child(b); BOOST_ASSERT(b->parent() == root); BOOST_ASSERT(b->prev_sibling() == a); BOOST_ASSERT(b->next_sibling() == 0); BOOST_ASSERT(a->next_sibling() == b); BOOST_ASSERT(root->first_child() == a); BOOST_ASSERT(root->last_child() == b); a->insert_after(c); BOOST_ASSERT(c->parent() == root); BOOST_ASSERT(c->prev_sibling() == a); BOOST_ASSERT(c->next_sibling() == b); BOOST_ASSERT(a->next_sibling() == c); BOOST_ASSERT(b->prev_sibling() == c); c->detach(); BOOST_ASSERT(c->parent() == 0); BOOST_ASSERT(c->prev_sibling() == 0); BOOST_ASSERT(c->next_sibling() == 0); BOOST_ASSERT(a->next_sibling() == b); BOOST_ASSERT(b->prev_sibling() == a); return 0; }