File indexing completed on 2025-01-30 09:31:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MEMBERS_TEST_H_
0016 #define ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MEMBERS_TEST_H_
0017
0018 #include <type_traits>
0019 #include "gmock/gmock.h"
0020 #include "gtest/gtest.h"
0021 #include "absl/meta/type_traits.h"
0022
0023 namespace absl {
0024 ABSL_NAMESPACE_BEGIN
0025 namespace container_internal {
0026
0027 template <class UnordSet>
0028 class MembersTest : public ::testing::Test {};
0029
0030 TYPED_TEST_SUITE_P(MembersTest);
0031
0032 template <typename T>
0033 void UseType() {}
0034
0035 TYPED_TEST_P(MembersTest, Typedefs) {
0036 EXPECT_TRUE((std::is_same<typename TypeParam::key_type,
0037 typename TypeParam::value_type>()));
0038 EXPECT_TRUE((absl::conjunction<
0039 absl::negation<std::is_signed<typename TypeParam::size_type>>,
0040 std::is_integral<typename TypeParam::size_type>>()));
0041 EXPECT_TRUE((absl::conjunction<
0042 std::is_signed<typename TypeParam::difference_type>,
0043 std::is_integral<typename TypeParam::difference_type>>()));
0044 EXPECT_TRUE((std::is_convertible<
0045 decltype(std::declval<const typename TypeParam::hasher&>()(
0046 std::declval<const typename TypeParam::key_type&>())),
0047 size_t>()));
0048 EXPECT_TRUE((std::is_convertible<
0049 decltype(std::declval<const typename TypeParam::key_equal&>()(
0050 std::declval<const typename TypeParam::key_type&>(),
0051 std::declval<const typename TypeParam::key_type&>())),
0052 bool>()));
0053 EXPECT_TRUE((std::is_same<typename TypeParam::allocator_type::value_type,
0054 typename TypeParam::value_type>()));
0055 EXPECT_TRUE((std::is_same<typename TypeParam::value_type&,
0056 typename TypeParam::reference>()));
0057 EXPECT_TRUE((std::is_same<const typename TypeParam::value_type&,
0058 typename TypeParam::const_reference>()));
0059 EXPECT_TRUE((std::is_same<typename std::allocator_traits<
0060 typename TypeParam::allocator_type>::pointer,
0061 typename TypeParam::pointer>()));
0062 EXPECT_TRUE(
0063 (std::is_same<typename std::allocator_traits<
0064 typename TypeParam::allocator_type>::const_pointer,
0065 typename TypeParam::const_pointer>()));
0066 }
0067
0068 TYPED_TEST_P(MembersTest, SimpleFunctions) {
0069 EXPECT_GT(TypeParam().max_size(), 0);
0070 }
0071
0072 TYPED_TEST_P(MembersTest, BeginEnd) {
0073 TypeParam t = {typename TypeParam::value_type{}};
0074 EXPECT_EQ(t.begin(), t.cbegin());
0075 EXPECT_EQ(t.end(), t.cend());
0076 EXPECT_NE(t.begin(), t.end());
0077 EXPECT_NE(t.cbegin(), t.cend());
0078 }
0079
0080 REGISTER_TYPED_TEST_SUITE_P(MembersTest, Typedefs, SimpleFunctions, BeginEnd);
0081
0082 }
0083 ABSL_NAMESPACE_END
0084 }
0085
0086 #endif