I am trying to mock out some code that returns information by writing to one of the references passed to the function as a parameter. Is there a good way to mock this behavior such that I can have the test code determine what value is written to that variable?
I did a little research and it turns out that GMock has a couple of nice options. From the Google Mock Cheat Sheet
SetArgReferee<N>(value)
SetArgPointee<N>(value)
"Assign value to the variable referenced by the N-th (0-based) argument" and "Assign value to the variable pointed by the N-th (0-based) argument" respectively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With