Commit 99bb2f6f by Dino Radakovic Committed by Copybara-Service

`convert_test`: Delete obsolete condition around ASSERT_EQ in TestWithMultipleFormatsHelper

The `if (actual != expected)` makes the `ASSERT_EQ(actual, expected)` trigger only when the assertion fails. However, a successful `ASSERT_EQ` takes a negligible amount of time, which means the `if` is useless and only makes the test harder to read.

PiperOrigin-RevId: 632487285
Change-Id: I1f78136cf4895295c88a5ff3e0bcdce6b08c1d0b
parent 1f6c241c
......@@ -844,15 +844,13 @@ void TestWithMultipleFormatsHelper(Floating tested_float) {
// Apple formats NaN differently (+nan) vs. (nan)
if (std::isnan(tested_float)) continue;
#endif
if (string_printf_result != str_format_result) {
// We use ASSERT_EQ here because failures are usually correlated and a
// bug would print way too many failed expectations causing the test
// to time out.
ASSERT_EQ(string_printf_result, str_format_result)
<< fmt_str << " " << StrPrint("%.18g", tested_float) << " "
<< StrPrint("%a", tested_float) << " "
<< StrPrint("%.50f", tested_float);
}
// We use ASSERT_EQ here because failures are usually correlated and a
// bug would print way too many failed expectations causing the test
// to time out.
ASSERT_EQ(string_printf_result, str_format_result)
<< fmt_str << " " << StrPrint("%.18g", tested_float) << " "
<< StrPrint("%a", tested_float) << " "
<< StrPrint("%.50f", tested_float);
}
}
}
......
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