Open kfabian opened 5 years ago
I too am having this exact problem. No triage since 2018?
Did the OP ever get their problem worked out?
Is this something that a migration from 1.8.1 o 1.10 will fix?
Hello~
I've got a mail from BillBarnhill and made some workaround for the code in the mail
I don't know whether my suggestion is proper but how about applying below code
(reference in cookbook.md)
and I think it needs more information to check kfabian's question
class Foo {
public:
virtual void update(shared_ptr<Point2D> point) = 0;
virtual void update(shared_ptr<Point3D> point) = 0;
};
class MockFoo : public Foo {
public:
MockFoo() {}
void update(shared_ptr<Point2D> point) {
cout << "update Point2D" << endl;
DoUpdate2D();
}
void update(shared_ptr<Point3D> point) {
cout << "update Point3D" << endl;
DoUpdate3D();
}
MOCK_METHOD0(DoUpdate2D, void());
MOCK_METHOD0(DoUpdate3D, void());
};
TEST(FooTest,Update2D) {
MockFoo mock_foo;
EXPECT_CALL(mock_foo, DoUpdate2D()).Times(1);
EXPECT_CALL(mock_foo, DoUpdate3D()).Times(1);
std::shared_ptr<Point2D> pt2d(new Point2D(2,3));
std::shared_ptr<Point3D> pt3d(new Point3D(2,3, 4));
mock_foo.update(pt2d);
mock_foo.update(pt3d);
}
I have the following overloaded mock functions MOCK_METHOD1_T(function, void(int value)); MOCK_METHOD1_T(function, void(std::shared_ptr pointer));
if expect the call EXPECT_CALL(*mock_object, function(testing::Pointee(10))). Times(2);
I can't compile it, because the call of the overloaded function is ambiguous. How can I solve this problem.