15 #ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_SET_LOOKUP_TEST_H_ 16 #define ABSL_CONTAINER_INTERNAL_UNORDERED_SET_LOOKUP_TEST_H_ 18 #include "gmock/gmock.h" 19 #include "gtest/gtest.h" 24 namespace container_internal {
26 template <
class UnordSet>
27 class LookupTest :
public ::testing::Test {};
32 using T = hash_internal::GeneratedType<TypeParam>;
33 std::vector<T> values;
34 std::generate_n(std::back_inserter(values), 10,
35 hash_internal::Generator<T>());
37 for (
const auto&
v : values)
38 EXPECT_EQ(0, m.count(
v)) << ::testing::PrintToString(
v);
39 m.insert(values.begin(), values.end());
40 for (
const auto&
v : values)
41 EXPECT_EQ(1, m.count(
v)) << ::testing::PrintToString(
v);
45 using T = hash_internal::GeneratedType<TypeParam>;
46 std::vector<T> values;
47 std::generate_n(std::back_inserter(values), 10,
48 hash_internal::Generator<T>());
50 for (
const auto&
v : values)
51 EXPECT_TRUE(m.end() == m.find(
v)) << ::testing::PrintToString(
v);
52 m.insert(values.begin(), values.end());
53 for (
const auto&
v : values) {
54 typename TypeParam::iterator it = m.find(
v);
56 decltype(*it)>::
value,
59 decltype(it.operator->())>
::value,
61 EXPECT_TRUE(m.end() != it) << ::testing::PrintToString(
v);
62 EXPECT_EQ(
v, *it) << ::testing::PrintToString(
v);
67 using T = hash_internal::GeneratedType<TypeParam>;
68 std::vector<T> values;
69 std::generate_n(std::back_inserter(values), 10,
70 hash_internal::Generator<T>());
72 for (
const auto&
v : values) {
73 auto r = m.equal_range(
v);
74 ASSERT_EQ(0, std::distance(r.first, r.second));
76 m.insert(values.begin(), values.end());
77 for (
const auto&
v : values) {
78 auto r = m.equal_range(
v);
79 ASSERT_EQ(1, std::distance(r.first, r.second));
80 EXPECT_EQ(
v, *r.first);
89 #endif // ABSL_CONTAINER_INTERNAL_UNORDERED_SET_LOOKUP_TEST_H_
constexpr size_t Find(Needle, Needle, Ts...)
TYPED_TEST_SUITE_P(ConstructorTest)
TYPED_TEST_P(ConstructorTest, NoArgs)
REGISTER_TYPED_TEST_CASE_P(ConstructorTest, NoArgs, BucketCount, BucketCountHash, BucketCountHashEqual, BucketCountHashEqualAlloc, BucketCountAlloc, BucketCountHashAlloc, Alloc, InputIteratorBucketHashEqualAlloc, InputIteratorBucketAlloc, InputIteratorBucketHashAlloc, CopyConstructor, CopyConstructorAlloc, MoveConstructor, MoveConstructorAlloc, InitializerListBucketHashEqualAlloc, InitializerListBucketAlloc, InitializerListBucketHashAlloc, Assignment, MoveAssignment, AssignmentFromInitializerList, AssignmentOverwritesExisting, MoveAssignmentOverwritesExisting, AssignmentFromInitializerListOverwritesExisting, AssignmentOnSelf)