For UT purposes, I am trying to Mock out a function that returns a vector of user defined structs.
std::vector<myStruct> myClass::foo()
In gmock, Is there a way to do something like this:
std::vector<myStruct> TestVector;
//code to populate my vector ....
ON_CALL(MockMyClass, foo()).WillByDefault(Return(TestVector))
I couldn't find anything in the gmock cookbook, it looks like the return values are all primitives. Thanks
I ended up using ReturnPointee
https://code.google.com/p/googlemock/wiki/CookBook#Returning_Live_Values_from_Mock_Methods
std::vector * ptr;
//instantiate and populate vector...
ON_CALL(MockMyClass, foo()).WillByDefault(ReturnPointee(ptr));