class Foo {
public:
int x;
int y;
void move(void);
};
class SuperFoo: public Foo {
public:
int age;
void update();
};
SuperFoo::update(void) {
move();
age++;
}
I'm just starting out with C++ and unit testing, I have some code resembling the above and I want to use gmock to test that SuperFoo::update()
calls the base class' move()
method. What would be that best way to attack this type of situation?
One way is to make the
move
method virtual, and create a mock of your class:Then in your test, setup the corresponding call expectations