Added test cases for DataNode::key() and DataTree::key()
This commit is contained in:
parent
4d50479777
commit
68182e523f
@ -110,6 +110,22 @@ public:
|
||||
|
||||
constexpr uint32_t DataInnerNodeTest::BLOCKSIZE_BYTES;
|
||||
|
||||
TEST_F(DataInnerNodeTest, CorrectKeyReturnedAfterInitialization) {
|
||||
auto block = blockStore->create(BLOCKSIZE_BYTES);
|
||||
Key key = block->key();
|
||||
auto node = DataInnerNode::InitializeNewNode(std::move(block), *leaf);
|
||||
EXPECT_EQ(key, node->key());
|
||||
}
|
||||
|
||||
TEST_F(DataInnerNodeTest, CorrectKeyReturnedAfterLoading) {
|
||||
auto block = blockStore->create(BLOCKSIZE_BYTES);
|
||||
Key key = block->key();
|
||||
DataInnerNode::InitializeNewNode(std::move(block), *leaf);
|
||||
|
||||
auto loaded = nodeStore->load(key);
|
||||
EXPECT_EQ(key, loaded->key());
|
||||
}
|
||||
|
||||
TEST_F(DataInnerNodeTest, InitializesCorrectly) {
|
||||
auto node = DataInnerNode::InitializeNewNode(blockStore->create(BLOCKSIZE_BYTES), *leaf);
|
||||
|
||||
|
@ -106,6 +106,22 @@ public:
|
||||
|
||||
constexpr uint32_t DataLeafNodeTest::BLOCKSIZE_BYTES;
|
||||
|
||||
TEST_F(DataLeafNodeTest, CorrectKeyReturnedAfterInitialization) {
|
||||
auto block = blockStore->create(BLOCKSIZE_BYTES);
|
||||
Key key = block->key();
|
||||
auto node = DataLeafNode::InitializeNewNode(std::move(block));
|
||||
EXPECT_EQ(key, node->key());
|
||||
}
|
||||
|
||||
TEST_F(DataLeafNodeTest, CorrectKeyReturnedAfterLoading) {
|
||||
auto block = blockStore->create(BLOCKSIZE_BYTES);
|
||||
Key key = block->key();
|
||||
DataLeafNode::InitializeNewNode(std::move(block));
|
||||
|
||||
auto loaded = nodeStore->load(key);
|
||||
EXPECT_EQ(key, loaded->key());
|
||||
}
|
||||
|
||||
TEST_F(DataLeafNodeTest, InitializesCorrectly) {
|
||||
auto leaf = DataLeafNode::InitializeNewNode(blockStore->create(BLOCKSIZE_BYTES));
|
||||
EXPECT_EQ(0u, leaf->numBytes());
|
||||
|
@ -14,6 +14,12 @@ using namespace blobstore::onblocks::datatreestore;
|
||||
class DataTreeStoreTest: public DataTreeTest {
|
||||
};
|
||||
|
||||
TEST_F(DataTreeStoreTest, CorrectKeyReturned) {
|
||||
Key key = treeStore.createNewTree()->key();
|
||||
auto tree = treeStore.load(key);
|
||||
EXPECT_EQ(key, tree->key());
|
||||
}
|
||||
|
||||
TEST_F(DataTreeStoreTest, CreatedTreeIsLoadable) {
|
||||
auto key = treeStore.createNewTree()->key();
|
||||
auto loaded = treeStore.load(key);
|
||||
|
Loading…
Reference in New Issue
Block a user