summaryrefslogtreecommitdiff
path: root/absl/crc/crc32c_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/crc/crc32c_test.cc')
-rw-r--r--absl/crc/crc32c_test.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/absl/crc/crc32c_test.cc b/absl/crc/crc32c_test.cc
index 98e5fea3..0b9dc683 100644
--- a/absl/crc/crc32c_test.cc
+++ b/absl/crc/crc32c_test.cc
@@ -34,22 +34,22 @@ TEST(CRC32C, RFC3720) {
// 32 bytes of ones.
memset(data, 0, sizeof(data));
EXPECT_EQ(absl::ComputeCrc32c(absl::string_view(data, sizeof(data))),
- absl::ToCrc32c(0x8a9136aa));
+ absl::crc32c_t{0x8a9136aa});
// 32 bytes of ones.
memset(data, 0xff, sizeof(data));
EXPECT_EQ(absl::ComputeCrc32c(absl::string_view(data, sizeof(data))),
- absl::ToCrc32c(0x62a8ab43));
+ absl::crc32c_t{0x62a8ab43});
// 32 incrementing bytes.
for (int i = 0; i < 32; ++i) data[i] = static_cast<char>(i);
EXPECT_EQ(absl::ComputeCrc32c(absl::string_view(data, sizeof(data))),
- absl::ToCrc32c(0x46dd794e));
+ absl::crc32c_t{0x46dd794e});
// 32 decrementing bytes.
for (int i = 0; i < 32; ++i) data[i] = static_cast<char>(31 - i);
EXPECT_EQ(absl::ComputeCrc32c(absl::string_view(data, sizeof(data))),
- absl::ToCrc32c(0x113fdb5c));
+ absl::crc32c_t{0x113fdb5c});
// An iSCSI - SCSI Read (10) Command PDU.
constexpr uint8_t cmd[48] = {
@@ -60,7 +60,7 @@ TEST(CRC32C, RFC3720) {
};
EXPECT_EQ(absl::ComputeCrc32c(absl::string_view(
reinterpret_cast<const char*>(cmd), sizeof(cmd))),
- absl::ToCrc32c(0xd9963a56));
+ absl::crc32c_t{0xd9963a56});
}
std::string TestString(size_t len) {
@@ -73,8 +73,8 @@ std::string TestString(size_t len) {
}
TEST(CRC32C, Compute) {
- EXPECT_EQ(absl::ComputeCrc32c(""), absl::ToCrc32c(0));
- EXPECT_EQ(absl::ComputeCrc32c("hello world"), absl::ToCrc32c(0xc99465aa));
+ EXPECT_EQ(absl::ComputeCrc32c(""), absl::crc32c_t{0});
+ EXPECT_EQ(absl::ComputeCrc32c("hello world"), absl::crc32c_t{0xc99465aa});
}
TEST(CRC32C, Extend) {
@@ -82,13 +82,13 @@ TEST(CRC32C, Extend) {
std::string extension = "Extension String";
EXPECT_EQ(
- absl::ExtendCrc32c(absl::ToCrc32c(base), extension),
- absl::ToCrc32c(0xD2F65090)); // CRC32C of "Hello WorldExtension String"
+ absl::ExtendCrc32c(absl::crc32c_t{base}, extension),
+ absl::crc32c_t{0xD2F65090}); // CRC32C of "Hello WorldExtension String"
}
TEST(CRC32C, ExtendByZeroes) {
std::string base = "hello world";
- absl::crc32c_t base_crc = absl::ToCrc32c(0xc99465aa);
+ absl::crc32c_t base_crc = absl::crc32c_t{0xc99465aa};
for (const size_t extend_by : {100, 10000, 100000}) {
SCOPED_TRACE(extend_by);
@@ -98,7 +98,7 @@ TEST(CRC32C, ExtendByZeroes) {
}
TEST(CRC32C, UnextendByZeroes) {
- for (auto seed_crc : {absl::ToCrc32c(0), absl::ToCrc32c(0xc99465aa)}) {
+ for (auto seed_crc : {absl::crc32c_t{0}, absl::crc32c_t{0xc99465aa}}) {
SCOPED_TRACE(seed_crc);
for (const size_t size_1 : {2, 200, 20000, 200000, 20000000}) {
for (const size_t size_2 : {0, 100, 10000, 100000, 10000000}) {