diff options
author | Andy Getzendanner <durandal@google.com> | 2023-05-23 15:46:35 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-05-23 15:47:23 -0700 |
commit | 52747821480e6cadd8b27a0947af5d7933f9dfb4 (patch) | |
tree | cc42f6dc30fa8eca19047efd799c769ead59b6c4 /absl/strings/numbers_test.cc | |
parent | 79ca5d7aad63973c83a4962a66ab07cd623131ea (diff) | |
download | abseil-52747821480e6cadd8b27a0947af5d7933f9dfb4.tar.gz abseil-52747821480e6cadd8b27a0947af5d7933f9dfb4.tar.bz2 abseil-52747821480e6cadd8b27a0947af5d7933f9dfb4.zip |
Migrate most RAW_LOGs and RAW_CHECKs in tests to regular LOG and CHECK.
The non-RAW_ versions provide better output but weren't available when most of these tests were written.
There are just a couple spots where RAW_ is actually needed, e.g. signal handlers and malloc hooks.
Also fix a couple warnings in layout_test.cc newly surfaced because the optimizer understands CHECK_XX differently than INTERNAL_CHECK.
PiperOrigin-RevId: 534584435
Change-Id: I8d36fa809ffdaae5a3813064bd602cb8611c1613
Diffstat (limited to 'absl/strings/numbers_test.cc')
-rw-r--r-- | absl/strings/numbers_test.cc | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/absl/strings/numbers_test.cc b/absl/strings/numbers_test.cc index b3c098d1..2864bda2 100644 --- a/absl/strings/numbers_test.cc +++ b/absl/strings/numbers_test.cc @@ -37,7 +37,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" -#include "absl/base/internal/raw_logging.h" +#include "absl/log/log.h" #include "absl/random/distributions.h" #include "absl/random/random.h" #include "absl/strings/internal/numbers_test_common.h" @@ -1337,11 +1337,9 @@ TEST_F(SimpleDtoaTest, ExhaustiveDoubleToSixDigits) { if (strcmp(sixdigitsbuf, snprintfbuf) != 0) { mismatches.push_back(d); if (mismatches.size() < 10) { - ABSL_RAW_LOG(ERROR, "%s", - absl::StrCat("Six-digit failure with double. ", "d=", d, - "=", d, " sixdigits=", sixdigitsbuf, - " printf(%g)=", snprintfbuf) - .c_str()); + LOG(ERROR) << "Six-digit failure with double. d=" << d + << " sixdigits=" << sixdigitsbuf + << " printf(%g)=" << snprintfbuf; } } }; @@ -1389,12 +1387,10 @@ TEST_F(SimpleDtoaTest, ExhaustiveDoubleToSixDigits) { if (kFloatNumCases >= 1e9) { // The exhaustive test takes a very long time, so log progress. char buf[kSixDigitsToBufferSize]; - ABSL_RAW_LOG( - INFO, "%s", - absl::StrCat("Exp ", exponent, " powten=", powten, "(", powten, - ") (", - std::string(buf, SixDigitsToBuffer(powten, buf)), ")") - .c_str()); + LOG(INFO) << "Exp " << exponent << " powten=" << powten << "(" << powten + << ") (" + << absl::string_view(buf, SixDigitsToBuffer(powten, buf)) + << ")"; } for (int digits : digit_testcases) { if (exponent == 308 && digits >= 179769) break; // don't overflow! @@ -1419,20 +1415,17 @@ TEST_F(SimpleDtoaTest, ExhaustiveDoubleToSixDigits) { double before = nextafter(d, 0.0); double after = nextafter(d, 1.7976931348623157e308); char b1[32], b2[kSixDigitsToBufferSize]; - ABSL_RAW_LOG( - ERROR, "%s", - absl::StrCat( - "Mismatch #", i, " d=", d, " (", ToNineDigits(d), ")", - " sixdigits='", sixdigitsbuf, "'", " snprintf='", snprintfbuf, - "'", " Before.=", PerfectDtoa(before), " ", - (SixDigitsToBuffer(before, b2), b2), - " vs snprintf=", (snprintf(b1, sizeof(b1), "%g", before), b1), - " Perfect=", PerfectDtoa(d), " ", (SixDigitsToBuffer(d, b2), b2), - " vs snprintf=", (snprintf(b1, sizeof(b1), "%g", d), b1), - " After.=.", PerfectDtoa(after), " ", - (SixDigitsToBuffer(after, b2), b2), - " vs snprintf=", (snprintf(b1, sizeof(b1), "%g", after), b1)) - .c_str()); + LOG(ERROR) << "Mismatch #" << i << " d=" << d << " (" << ToNineDigits(d) + << ") sixdigits='" << sixdigitsbuf << "' snprintf='" + << snprintfbuf << "' Before.=" << PerfectDtoa(before) << " " + << (SixDigitsToBuffer(before, b2), b2) << " vs snprintf=" + << (snprintf(b1, sizeof(b1), "%g", before), b1) + << " Perfect=" << PerfectDtoa(d) << " " + << (SixDigitsToBuffer(d, b2), b2) + << " vs snprintf=" << (snprintf(b1, sizeof(b1), "%g", d), b1) + << " After.=." << PerfectDtoa(after) << " " + << (SixDigitsToBuffer(after, b2), b2) << " vs snprintf=" + << (snprintf(b1, sizeof(b1), "%g", after), b1); } } } |