For some of my low lever work, array comparison is always inconvient. would it be possible to add to the package something like:
template<typename T, size_t size>
::testing::AssertionResult ArraysMatch(const T (&expected)[size],
const T (&actual)[size]){
for (size_t i(0); i < size; ++i){
if (expected[i] != actual[i]){
return ::testing::AssertionFailure() << "array[" << i
<< "] (" << actual[i] << ") != expected[" << i
<< "] (" << expected[i] << ")";
}
}
return ::testing::AssertionSuccess();
}
I found it here: http://stackoverflow.com/questions/10060110/how-does-gtest-compare-the-values-in-two-arrays
TEST(..., ...)
{
EXPECT_THAT(array, ElementsAre(1,2,3,4...));
}
Most helpful comment
include "gmock/gmock.h"
TEST(..., ...)
{
EXPECT_THAT(array, ElementsAre(1,2,3,4...));
}