I have a mock class
class AMock : public InterfaceA
{
public:
MOCK_METHOD2(afuncProxy, void(int, uint8_t*));
void afunc(int i, std::unique_ptr<B> b)
{
auto data = b->getData();
b.release();
afuncProxy(i, data);
}
};
In my code I create class like below:
AMock mymock;
In test case :
auto inData = new uint8_t[5] { 0, 1, 2, 3, 4 };
auto outData = new uint8_t[5] { 5, 6, 7, 8, 2 };
EXPECT_CALL(mymock, afuncProxy(_, _)).Times(1).WillOnce(SaveArg<1>(&outData));
Where
ACTION_TEMPLATE(SaveArg, HAS_1_TEMPLATE_PARAMS(int, k), AND_1_VALUE_PARAMS(destination))
{
*destination = std::move(::std::tr1::get<k>(args));
}
I am able to get the data in outData variable but at the end of test case I get read access violation exception:
// Warns about the uninteresting call.
::std::stringstream ss;
this->UntypedDescribeUninterestingCall(untyped_args, &ss);
What is the issue?
Aucun commentaire:
Enregistrer un commentaire