I have not even begun testing and I am encountering some syntax issues with GMock's MOCK_METHOD macro even though I am following GMock's documentation properly. Could it be a compiler issue? I have:
MingGW (GCC 4.9.2)
Googletest 1.10.x
class SimpleClass {
public:
virtual int simpleFirstFunction(int a, int b) { return (a + simpleSecondFunction(b)); }
virtual int simpleSecondFunction(int b) { return (2 * b); }
virtual ~SimpleClass();
};
class MockSimpleClass :public SimpleClass {
MOCK_METHOD(int, simpleSecondFunction, (int a, int b), (override));
};
I am seeing 3 compiler errors:
Error-1: about the function name
MockSimpleClass.cpp:18:24: error:
'simpleSecondFunction' is not a type MOCK_METHOD(int, simpleSecondFunction(int a, int b), (override));
Error-2: about input parameters
MockSimpleClass.cpp:18:46: error:
expected identifier before '(' token MOCK_METHOD(int, simpleSecondFunction, (int a, int b), (override));
Error-3: About parentheses around "override"
MockSimpleClass.cpp:18:60: error:
expected identifier before '(' token MOCK_METHOD(int, simpleSecondFunction(int a, int b), (override));
override
, but the number of parametrs is not matching. – Linage