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_MAP_MEMBERS_TEST_H_
0016 #define ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_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 UnordMap>
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<std::pair<const typename TypeParam::key_type,
0037 typename TypeParam::mapped_type>,
0038 typename TypeParam::value_type>()));
0039 EXPECT_TRUE((absl::conjunction<
0040 absl::negation<std::is_signed<typename TypeParam::size_type>>,
0041 std::is_integral<typename TypeParam::size_type>>()));
0042 EXPECT_TRUE((absl::conjunction<
0043 std::is_signed<typename TypeParam::difference_type>,
0044 std::is_integral<typename TypeParam::difference_type>>()));
0045 EXPECT_TRUE((std::is_convertible<
0046 decltype(std::declval<const typename TypeParam::hasher&>()(
0047 std::declval<const typename TypeParam::key_type&>())),
0048 size_t>()));
0049 EXPECT_TRUE((std::is_convertible<
0050 decltype(std::declval<const typename TypeParam::key_equal&>()(
0051 std::declval<const typename TypeParam::key_type&>(),
0052 std::declval<const typename TypeParam::key_type&>())),
0053 bool>()));
0054 EXPECT_TRUE((std::is_same<typename TypeParam::allocator_type::value_type,
0055 typename TypeParam::value_type>()));
0056 EXPECT_TRUE((std::is_same<typename TypeParam::value_type&,
0057 typename TypeParam::reference>()));
0058 EXPECT_TRUE((std::is_same<const typename TypeParam::value_type&,
0059 typename TypeParam::const_reference>()));
0060 EXPECT_TRUE((std::is_same<typename std::allocator_traits<
0061 typename TypeParam::allocator_type>::pointer,
0062 typename TypeParam::pointer>()));
0063 EXPECT_TRUE(
0064 (std::is_same<typename std::allocator_traits<
0065 typename TypeParam::allocator_type>::const_pointer,
0066 typename TypeParam::const_pointer>()));
0067 }
0068
0069 TYPED_TEST_P(MembersTest, SimpleFunctions) {
0070 EXPECT_GT(TypeParam().max_size(), 0);
0071 }
0072
0073 TYPED_TEST_P(MembersTest, BeginEnd) {
0074 TypeParam t = {typename TypeParam::value_type{}};
0075 EXPECT_EQ(t.begin(), t.cbegin());
0076 EXPECT_EQ(t.end(), t.cend());
0077 EXPECT_NE(t.begin(), t.end());
0078 EXPECT_NE(t.cbegin(), t.cend());
0079 }
0080
0081 REGISTER_TYPED_TEST_SUITE_P(MembersTest, Typedefs, SimpleFunctions, BeginEnd);
0082
0083 }
0084 ABSL_NAMESPACE_END
0085 }
0086
0087 #endif