]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1971] Test the node_path.isEmpty() check
authorMukund Sivaraman <muks@isc.org>
Mon, 14 May 2012 06:38:20 +0000 (12:08 +0530)
committerMukund Sivaraman <muks@isc.org>
Tue, 15 May 2012 20:02:31 +0000 (01:32 +0530)
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.

src/lib/datasrc/tests/rbtree_unittest.cc

index 25eafb4c6a199250c8279d6daa7763baf903e99d..97ec78b516dd346bfc5539aeeca14162daab5321 100644 (file)
@@ -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