How can I match value of an element in a union for an input argument e.g - if I mock a method with the following signatiure -
struct SomeStruct
{
This is basically answered above but I want to give you one more good example:
// some test type
struct Foo {
bool b;
int i;
};
// define a matcher if ==operator is not needed in production
MATCHER_P(EqFoo, other, "Equality matcher for type Foo") {
return std::tie(arg.b, arg.i) == std::tie(other.b, other.i);
}
// example usage in your test
const Foo test_value {true, 42};
EXPECT_CALL(your_mock, YourMethod(EqFoo(test_value)));