BIND 10 trac1971, updated. bd0f5b0f17df273b7e1d43f540f24ebf86890d21 [1971] Add another testcase for untested code detected by lcov
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon May 14 06:50:48 UTC 2012
The branch, trac1971 has been updated
via bd0f5b0f17df273b7e1d43f540f24ebf86890d21 (commit)
via 3fb174e68620d1a626aee5e4d30b7481a265d7b8 (commit)
from 8ecf0d915493c6c4682a37cb65d4a7417490eff1 (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 bd0f5b0f17df273b7e1d43f540f24ebf86890d21
Author: Mukund Sivaraman <muks at isc.org>
Date: Mon May 14 12:17:52 2012 +0530
[1971] Add another testcase for untested code detected by lcov
When find() returns COMMONANCESTOR and exits to the right of a
last_compared_node which has a valid down pointer, previousNode() has to
return nodes beginning at at the right-most leaf of subtrees in
last_compared_node->down.
commit 3fb174e68620d1a626aee5e4d30b7481a265d7b8
Author: Mukund Sivaraman <muks at isc.org>
Date: Mon May 14 12:08:20 2012 +0530
[1971] Test the node_path.isEmpty() check
If previousNode() has been called enough times that it has popped
all nodes from the node chain when walking up the trees, the
node chain is then empty. If previousNode() is called yet again
on the empty tree, it should return NULL.
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/tests/rbtree_unittest.cc | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/tests/rbtree_unittest.cc b/src/lib/datasrc/tests/rbtree_unittest.cc
index 25eafb4..2bc309a 100644
--- a/src/lib/datasrc/tests/rbtree_unittest.cc
+++ b/src/lib/datasrc/tests/rbtree_unittest.cc
@@ -405,6 +405,11 @@ previousWalk(RBTree<int>& rbtree, const RBNode<int>* node,
// We should have reached the start of the tree.
EXPECT_EQ(static_cast<void*>(NULL), node);
+
+ // Calling previousNode() yet again should still return NULL without
+ // fail.
+ node = rbtree.previousNode(node_path);
+ EXPECT_EQ(static_cast<void*>(NULL), node);
}
// Check the previousNode
@@ -506,6 +511,28 @@ TEST_F(RBTreeTest, previousNode) {
}
{
+ SCOPED_TRACE("Start to the right of a parent");
+ // When searching for this, we exit the 'g.h' node to the right
+ // side, so we should go to g.h's children afterwards.
+
+ // 'g.h' is an empty node, so we get a NOTFOUND and not
+ // PARTIALMATCH.
+ EXPECT_EQ(RBTree<int>::NOTFOUND,
+ rbtree.find(Name("x.h"), &node, node_path));
+ // 'g.h' is the COMMONANCESTOR.
+ EXPECT_EQ(node_path.getLastComparedNode()->getName(), Name("g.h"));
+ EXPECT_EQ(NameComparisonResult::COMMONANCESTOR,
+ node_path.getLastComparisonResult().getRelation());
+ // find() exits to the right of 'g.h'
+ EXPECT_GT(node_path.getLastComparisonResult().getOrder(), 0);
+ // We then descend into 'i.g.h' and walk all the nodes in the
+ // tree.
+ previousWalk(rbtree, node, node_path, name_count, true);
+ node = NULL;
+ node_path.clear();
+ }
+
+ {
SCOPED_TRACE("Start inside a wrong node");
// The d.e.f is a single node, but we want only part of it. We
// should start iterating before it.
More information about the bind10-changes
mailing list