From db32c37b872cbcedf2537954cf86cfbda4c2861b Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Tue, 24 Feb 2015 16:54:44 +0100 Subject: [PATCH] Added testcase for DataNodeStore::remove() --- implementations/onblocks/datanodestore/DataNodeStore.h | 2 +- .../onblocks/datanodestore/DataNodeStoreTest.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/implementations/onblocks/datanodestore/DataNodeStore.h b/implementations/onblocks/datanodestore/DataNodeStore.h index 3c916fd5..ea747de4 100644 --- a/implementations/onblocks/datanodestore/DataNodeStore.h +++ b/implementations/onblocks/datanodestore/DataNodeStore.h @@ -37,7 +37,7 @@ public: void remove(std::unique_ptr node); uint64_t numNodes() const; - //TODO Test remove(), overwriteNodeWith(), createNodeAsCopyFrom() + //TODO Test overwriteNodeWith(), createNodeAsCopyFrom() private: std::unique_ptr load(std::unique_ptr block); diff --git a/test/implementations/onblocks/datanodestore/DataNodeStoreTest.cpp b/test/implementations/onblocks/datanodestore/DataNodeStoreTest.cpp index e5ede1c4..269c6483 100644 --- a/test/implementations/onblocks/datanodestore/DataNodeStoreTest.cpp +++ b/test/implementations/onblocks/datanodestore/DataNodeStoreTest.cpp @@ -93,6 +93,14 @@ TEST_F(DataNodeStoreTest, CreatedLeafNodeIsInitialized) { 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) { EXPECT_EQ(0, nodeStore->numNodes()); }