Use optional::value() instead of optional::get() in test cases
This commit is contained in:
parent
de5dd8a838
commit
5ea654445c
@ -41,7 +41,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
unique_ref<DataInnerNode> LoadInnerNode(const Key &key) {
|
unique_ref<DataInnerNode> LoadInnerNode(const Key &key) {
|
||||||
auto node = std::move(nodeStore->load(key).get());
|
auto node = nodeStore->load(key).value();
|
||||||
return dynamic_pointer_move<DataInnerNode>(node).value();
|
return dynamic_pointer_move<DataInnerNode>(node).value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ TEST_F(DataInnerNodeTest, CorrectKeyReturnedAfterLoading) {
|
|||||||
Key key = block->key();
|
Key key = block->key();
|
||||||
DataInnerNode::InitializeNewNode(std::move(block), *leaf);
|
DataInnerNode::InitializeNewNode(std::move(block), *leaf);
|
||||||
|
|
||||||
auto loaded = std::move(nodeStore->load(key).get());
|
auto loaded = nodeStore->load(key).value();
|
||||||
EXPECT_EQ(key, loaded->key());
|
EXPECT_EQ(key, loaded->key());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
unique_ref<DataLeafNode> LoadLeafNode(const Key &key) {
|
unique_ref<DataLeafNode> LoadLeafNode(const Key &key) {
|
||||||
auto leaf = std::move(nodeStore->load(key).get());
|
auto leaf = nodeStore->load(key).value();
|
||||||
return dynamic_pointer_move<DataLeafNode>(leaf).value();
|
return dynamic_pointer_move<DataLeafNode>(leaf).value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ TEST_F(DataLeafNodeTest, CorrectKeyReturnedAfterLoading) {
|
|||||||
Key key = block->key();
|
Key key = block->key();
|
||||||
DataLeafNode::InitializeNewNode(std::move(block));
|
DataLeafNode::InitializeNewNode(std::move(block));
|
||||||
|
|
||||||
auto loaded = std::move(nodeStore->load(key).get());
|
auto loaded = nodeStore->load(key).value();
|
||||||
EXPECT_EQ(key, loaded->key());
|
EXPECT_EQ(key, loaded->key());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ TEST_F(DataNodeStoreTest, CreateInnerNodeCreatesInnerNode) {
|
|||||||
TEST_F(DataNodeStoreTest, LeafNodeIsRecognizedAfterStoreAndLoad) {
|
TEST_F(DataNodeStoreTest, LeafNodeIsRecognizedAfterStoreAndLoad) {
|
||||||
Key key = nodeStore->createNewLeafNode()->key();
|
Key key = nodeStore->createNewLeafNode()->key();
|
||||||
|
|
||||||
auto loaded_node = std::move(nodeStore->load(key).get());
|
auto loaded_node = nodeStore->load(key).value();
|
||||||
|
|
||||||
EXPECT_IS_PTR_TYPE(DataLeafNode, loaded_node.get());
|
EXPECT_IS_PTR_TYPE(DataLeafNode, loaded_node.get());
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ TEST_F(DataNodeStoreTest, InnerNodeWithDepth1IsRecognizedAfterStoreAndLoad) {
|
|||||||
auto leaf = nodeStore->createNewLeafNode();
|
auto leaf = nodeStore->createNewLeafNode();
|
||||||
Key key = nodeStore->createNewInnerNode(*leaf)->key();
|
Key key = nodeStore->createNewInnerNode(*leaf)->key();
|
||||||
|
|
||||||
auto loaded_node = std::move(nodeStore->load(key).get());
|
auto loaded_node = nodeStore->load(key).value();
|
||||||
|
|
||||||
EXPECT_IS_PTR_TYPE(DataInnerNode, loaded_node.get());
|
EXPECT_IS_PTR_TYPE(DataInnerNode, loaded_node.get());
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ TEST_F(DataNodeStoreTest, InnerNodeWithDepth2IsRecognizedAfterStoreAndLoad) {
|
|||||||
auto inner = nodeStore->createNewInnerNode(*leaf);
|
auto inner = nodeStore->createNewInnerNode(*leaf);
|
||||||
Key key = nodeStore->createNewInnerNode(*inner)->key();
|
Key key = nodeStore->createNewInnerNode(*inner)->key();
|
||||||
|
|
||||||
auto loaded_node = std::move(nodeStore->load(key).get());
|
auto loaded_node = nodeStore->load(key).value();
|
||||||
|
|
||||||
EXPECT_IS_PTR_TYPE(DataInnerNode, loaded_node.get());
|
EXPECT_IS_PTR_TYPE(DataInnerNode, loaded_node.get());
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class DataTreeStoreTest: public DataTreeTest {
|
|||||||
|
|
||||||
TEST_F(DataTreeStoreTest, CorrectKeyReturned) {
|
TEST_F(DataTreeStoreTest, CorrectKeyReturned) {
|
||||||
Key key = treeStore.createNewTree()->key();
|
Key key = treeStore.createNewTree()->key();
|
||||||
auto tree = std::move(treeStore.load(key).get());
|
auto tree = treeStore.load(key).value();
|
||||||
EXPECT_EQ(key, tree->key());
|
EXPECT_EQ(key, tree->key());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ TEST_F(DataTreeStoreTest, TreeIsNotLoadableAfterRemove) {
|
|||||||
|
|
||||||
TEST_F(DataTreeStoreTest, RemovingTreeRemovesAllNodesOfTheTree) {
|
TEST_F(DataTreeStoreTest, RemovingTreeRemovesAllNodesOfTheTree) {
|
||||||
auto key = CreateThreeLevelMinData()->key();
|
auto key = CreateThreeLevelMinData()->key();
|
||||||
auto tree1 = std::move(treeStore.load(key).get());
|
auto tree1 = treeStore.load(key).value();
|
||||||
auto tree2_key = treeStore.createNewTree()->key();
|
auto tree2_key = treeStore.createNewTree()->key();
|
||||||
|
|
||||||
treeStore.remove(std::move(tree1));
|
treeStore.remove(std::move(tree1));
|
||||||
|
@ -28,48 +28,48 @@ INSTANTIATE_TEST_CASE_P(FullLastLeaf, DataTreeTest_NumStoredBytes_P, Values(Data
|
|||||||
|
|
||||||
TEST_P(DataTreeTest_NumStoredBytes_P, SingleLeaf) {
|
TEST_P(DataTreeTest_NumStoredBytes_P, SingleLeaf) {
|
||||||
Key key = CreateLeafWithSize(GetParam())->key();
|
Key key = CreateLeafWithSize(GetParam())->key();
|
||||||
auto tree = std::move(treeStore.load(key).get());
|
auto tree = treeStore.load(key).value();
|
||||||
EXPECT_EQ(GetParam(), tree->numStoredBytes());
|
EXPECT_EQ(GetParam(), tree->numStoredBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(DataTreeTest_NumStoredBytes_P, TwoLeafTree) {
|
TEST_P(DataTreeTest_NumStoredBytes_P, TwoLeafTree) {
|
||||||
Key key = CreateTwoLeafWithSecondLeafSize(GetParam())->key();
|
Key key = CreateTwoLeafWithSecondLeafSize(GetParam())->key();
|
||||||
auto tree = std::move(treeStore.load(key).get());
|
auto tree = treeStore.load(key).value();
|
||||||
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf() + GetParam(), tree->numStoredBytes());
|
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf() + GetParam(), tree->numStoredBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(DataTreeTest_NumStoredBytes_P, FullTwolevelTree) {
|
TEST_P(DataTreeTest_NumStoredBytes_P, FullTwolevelTree) {
|
||||||
Key key = CreateFullTwoLevelWithLastLeafSize(GetParam())->key();
|
Key key = CreateFullTwoLevelWithLastLeafSize(GetParam())->key();
|
||||||
auto tree = std::move(treeStore.load(key).get());
|
auto tree = treeStore.load(key).value();
|
||||||
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf()*(nodeStore->layout().maxChildrenPerInnerNode()-1) + GetParam(), tree->numStoredBytes());
|
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf()*(nodeStore->layout().maxChildrenPerInnerNode()-1) + GetParam(), tree->numStoredBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(DataTreeTest_NumStoredBytes_P, ThreeLevelTreeWithOneChild) {
|
TEST_P(DataTreeTest_NumStoredBytes_P, ThreeLevelTreeWithOneChild) {
|
||||||
Key key = CreateThreeLevelWithOneChildAndLastLeafSize(GetParam())->key();
|
Key key = CreateThreeLevelWithOneChildAndLastLeafSize(GetParam())->key();
|
||||||
auto tree = std::move(treeStore.load(key).get());
|
auto tree = treeStore.load(key).value();
|
||||||
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf() + GetParam(), tree->numStoredBytes());
|
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf() + GetParam(), tree->numStoredBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(DataTreeTest_NumStoredBytes_P, ThreeLevelTreeWithTwoChildren) {
|
TEST_P(DataTreeTest_NumStoredBytes_P, ThreeLevelTreeWithTwoChildren) {
|
||||||
Key key = CreateThreeLevelWithTwoChildrenAndLastLeafSize(GetParam())->key();
|
Key key = CreateThreeLevelWithTwoChildrenAndLastLeafSize(GetParam())->key();
|
||||||
auto tree = std::move(treeStore.load(key).get());
|
auto tree = treeStore.load(key).value();
|
||||||
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf()*nodeStore->layout().maxChildrenPerInnerNode() + nodeStore->layout().maxBytesPerLeaf() + GetParam(), tree->numStoredBytes());
|
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf()*nodeStore->layout().maxChildrenPerInnerNode() + nodeStore->layout().maxBytesPerLeaf() + GetParam(), tree->numStoredBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(DataTreeTest_NumStoredBytes_P, ThreeLevelTreeWithThreeChildren) {
|
TEST_P(DataTreeTest_NumStoredBytes_P, ThreeLevelTreeWithThreeChildren) {
|
||||||
Key key = CreateThreeLevelWithThreeChildrenAndLastLeafSize(GetParam())->key();
|
Key key = CreateThreeLevelWithThreeChildrenAndLastLeafSize(GetParam())->key();
|
||||||
auto tree = std::move(treeStore.load(key).get());
|
auto tree = treeStore.load(key).value();
|
||||||
EXPECT_EQ(2*nodeStore->layout().maxBytesPerLeaf()*nodeStore->layout().maxChildrenPerInnerNode() + nodeStore->layout().maxBytesPerLeaf() + GetParam(), tree->numStoredBytes());
|
EXPECT_EQ(2*nodeStore->layout().maxBytesPerLeaf()*nodeStore->layout().maxChildrenPerInnerNode() + nodeStore->layout().maxBytesPerLeaf() + GetParam(), tree->numStoredBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(DataTreeTest_NumStoredBytes_P, FullThreeLevelTree) {
|
TEST_P(DataTreeTest_NumStoredBytes_P, FullThreeLevelTree) {
|
||||||
Key key = CreateFullThreeLevelWithLastLeafSize(GetParam())->key();
|
Key key = CreateFullThreeLevelWithLastLeafSize(GetParam())->key();
|
||||||
auto tree = std::move(treeStore.load(key).get());
|
auto tree = treeStore.load(key).value();
|
||||||
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf()*nodeStore->layout().maxChildrenPerInnerNode()*(nodeStore->layout().maxChildrenPerInnerNode()-1) + nodeStore->layout().maxBytesPerLeaf()*(nodeStore->layout().maxChildrenPerInnerNode()-1) + GetParam(), tree->numStoredBytes());
|
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf()*nodeStore->layout().maxChildrenPerInnerNode()*(nodeStore->layout().maxChildrenPerInnerNode()-1) + nodeStore->layout().maxBytesPerLeaf()*(nodeStore->layout().maxChildrenPerInnerNode()-1) + GetParam(), tree->numStoredBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(DataTreeTest_NumStoredBytes_P, FourLevelMinDataTree) {
|
TEST_P(DataTreeTest_NumStoredBytes_P, FourLevelMinDataTree) {
|
||||||
Key key = CreateFourLevelMinDataWithLastLeafSize(GetParam())->key();
|
Key key = CreateFourLevelMinDataWithLastLeafSize(GetParam())->key();
|
||||||
auto tree = std::move(treeStore.load(key).get());
|
auto tree = treeStore.load(key).value();
|
||||||
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf()*nodeStore->layout().maxChildrenPerInnerNode()*nodeStore->layout().maxChildrenPerInnerNode() + GetParam(), tree->numStoredBytes());
|
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf()*nodeStore->layout().maxChildrenPerInnerNode()*nodeStore->layout().maxChildrenPerInnerNode() + GetParam(), tree->numStoredBytes());
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
unique_ref<DataTree> CreateTree(unique_ref<DataNode> root) {
|
unique_ref<DataTree> CreateTree(unique_ref<DataNode> root) {
|
||||||
Key key = root->key();
|
Key key = root->key();
|
||||||
cpputils::to_unique_ptr(std::move(root)).reset(); //Destruct
|
cpputils::to_unique_ptr(std::move(root)).reset(); //Destruct
|
||||||
return std::move(treeStore.load(key).get());
|
return treeStore.load(key).value();
|
||||||
}
|
}
|
||||||
|
|
||||||
unique_ref<DataTree> CreateLeafTreeWithSize(uint32_t size) {
|
unique_ref<DataTree> CreateLeafTreeWithSize(uint32_t size) {
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EXPECT_IS_LEFTMAXDATA_TREE(const Key &key) {
|
void EXPECT_IS_LEFTMAXDATA_TREE(const Key &key) {
|
||||||
auto root = std::move(nodeStore->load(key).get());
|
auto root = nodeStore->load(key).value();
|
||||||
DataInnerNode *inner = dynamic_cast<DataInnerNode*>(root.get());
|
DataInnerNode *inner = dynamic_cast<DataInnerNode*>(root.get());
|
||||||
if (inner != nullptr) {
|
if (inner != nullptr) {
|
||||||
for (uint32_t i = 0; i < inner->numChildren()-1; ++i) {
|
for (uint32_t i = 0; i < inner->numChildren()-1; ++i) {
|
||||||
@ -76,7 +76,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EXPECT_IS_MAXDATA_TREE(const Key &key) {
|
void EXPECT_IS_MAXDATA_TREE(const Key &key) {
|
||||||
auto root = std::move(nodeStore->load(key).get());
|
auto root = nodeStore->load(key).value();
|
||||||
DataInnerNode *inner = dynamic_cast<DataInnerNode*>(root.get());
|
DataInnerNode *inner = dynamic_cast<DataInnerNode*>(root.get());
|
||||||
if (inner != nullptr) {
|
if (inner != nullptr) {
|
||||||
for (uint32_t i = 0; i < inner->numChildren(); ++i) {
|
for (uint32_t i = 0; i < inner->numChildren(); ++i) {
|
||||||
@ -116,7 +116,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
unique_ref<DataLeafNode> LastLeaf(const Key &key) {
|
unique_ref<DataLeafNode> LastLeaf(const Key &key) {
|
||||||
auto root = std::move(nodeStore->load(key).get());
|
auto root = nodeStore->load(key).value();
|
||||||
auto leaf = dynamic_pointer_move<DataLeafNode>(root);
|
auto leaf = dynamic_pointer_move<DataLeafNode>(root);
|
||||||
if (leaf != none) {
|
if (leaf != none) {
|
||||||
return std::move(*leaf);
|
return std::move(*leaf);
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
unique_ref<DataTree> CreateTree(unique_ref<DataNode> root) {
|
unique_ref<DataTree> CreateTree(unique_ref<DataNode> root) {
|
||||||
Key key = root->key();
|
Key key = root->key();
|
||||||
cpputils::to_unique_ptr(std::move(root)).reset(); // Destruct
|
cpputils::to_unique_ptr(std::move(root)).reset(); // Destruct
|
||||||
return std::move(treeStore.load(key).get());
|
return treeStore.load(key).value();
|
||||||
}
|
}
|
||||||
|
|
||||||
unique_ref<DataTree> CreateLeafTreeWithSize(uint32_t size) {
|
unique_ref<DataTree> CreateLeafTreeWithSize(uint32_t size) {
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EXPECT_IS_LEFTMAXDATA_TREE(const Key &key) {
|
void EXPECT_IS_LEFTMAXDATA_TREE(const Key &key) {
|
||||||
auto root = std::move(nodeStore->load(key).get());
|
auto root = nodeStore->load(key).value();
|
||||||
DataInnerNode *inner = dynamic_cast<DataInnerNode*>(root.get());
|
DataInnerNode *inner = dynamic_cast<DataInnerNode*>(root.get());
|
||||||
if (inner != nullptr) {
|
if (inner != nullptr) {
|
||||||
for (uint32_t i = 0; i < inner->numChildren()-1; ++i) {
|
for (uint32_t i = 0; i < inner->numChildren()-1; ++i) {
|
||||||
@ -76,7 +76,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EXPECT_IS_MAXDATA_TREE(const Key &key) {
|
void EXPECT_IS_MAXDATA_TREE(const Key &key) {
|
||||||
auto root = std::move(nodeStore->load(key).get());
|
auto root = nodeStore->load(key).value();
|
||||||
DataInnerNode *inner = dynamic_cast<DataInnerNode*>(root.get());
|
DataInnerNode *inner = dynamic_cast<DataInnerNode*>(root.get());
|
||||||
if (inner != nullptr) {
|
if (inner != nullptr) {
|
||||||
for (uint32_t i = 0; i < inner->numChildren(); ++i) {
|
for (uint32_t i = 0; i < inner->numChildren(); ++i) {
|
||||||
@ -108,7 +108,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
unique_ref<DataLeafNode> LastLeaf(const Key &key) {
|
unique_ref<DataLeafNode> LastLeaf(const Key &key) {
|
||||||
auto root = std::move(nodeStore->load(key).get());
|
auto root = nodeStore->load(key).value();
|
||||||
auto leaf = dynamic_pointer_move<DataLeafNode>(root);
|
auto leaf = dynamic_pointer_move<DataLeafNode>(root);
|
||||||
if (leaf != none) {
|
if (leaf != none) {
|
||||||
return std::move(*leaf);
|
return std::move(*leaf);
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
|
|
||||||
void TraverseLeaves(DataNode *root, uint32_t beginIndex, uint32_t endIndex) {
|
void TraverseLeaves(DataNode *root, uint32_t beginIndex, uint32_t endIndex) {
|
||||||
root->flush();
|
root->flush();
|
||||||
auto tree = std::move(treeStore.load(root->key()).get());
|
auto tree = treeStore.load(root->key()).value();
|
||||||
tree->traverseLeaves(beginIndex, endIndex, [this] (DataLeafNode *leaf, uint32_t nodeIndex) {
|
tree->traverseLeaves(beginIndex, endIndex, [this] (DataLeafNode *leaf, uint32_t nodeIndex) {
|
||||||
traversor.called(leaf, nodeIndex);
|
traversor.called(leaf, nodeIndex);
|
||||||
});
|
});
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void check(const TestData &testData) {
|
void check(const TestData &testData) {
|
||||||
auto root = std::move(nodeStore->load(testData.rootNode).get());
|
auto root = nodeStore->load(testData.rootNode).value();
|
||||||
auto result = GetLowestInnerRightBorderNodeWithLessThanKChildrenOrNull(nodeStore, root.get());
|
auto result = GetLowestInnerRightBorderNodeWithLessThanKChildrenOrNull(nodeStore, root.get());
|
||||||
EXPECT_EQ(testData.expectedResult, result->key());
|
EXPECT_EQ(testData.expectedResult, result->key());
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void check(const TestData &testData) {
|
void check(const TestData &testData) {
|
||||||
auto root = std::move(nodeStore->load(testData.rootNode).get());
|
auto root = nodeStore->load(testData.rootNode).value();
|
||||||
auto result = GetLowestRightBorderNodeWithMoreThanOneChildOrNull(nodeStore, root.get());
|
auto result = GetLowestRightBorderNodeWithMoreThanOneChildOrNull(nodeStore, root.get());
|
||||||
EXPECT_EQ(testData.expectedResult, result->key());
|
EXPECT_EQ(testData.expectedResult, result->key());
|
||||||
}
|
}
|
||||||
@ -78,19 +78,19 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest, Leaf) {
|
TEST_F(GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest, Leaf) {
|
||||||
auto leaf = std::move(nodeStore->load(CreateLeafOnlyTree()).get());
|
auto leaf = nodeStore->load(CreateLeafOnlyTree()).value();
|
||||||
auto result = GetLowestRightBorderNodeWithMoreThanOneChildOrNull(nodeStore, leaf.get());
|
auto result = GetLowestRightBorderNodeWithMoreThanOneChildOrNull(nodeStore, leaf.get());
|
||||||
EXPECT_EQ(nullptr, result.get());
|
EXPECT_EQ(nullptr, result.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest, TwoRightBorderNodes) {
|
TEST_F(GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest, TwoRightBorderNodes) {
|
||||||
auto node = std::move(nodeStore->load(CreateTwoRightBorderNodes()).get());
|
auto node = nodeStore->load(CreateTwoRightBorderNodes()).value();
|
||||||
auto result = GetLowestRightBorderNodeWithMoreThanOneChildOrNull(nodeStore, node.get());
|
auto result = GetLowestRightBorderNodeWithMoreThanOneChildOrNull(nodeStore, node.get());
|
||||||
EXPECT_EQ(nullptr, result.get());
|
EXPECT_EQ(nullptr, result.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest, ThreeRightBorderNodes) {
|
TEST_F(GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest, ThreeRightBorderNodes) {
|
||||||
auto node = std::move(nodeStore->load(CreateThreeRightBorderNodes()).get());
|
auto node = nodeStore->load(CreateThreeRightBorderNodes()).value();
|
||||||
auto result = GetLowestRightBorderNodeWithMoreThanOneChildOrNull(nodeStore, node.get());
|
auto result = GetLowestRightBorderNodeWithMoreThanOneChildOrNull(nodeStore, node.get());
|
||||||
EXPECT_EQ(nullptr, result.get());
|
EXPECT_EQ(nullptr, result.get());
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ unique_ref<DataInnerNode> DataTreeTest::CreateInner(vector<const DataNode*> chil
|
|||||||
|
|
||||||
unique_ref<DataTree> DataTreeTest::CreateLeafOnlyTree() {
|
unique_ref<DataTree> DataTreeTest::CreateLeafOnlyTree() {
|
||||||
auto key = CreateLeaf()->key();
|
auto key = CreateLeaf()->key();
|
||||||
return std::move(treeStore.load(key).get());
|
return treeStore.load(key).value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataTreeTest::FillNode(DataInnerNode *node) {
|
void DataTreeTest::FillNode(DataInnerNode *node) {
|
||||||
@ -93,14 +93,14 @@ unique_ref<DataInnerNode> DataTreeTest::CreateFullThreeLevel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unique_ref<DataInnerNode> DataTreeTest::LoadInnerNode(const Key &key) {
|
unique_ref<DataInnerNode> DataTreeTest::LoadInnerNode(const Key &key) {
|
||||||
auto node = std::move(nodeStore->load(key).get());
|
auto node = nodeStore->load(key).value();
|
||||||
auto casted = dynamic_pointer_move<DataInnerNode>(node);
|
auto casted = dynamic_pointer_move<DataInnerNode>(node);
|
||||||
EXPECT_NE(none, casted) << "Is not an inner node";
|
EXPECT_NE(none, casted) << "Is not an inner node";
|
||||||
return std::move(*casted);
|
return std::move(*casted);
|
||||||
}
|
}
|
||||||
|
|
||||||
unique_ref<DataLeafNode> DataTreeTest::LoadLeafNode(const Key &key) {
|
unique_ref<DataLeafNode> DataTreeTest::LoadLeafNode(const Key &key) {
|
||||||
auto node = std::move(nodeStore->load(key).get());
|
auto node = nodeStore->load(key).value();
|
||||||
auto casted = dynamic_pointer_move<DataLeafNode>(node);
|
auto casted = dynamic_pointer_move<DataLeafNode>(node);
|
||||||
EXPECT_NE(none, casted) << "Is not a leaf node";
|
EXPECT_NE(none, casted) << "Is not a leaf node";
|
||||||
return std::move(*casted);
|
return std::move(*casted);
|
||||||
@ -112,7 +112,7 @@ unique_ref<DataInnerNode> DataTreeTest::CreateTwoLeaf() {
|
|||||||
|
|
||||||
unique_ref<DataTree> DataTreeTest::CreateTwoLeafTree() {
|
unique_ref<DataTree> DataTreeTest::CreateTwoLeafTree() {
|
||||||
auto key = CreateTwoLeaf()->key();
|
auto key = CreateTwoLeaf()->key();
|
||||||
return std::move(treeStore.load(key).get());
|
return treeStore.load(key).value();
|
||||||
}
|
}
|
||||||
|
|
||||||
unique_ref<DataLeafNode> DataTreeTest::CreateLeafWithSize(uint32_t size) {
|
unique_ref<DataLeafNode> DataTreeTest::CreateLeafWithSize(uint32_t size) {
|
||||||
|
@ -50,7 +50,7 @@ private:
|
|||||||
auto inner = dynamic_cast<blobstore::onblocks::datanodestore::DataInnerNode*>(node);
|
auto inner = dynamic_cast<blobstore::onblocks::datanodestore::DataInnerNode*>(node);
|
||||||
int leafIndex = firstLeafIndex;
|
int leafIndex = firstLeafIndex;
|
||||||
for (uint32_t i = 0; i < inner->numChildren(); ++i) {
|
for (uint32_t i = 0; i < inner->numChildren(); ++i) {
|
||||||
auto child = std::move(_dataNodeStore->load(inner->getChild(i)->key()).get());
|
auto child = _dataNodeStore->load(inner->getChild(i)->key()).value();
|
||||||
leafIndex = ForEachLeaf(child.get(), leafIndex, endLeafIndex, action);
|
leafIndex = ForEachLeaf(child.get(), leafIndex, endLeafIndex, action);
|
||||||
}
|
}
|
||||||
return leafIndex;
|
return leafIndex;
|
||||||
|
Loading…
Reference in New Issue
Block a user