BIND 10 trac2218_2, updated. 328b5fc4dbbafe7a5286d857581505a7cf55ea0e [2218] Add test for DomainTreeNode::getLargestInSubTree()
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Sep 19 07:49:22 UTC 2012
The branch, trac2218_2 has been updated
via 328b5fc4dbbafe7a5286d857581505a7cf55ea0e (commit)
from 10018747ad68736c31da97ec1ad7c5eef94489a0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 328b5fc4dbbafe7a5286d857581505a7cf55ea0e
Author: Mukund Sivaraman <muks at isc.org>
Date: Wed Sep 19 13:19:04 2012 +0530
[2218] Add test for DomainTreeNode::getLargestInSubTree()
-----------------------------------------------------------------------
Summary of changes:
.../datasrc/memory/tests/domaintree_unittest.cc | 34 ++++++++++++++++++++
1 file changed, 34 insertions(+)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/tests/domaintree_unittest.cc b/src/lib/datasrc/memory/tests/domaintree_unittest.cc
index 25d7aa9..b26c9b5 100644
--- a/src/lib/datasrc/memory/tests/domaintree_unittest.cc
+++ b/src/lib/datasrc/memory/tests/domaintree_unittest.cc
@@ -692,6 +692,11 @@ const char* const subtree_root_node_names[] = {
"p.w.y.d.e.f", "p.w.y.d.e.f", "w.y.d.e.f", "j.z.d.e.f",
"b", "i.g.h", "i.g.h"};
+const char* const largest_node_names[] = {
+ "g.h", "g.h", "g.h", "g.h", "z.d.e.f", "z.d.e.f", "q.w.y.d.e.f",
+ "q.w.y.d.e.f", "q.w.y.d.e.f", "z.d.e.f", "j.z.d.e.f",
+ "g.h", "k.g.h", "k.g.h"};
+
TEST_F(DomainTreeTest, getUpperNode) {
TestDomainTreeNodeChain node_path;
const TestDomainTreeNode* node = NULL;
@@ -750,6 +755,35 @@ TEST_F(DomainTreeTest, getSubTreeRoot) {
EXPECT_EQ(static_cast<void*>(NULL), node);
}
+TEST_F(DomainTreeTest, getLargestInSubTree) {
+ TestDomainTreeNodeChain node_path;
+ const TestDomainTreeNode* node = NULL;
+ EXPECT_EQ(TestDomainTree::EXACTMATCH,
+ dtree_expose_empty_node.find(Name(names[0]),
+ &node,
+ node_path));
+ for (int i = 0; i < name_count; ++i) {
+ EXPECT_NE(static_cast<void*>(NULL), node);
+
+ const TestDomainTreeNode* largest_node = node->getLargestInSubTree();
+ if (largest_node_names[i] != NULL) {
+ const TestDomainTreeNode* largest_node2 = NULL;
+ EXPECT_EQ(TestDomainTree::EXACTMATCH,
+ dtree_expose_empty_node.find(Name(largest_node_names[i]),
+ &largest_node2));
+ EXPECT_NE(static_cast<void*>(NULL), largest_node2);
+ EXPECT_EQ(largest_node, largest_node2);
+ } else {
+ EXPECT_EQ(static_cast<void*>(NULL), largest_node);
+ }
+
+ node = dtree_expose_empty_node.nextNode(node_path);
+ }
+
+ // We should have reached the end of the tree.
+ EXPECT_EQ(static_cast<void*>(NULL), node);
+}
+
TEST_F(DomainTreeTest, nextNode) {
TestDomainTreeNodeChain node_path;
const TestDomainTreeNode* node = NULL;
More information about the bind10-changes
mailing list