Fix compiler errors in tests

This commit is contained in:
Sebastian Messmer 2015-04-25 00:08:29 +02:00
parent f2adbf01df
commit 3d9e98d892
4 changed files with 21 additions and 19 deletions

View File

@ -95,7 +95,7 @@ public:
} }
Key InitializeInnerNodeAddLeafReturnKey() { Key InitializeInnerNodeAddLeafReturnKey() {
auto node = DataInnerNode::InitializeNewNode(blockStore->create(BLOCKSIZE_BYTES), *leaf); auto node = DataInnerNode::InitializeNewNode(blockStore->create(Data(BLOCKSIZE_BYTES)), *leaf);
AddALeafTo(node.get()); AddALeafTo(node.get());
return node->key(); return node->key();
} }
@ -111,14 +111,14 @@ public:
constexpr uint32_t DataInnerNodeTest::BLOCKSIZE_BYTES; constexpr uint32_t DataInnerNodeTest::BLOCKSIZE_BYTES;
TEST_F(DataInnerNodeTest, CorrectKeyReturnedAfterInitialization) { TEST_F(DataInnerNodeTest, CorrectKeyReturnedAfterInitialization) {
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
Key key = block->key(); Key key = block->key();
auto node = DataInnerNode::InitializeNewNode(std::move(block), *leaf); auto node = DataInnerNode::InitializeNewNode(std::move(block), *leaf);
EXPECT_EQ(key, node->key()); EXPECT_EQ(key, node->key());
} }
TEST_F(DataInnerNodeTest, CorrectKeyReturnedAfterLoading) { TEST_F(DataInnerNodeTest, CorrectKeyReturnedAfterLoading) {
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
Key key = block->key(); Key key = block->key();
DataInnerNode::InitializeNewNode(std::move(block), *leaf); DataInnerNode::InitializeNewNode(std::move(block), *leaf);
@ -127,7 +127,7 @@ TEST_F(DataInnerNodeTest, CorrectKeyReturnedAfterLoading) {
} }
TEST_F(DataInnerNodeTest, InitializesCorrectly) { 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(1u, node->numChildren());
EXPECT_EQ(leaf->key(), node->getChild(0)->key()); EXPECT_EQ(leaf->key(), node->getChild(0)->key());

View File

@ -100,7 +100,7 @@ public:
} }
Key InitializeLeafGrowAndReturnKey() { Key InitializeLeafGrowAndReturnKey() {
auto leaf = DataLeafNode::InitializeNewNode(blockStore->create(BLOCKSIZE_BYTES)); auto leaf = DataLeafNode::InitializeNewNode(blockStore->create(Data(BLOCKSIZE_BYTES)));
leaf->resize(5); leaf->resize(5);
return leaf->key(); return leaf->key();
} }
@ -117,14 +117,14 @@ constexpr uint32_t DataLeafNodeTest::BLOCKSIZE_BYTES;
constexpr DataNodeLayout DataLeafNodeTest::LAYOUT; constexpr DataNodeLayout DataLeafNodeTest::LAYOUT;
TEST_F(DataLeafNodeTest, CorrectKeyReturnedAfterInitialization) { TEST_F(DataLeafNodeTest, CorrectKeyReturnedAfterInitialization) {
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
Key key = block->key(); Key key = block->key();
auto node = DataLeafNode::InitializeNewNode(std::move(block)); auto node = DataLeafNode::InitializeNewNode(std::move(block));
EXPECT_EQ(key, node->key()); EXPECT_EQ(key, node->key());
} }
TEST_F(DataLeafNodeTest, CorrectKeyReturnedAfterLoading) { TEST_F(DataLeafNodeTest, CorrectKeyReturnedAfterLoading) {
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
Key key = block->key(); Key key = block->key();
DataLeafNode::InitializeNewNode(std::move(block)); DataLeafNode::InitializeNewNode(std::move(block));
@ -133,7 +133,7 @@ TEST_F(DataLeafNodeTest, CorrectKeyReturnedAfterLoading) {
} }
TEST_F(DataLeafNodeTest, InitializesCorrectly) { 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()); EXPECT_EQ(0u, leaf->numBytes());
} }

View File

