Reduce use of memcmp and use operator==(Data, Data) instead

This commit is contained in:
Sebastian Messmer 2015-04-25 17:17:15 +02:00
parent b4e2eaa3e8
commit 7d6febe17f

View File

@ -150,7 +150,7 @@ TEST_F(DataLeafNodeTest, ReadWrittenDataAfterReloadingBlock) {
auto loaded = LoadLeafNode(key);
EXPECT_EQ(randomData.size(), loaded->numBytes());
EXPECT_EQ(0, std::memcmp(randomData.data(), loadData(*loaded).data(), randomData.size()));
EXPECT_EQ(randomData, loadData(*loaded));
}
TEST_F(DataLeafNodeTest, NewLeafNodeHasSizeZero) {
@ -287,11 +287,6 @@ public:
backgroundData(DataFixture::generate(GetParam().leafsize, 1)) {
}
void EXPECT_DATA_EQ(const Data &expected, const Data &actual) {
EXPECT_EQ(expected.size(), actual.size());
EXPECT_EQ(0, std::memcmp(expected.data(), actual.data(), expected.size()));
}
Key CreateLeafWriteToItAndReturnKey(const Data &to_write) {
auto newleaf = nodeStore->createNewLeafNode();
@ -303,7 +298,7 @@ public:
void EXPECT_DATA_READS_AS(const Data &expected, const DataLeafNode &leaf, off_t offset, size_t count) {
Data read(count);
leaf.read(read.data(), offset, count);
EXPECT_DATA_EQ(expected, read);
EXPECT_EQ(expected, read);
}
void EXPECT_DATA_READS_AS_OUTSIDE_OF(const Data &expected, const DataLeafNode &leaf, off_t start, size_t count) {