[svn] commit: r3583 - in /branches/trac397/src/bin/auth: Makefile.am rbt_datasrc.h tests/rbt_datasrc_unittest.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Nov 22 02:54:56 UTC 2010
Author: chenzhengzhang
Date: Mon Nov 22 02:54:55 2010
New Revision: 3583
Log:
add unittest for printTree()
Modified:
branches/trac397/src/bin/auth/Makefile.am
branches/trac397/src/bin/auth/rbt_datasrc.h
branches/trac397/src/bin/auth/tests/rbt_datasrc_unittest.cc
Modified: branches/trac397/src/bin/auth/Makefile.am
==============================================================================
--- branches/trac397/src/bin/auth/Makefile.am (original)
+++ branches/trac397/src/bin/auth/Makefile.am Mon Nov 22 02:54:55 2010
@@ -51,7 +51,7 @@
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
Modified: branches/trac397/src/bin/auth/rbt_datasrc.h
==============================================================================
--- branches/trac397/src/bin/auth/rbt_datasrc.h (original)
+++ branches/trac397/src/bin/auth/rbt_datasrc.h Mon Nov 22 02:54:55 2010
@@ -878,6 +878,6 @@
#endif // _RBTREE_H
-// Local Variables:
+// Local Variables:
// mode: c++
-// End:
+// End:
Modified: branches/trac397/src/bin/auth/tests/rbt_datasrc_unittest.cc
==============================================================================
--- branches/trac397/src/bin/auth/tests/rbt_datasrc_unittest.cc (original)
+++ branches/trac397/src/bin/auth/tests/rbt_datasrc_unittest.cc Mon Nov 22 02:54:55 2010
@@ -377,4 +377,22 @@
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());
+}
+
+}
More information about the bind10-changes
mailing list