1

I am using googletest 1.8 with QT5.9.1 visual studio 2015 I have a container QVector(error) that is populated with data. Basically I want to compare the two containers and check that they have identical populated values using google test. How do i do this?

The program will not compile.

C:\googletest-master\googletest\include\gtest\internal\gtest-internal.h:961: error: C2678: binary '==': no operator found which takes a left-hand operand of type 'const error' (or there is no acceptable conversion)

The program compiles when i use the example compare two QVector(int).

struct error
{
    int max_error;
    int applied_offset;
    int min_error;
    int sum_squares;
    std::vector<int> results;
};


TEST(CalculationsTest,PopulateError)
{
    Calculations c;
    std::vector<int> data = {1,2,3,4,5};
    QVector<error> e1 = c.PopulateErrorSet(data);
    QVector<error> e2= c.PopulateErrorSet(data);

    std::vector<error> e11 = e1.toStdVector();
    e2.begin()->max_error = 12;
    std::vector<error> e12 = e2.toStdVector();

    //EXPECT_THAT(1,0);
    ASSERT_THAT(e11, ::testing::ContainerEq(e12));
}
agent_bean
  • 1,493
  • 1
  • 16
  • 30

0 Answers0