lundi 7 août 2017

Google mock: Mocking parent class?

Assume I have a base class:

class Command {
public:
    virtual int8_t Execute();
};

with a definition in the base class cpp.

Additionally, I have a child class:

class SpecificCommand: public Command {
public:
    int8_t Execute();
};

With the definition:

int8_t SpecificCommand::Execute() {
    doSomeStuff();
    Command::Execute();
}

How do I mock Command::Execute() but using a SpecificCommand object for tests?

Aucun commentaire:

Enregistrer un commentaire