Use C++11 uniform initialization for structs
This commit is contained in:
parent
31cd0eb9e9
commit
d1528fe541
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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()};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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()};
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user