Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MEMBERS_TEST_H_
00016 #define ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MEMBERS_TEST_H_
00017
00018 #include <type_traits>
00019 #include "gmock/gmock.h"
00020 #include "gtest/gtest.h"
00021 #include "absl/meta/type_traits.h"
00022
00023 namespace absl {
00024 namespace container_internal {
00025
00026 template <class UnordMap>
00027 class MembersTest : public ::testing::Test {};
00028
00029 TYPED_TEST_SUITE_P(MembersTest);
00030
00031 template <typename T>
00032 void UseType() {}
00033
00034 TYPED_TEST_P(MembersTest, Typedefs) {
00035 EXPECT_TRUE((std::is_same<std::pair<const typename TypeParam::key_type,
00036 typename TypeParam::mapped_type>,
00037 typename TypeParam::value_type>()));
00038 EXPECT_TRUE((absl::conjunction<
00039 absl::negation<std::is_signed<typename TypeParam::size_type>>,
00040 std::is_integral<typename TypeParam::size_type>>()));
00041 EXPECT_TRUE((absl::conjunction<
00042 std::is_signed<typename TypeParam::difference_type>,
00043 std::is_integral<typename TypeParam::difference_type>>()));
00044 EXPECT_TRUE((std::is_convertible<
00045 decltype(std::declval<const typename TypeParam::hasher&>()(
00046 std::declval<const typename TypeParam::key_type&>())),
00047 size_t>()));
00048 EXPECT_TRUE((std::is_convertible<
00049 decltype(std::declval<const typename TypeParam::key_equal&>()(
00050 std::declval<const typename TypeParam::key_type&>(),
00051 std::declval<const typename TypeParam::key_type&>())),
00052 bool>()));
00053 EXPECT_TRUE((std::is_same<typename TypeParam::allocator_type::value_type,
00054 typename TypeParam::value_type>()));
00055 EXPECT_TRUE((std::is_same<typename TypeParam::value_type&,
00056 typename TypeParam::reference>()));
00057 EXPECT_TRUE((std::is_same<const typename TypeParam::value_type&,
00058 typename TypeParam::const_reference>()));
00059 EXPECT_TRUE((std::is_same<typename std::allocator_traits<
00060 typename TypeParam::allocator_type>::pointer,
00061 typename TypeParam::pointer>()));
00062 EXPECT_TRUE(
00063 (std::is_same<typename std::allocator_traits<
00064 typename TypeParam::allocator_type>::const_pointer,
00065 typename TypeParam::const_pointer>()));
00066 }
00067
00068 TYPED_TEST_P(MembersTest, SimpleFunctions) {
00069 EXPECT_GT(TypeParam().max_size(), 0);
00070 }
00071
00072 TYPED_TEST_P(MembersTest, BeginEnd) {
00073 TypeParam t = {typename TypeParam::value_type{}};
00074 EXPECT_EQ(t.begin(), t.cbegin());
00075 EXPECT_EQ(t.end(), t.cend());
00076 EXPECT_NE(t.begin(), t.end());
00077 EXPECT_NE(t.cbegin(), t.cend());
00078 }
00079
00080 REGISTER_TYPED_TEST_SUITE_P(MembersTest, Typedefs, SimpleFunctions, BeginEnd);
00081
00082 }
00083 }
00084
00085 #endif // ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MEMBERS_TEST_H_