15 #include "absl/container/node_hash_set.h"
17 #include "absl/container/internal/unordered_set_constructor_test.h"
18 #include "absl/container/internal/unordered_set_lookup_test.h"
19 #include "absl/container/internal/unordered_set_members_test.h"
20 #include "absl/container/internal/unordered_set_modifiers_test.h"
24 namespace container_internal {
33 node_hash_set<int, StatefulTestingHash, StatefulTestingEqual, Alloc<int>>,
34 node_hash_set<
std::string, StatefulTestingHash, StatefulTestingEqual,
36 node_hash_set<Enum, StatefulTestingHash, StatefulTestingEqual, Alloc<Enum>>,
37 node_hash_set<
EnumClass, StatefulTestingHash, StatefulTestingEqual,
45 TEST(NodeHashSet, MoveableNotCopyableCompiles) {
46 node_hash_set<std::unique_ptr<void*>>
t;
47 node_hash_set<std::unique_ptr<void*>>
u;
51 TEST(NodeHashSet, MergeExtractInsert) {
53 size_t operator()(
const std::unique_ptr<int>& p)
const {
return *
p; }
56 bool operator()(
const std::unique_ptr<int>& a,
57 const std::unique_ptr<int>&
b)
const {
62 set1.
insert(absl::make_unique<int>(7));
63 set1.
insert(absl::make_unique<int>(17));
65 set2.
insert(absl::make_unique<int>(7));
66 set2.
insert(absl::make_unique<int>(19));
76 auto node = set1.
extract(absl::make_unique<int>(7));
87 EXPECT_NE(insert_result.position->get(), insert_result.node.value().get());
90 node = set1.
extract(absl::make_unique<int>(17));
95 node.value() = absl::make_unique<int>(23);
105 bool IsEven(
int k) {
return k % 2 == 0; }
110 node_hash_set<int>
s = {1, 2, 3, 4, 5};
116 node_hash_set<int>
s = {1, 2, 3, 4, 5};
122 node_hash_set<int>
s = {1, 2, 3, 4, 5};
128 node_hash_set<int>
s = {1, 2, 3, 4, 5};
134 node_hash_set<int>
s = {1, 2, 3, 4, 5};