summaryrefslogtreecommitdiff
path: root/absl/container/internal/raw_hash_set_test.cc
diff options
context:
space:
mode:
authorGravatar Vitaly Goldshteyn <goldvitaly@google.com>2024-06-20 23:05:54 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2024-06-20 23:06:52 -0700
commit0f29d3e828949fbd7dd5e8e7e551b297ff2cdbee (patch)
tree7846c20f64e3ce9fa3adae706575959056903639 /absl/container/internal/raw_hash_set_test.cc
parent10ac811f7c3720761c0fa0cd2b3fe92116b89420 (diff)
Remove not used after all kAllowRemoveReentrance parameter from IterateOverFullSlots.
We decided to not allow reentrance in absl::erase_if and absl::container_internal::c_for_each_fast. PiperOrigin-RevId: 645273965 Change-Id: I75dfc73b93ba10f0e051bf0833723af887e1bb36
Diffstat (limited to 'absl/container/internal/raw_hash_set_test.cc')
-rw-r--r--absl/container/internal/raw_hash_set_test.cc41
1 files changed, 3 insertions, 38 deletions
diff --git a/absl/container/internal/raw_hash_set_test.cc b/absl/container/internal/raw_hash_set_test.cc
index 673d78a6..ba603d2b 100644
--- a/absl/container/internal/raw_hash_set_test.cc
+++ b/absl/container/internal/raw_hash_set_test.cc
@@ -3334,12 +3334,12 @@ TEST(Table, IterateOverFullSlotsEmpty) {
auto fail_if_any = [](const ctrl_t*, auto* i) {
FAIL() << "expected no slots " << **i;
};
- container_internal::IterateOverFullSlots</*kAllowRemoveReentrance=*/false>(
+ container_internal::IterateOverFullSlots(
RawHashSetTestOnlyAccess::GetCommon(t),
RawHashSetTestOnlyAccess::GetSlots(t), fail_if_any);
for (size_t i = 0; i < 256; ++i) {
t.reserve(i);
- container_internal::IterateOverFullSlots</*kAllowRemoveReentrance=*/false>(
+ container_internal::IterateOverFullSlots(
RawHashSetTestOnlyAccess::GetCommon(t),
RawHashSetTestOnlyAccess::GetSlots(t), fail_if_any);
}
@@ -3354,7 +3354,7 @@ TEST(Table, IterateOverFullSlotsFull) {
expected_slots.push_back(idx);
std::vector<int64_t> slots;
- container_internal::IterateOverFullSlots</*kAllowRemoveReentrance=*/false>(
+ container_internal::IterateOverFullSlots(
RawHashSetTestOnlyAccess::GetCommon(t),
RawHashSetTestOnlyAccess::GetSlots(t),
[&t, &slots](const ctrl_t* ctrl, auto* i) {
@@ -3368,41 +3368,6 @@ TEST(Table, IterateOverFullSlotsFull) {
}
}
-TEST(Table, IterateOverFullSlotsAllowReentrance) {
- std::vector<int64_t> expected_values;
- for (int64_t idx = 0; idx < 128; ++idx) {
- NonSooIntTable t;
- for (int val = 0; val <= idx; ++val) {
- t.insert(val);
- }
-
- // We are inserting only even values.
- // Only one element across 2*k and 2*k+1 should be visited.
- if (idx % 2 == 0) {
- expected_values.push_back(idx);
- }
-
- std::vector<int64_t> actual_values;
- container_internal::IterateOverFullSlots</*kAllowRemoveReentrance=*/true>(
- RawHashSetTestOnlyAccess::GetCommon(t),
- RawHashSetTestOnlyAccess::GetSlots(t),
- [&t, &actual_values](const ctrl_t* ctrl, auto* i) {
- int64_t value = **i;
- // Erase the other element from 2*k and 2*k+1 pair.
- t.erase(value ^ 1);
- ptrdiff_t ctrl_offset =
- ctrl - RawHashSetTestOnlyAccess::GetCommon(t).control();
- ptrdiff_t slot_offset = i - RawHashSetTestOnlyAccess::GetSlots(t);
- ASSERT_EQ(ctrl_offset, slot_offset);
- // Add an even value from the pair.
- // Only one element for each 2*k and 2*k+1 pair should be inserted.
- actual_values.push_back(value - value % 2);
- });
- EXPECT_THAT(actual_values,
- testing::UnorderedElementsAreArray(expected_values));
- }
-}
-
template <typename T>
class SooTable : public testing::Test {};
using FreezableSooTableTypes =