Browse Source

[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.
Mukund Sivaraman 13 years ago
parent
commit
3692c48386
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/lib/datasrc/tests/rbtree_unittest.cc

+ 5 - 0
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