I am having trouble in mocking the following method.
I have this code:
// contents of XRECT.h
using VRECT = std::vector<RECT>;
class XRECT {
public:
virtual bool DisplayRect(VRECT rects) = 0;
}
class CXRECT : public XRECT {
public:
virtual bool DisplayRect(VRECT rects) override;
}
// contents of XRECT.cpp
bool CXRECT::DisplayRect(VRECT rects) {
// do something
return true;
}
// contents of test.cpp
#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include "XRECT.h"
class MockCXRECT : public CXRECT {
public:
MOCK_METHOD(bool, DisplayRect, (VRECT rects), (override)); // hovering over the mock method shows the "Function definition for MOCK_METHOD" not found
};
TEST(Testing, Case1) {
MockCXRECT mock;
VRECT v;
EXPECT_CALL(mock, DisplayRect(v)).WillRepeatedly(::testing::Return(true));
}
When I replace VRECT with a simple data type int
then everything works just fine. Is there a different way to define container based arguments?
I am getting error for compiling:
error C2893: Failed to specialize function template 'unknown-type std::equal_to<void>::operator ()(_Ty1 &&,_Ty2) noexcept(<expr>) const'
++++ Edit: I see the problem is not with vector but with windef.h's RECT.