Commit 3df27b54 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[2094] use xxx_EQ() instead of FAIL().

this makes the code more concise.  also add comments on why we use ASSERT
for one of the tests.
parent af5673b0
......@@ -34,18 +34,17 @@ matchWireData(const void* expected_data, size_t expected_len,
for (size_t i = 0; i < cmplen; ++i) {
const int ebyte = static_cast<const uint8_t*>(expected_data)[i];
const int abyte = static_cast<const uint8_t*>(actual_data)[i];
if (ebyte != abyte) {
FAIL() << "Wire data mismatch at " << i << "th byte\n"
<< " Actual: " << abyte << "\n"
<< "Expected: " << ebyte << "\n";
return;
}
}
if (expected_len != actual_len) {
FAIL() << "Wire data mismatch in length:\n"
<< " Actual: " << actual_len << "\n"
<< "Expected: " << expected_len << "\n";
// Once we find a mismatch, it's quite likely that there will be many
// mismatches after this point. So we stop here by using ASSERT not
// to be too noisy.
ASSERT_EQ(ebyte, abyte) << "Wire data mismatch at " << i << "th byte\n"
<< " Actual: " << abyte << "\n"
<< "Expected: " << ebyte << "\n";
}
EXPECT_EQ(expected_len, actual_len)
<< "Wire data mismatch in length:\n"
<< " Actual: " << actual_len << "\n"
<< "Expected: " << expected_len << "\n";
}
} // unittests
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment