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/cord_test.cc | |
parent | 79ca5d7aad63973c83a4962a66ab07cd623131ea (diff) |
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/cord_test.cc')
-rw-r--r-- | absl/strings/cord_test.cc | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/absl/strings/cord_test.cc b/absl/strings/cord_test.cc index 3fe3967f..55412c7f 100644 --- a/absl/strings/cord_test.cc +++ b/absl/strings/cord_test.cc @@ -30,10 +30,11 @@ #include "gtest/gtest.h" #include "absl/base/config.h" #include "absl/base/internal/endian.h" -#include "absl/base/internal/raw_logging.h" #include "absl/base/macros.h" #include "absl/container/fixed_array.h" #include "absl/hash/hash.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/random/random.h" #include "absl/strings/cord_test_helpers.h" #include "absl/strings/cordz_test_helpers.h" @@ -210,9 +211,8 @@ class CordTestPeer { } static Cord MakeSubstring(Cord src, size_t offset, size_t length) { - ABSL_RAW_CHECK(src.contents_.is_tree(), "Can not be inlined"); - ABSL_RAW_CHECK(src.ExpectedChecksum() == absl::nullopt, - "Can not be hardened"); + CHECK(src.contents_.is_tree()) << "Can not be inlined"; + CHECK(!src.ExpectedChecksum().has_value()) << "Can not be hardened"; Cord cord; auto* tree = cord_internal::SkipCrcNode(src.contents_.tree()); auto* rep = CordRepSubstring::Create(CordRep::Ref(tree), offset, length); @@ -374,7 +374,7 @@ TEST_P(CordTest, GigabyteCordFromExternal) { for (int i = 0; i < 1024; ++i) { c.Append(from); } - ABSL_RAW_LOG(INFO, "Made a Cord with %zu bytes!", c.size()); + LOG(INFO) << "Made a Cord with " << c.size() << " bytes!"; // Note: on a 32-bit build, this comes out to 2,818,048,000 bytes. // Note: on a 64-bit build, this comes out to 171,932,385,280 bytes. } @@ -1247,15 +1247,15 @@ absl::Cord BigCord(size_t len, char v) { // Splice block into cord. absl::Cord SpliceCord(const absl::Cord& blob, int64_t offset, const absl::Cord& block) { - ABSL_RAW_CHECK(offset >= 0, ""); - ABSL_RAW_CHECK(offset + block.size() <= blob.size(), ""); + CHECK_GE(offset, 0); + CHECK_LE(static_cast<size_t>(offset) + block.size(), blob.size()); absl::Cord result(blob); result.RemoveSuffix(blob.size() - offset); result.Append(block); absl::Cord suffix(blob); suffix.RemovePrefix(offset + block.size()); result.Append(suffix); - ABSL_RAW_CHECK(blob.size() == result.size(), ""); + CHECK_EQ(blob.size(), result.size()); return result; } @@ -1855,7 +1855,7 @@ TEST(CordTest, CordMemoryUsageBTree) { // windows DLL, we may have ODR like effects on the flag, meaning the DLL // code will run with the picked up default. if (!absl::CordTestPeer::Tree(cord1)->IsBtree()) { - ABSL_RAW_LOG(WARNING, "Cord library code not respecting btree flag"); + LOG(WARNING) << "Cord library code not respecting btree flag"; return; } @@ -1940,8 +1940,7 @@ TEST_P(CordTest, DiabolicalGrowth) { std::string value; absl::CopyCordToString(cord, &value); EXPECT_EQ(value, expected); - ABSL_RAW_LOG(INFO, "Diabolical size allocated = %zu", - cord.EstimatedMemoryUsage()); + LOG(INFO) << "Diabolical size allocated = " << cord.EstimatedMemoryUsage(); } // The following tests check support for >4GB cords in 64-bit binaries, and |