diff options
author | Abseil Team <absl-team@google.com> | 2018-03-20 21:10:15 -0700 |
---|---|---|
committer | katzdm <katzdm@google.com> | 2018-03-21 10:51:50 -0400 |
commit | 4e2e6c5c0071e6430056a8ef0a6c8a1fe584d8ff (patch) | |
tree | 37fb874b61a1ef7dac7cc6efa36de0b2cc2f40d7 /absl/strings/str_cat_test.cc | |
parent | 506fb4b56a339314fde23802bd749dbc3b3c1c79 (diff) |
Changes imported from Abseil "staging" branch:
- 1320147f7597a9490562d439ecea46faa1793a24 Support Hex formatting of pointers without forcing a cast... by Jorg Brown <jorg@google.com>
- 13c793d6e14a52063c2d4ee327b6c976631b690e Add support for native WebAssembly llvm backend. by Abseil Team <absl-team@google.com>
GitOrigin-RevId: 1320147f7597a9490562d439ecea46faa1793a24
Change-Id: Ibd4dbf288903ab45387932e5b11a28f5accdf166
Diffstat (limited to 'absl/strings/str_cat_test.cc')
-rw-r--r-- | absl/strings/str_cat_test.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/absl/strings/str_cat_test.cc b/absl/strings/str_cat_test.cc index 710113f8..c5a3526d 100644 --- a/absl/strings/str_cat_test.cc +++ b/absl/strings/str_cat_test.cc @@ -234,7 +234,7 @@ TEST(StrCat, CustomAllocator) { TEST(StrCat, MaxArgs) { std::string result; - // Test 10 up to 26 arguments, the current maximum + // Test 10 up to 26 arguments, the old maximum result = absl::StrCat(1, 2, 3, 4, 5, 6, 7, 8, 9, "a"); EXPECT_EQ(result, "123456789a"); result = absl::StrCat(1, 2, 3, 4, 5, 6, 7, 8, 9, "a", "b"); @@ -469,6 +469,12 @@ void CheckHexDec64(uint64_t v) { long long llv = static_cast<long long>(ullv); // NOLINT(runtime/int) CheckDec(llv, "%lld", "%0*lld", "%*lld"); + + if (sizeof(v) == sizeof(&v)) { + auto uintptr = static_cast<uintptr_t>(v); + void* ptr = reinterpret_cast<void*>(uintptr); + CheckHex(ptr, "%llx", "%0*llx", "%*llx"); + } } void CheckHexDec32(uint32_t uv) { @@ -476,6 +482,12 @@ void CheckHexDec32(uint32_t uv) { CheckDec(uv, "%u", "%0*u", "%*u"); int32_t v = static_cast<int32_t>(uv); CheckDec(v, "%d", "%0*d", "%*d"); + + if (sizeof(v) == sizeof(&v)) { + auto uintptr = static_cast<uintptr_t>(v); + void* ptr = reinterpret_cast<void*>(uintptr); + CheckHex(ptr, "%llx", "%0*llx", "%*llx"); + } } void CheckAll(uint64_t v) { |