Add test case for DataTree::numLeaves after resize

This commit is contained in:
Sebastian Messmer 2016-07-05 23:53:13 -07:00
parent a242076ecc
commit 2f8e8d8157
2 changed files with 9 additions and 1 deletions

View File

@ -168,7 +168,7 @@ TEST_P(DataTreeTest_ResizeByTraversing_P, StructureIsValid) {
EXPECT_IS_LEFTMAXDATA_TREE(tree->key());
}
TEST_P(DataTreeTest_ResizeByTraversing_P, NumBytesIsCorrect) {
TEST_P(DataTreeTest_ResizeByTraversing_P, NumLeavesIsCorrect) {
GrowTree(tree.get(), numberOfLeavesToAdd);
// tree->numLeaves() only goes down the right border nodes and expects the tree to be a left max data tree.
// This is what the StructureIsValid test case is for.

View File

@ -176,6 +176,14 @@ TEST_P(DataTreeTest_ResizeNumBytes_P, NumBytesIsCorrect) {
EXPECT_EQ(newSize, tree->numStoredBytes());
}
TEST_P(DataTreeTest_ResizeNumBytes_P, NumLeavesIsCorrect) {
tree->resizeNumBytes(newSize);
tree->flush();
// tree->numLeaves() only goes down the right border nodes and expects the tree to be a left max data tree.
// This is what the StructureIsValid test case is for.
EXPECT_EQ(newNumberOfLeaves, tree->numLeaves());
}
TEST_P(DataTreeTest_ResizeNumBytes_P, DepthFlagsAreCorrect) {
tree->resizeNumBytes(newSize);
tree->flush();