From: Mukund Sivaraman Date: Mon, 14 May 2012 06:38:20 +0000 (+0530) Subject: [1971] Test the node_path.isEmpty() check X-Git-Tag: trac2351_base~226^2~113 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3692c48386327df01b447308fb39ca748c451f47;p=thirdparty%2Fkea.git [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. --- diff --git a/src/lib/datasrc/tests/rbtree_unittest.cc b/src/lib/datasrc/tests/rbtree_unittest.cc index 25eafb4c6a..97ec78b516 100644 --- a/src/lib/datasrc/tests/rbtree_unittest.cc +++ b/src/lib/datasrc/tests/rbtree_unittest.cc @@ -405,6 +405,11 @@ previousWalk(RBTree& rbtree, const RBNode* node, // We should have reached the start of the tree. EXPECT_EQ(static_cast(NULL), node); + + // Calling previousNode() yet again should still return NULL without + // fail. + node = rbtree.previousNode(node_path); + EXPECT_EQ(static_cast(NULL), node); } // Check the previousNode