@ -16,6 +16,7 @@ using std::string;
using blockstore::BlockStore; using blockstore::BlockStore;
using blockstore::testfake::FakeBlockStore; using blockstore::testfake::FakeBlockStore;
using blockstore::Key; using blockstore::Key;
using blockstore::Data;
using namespace blobstore; using namespace blobstore;
using namespace blobstore::onblocks; using namespace blobstore::onblocks;
using namespace blobstore::onblocks::datanodestore; using namespace blobstore::onblocks::datanodestore;
@ -73,7 +74,7 @@ TEST_F(DataNodeStoreTest, InnerNodeWithDepth2IsRecognizedAfterStoreAndLoad) {
} }
TEST_F(DataNodeStoreTest, DataNodeCrashesOnLoadIfDepthIsTooHigh) { TEST_F(DataNodeStoreTest, DataNodeCrashesOnLoadIfDepthIsTooHigh) {
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
Key key = block->key(); Key key = block->key();
{ {
DataNodeView view(std::move(block)); DataNodeView view(std::move(block));

View File

@ -15,6 +15,7 @@ using std::string;
using blockstore::BlockStore; using blockstore::BlockStore;
using blockstore::testfake::FakeBlockStore; using blockstore::testfake::FakeBlockStore;
using blockstore::Data;
using namespace blobstore; using namespace blobstore;
using namespace blobstore::onblocks; using namespace blobstore::onblocks;
using namespace blobstore::onblocks::datanodestore; 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)); INSTANTIATE_TEST_CASE_P(DataNodeViewDepthTest, DataNodeViewDepthTest, Values(0, 1, 3, 10, 100));
TEST_P(DataNodeViewDepthTest, DepthIsStored) { TEST_P(DataNodeViewDepthTest, DepthIsStored) {
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
auto key = block->key(); auto key = block->key();
{ {
DataNodeView view(std::move(block)); DataNodeView view(std::move(block));
@ -47,7 +48,7 @@ class DataNodeViewSizeTest: public DataNodeViewTest, public WithParamInterface<u
INSTANTIATE_TEST_CASE_P(DataNodeViewSizeTest, DataNodeViewSizeTest, Values(0, 50, 64, 1024, 1024*1024*1024)); INSTANTIATE_TEST_CASE_P(DataNodeViewSizeTest, DataNodeViewSizeTest, Values(0, 50, 64, 1024, 1024*1024*1024));
TEST_P(DataNodeViewSizeTest, SizeIsStored) { TEST_P(DataNodeViewSizeTest, SizeIsStored) {
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
auto key = block->key(); auto key = block->key();
{ {
DataNodeView view(std::move(block)); DataNodeView view(std::move(block));
@ -59,7 +60,7 @@ TEST_P(DataNodeViewSizeTest, SizeIsStored) {
TEST_F(DataNodeViewTest, DataIsStored) { TEST_F(DataNodeViewTest, DataIsStored) {
DataBlockFixture randomData(DATASIZE_BYTES); DataBlockFixture randomData(DATASIZE_BYTES);
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
auto key = block->key(); auto key = block->key();
{ {
DataNodeView view(std::move(block)); DataNodeView view(std::move(block));
@ -71,7 +72,7 @@ TEST_F(DataNodeViewTest, DataIsStored) {
TEST_F(DataNodeViewTest, HeaderAndBodyDontOverlap) { TEST_F(DataNodeViewTest, HeaderAndBodyDontOverlap) {
DataBlockFixture randomData(DATASIZE_BYTES); DataBlockFixture randomData(DATASIZE_BYTES);
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
auto key = block->key(); auto key = block->key();
{ {
DataNodeView view(std::move(block)); DataNodeView view(std::move(block));
@ -86,7 +87,7 @@ TEST_F(DataNodeViewTest, HeaderAndBodyDontOverlap) {
} }
TEST_F(DataNodeViewTest, DataBeginWorksWithOneByteEntries) { TEST_F(DataNodeViewTest, DataBeginWorksWithOneByteEntries) {
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
uint8_t *blockBegin = (uint8_t*)block->data(); uint8_t *blockBegin = (uint8_t*)block->data();
DataNodeView view(std::move(block)); DataNodeView view(std::move(block));
@ -94,7 +95,7 @@ TEST_F(DataNodeViewTest, DataBeginWorksWithOneByteEntries) {
} }
TEST_F(DataNodeViewTest, DataBeginWorksWithEightByteEntries) { TEST_F(DataNodeViewTest, DataBeginWorksWithEightByteEntries) {
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
uint8_t *blockBegin = (uint8_t*)block->data(); uint8_t *blockBegin = (uint8_t*)block->data();
DataNodeView view(std::move(block)); DataNodeView view(std::move(block));
@ -102,7 +103,7 @@ TEST_F(DataNodeViewTest, DataBeginWorksWithEightByteEntries) {
} }
TEST_F(DataNodeViewTest, DataEndWorksWithOneByteEntries) { TEST_F(DataNodeViewTest, DataEndWorksWithOneByteEntries) {
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
uint8_t *blockBegin = (uint8_t*)block->data(); uint8_t *blockBegin = (uint8_t*)block->data();
DataNodeView view(std::move(block)); DataNodeView view(std::move(block));
@ -110,7 +111,7 @@ TEST_F(DataNodeViewTest, DataEndWorksWithOneByteEntries) {
} }
TEST_F(DataNodeViewTest, DataEndWorksWithEightByteEntries) { TEST_F(DataNodeViewTest, DataEndWorksWithEightByteEntries) {
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
uint8_t *blockBegin = (uint8_t*)block->data(); uint8_t *blockBegin = (uint8_t*)block->data();
DataNodeView view(std::move(block)); 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."); "If this static assertion fails, please use a different size for SizedDataEntry.");
TEST_F(DataNodeViewTest, DataBeginWorksWithStructEntries) { TEST_F(DataNodeViewTest, DataBeginWorksWithStructEntries) {
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
uint8_t *blockBegin = (uint8_t*)block->data(); uint8_t *blockBegin = (uint8_t*)block->data();
DataNodeView view(std::move(block)); DataNodeView view(std::move(block));
@ -134,7 +135,7 @@ TEST_F(DataNodeViewTest, DataBeginWorksWithStructEntries) {
} }
TEST_F(DataNodeViewTest, DataEndWorksWithStructByteEntries) { TEST_F(DataNodeViewTest, DataEndWorksWithStructByteEntries) {
auto block = blockStore->create(BLOCKSIZE_BYTES); auto block = blockStore->create(Data(BLOCKSIZE_BYTES));
uint8_t *blockBegin = (uint8_t*)block->data(); uint8_t *blockBegin = (uint8_t*)block->data();
DataNodeView view(std::move(block)); DataNodeView view(std::move(block));