I have a following test case where I want to compare bytes in google test. In Unity unit test frame work we have
TEST_ASSERT_BYTES_EQUAL(0xaa, output[4]);
Is similar ASSERT available in google test. I have following code in google test and test case failing.
TEST(sprintf, NoBufferOverRunsForNoFormatOperations) {
char output[5];
memset(output, 0xaa, sizeof output);
ASSERT_EQ(3, sprintf_s(output, "hey"));
ASSERT_STREQ("hey", output);
ASSERT_THAT(0xaa, output[4]);
}
Failed log
[ RUN ] sprintf.NoBufferOverRunsForNoFormatOperations
Value of: 0xaa
Expected: is equal to -86
Actual: 170 (of type int)
[ FAILED ] sprintf.NoBufferOverRunsForNoFormatOperations (0 ms)
Any clues and help are welcome.