googletest - Is there any good way to check mock calls if it is copied in Google Mock Framework -
i use google test , google mock making unit tests , there need check calls of object, placed std::vector. this:
test(footest, sometest) { // given csomeclass someobject; strictmock<mockfoo> strictfoo; std::vector<foo> foocontainer; foocontainer.push_back(strictfoo); // expected expect_call(strictfoo, dosomething()); // can't because there copy of strictfoo in vector // when someobject.do(foocontainer); }
i'd appreciate tips on accomplishing this.
i guess i'd go more this:
test(footest, sometest) { // given csomeclass someobject; std::vector<std::unique_ptr<foo>> foocontainer; foocontainer.emplace_back(new mockfoo); // expected auto mock_foo_ptr(static_cast<mockfoo*>(foocontainer.rbegin()->get())); expect_call(*mock_foo_ptr, dosomething()); // when someobject.do(foocontainer); }
Comments
Post a Comment