Parcourir la 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 il y a 13 ans
Parent
commit
3692c48386
1 fichiers modifiés avec 5 ajouts et 0 suppressions
  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