BIND 10 trac2811, updated. 46660bcb71022d1732161951a59519998cbd0207 [2811] Move common code to a separate function
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Feb 25 17:10:20 UTC 2013
The branch, trac2811 has been updated
via 46660bcb71022d1732161951a59519998cbd0207 (commit)
from bb9ff965b73e08cc800083546b46a5b5ede22a41 (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 46660bcb71022d1732161951a59519998cbd0207
Author: Mukund Sivaraman <muks at isc.org>
Date: Mon Feb 25 22:40:03 2013 +0530
[2811] Move common code to a separate function
-----------------------------------------------------------------------
Summary of changes:
.../datasrc/tests/memory/domaintree_unittest.cc | 42 +++++++++-----------
1 file changed, 18 insertions(+), 24 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/tests/memory/domaintree_unittest.cc b/src/lib/datasrc/tests/memory/domaintree_unittest.cc
index 48ac111..e65da18 100644
--- a/src/lib/datasrc/tests/memory/domaintree_unittest.cc
+++ b/src/lib/datasrc/tests/memory/domaintree_unittest.cc
@@ -150,6 +150,22 @@ TEST_F(DomainTreeTest, getDistance) {
}
}
+void
+checkDistances(const TestDomainTree& tree, size_t distance) {
+ TestDomainTreeNodeChain node_path;
+ const TestDomainTreeNode* node = NULL;
+
+ // Try to find a node left of the left-most node, and start from its
+ // next node (which is the left-most node in its subtree).
+ EXPECT_EQ(TestDomainTree::NOTFOUND,
+ tree.find<void*>(Name("0"), &node, node_path, NULL, NULL));
+ while ((node = tree.nextNode(node_path)) != NULL) {
+ // The distance from each node to its sub-tree root must be less
+ // than 2 * log(n).
+ EXPECT_GE(2 * distance, node->getDistance());
+ }
+}
+
TEST_F(DomainTreeTest, checkDistanceRandom) {
// This test checks an important performance-related property of the
// DomainTree (a red-black tree), which is important for us: the
@@ -190,18 +206,7 @@ TEST_F(DomainTreeTest, checkDistanceRandom) {
EXPECT_EQ(static_cast<int*>(NULL), dtnode->setData(new int(i + 1)));
}
- TestDomainTreeNodeChain node_path;
- const TestDomainTreeNode* node = NULL;
-
- // Try to find a node left of the left-most node, and start from its
- // next node (which is the left-most node in its subtree).
- EXPECT_EQ(TestDomainTree::NOTFOUND,
- mytree.find<void*>(Name("0"), &node, node_path, NULL, NULL));
- while ((node = mytree.nextNode(node_path)) != NULL) {
- // The distance from each node to its sub-tree root must be less
- // than 2 * log(n).
- EXPECT_GE(2 * log_num_nodes, node->getDistance());
- }
+ checkDistances(mytree, log_num_nodes);
}
TEST_F(DomainTreeTest, checkDistanceSorted) {
@@ -230,18 +235,7 @@ TEST_F(DomainTreeTest, checkDistanceSorted) {
EXPECT_EQ(static_cast<int*>(NULL), dtnode->setData(new int(i + 1)));
}
- TestDomainTreeNodeChain node_path;
- const TestDomainTreeNode* node = NULL;
-
- // Try to find a node left of the left-most node, and start from its
- // next node (which is the left-most node in its subtree).
- EXPECT_EQ(TestDomainTree::NOTFOUND,
- mytree.find<void*>(Name("0"), &node, node_path, NULL, NULL));
- while ((node = mytree.nextNode(node_path)) != NULL) {
- // The distance from each node to its sub-tree root must be less
- // than 2 * log(n).
- EXPECT_GE(2 * log_num_nodes, node->getDistance());
- }
+ checkDistances(mytree, log_num_nodes);
}
TEST_F(DomainTreeTest, setGetData) {
More information about the bind10-changes
mailing list