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_SET_MEMBERS_TEST_H_
00016 #define ABSL_CONTAINER_INTERNAL_UNORDERED_SET_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 UnordSet>
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<typename TypeParam::key_type,
00036 typename TypeParam::value_type>()));
00037 EXPECT_TRUE((absl::conjunction<
00038 absl::negation<std::is_signed<typename TypeParam::size_type>>,
00039 std::is_integral<typename TypeParam::size_type>>()));
00040 EXPECT_TRUE((absl::conjunction<
00041 std::is_signed<typename TypeParam::difference_type>,
00042 std::is_integral<typename TypeParam::difference_type>>()));
00043 EXPECT_TRUE((std::is_convertible<
00044 decltype(std::declval<const typename TypeParam::hasher&>()(
00045 std::declval<const typename TypeParam::key_type&>())),
00046 size_t>()));
00047 EXPECT_TRUE((std::is_convertible<
00048 decltype(std::declval<const typename TypeParam::key_equal&>()(
00049 std::declval<const typename TypeParam::key_type&>(),
00050 std::declval<const typename TypeParam::key_type&>())),
00051 bool>()));
00052 EXPECT_TRUE((std::is_same<typename TypeParam::allocator_type::value_type,
00053 typename TypeParam::value_type>()));
00054 EXPECT_TRUE((std::is_same<typename TypeParam::value_type&,
00055 typename TypeParam::reference>()));
00056 EXPECT_TRUE((std::is_same<const typename TypeParam::value_type&,
00057 typename TypeParam::const_reference>()));
00058 EXPECT_TRUE((std::is_same<typename std::allocator_traits<
00059 typename TypeParam::allocator_type>::pointer,
00060 typename TypeParam::pointer>()));
00061 EXPECT_TRUE(
00062 (std::is_same<typename std::allocator_traits<
00063 typename TypeParam::allocator_type>::const_pointer,
00064 typename TypeParam::const_pointer>()));
00065 }
00066
00067 TYPED_TEST_P(MembersTest, SimpleFunctions) {
00068 EXPECT_GT(TypeParam().max_size(), 0);
00069 }
00070
00071 TYPED_TEST_P(MembersTest, BeginEnd) {
00072 TypeParam t = {typename TypeParam::value_type{}};
00073 EXPECT_EQ(t.begin(), t.cbegin());
00074 EXPECT_EQ(t.end(), t.cend());
00075 EXPECT_NE(t.begin(), t.end());
00076 EXPECT_NE(t.cbegin(), t.cend());
00077 }
00078
00079 REGISTER_TYPED_TEST_SUITE_P(MembersTest, Typedefs, SimpleFunctions, BeginEnd);
00080
00081 }
00082 }
00083
00084 #endif // ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MEMBERS_TEST_H_