From 7d6febe17f8534b104d8708e25d6021c04d9c06c Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sat, 25 Apr 2015 17:17:15 +0200 Subject: [PATCH] Reduce use of memcmp and use operator==(Data, Data) instead --- .../onblocks/datanodestore/DataLeafNodeTest.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/test/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp b/test/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp index e719dcc2..290b0fca 100644 --- a/test/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp +++ b/test/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp @@ -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) {