summaryrefslogtreecommitdiff
path: root/absl
diff options
context:
space:
mode:
authorGravatar Dino Radakovic <dinor@google.com>2024-05-10 07:18:19 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2024-05-10 07:19:22 -0700
commit99bb2f6f106db314fc93fdda3bdeed4005584887 (patch)
treeb5d956646b82668d8d894f2fea8baa3b52d2df11 /absl
parent1f6c241cb62eec9450895450aafae8fe2c265c3d (diff)
`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
Diffstat (limited to 'absl')
-rw-r--r--absl/strings/internal/str_format/convert_test.cc16
1 files changed, 7 insertions, 9 deletions
diff --git a/absl/strings/internal/str_format/convert_test.cc b/absl/strings/internal/str_format/convert_test.cc
index 3a4c27d7..baffe052 100644
--- a/absl/strings/internal/str_format/convert_test.cc
+++ b/absl/strings/internal/str_format/convert_test.cc
@@ -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);
}
}
}