Added testcase for DataNodeStore::remove()

This commit is contained in:
Sebastian Messmer 2015-02-24 16:54:44 +01:00
parent b9e3a9b109
commit db32c37b87
2 changed files with 9 additions and 1 deletions

View File

@ -37,7 +37,7 @@ public:
void remove(std::unique_ptr<DataNode> node); void remove(std::unique_ptr<DataNode> node);
uint64_t numNodes() const; uint64_t numNodes() const;
//TODO Test remove(), overwriteNodeWith(), createNodeAsCopyFrom() //TODO Test overwriteNodeWith(), createNodeAsCopyFrom()
private: private:
std::unique_ptr<DataNode> load(std::unique_ptr<blockstore::Block> block); std::unique_ptr<DataNode> load(std::unique_ptr<blockstore::Block> block);

View File

@ -93,6 +93,14 @@ TEST_F(DataNodeStoreTest, CreatedLeafNodeIsInitialized) {
EXPECT_EQ(0u, leaf->numBytes()); EXPECT_EQ(0u, leaf->numBytes());
} }
TEST_F(DataNodeStoreTest, NodeIsNotLoadableAfterDeleting) {
auto nodekey = nodeStore->createNewLeafNode()->key();
auto node = nodeStore->load(nodekey);
EXPECT_NE(nullptr, node);
nodeStore->remove(std::move(node));
EXPECT_EQ(nullptr, nodeStore->load(nodekey));
}
TEST_F(DataNodeStoreTest, NumNodesIsCorrectOnEmptyNodestore) { TEST_F(DataNodeStoreTest, NumNodesIsCorrectOnEmptyNodestore) {
EXPECT_EQ(0, nodeStore->numNodes()); EXPECT_EQ(0, nodeStore->numNodes());
} }