#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; cpputils::unique_ref CreateLeaf(); cpputils::unique_ref CreateInner(std::vector children); cpputils::unique_ref CreateInner(std::initializer_list children); cpputils::unique_ref CreateInner(std::initializer_list> children); cpputils::unique_ref CreateLeafOnlyTree(); cpputils::unique_ref CreateTwoLeaf(); cpputils::unique_ref CreateTwoLeafTree(); void FillNode(blobstore::onblocks::datanodestore::DataInnerNode *node); void FillNodeTwoLevel(blobstore::onblocks::datanodestore::DataInnerNode *node); cpputils::unique_ref CreateFullTwoLevel(); cpputils::unique_ref CreateFullThreeLevel(); cpputils::unique_ref CreateThreeLevelMinData(); cpputils::unique_ref CreateFourLevelMinData(); cpputils::unique_ref LoadInnerNode(const blockstore::Key &key); cpputils::unique_ref LoadLeafNode(const blockstore::Key &key); cpputils::unique_ref CreateLeafWithSize(uint32_t size); cpputils::unique_ref CreateTwoLeafWithSecondLeafSize(uint32_t size); cpputils::unique_ref CreateFullTwoLevelWithLastLeafSize(uint32_t size); cpputils::unique_ref CreateThreeLevelWithOneChildAndLastLeafSize(uint32_t size); cpputils::unique_ref CreateThreeLevelWithTwoChildrenAndLastLeafSize(uint32_t size); cpputils::unique_ref CreateThreeLevelWithThreeChildrenAndLastLeafSize(uint32_t size); cpputils::unique_ref CreateFullThreeLevelWithLastLeafSize(uint32_t size); cpputils::unique_ref CreateFourLevelMinDataWithLastLeafSize(uint32_t size); cpputils::unique_ref _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