TEST_F(TestSuite3, T2)
{
Sample3 t = {1, 2};
MOCKER(save_data).stubs().with(eq((const Sample3*)&t));
auto ret = test(&t);
EXPECT_EQ(ret, 0);
}
test result:
[ RUN ] TestSuite3.T2
unknown file: Failure
C++ exception with description "
=====================================
Unexpected invocation: the invocation cannot be found in allowed invoking list.
Invoked: save_data((Sample3 const*)0x7fff442b0630)
Allowed:
method(save_data)
.stubs()
.invoked(0)
.with(eq(unique_ptr (Sample3 const*)0x7fff442b0630));
=====================================
" thrown in the test body.
https://github.com/sinojelly/mockcpp/blob/23fa9fbf6fe76c9603068eb1ed8d599cfd1bc228/include/mockcpp/ChainingMockHelper.h#L58
sample code:
testcase:
test result: