#pragma once #ifndef TEST_BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATATREESTORE_DATATREETEST_H_ #define TEST_BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATATREESTORE_DATATREETEST_H_ #include "google/gtest/gtest.h" #include "../../../../../implementations/onblocks/datanodestore/DataNodeStore.h" #include "../../../../../implementations/onblocks/datanodestore/DataInnerNode.h" #include "../../../../../implementations/onblocks/datanodestore/DataLeafNode.h" #include "../../../../../implementations/onblocks/datatreestore/DataTree.h" #include "../../../../../implementations/onblocks/datatreestore/DataTreeStore.h" class DataTreeTest: public ::testing::Test { public: DataTreeTest(); static constexpr uint32_t BLOCKSIZE_BYTES = 256; std::unique_ptr CreateLeaf(); std::unique_ptr CreateInner(std::vector children); std::unique_ptr CreateInner(std::initializer_list children); std::unique_ptr CreateInner(std::initializer_list> children); std::unique_ptr CreateLeafOnlyTree(); std::unique_ptr CreateTwoLeaf(); std::unique_ptr CreateTwoLeafTree(); void FillNode(blobstore::onblocks::datanodestore::DataInnerNode *node); void FillNodeTwoLevel(blobstore::onblocks::datanodestore::DataInnerNode *node); std::unique_ptr CreateFullTwoLevel(); std::unique_ptr CreateFullThreeLevel(); std::unique_ptr CreateThreeLevelMinData(); std::unique_ptr CreateFourLevelMinData(); std::unique_ptr LoadInnerNode(const blockstore::Key &key); std::unique_ptr LoadLeafNode(const blockstore::Key &key); std::unique_ptr CreateLeafWithSize(uint32_t size); std::unique_ptr CreateTwoLeafWithSecondLeafSize(uint32_t size); std::unique_ptr CreateFullTwoLevelWithLastLeafSize(uint32_t size); std::unique_ptr CreateThreeLevelWithOneChildAndLastLeafSize(uint32_t size); std::unique_ptr CreateThreeLevelWithTwoChildrenAndLastLeafSize(uint32_t size); std::unique_ptr CreateThreeLevelWithThreeChildrenAndLastLeafSize(uint32_t size); std::unique_ptr CreateFullThreeLevelWithLastLeafSize(uint32_t size); std::unique_ptr CreateFourLevelMinDataWithLastLeafSize(uint32_t size); std::unique_ptr _nodeStore; blobstore::onblocks::datanodestore::DataNodeStore *nodeStore; blobstore::onblocks::datatreestore::DataTreeStore treeStore; void EXPECT_IS_LEAF_NODE(const blockstore::Key &key); void EXPECT_IS_INNER_NODE(const blockstore::Key &key); void EXPECT_IS_TWONODE_CHAIN(const blockstore::Key &key); void EXPECT_IS_FULL_TWOLEVEL_TREE(const blockstore::Key &key); void EXPECT_IS_FULL_THREELEVEL_TREE(const blockstore::Key &key); void CHECK_DEPTH(int depth, const blockstore::Key &key); }; #endif