Export of internal Abseil changes
-- 91ca367a7548270155721bdda74611aeea2a2153 by Abseil Team <absl-team@google.com>: Replace the only usage of btree_node::swap with simpler logic using transfers and delete btree_node::swap. Add a benchmark for constructing small containers. PiperOrigin-RevId: 301169874 -- ff9d73a7125b7f8ab5733cda877204dfbfac138e by Derek Mauro <dmauro@google.com>: Ensure ABSL_CXX_STANDARD is set. Fixes #640 PiperOrigin-RevId: 301160106 -- 14ca0beee8c109e532134e7e9da7b072da1bf911 by Abseil Team <absl-team@google.com>: Rollback the change to make Cord iterators a fixed size. That change increased the iterator size, which can cause a deep recursion call to hit the stack memory limit, in turn causing a signal 11 failure. PiperOrigin-RevId: 301084915 -- 619e3cd9e56408bdb8b3b5a1e08dda1e95242264 by Matthew Brown <matthewbr@google.com>: Internal Change PiperOrigin-RevId: 300832828 -- 64f8d62ab4c4c78077dbe85a9595a8eeb6d16608 by Gennadiy Rozental <rogeeff@google.com>: Fix for empty braces support. We will call proper aggregate construction in case when {} is used as default value. In other words instead of "new T", we'll call "new T{}". PiperOrigin-RevId: 300715686 -- db3f65594d6db8b104b01262f884dff465b696ef by Abseil Team <absl-team@google.com>: Emscripten supports thread-local storage nowadays. PiperOrigin-RevId: 300675185 GitOrigin-RevId: 91ca367a7548270155721bdda74611aeea2a2153 Change-Id: I3344f745f9c3fc78775532b1808442fabd98e34a
This commit is contained in:
parent
c6954897f7
commit
7853a7586c
12 changed files with 254 additions and 283 deletions
|
|
@ -1402,53 +1402,6 @@ TEST(CordChunkIterator, Operations) {
|
|||
VerifyChunkIterator(subcords, 128);
|
||||
}
|
||||
|
||||
TEST(CordChunkIterator, MaxLengthFullTree) {
|
||||
// Start with a 1-byte cord, and then double its length in a loop. We should
|
||||
// be able to do this until the point where we would overflow size_t.
|
||||
|
||||
absl::Cord cord;
|
||||
size_t size = 1;
|
||||
AddExternalMemory("x", &cord);
|
||||
EXPECT_EQ(cord.size(), size);
|
||||
|
||||
const int kCordLengthDoublingLimit = std::numeric_limits<size_t>::digits - 1;
|
||||
for (int i = 0; i < kCordLengthDoublingLimit; ++i) {
|
||||
cord.Prepend(absl::Cord(cord));
|
||||
size <<= 1;
|
||||
|
||||
EXPECT_EQ(cord.size(), size);
|
||||
|
||||
auto chunk_it = cord.chunk_begin();
|
||||
EXPECT_EQ(*chunk_it, "x");
|
||||
}
|
||||
|
||||
EXPECT_DEATH_IF_SUPPORTED(
|
||||
(cord.Prepend(absl::Cord(cord)), *cord.chunk_begin()),
|
||||
"Cord is too long");
|
||||
}
|
||||
|
||||
TEST(CordChunkIterator, MaxDepth) {
|
||||
// By reusing nodes, it's possible in pathological cases to build a Cord that
|
||||
// exceeds both the maximum permissible length and depth. In this case, the
|
||||
// violation of the maximum depth is reported.
|
||||
absl::Cord left_child;
|
||||
AddExternalMemory("x", &left_child);
|
||||
absl::Cord root = left_child;
|
||||
|
||||
for (int i = 0; i < absl::cord_internal::MaxCordDepth() - 2; ++i) {
|
||||
size_t new_size = left_child.size() + root.size();
|
||||
root.Prepend(left_child);
|
||||
EXPECT_EQ(root.size(), new_size);
|
||||
|
||||
auto chunk_it = root.chunk_begin();
|
||||
EXPECT_EQ(*chunk_it, "x");
|
||||
|
||||
std::swap(left_child, root);
|
||||
}
|
||||
|
||||
EXPECT_DEATH_IF_SUPPORTED(root.Prepend(left_child), "Cord is too long");
|
||||
}
|
||||
|
||||
TEST(CordCharIterator, Traits) {
|
||||
static_assert(std::is_copy_constructible<absl::Cord::CharIterator>::value,
|
||||
"");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue