Question

I created a test mock class pretty much as simple as described in the docs:

class MockLogicLoopable : public LogicLoopable 
{
public:
  MOCK_METHOD0(update,void());
  MOCK_METHOD0(loopableType,LoopableType());
};

Now I'd like to do something like this:

TEST(Examplegroup,Example)
{
    MockLogicLoopable* mll = new MockLogicLoopable();
    EXPECT_CALL(mll,loopableType())
        .WillRepeatedly(Return(LOGIC));
}

I'm not really sure how, if at all, something like this can be realized with googlemock.

Was it helpful?

Solution

You have a pointer in mll, but EXPECT_CALL expects its first argument to be a value. Dereference your pointer with *, just as you would any other:

EXPECT_CALL(*mll, loopableType())
  .WillRepeatedly(Return(LOGIC));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top