From 3d9e98d89263e5faa1ea319da169432012d0ba07 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sat, 25 Apr 2015 00:08:29 +0200 Subject: [PATCH] Fix compiler errors in tests --- .../datanodestore/DataInnerNodeTest.cpp | 8 +++---- .../datanodestore/DataLeafNodeTest.cpp | 8 +++---- .../datanodestore/DataNodeStoreTest.cpp | 3 ++- .../datanodestore/DataNodeViewTest.cpp | 21 ++++++++++--------- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/test/implementations/onblocks/datanodestore/DataInnerNodeTest.cpp b/test/implementations/onblocks/datanodestore/DataInnerNodeTest.cpp index 14e61b76..6696492a 100644 --- a/test/implementations/onblocks/datanodestore/DataInnerNodeTest.cpp +++ b/test/implementations/onblocks/datanodestore/DataInnerNodeTest.cpp @@ -95,7 +95,7 @@ public: } Key InitializeInnerNodeAddLeafReturnKey() { - auto node = DataInnerNode::InitializeNewNode(blockStore->create(BLOCKSIZE_BYTES), *leaf); + auto node = DataInnerNode::InitializeNewNode(blockStore->create(Data(BLOCKSIZE_BYTES)), *leaf); AddALeafTo(node.get()); return node->key(); } @@ -111,14 +111,14 @@ public: constexpr uint32_t DataInnerNodeTest::BLOCKSIZE_BYTES; TEST_F(DataInnerNodeTest, CorrectKeyReturnedAfterInitialization) { - auto block = blockStore->create(BLOCKSIZE_BYTES); + auto block = blockStore->create(Data(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); + auto block = blockStore->create(Data(BLOCKSIZE_BYTES)); Key key = block->key(); DataInnerNode::InitializeNewNode(std::move(block), *leaf); @@ -127,7 +127,7 @@ TEST_F(DataInnerNodeTest, CorrectKeyReturnedAfterLoading) { } TEST_F(DataInnerNodeTest, InitializesCorrectly) { - auto node = DataInnerNode::InitializeNewNode(blockStore->create(BLOCKSIZE_BYTES), *leaf); + auto node = DataInnerNode::InitializeNewNode(blockStore->create(Data(BLOCKSIZE_BYTES)), *leaf); EXPECT_EQ(1u, node->numChildren()); EXPECT_EQ(leaf->key(), node->getChild(0)->key()); diff --git a/test/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp b/test/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp index 265be219..283c772e 100644 --- a/test/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp +++ b/test/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp @@ -100,7 +100,7 @@ public: } Key InitializeLeafGrowAndReturnKey() { - auto leaf = DataLeafNode::InitializeNewNode(blockStore->create(BLOCKSIZE_BYTES)); + auto leaf = DataLeafNode::InitializeNewNode(blockStore->create(Data(BLOCKSIZE_BYTES))); leaf->resize(5); return leaf->key(); } @@ -117,14 +117,14 @@ constexpr uint32_t DataLeafNodeTest::BLOCKSIZE_BYTES; constexpr DataNodeLayout DataLeafNodeTest::LAYOUT; TEST_F(DataLeafNodeTest, CorrectKeyReturnedAfterInitialization) { - auto block = blockStore->create(BLOCKSIZE_BYTES); + auto block = blockStore->create(Data(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); + auto block = blockStore->create(Data(BLOCKSIZE_BYTES)); Key key = block->key(); DataLeafNode::InitializeNewNode(std::move(block)); @@ -133,7 +133,7 @@ TEST_F(DataLeafNodeTest, CorrectKeyReturnedAfterLoading) { } TEST_F(DataLeafNodeTest, InitializesCorrectly) { - auto leaf = DataLeafNode::InitializeNewNode(blockStore->create(BLOCKSIZE_BYTES)); + auto leaf = DataLeafNode::InitializeNewNode(blockStore->create(Data(BLOCKSIZE_BYTES))); EXPECT_EQ(0u, leaf->numBytes()); } diff --git a/test/implementations/onblocks/datanodestore/DataNodeStoreTest.cpp b/test/implementations/onblocks/datanodestore/DataNodeStoreTest.cpp index e804bc37..c07fd8ec 100644 --- a/test/implementations/onblocks/datanodestore/DataNodeStoreTest.cpp +++ b/test/implementations/onblocks/datanodestore/DataNodeStoreTest.cpp @@ -16,6 +16,7 @@ using std::string; using blockstore::BlockStore; using blockstore::testfake::FakeBlockStore; using blockstore::Key; +using blockstore::Data; using namespace blobstore; using namespace blobstore::onblocks; using namespace blobstore::onblocks::datanodestore; @@ -73,7 +74,7 @@ TEST_F(DataNodeStoreTest, InnerNodeWithDepth2IsRecognizedAfterStoreAndLoad) { } TEST_F(DataNodeStoreTest, DataNodeCrashesOnLoadIfDepthIsTooHigh) { - auto block = blockStore->create(BLOCKSIZE_BYTES); + auto block = blockStore->create(Data(BLOCKSIZE_BYTES)); Key key = block->key(); { DataNodeView view(std::move(block)); diff --git a/test/implementations/onblocks/datanodestore/DataNodeViewTest.cpp b/test/implementations/onblocks/datanodestore/DataNodeViewTest.cpp index dc8dbb88..c576d4e8 100644 --- a/test/implementations/onblocks/datanodestore/DataNodeViewTest.cpp +++ b/test/implementations/onblocks/datanodestore/DataNodeViewTest.cpp @@ -15,6 +15,7 @@ using std::string; using blockstore::BlockStore; using blockstore::testfake::FakeBlockStore; +using blockstore::Data; using namespace blobstore; using namespace blobstore::onblocks; using namespace blobstore::onblocks::datanodestore; @@ -32,7 +33,7 @@ class DataNodeViewDepthTest: public DataNodeViewTest, public WithParamInterface< INSTANTIATE_TEST_CASE_P(DataNodeViewDepthTest, DataNodeViewDepthTest, Values(0, 1, 3, 10, 100)); TEST_P(DataNodeViewDepthTest, DepthIsStored) { - auto block = blockStore->create(BLOCKSIZE_BYTES); + auto block = blockStore->create(Data(BLOCKSIZE_BYTES)); auto key = block->key(); { DataNodeView view(std::move(block)); @@ -47,7 +48,7 @@ class DataNodeViewSizeTest: public DataNodeViewTest, public WithParamInterfacecreate(BLOCKSIZE_BYTES); + auto block = blockStore->create(Data(BLOCKSIZE_BYTES)); auto key = block->key(); { DataNodeView view(std::move(block)); @@ -59,7 +60,7 @@ TEST_P(DataNodeViewSizeTest, SizeIsStored) { TEST_F(DataNodeViewTest, DataIsStored) { DataBlockFixture randomData(DATASIZE_BYTES); - auto block = blockStore->create(BLOCKSIZE_BYTES); + auto block = blockStore->create(Data(BLOCKSIZE_BYTES)); auto key = block->key(); { DataNodeView view(std::move(block)); @@ -71,7 +72,7 @@ TEST_F(DataNodeViewTest, DataIsStored) { TEST_F(DataNodeViewTest, HeaderAndBodyDontOverlap) { DataBlockFixture randomData(DATASIZE_BYTES); - auto block = blockStore->create(BLOCKSIZE_BYTES); + auto block = blockStore->create(Data(BLOCKSIZE_BYTES)); auto key = block->key(); { DataNodeView view(std::move(block)); @@ -86,7 +87,7 @@ TEST_F(DataNodeViewTest, HeaderAndBodyDontOverlap) { } TEST_F(DataNodeViewTest, DataBeginWorksWithOneByteEntries) { - auto block = blockStore->create(BLOCKSIZE_BYTES); + auto block = blockStore->create(Data(BLOCKSIZE_BYTES)); uint8_t *blockBegin = (uint8_t*)block->data(); DataNodeView view(std::move(block)); @@ -94,7 +95,7 @@ TEST_F(DataNodeViewTest, DataBeginWorksWithOneByteEntries) { } TEST_F(DataNodeViewTest, DataBeginWorksWithEightByteEntries) { - auto block = blockStore->create(BLOCKSIZE_BYTES); + auto block = blockStore->create(Data(BLOCKSIZE_BYTES)); uint8_t *blockBegin = (uint8_t*)block->data(); DataNodeView view(std::move(block)); @@ -102,7 +103,7 @@ TEST_F(DataNodeViewTest, DataBeginWorksWithEightByteEntries) { } TEST_F(DataNodeViewTest, DataEndWorksWithOneByteEntries) { - auto block = blockStore->create(BLOCKSIZE_BYTES); + auto block = blockStore->create(Data(BLOCKSIZE_BYTES)); uint8_t *blockBegin = (uint8_t*)block->data(); DataNodeView view(std::move(block)); @@ -110,7 +111,7 @@ TEST_F(DataNodeViewTest, DataEndWorksWithOneByteEntries) { } TEST_F(DataNodeViewTest, DataEndWorksWithEightByteEntries) { - auto block = blockStore->create(BLOCKSIZE_BYTES); + auto block = blockStore->create(Data(BLOCKSIZE_BYTES)); uint8_t *blockBegin = (uint8_t*)block->data(); DataNodeView view(std::move(block)); @@ -126,7 +127,7 @@ BOOST_STATIC_ASSERT_MSG(DataNodeViewTest::DATASIZE_BYTES % sizeof(SizedDataEntry "If this static assertion fails, please use a different size for SizedDataEntry."); TEST_F(DataNodeViewTest, DataBeginWorksWithStructEntries) { - auto block = blockStore->create(BLOCKSIZE_BYTES); + auto block = blockStore->create(Data(BLOCKSIZE_BYTES)); uint8_t *blockBegin = (uint8_t*)block->data(); DataNodeView view(std::move(block)); @@ -134,7 +135,7 @@ TEST_F(DataNodeViewTest, DataBeginWorksWithStructEntries) { } TEST_F(DataNodeViewTest, DataEndWorksWithStructByteEntries) { - auto block = blockStore->create(BLOCKSIZE_BYTES); + auto block = blockStore->create(Data(BLOCKSIZE_BYTES)); uint8_t *blockBegin = (uint8_t*)block->data(); DataNodeView view(std::move(block));