Commit c3b4f295 by Dino Radakovic Committed by Copybara-Service

`convert_test`: Delete obsolete `skip_verify` parameter in test helper

It is unused.
We already use code within the `TestWithMultipleFormatsHelper` to skip output verification for Apple and MSVC.

PiperOrigin-RevId: 627783586
Change-Id: Ib51374e8571aa5f4b5f1e836815188bd9bdc1536
parent e022c806
...@@ -785,8 +785,7 @@ TEST_F(FormatConvertTest, Uint128) { ...@@ -785,8 +785,7 @@ TEST_F(FormatConvertTest, Uint128) {
} }
template <typename Floating> template <typename Floating>
void TestWithMultipleFormatsHelper(const std::vector<Floating> &floats, void TestWithMultipleFormatsHelper(const std::vector<Floating> &floats) {
const std::set<Floating> &skip_verify) {
const NativePrintfTraits &native_traits = VerifyNativeImplementation(); const NativePrintfTraits &native_traits = VerifyNativeImplementation();
// Reserve the space to ensure we don't allocate memory in the output itself. // Reserve the space to ensure we don't allocate memory in the output itself.
std::string str_format_result; std::string str_format_result;
...@@ -834,6 +833,9 @@ void TestWithMultipleFormatsHelper(const std::vector<Floating> &floats, ...@@ -834,6 +833,9 @@ void TestWithMultipleFormatsHelper(const std::vector<Floating> &floats,
AppendPack(&str_format_result, format, absl::MakeSpan(args)); AppendPack(&str_format_result, format, absl::MakeSpan(args));
} }
// For values that we know won't match the standard library
// implementation we skip verification, but still run the algorithm to
// catch asserts/sanitizer bugs.
#ifdef _MSC_VER #ifdef _MSC_VER
// MSVC has a different rounding policy than us so we can't test our // MSVC has a different rounding policy than us so we can't test our
// implementation against the native one there. // implementation against the native one there.
...@@ -842,8 +844,7 @@ void TestWithMultipleFormatsHelper(const std::vector<Floating> &floats, ...@@ -842,8 +844,7 @@ void TestWithMultipleFormatsHelper(const std::vector<Floating> &floats,
// Apple formats NaN differently (+nan) vs. (nan) // Apple formats NaN differently (+nan) vs. (nan)
if (std::isnan(d)) continue; if (std::isnan(d)) continue;
#endif #endif
if (string_printf_result != str_format_result && if (string_printf_result != str_format_result) {
skip_verify.find(d) == skip_verify.end()) {
// We use ASSERT_EQ here because failures are usually correlated and a // We use ASSERT_EQ here because failures are usually correlated and a
// bug would print way too many failed expectations causing the test // bug would print way too many failed expectations causing the test
// to time out. // to time out.
...@@ -904,14 +905,10 @@ TEST_F(FormatConvertTest, Float) { ...@@ -904,14 +905,10 @@ TEST_F(FormatConvertTest, Float) {
}); });
floats.erase(std::unique(floats.begin(), floats.end()), floats.end()); floats.erase(std::unique(floats.begin(), floats.end()), floats.end());
TestWithMultipleFormatsHelper(floats, {}); TestWithMultipleFormatsHelper(floats);
} }
TEST_F(FormatConvertTest, Double) { TEST_F(FormatConvertTest, Double) {
// For values that we know won't match the standard library implementation we
// skip verification, but still run the algorithm to catch asserts/sanitizer
// bugs.
std::set<double> skip_verify;
std::vector<double> doubles = {0.0, std::vector<double> doubles = {0.0,
-0.0, -0.0,
.99999999999999, .99999999999999,
...@@ -959,7 +956,7 @@ TEST_F(FormatConvertTest, Double) { ...@@ -959,7 +956,7 @@ TEST_F(FormatConvertTest, Double) {
}); });
doubles.erase(std::unique(doubles.begin(), doubles.end()), doubles.end()); doubles.erase(std::unique(doubles.begin(), doubles.end()), doubles.end());
TestWithMultipleFormatsHelper(doubles, skip_verify); TestWithMultipleFormatsHelper(doubles);
} }
TEST_F(FormatConvertTest, DoubleRound) { TEST_F(FormatConvertTest, DoubleRound) {
......
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