What steps will reproduce the problem?
1. The problem comes from diamond inheritance but can be reproduced with
the following unit test :
class IBaseInterface
{
public:
virtual int SimpleFunctionWithReturn() = 0;
};
class IInterface : public virtual IBaseInterface
{
public:
// ...
};
TEST(MockObjectMethodSimpleWithReturn)
{
TMockObject<IInterface> mock;
mock.Method(&IInterface::SimpleFunctionWithReturn)
.Will(22);
CHECK_EQUAL(22, ((IInterface*)mock)->SimpleFunctionWithReturn());
}
=> It will failed
What is the expected output?
To get a correct behaviour, I need to remove the virtual inheritance (not
what I want) or to change the IInterface declaration to (without changing
IBaseInterface of course)
class IInterface : public virtual IBaseInterface
{
public:
virtual int SimpleFunctionWithReturn() = 0;
};
What's wrong with this inheritance ?
What I don't understand ?
What version of the product are you using? On what operating system?
I'm using gcc 3.4.6 20060404 (Red Hat 3.4.6-3)
Thank you for this great mock framework
Original issue reported on code.google.com by cedric.bresson@gmail.com on 27 Jun 2008 at 1:10
Original issue reported on code.google.com by
cedric.bresson@gmail.com
on 27 Jun 2008 at 1:10