I have an interface class say:
class MyInterface
{
virtual int doThing(int x, int y, int z) = 0;
};
I want to write a mock implementation for use in my tests. E.g.Traditionally, without using Google Mocks, I would write say:
class class MyMock: public MyInterface
{
virtual int doThing(int x, int y, int z)
{
if (x == 1)
return y + z;
else
return y - z;
}
};
How would I do this in google mocks. Please note, I don't want to (Ok, I don't need to) set an expectation about how this mock is called. I'm just using it to test something else.
How would you do it (and what is the most clearest way)? I find the google mocks documentation a little too concise to figure this out.
Aucun commentaire:
Enregistrer un commentaire