diff options
author | Abseil Team <absl-team@google.com> | 2023-08-01 14:40:45 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-08-01 14:41:35 -0700 |
commit | fc1dcc0f6a6b22f4ef4a30fc2020d4c81ab1b3c5 (patch) | |
tree | b950bdb1c287662cb0a4c1c325a7727d4f740fa2 /absl/crc/crc32c_test.cc | |
parent | 5b3b0ed81cb514540c3b9d752d9e01efb64056d2 (diff) | |
download | abseil-fc1dcc0f6a6b22f4ef4a30fc2020d4c81ab1b3c5.tar.gz abseil-fc1dcc0f6a6b22f4ef4a30fc2020d4c81ab1b3c5.tar.bz2 abseil-fc1dcc0f6a6b22f4ef4a30fc2020d4c81ab1b3c5.zip |
Changes absl::crc32c_t insertion operator (<<) to return value as 0-padded hex instead of dec
PiperOrigin-RevId: 552927211
Change-Id: I0375d60a9df4cdfc694fe8d3b3d790f80fc614a1
Diffstat (limited to 'absl/crc/crc32c_test.cc')
-rw-r--r-- | absl/crc/crc32c_test.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/absl/crc/crc32c_test.cc b/absl/crc/crc32c_test.cc index 72d422a1..635424aa 100644 --- a/absl/crc/crc32c_test.cc +++ b/absl/crc/crc32c_test.cc @@ -18,6 +18,7 @@ #include <cstddef> #include <cstdint> #include <cstring> +#include <sstream> #include <string> #include "gtest/gtest.h" @@ -191,4 +192,22 @@ TEST(CRC32C, RemoveSuffix) { EXPECT_EQ(absl::RemoveCrc32cSuffix(crc_ab, crc_b, world.size()), crc_a); } + +TEST(CRC32C, InsertionOperator) { + { + std::ostringstream buf; + buf << absl::crc32c_t{0xc99465aa}; + EXPECT_EQ(buf.str(), "c99465aa"); + } + { + std::ostringstream buf; + buf << absl::crc32c_t{0}; + EXPECT_EQ(buf.str(), "00000000"); + } + { + std::ostringstream buf; + buf << absl::crc32c_t{17}; + EXPECT_EQ(buf.str(), "00000011"); + } +} } // namespace |