Hello everyone,
I just started with writing a test using Isolator++. I installed it like described in the documentation and tried to write a test. Unfortunately it didn't work so I tried the example from the document of DoInstead:
class Person
{
private:
static int groupID;
public:
int GetAge() { return 0; }
static int GetAverageAge() { return 0; }
static bool IsPartOfGroup(int newGroupID) { return false; }
};
class AltPerson
{
public:
int ReturnAnotherAge() { return 10; }
static int ReturnAnotherAverageAge() { return 20; }
};
TEST_F(Examples, DoInsteadForInstanceMethod)
{
Person* livePerson = new Person();
AltPerson* altPerson = new AltPerson();
WHEN_CALLED(livePerson->GetAge()).DoMemberFunctionInstead(altPerson,ReturnAnotherAge);
ASSERT_EQ(10, livePerson->GetAge());
ISOLATOR_CLEANUP();
}
I get the same error message than with my own classes:
The function 'AltPerson::ReturnAnotherAge' could not be found. If the method is not called in the code under test it will be optimized away. Remove any inline keywords, and Add ISOLATOR_TESTABLE to the method.
What might be the problem? What am I doing wrong?
Is ISOLATOR_TESTABLE neccessary in each method?
I use it with google test and have installed the newest version. Do you need any further information?
Thanks a lot in advance,
Michaela