Fix ODR violations in test cases by adding an anonymous namespace around duplicate definitions

This commit is contained in:
Sebastian Messmer 2021-01-12 19:48:27 -08:00
parent 5ee4991281
commit c751f432a6
4 changed files with 15 additions and 0 deletions

View File

@ -13,6 +13,8 @@ using blockstore::BlockId;
using cpputils::Data;
using cpputils::DataFixture;
namespace {
class BlobReadWriteTest: public BlobStoreTest {
public:
static constexpr uint32_t LARGE_SIZE = 10 * 1024 * 1024;
@ -250,3 +252,5 @@ TEST_P(BlobReadWriteDataTest, WritePartAndReadWhole) {
EXPECT_EQ(0, std::memcmp(read.dataOffset(GetParam().offset), this->foregroundData.data(), GetParam().count));
EXPECT_EQ(0, std::memcmp(read.dataOffset(GetParam().offset+GetParam().count), this->backgroundData.dataOffset(GetParam().offset+GetParam().count), GetParam().blobsize-GetParam().count-GetParam().offset));
}
}

View File

@ -31,6 +31,8 @@ using namespace blobstore;
using namespace blobstore::onblocks;
using namespace blobstore::onblocks::datanodestore;
namespace {
#define EXPECT_IS_PTR_TYPE(Type, ptr) EXPECT_NE(nullptr, dynamic_cast<Type*>(ptr)) << "Given pointer cannot be cast to the given type"
class DataLeafNodeTest: public Test {
@ -340,3 +342,4 @@ TEST_P(DataLeafNodeDataTest, OverwriteAndRead) {
EXPECT_DATA_READS_AS_OUTSIDE_OF(this->backgroundData, *leaf, GetParam().offset, GetParam().count);
}
}

View File

@ -20,6 +20,8 @@ using testing::StrEq;
using testing::NiceMock;
using testing::_;
namespace {
class MockCallable {
public:
MOCK_METHOD(std::string, call, ());
@ -83,3 +85,5 @@ TEST_F(CryPasswordBasedKeyProviderTest, requestKeyForExistingFilesystem) {
EXPECT_EQ(key.ToString(), returned_key.ToString());
}
}

View File

@ -15,6 +15,8 @@ using testing::Eq;
using testing::StrEq;
using testing::_;
namespace {
class MockKDF : public PasswordBasedKDF {
public:
MOCK_METHOD(EncryptionKey, deriveExistingKey, (size_t keySize, const string& password, const Data& kdfParameters), (override));
@ -54,3 +56,5 @@ TEST(CryPresetPasswordBasedKeyProviderTest, requestKeyForExistingFilesystem) {
EXPECT_EQ(key.ToString(), returned_key.ToString());
}
}