Commit 7097d7cf authored by Jerry's avatar Jerry
Browse files

add unittest for printTree()


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac397@3583 e5f2f494-b856-4b98-b285-d166d9295462
parent 6ad0a214
......@@ -51,7 +51,7 @@ libasio_link_a_CPPFLAGS = $(AM_CPPFLAGS)
BUILT_SOURCES = spec_config.h
pkglibexec_PROGRAMS = b10-auth
b10_auth_SOURCES = auth_srv.cc auth_srv.h
b10_auth_SOURCES += rbt_datasrc.h
b10_auth_SOURCES += rbt_datasrc.h
b10_auth_SOURCES += change_user.cc change_user.h
b10_auth_SOURCES += common.h
b10_auth_SOURCES += main.cc
......
......@@ -878,6 +878,6 @@ RBTree<T>::printTreeHelper(std::ostream &os, const RBNode<T>* node, int depth) c
#endif // _RBTREE_H
// Local Variables:
// Local Variables:
// mode: c++
// End:
// End:
......@@ -377,4 +377,22 @@ TEST_F(RBTreeTest, eraseName) {
EXPECT_EQ(0, rbtree.getNodeCount());
}
TEST_F(RBTreeTest, printTree) {
std::ostringstream str;
std::ostringstream str2;
rbtree.printTree(str);
str2 << "tree has node 5\nb. (black)\n\n a. (black)\n\n NULL\n NULL\n d.e.f. (black)\n[invisible] \n begin down from d.e.f.\n tree has node 3\n w.y. (black)\n[invisible] \n begin down from w.y.\n tree has node 3\n p. (black)\n\n o. (red)\n\n NULL\n NULL\n q. (red)\n\n NULL\n NULL\n end down fromw.y.\n x. (red)\n\n NULL\n NULL\n z. (red)\n\n begin down from z.\n tree has node 1\n j. (black)\n\n NULL\n NULL\n end down fromz.\n NULL\n NULL\n end down fromd.e.f.\n c. (red)\n\n NULL\n NULL\n g.h. (red)\n\n begin down from g.h.\n tree has node 1\n i. (black)\n\n NULL\n NULL\n end down fromg.h.\n NULL\n NULL\n";
EXPECT_EQ(str.str(), str2.str());
rbtree.erase(Name("o.w.y.d.e.f"));
rbtree.erase(Name("p.w.y.d.e.f"));
rbtree.erase(Name("q.w.y.d.e.f"));
rbtree.erase(Name("j.z.d.e.f"));
rbtree.erase(Name("x.d.e.f"));
str.str("");
str2.str("");
rbtree.printTree(str);
str2 << "tree has node 5\nb. (black)\n\n a. (black)\n\n NULL\n NULL\n z.d.e.f. (black)\n\n c. (red)\n\n NULL\n NULL\n g.h. (red)\n\n begin down from g.h.\n tree has node 1\n i. (black)\n\n NULL\n NULL\n end down fromg.h.\n NULL\n NULL\n";
EXPECT_EQ(str.str(), str2.str());
}
}
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