From d1528fe541caf1178dc1abfccb936f4a87abac6b Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sun, 21 Jun 2015 14:40:52 +0200 Subject: [PATCH] Use C++11 uniform initialization for structs --- .../onblocks/BlobReadWriteTest.cpp | 31 +++++++++---------- .../datanodestore/DataLeafNodeTest.cpp | 17 +++++----- ...derNodeWithLessThanKChildrenOrNullTest.cpp | 9 +++--- ...rderNodeWithMoreThanOneChildOrNullTest.cpp | 13 ++++---- 4 files changed, 33 insertions(+), 37 deletions(-) diff --git a/test/implementations/onblocks/BlobReadWriteTest.cpp b/test/implementations/onblocks/BlobReadWriteTest.cpp index 9f63a479..71891b86 100644 --- a/test/implementations/onblocks/BlobReadWriteTest.cpp +++ b/test/implementations/onblocks/BlobReadWriteTest.cpp @@ -57,7 +57,6 @@ TEST_F(BlobReadWriteTest, WritingImmediatelyFlushes_LargeSize) { } struct DataRange { - DataRange(size_t blobsize_, off_t offset_, size_t count_): blobsize(blobsize_), offset(offset_), count(count_) {} size_t blobsize; off_t offset; size_t count; @@ -92,22 +91,22 @@ public: }; INSTANTIATE_TEST_CASE_P(BlobReadWriteDataTest, BlobReadWriteDataTest, Values( //Blob with only one leaf - DataRange(BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf(), 0, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()), // full size leaf, access beginning to end - DataRange(BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf(), 100, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-200), // full size leaf, access middle to middle - DataRange(BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf(), 0, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-100), // full size leaf, access beginning to middle - DataRange(BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf(), 100, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-100), // full size leaf, access middle to end - DataRange(BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-100, 0, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-100), // non-full size leaf, access beginning to end - DataRange(BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-100, 100, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-300), // non-full size leaf, access middle to middle - DataRange(BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-100, 0, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-200), // non-full size leaf, access beginning to middle - DataRange(BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-100, 100, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-200), // non-full size leaf, access middle to end + DataRange{BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf(), 0, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()}, // full size leaf, access beginning to end + DataRange{BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf(), 100, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-200}, // full size leaf, access middle to middle + DataRange{BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf(), 0, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-100}, // full size leaf, access beginning to middle + DataRange{BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf(), 100, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-100}, // full size leaf, access middle to end + DataRange{BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-100, 0, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-100}, // non-full size leaf, access beginning to end + DataRange{BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-100, 100, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-300}, // non-full size leaf, access middle to middle + DataRange{BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-100, 0, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-200}, // non-full size leaf, access beginning to middle + DataRange{BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-100, 100, BlobReadWriteDataTest::LAYOUT.maxBytesPerLeaf()-200}, // non-full size leaf, access middle to end //Larger blob - DataRange(BlobReadWriteDataTest::LARGE_SIZE, 0, BlobReadWriteDataTest::LARGE_SIZE), // access beginning to end - DataRange(BlobReadWriteDataTest::LARGE_SIZE, 100, BlobReadWriteDataTest::LARGE_SIZE-200), // access middle first leaf to middle last leaf - DataRange(BlobReadWriteDataTest::LARGE_SIZE, 0, BlobReadWriteDataTest::LARGE_SIZE-100), // access beginning to middle last leaf - DataRange(BlobReadWriteDataTest::LARGE_SIZE, 100, BlobReadWriteDataTest::LARGE_SIZE-100), // access middle first leaf to end - DataRange(BlobReadWriteDataTest::LARGE_SIZE, BlobReadWriteDataTest::LARGE_SIZE*1/3, BlobReadWriteDataTest::LARGE_SIZE*1/3), // access middle to middle - DataRange(BlobReadWriteDataTest::LARGE_SIZE, 0, BlobReadWriteDataTest::LARGE_SIZE*2/3), // access beginning to middle - DataRange(BlobReadWriteDataTest::LARGE_SIZE, BlobReadWriteDataTest::LARGE_SIZE*1/3, BlobReadWriteDataTest::LARGE_SIZE*2/3) // access middle to end + DataRange{BlobReadWriteDataTest::LARGE_SIZE, 0, BlobReadWriteDataTest::LARGE_SIZE}, // access beginning to end + DataRange{BlobReadWriteDataTest::LARGE_SIZE, 100, BlobReadWriteDataTest::LARGE_SIZE-200}, // access middle first leaf to middle last leaf + DataRange{BlobReadWriteDataTest::LARGE_SIZE, 0, BlobReadWriteDataTest::LARGE_SIZE-100}, // access beginning to middle last leaf + DataRange{BlobReadWriteDataTest::LARGE_SIZE, 100, BlobReadWriteDataTest::LARGE_SIZE-100}, // access middle first leaf to end + DataRange{BlobReadWriteDataTest::LARGE_SIZE, BlobReadWriteDataTest::LARGE_SIZE*1/3, BlobReadWriteDataTest::LARGE_SIZE*1/3}, // access middle to middle + DataRange{BlobReadWriteDataTest::LARGE_SIZE, 0, BlobReadWriteDataTest::LARGE_SIZE*2/3}, // access beginning to middle + DataRange{BlobReadWriteDataTest::LARGE_SIZE, BlobReadWriteDataTest::LARGE_SIZE*1/3, BlobReadWriteDataTest::LARGE_SIZE*2/3} // access middle to end )); TEST_P(BlobReadWriteDataTest, WritingDoesntChangeSize) { diff --git a/test/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp b/test/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp index 78348023..02d19a2b 100644 --- a/test/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp +++ b/test/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp @@ -271,7 +271,6 @@ TEST_F(DataLeafNodeTest, CopyDataLeaf) { struct DataRange { - DataRange(size_t leafsize_, off_t offset_, size_t count_): leafsize(leafsize_), offset(offset_), count(count_) {} size_t leafsize; off_t offset; size_t count; @@ -319,14 +318,14 @@ public: } }; INSTANTIATE_TEST_CASE_P(DataLeafNodeDataTest, DataLeafNodeDataTest, Values( - DataRange(DataLeafNodeTest::LAYOUT.maxBytesPerLeaf(), 0, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()), // full size leaf, access beginning to end - DataRange(DataLeafNodeTest::LAYOUT.maxBytesPerLeaf(), 100, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-200), // full size leaf, access middle to middle - DataRange(DataLeafNodeTest::LAYOUT.maxBytesPerLeaf(), 0, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-100), // full size leaf, access beginning to middle - DataRange(DataLeafNodeTest::LAYOUT.maxBytesPerLeaf(), 100, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-100), // full size leaf, access middle to end - DataRange(DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-100, 0, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-100), // non-full size leaf, access beginning to end - DataRange(DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-100, 100, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-300), // non-full size leaf, access middle to middle - DataRange(DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-100, 0, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-200), // non-full size leaf, access beginning to middle - DataRange(DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-100, 100, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-200) // non-full size leaf, access middle to end + DataRange{DataLeafNodeTest::LAYOUT.maxBytesPerLeaf(), 0, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()}, // full size leaf, access beginning to end + DataRange{DataLeafNodeTest::LAYOUT.maxBytesPerLeaf(), 100, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-200}, // full size leaf, access middle to middle + DataRange{DataLeafNodeTest::LAYOUT.maxBytesPerLeaf(), 0, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-100}, // full size leaf, access beginning to middle + DataRange{DataLeafNodeTest::LAYOUT.maxBytesPerLeaf(), 100, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-100}, // full size leaf, access middle to end + DataRange{DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-100, 0, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-100}, // non-full size leaf, access beginning to end + DataRange{DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-100, 100, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-300}, // non-full size leaf, access middle to middle + DataRange{DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-100, 0, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-200}, // non-full size leaf, access beginning to middle + DataRange{DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-100, 100, DataLeafNodeTest::LAYOUT.maxBytesPerLeaf()-200} // non-full size leaf, access middle to end )); TEST_P(DataLeafNodeDataTest, WriteAndReadImmediately) { diff --git a/test/implementations/onblocks/datatreestore/impl/GetLowestInnerRightBorderNodeWithLessThanKChildrenOrNullTest.cpp b/test/implementations/onblocks/datatreestore/impl/GetLowestInnerRightBorderNodeWithLessThanKChildrenOrNullTest.cpp index a2b2f8d9..447fc4f4 100644 --- a/test/implementations/onblocks/datatreestore/impl/GetLowestInnerRightBorderNodeWithLessThanKChildrenOrNullTest.cpp +++ b/test/implementations/onblocks/datatreestore/impl/GetLowestInnerRightBorderNodeWithLessThanKChildrenOrNullTest.cpp @@ -23,7 +23,6 @@ using namespace blobstore::onblocks::datatreestore::algorithms; class GetLowestInnerRightBorderNodeWithLessThanKChildrenOrNullTest: public DataTreeTest { public: struct TestData { - TestData(Key rootNode_, Key expectedResult_): rootNode(rootNode_), expectedResult(expectedResult_) {} Key rootNode; Key expectedResult; }; @@ -36,24 +35,24 @@ public: TestData CreateTwoRightBorderNodes() { auto node = CreateInner({CreateLeaf()}); - return TestData(node->key(), node->key()); + return TestData{node->key(), node->key()}; } TestData CreateThreeRightBorderNodes() { auto node = CreateInner({CreateLeaf()}); auto root = CreateInner({node.get()}); - return TestData(root->key(), node->key()); + return TestData{root->key(), node->key()}; } TestData CreateThreeRightBorderNodes_LastFull() { auto root = CreateInner({CreateFullTwoLevel()}); - return TestData(root->key(), root->key()); + return TestData{root->key(), root->key()}; } TestData CreateLargerTree() { auto node = CreateInner({CreateLeaf(), CreateLeaf()}); auto root = CreateInner({CreateFullTwoLevel().get(), node.get()}); - return TestData(root->key(), node->key()); + return TestData{root->key(), node->key()}; } }; diff --git a/test/implementations/onblocks/datatreestore/impl/GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest.cpp b/test/implementations/onblocks/datatreestore/impl/GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest.cpp index 4371630f..38111835 100644 --- a/test/implementations/onblocks/datatreestore/impl/GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest.cpp +++ b/test/implementations/onblocks/datatreestore/impl/GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest.cpp @@ -23,7 +23,6 @@ using namespace blobstore::onblocks::datatreestore::algorithms; class GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest: public DataTreeTest { public: struct TestData { - TestData(Key rootNode_, Key expectedResult_): rootNode(rootNode_), expectedResult(expectedResult_) {} Key rootNode; Key expectedResult; }; @@ -49,34 +48,34 @@ public: TestData CreateThreeRightBorderNodes_LastFull() { auto node = CreateFullTwoLevel(); auto root = CreateInner({node.get()}); - return TestData(root->key(), node->key()); + return TestData{root->key(), node->key()}; } TestData CreateLargerTree() { auto node = CreateInner({CreateLeaf(), CreateLeaf()}); auto root = CreateInner({CreateFullTwoLevel().get(), node.get()}); - return TestData(root->key(), node->key()); + return TestData{root->key(), node->key()}; } TestData CreateThreeLevelTreeWithRightBorderSingleNodeChain() { auto root = CreateInner({CreateFullTwoLevel(), CreateInner({CreateLeaf()})}); - return TestData(root->key(), root->key()); + return TestData{root->key(), root->key()}; } TestData CreateThreeLevelTree() { auto node = CreateInner({CreateLeaf(), CreateLeaf()}); auto root = CreateInner({CreateFullTwoLevel().get(), node.get()}); - return TestData(root->key(), node->key()); + return TestData{root->key(), node->key()}; } TestData CreateFullTwoLevelTree() { auto node = CreateFullTwoLevel(); - return TestData(node->key(), node->key()); + return TestData{node->key(), node->key()}; } TestData CreateFullThreeLevelTree() { auto root = CreateFullThreeLevel(); - return TestData(root->key(), root->LastChild()->key()); + return TestData{root->key(), root->LastChild()->key()}; } };