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
{
Maybe useless as the question has been answered long time ago but here is a solution that works with any structure and which does not use MATCHER or FIELD.
Suppose we are checking: methodName(const Foo& foo):
using ::testing::_;
struct Foo {
...
...
};
EXPECT_CALL(mockObject, methodName(_))
.WillOnce([&expectedFoo](const Foo& foo) {
// Here, gtest macros can be used to test struct Foo's members
// one by one for example (ASSERT_TRUE, ASSERT_EQ, ...)
ASSERT_EQ(foo.arg1, expectedFoo.arg1);
});