Reputation: 141
I have written a Parameterized Gtest using a struct I made as the parameter value. When the test fails it writes a byte object of the struct like so:
[ FAILED ] RulesNoProcessing/StressTest.MainTest/2, where GetParam() =
40-byte object <01-12 00-00 02-00 00-00 F4-01 00-00 ...>.
Is there anyway way that I can customize the output? I know that there is predicate formats for assertions but I need to do something similar with the actual outcome of the test. If anyone can I help I would really appreciate it!
Upvotes: 2
Views: 3195
Reputation: 31
You have to override the "operator <<", for example
struct Row
{
int window;
int osmap;
friend std::ostream& operator<<(std::ostream& os, const Row& bar) {
return os << "w = " << bar.window << ", opsmap= " << bar.osmap; // whatever needed to print
}
};
Look this for more info https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#teaching-googletest-how-to-print-your-values
Upvotes: 3