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
{
If there a need to explicitly test for specific value of just one field of a struct (or one "property" of a class), gmock has a simple way to test this with the "Field" and "Property" definitions. With a struct:
EXPECT_CALL( someMock, SomeMethod( Field( &SomeStruct::data1, expectedValue )));
Or, alternatively if we have SomeClass (intead of SomeStruct), that has private member variables and public getter functions:
EXPECT_CALL( someMock, SomeMethod( Property( &SomeClass::getData1, expectedValue )));