Tests based on GTEST_HAS_STD_UNIQUE_PTR_ and GTEST_HAS_STD_SHARED_PTR_.

Pull in gtest 744.
This commit is contained in:
kosak 2015-07-27 23:51:16 +00:00
parent 6702b97d5e
commit cac6c1bb53

View File

@ -96,6 +96,13 @@ TEST(ConvertIdentifierNameToWordsTest, WorksWhenNameIsMixture) {
TEST(PointeeOfTest, WorksForSmartPointers) {
CompileAssertTypesEqual<const char,
PointeeOf<internal::linked_ptr<const char> >::type>();
#if GTEST_HAS_STD_UNIQUE_PTR_
CompileAssertTypesEqual<int, PointeeOf<std::unique_ptr<int> >::type>();
#endif // GTEST_HAS_STD_UNIQUE_PTR_
#if GTEST_HAS_STD_SHARED_PTR_
CompileAssertTypesEqual<std::string,
PointeeOf<std::shared_ptr<std::string> >::type>();
#endif // GTEST_HAS_STD_SHARED_PTR_
}
TEST(PointeeOfTest, WorksForRawPointers) {
@ -105,6 +112,17 @@ TEST(PointeeOfTest, WorksForRawPointers) {
}
TEST(GetRawPointerTest, WorksForSmartPointers) {
#if GTEST_HAS_STD_UNIQUE_PTR_
const char* const raw_p1 = new const char('a'); // NOLINT
const std::unique_ptr<const char> p1(raw_p1);
EXPECT_EQ(raw_p1, GetRawPointer(p1));
#endif // GTEST_HAS_STD_UNIQUE_PTR_
#if GTEST_HAS_STD_SHARED_PTR_
double* const raw_p2 = new double(2.5); // NOLINT
const std::shared_ptr<double> p2(raw_p2);
EXPECT_EQ(raw_p2, GetRawPointer(p2));
#endif // GTEST_HAS_STD_SHARED_PTR_
const char* const raw_p4 = new const char('a'); // NOLINT
const internal::linked_ptr<const char> p4(raw_p4);
EXPECT_EQ(raw_p4, GetRawPointer(p4));