假设我有B类,它有两个函数,一个函数正在调用其他函数:
Class B {
virtual void funParent();
virtual void funChild();
};
void B::funChild(){}
void B::funParent()
{
funChild();
}
===============================================
class MockB : public B
{
MOCK_METHOD0(funChild,void()); MOCK_METHOD0(funParent,void());
}
===============================================
class TestClass : public testing::Test {
..
};
//Test case for checking function call of funChild() in funParent()
TEST_F(TestClass,testFunParent)
{
//I want to test function call "funChild" using EXPECT_CALL.
//EXPECT_CALL(__somePtr__,funChild()).Times(Atleast(1));
//B b;
//b.funParent();
}
我想知道如何实现此目标,因为它是同一类的成员函数。