Question

I'm trying to get a working googletest test that compares two vectors. For this I'm using google mock with its matchers but I get a C3861 error saying "ContainerEq identifier not found" and also C2512 saying "testing::AssertionResult has not a proper default constructor available". Why?

TEST(MyTestSuite, MyTest)
{
    std::vector<int> test1;
    std::vector<int> test2;

    ...

    EXPECT_THAT(test1, ContainerEq(test2));
}
Was it helpful?

Solution

You're just missing gtest's testing namespace qualifier:

EXPECT_THAT(test1, ::testing::ContainerEq(test2));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top