diff options
author | Abseil Team <absl-team@google.com> | 2024-03-26 11:41:28 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-03-26 11:42:35 -0700 |
commit | e7858c73279d81cbc005d9c76a385ab535520635 (patch) | |
tree | a6e9e216f48878fd1c8dae4a6e36af4992c7af1c /absl/strings/str_cat_test.cc | |
parent | 86f3019430baa53ca1bc38b7e370fcd5fc8d2503 (diff) | |
download | abseil-e7858c73279d81cbc005d9c76a385ab535520635.tar.gz abseil-e7858c73279d81cbc005d9c76a385ab535520635.tar.bz2 abseil-e7858c73279d81cbc005d9c76a385ab535520635.zip |
Revert integer-to-string conversion optimizations pending more thorough analysis
PiperOrigin-RevId: 619261152
Change-Id: Id3409b326c52ace0fda42537e0b91dbb2d6a2287
Diffstat (limited to 'absl/strings/str_cat_test.cc')
-rw-r--r-- | absl/strings/str_cat_test.cc | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/absl/strings/str_cat_test.cc b/absl/strings/str_cat_test.cc index b30a86fe..66eddf0d 100644 --- a/absl/strings/str_cat_test.cc +++ b/absl/strings/str_cat_test.cc @@ -39,24 +39,6 @@ namespace { -template <typename Integer> -void VerifyInteger(Integer value) { - const std::string expected = std::to_string(value); - - EXPECT_EQ(absl::StrCat(value), expected); - - const char* short_prefix = "x"; - const char* long_prefix = "2;k.msabxiuow2[09i;o3k21-93-9=29]"; - - std::string short_str = short_prefix; - absl::StrAppend(&short_str, value); - EXPECT_EQ(short_str, short_prefix + expected); - - std::string long_str = long_prefix; - absl::StrAppend(&long_str, value); - EXPECT_EQ(long_str, long_prefix + expected); -} - // Test absl::StrCat of ints and longs of various sizes and signdedness. TEST(StrCat, Ints) { const short s = -1; // NOLINT(runtime/int) @@ -86,34 +68,6 @@ TEST(StrCat, Ints) { EXPECT_EQ(answer, "-9-12"); answer = absl::StrCat(uintptr, 0); EXPECT_EQ(answer, "130"); - - for (const uint32_t base : {2u, 10u}) { - for (const int extra_shift : {0, 12}) { - for (uint64_t i = 0; i < (1 << 8); ++i) { - uint64_t j = i; - while (true) { - uint64_t v = j ^ (extra_shift != 0 ? (j << extra_shift) * base : 0); - VerifyInteger(static_cast<bool>(v)); - VerifyInteger(static_cast<wchar_t>(v)); - VerifyInteger(static_cast<signed char>(v)); - VerifyInteger(static_cast<unsigned char>(v)); - VerifyInteger(static_cast<short>(v)); // NOLINT - VerifyInteger(static_cast<unsigned short>(v)); // NOLINT - VerifyInteger(static_cast<int>(v)); // NOLINT - VerifyInteger(static_cast<unsigned int>(v)); // NOLINT - VerifyInteger(static_cast<long>(v)); // NOLINT - VerifyInteger(static_cast<unsigned long>(v)); // NOLINT - VerifyInteger(static_cast<long long>(v)); // NOLINT - VerifyInteger(static_cast<unsigned long long>(v)); // NOLINT - const uint64_t next = j == 0 ? 1 : j * base; - if (next <= j) { - break; - } - j = next; - } - } - } - } } TEST(StrCat, Enums) { |