struct obj
{
int a;
string str;
string str2;
bool operator==(const obj& o) const
{
if(a == o.a && str == o.str && str2 == o.str2) return true;
return false;
}
}
Then in a function in a class, it is using struct object as input parameters:
bool functionNeedsToBeMocked(obj& input)
{
//do something
}
Now what I want to do is,
EXPECT_CALL(*mockedPointer, functionNeedsToBeMocked( /* if input.a == 1 && input.str == "test" && input.str2.contains("first")*/ )).Times(1).WillOnce(Return(true));
And the input value is
inputFirst.a = 1;
inputFirst.str = "test";
inputFirst.str2 = "something first";
I expect the inputFirst can be matched to my EXPECT_CALL.
How could I using EXPECT_CALL matcher to do that ?
I did see
EXPECT_CALL(foo, DoThat(Not(HasSubstr("blah")),
NULL));
on gmock cookbook, but I don't know how to do HasSubStr for a struct parameter.