diff options
Diffstat (limited to 'googlemock/test/gmock-matchers_test.cc')
-rw-r--r-- | googlemock/test/gmock-matchers_test.cc | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index 79eb552e..ceff5b08 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -238,8 +238,8 @@ TEST(MatchResultListenerTest, StreamingWorks) { } TEST(MatchResultListenerTest, CanAccessUnderlyingStream) { - EXPECT_TRUE(DummyMatchResultListener().stream() == NULL); - EXPECT_TRUE(StreamMatchResultListener(NULL).stream() == NULL); + EXPECT_TRUE(DummyMatchResultListener().stream() == nullptr); + EXPECT_TRUE(StreamMatchResultListener(nullptr).stream() == nullptr); EXPECT_EQ(&std::cout, StreamMatchResultListener(&std::cout).stream()); } @@ -249,7 +249,7 @@ TEST(MatchResultListenerTest, IsInterestedWorks) { EXPECT_TRUE(StreamMatchResultListener(&std::cout).IsInterested()); EXPECT_FALSE(DummyMatchResultListener().IsInterested()); - EXPECT_FALSE(StreamMatchResultListener(NULL).IsInterested()); + EXPECT_FALSE(StreamMatchResultListener(nullptr).IsInterested()); } // Makes sure that the MatcherInterface<T> interface doesn't @@ -283,7 +283,7 @@ class NewEvenMatcherImpl : public MatcherInterface<int> { const bool match = x % 2 == 0; // Verifies that we can stream to a listener directly. *listener << "value % " << 2; - if (listener->stream() != NULL) { + if (listener->stream() != nullptr) { // Verifies that we can stream to a listener's underlying stream // too. *listener->stream() << " == " << (x % 2); @@ -327,7 +327,7 @@ TEST(MatcherTest, CanBeImplicitlyConstructedFromValue) { // Tests that NULL can be used in place of Eq(NULL). TEST(MatcherTest, CanBeImplicitlyConstructedFromNULL) { Matcher<int*> m1 = NULL; - EXPECT_TRUE(m1.Matches(NULL)); + EXPECT_TRUE(m1.Matches(nullptr)); int n = 0; EXPECT_FALSE(m1.Matches(&n)); } @@ -512,7 +512,7 @@ TEST(StringViewMatcherTest, CanBeImplicitlyConstructedFromStringView) { // MatcherInterface* without requiring the user to explicitly // write the type. TEST(MakeMatcherTest, ConstructsMatcherFromMatcherInterface) { - const MatcherInterface<int>* dummy_impl = NULL; + const MatcherInterface<int>* dummy_impl = nullptr; Matcher<int> m = MakeMatcher(dummy_impl); } @@ -571,7 +571,7 @@ class PolymorphicIsEvenImpl { bool MatchAndExplain(const T& x, MatchResultListener* listener) const { // Verifies that we can stream to the listener directly. *listener << "% " << 2; - if (listener->stream() != NULL) { + if (listener->stream() != nullptr) { // Verifies that we can stream to the listener's underlying stream // too. *listener->stream() << " == " << (x % 2); @@ -1154,13 +1154,13 @@ TEST(NeTest, CanDescribeSelf) { // Tests that IsNull() matches any NULL pointer of any type. TEST(IsNullTest, MatchesNullPointer) { Matcher<int*> m1 = IsNull(); - int* p1 = NULL; + int* p1 = nullptr; int n = 0; EXPECT_TRUE(m1.Matches(p1)); EXPECT_FALSE(m1.Matches(&n)); Matcher<const char*> m2 = IsNull(); - const char* p2 = NULL; + const char* p2 = nullptr; EXPECT_TRUE(m2.Matches(p2)); EXPECT_FALSE(m2.Matches("hi")); @@ -1174,7 +1174,7 @@ TEST(IsNullTest, MatchesNullPointer) { // gmock_matchers_test::IsNullTest_MatchesNullPointer_Test::TestBody()') // gmock-matchers.h: (instantiating: 'testing::PolymorphicMatc Matcher<void*> m3 = IsNull(); - void* p3 = NULL; + void* p3 = nullptr; EXPECT_TRUE(m3.Matches(p3)); EXPECT_FALSE(m3.Matches(reinterpret_cast<void*>(0xbeef))); #endif @@ -1217,13 +1217,13 @@ TEST(IsNullTest, CanDescribeSelf) { // Tests that NotNull() matches any non-NULL pointer of any type. TEST(NotNullTest, MatchesNonNullPointer) { Matcher<int*> m1 = NotNull(); - int* p1 = NULL; + int* p1 = nullptr; int n = 0; EXPECT_FALSE(m1.Matches(p1)); EXPECT_TRUE(m1.Matches(&n)); Matcher<const char*> m2 = NotNull(); - const char* p2 = NULL; + const char* p2 = nullptr; EXPECT_FALSE(m2.Matches(p2)); EXPECT_TRUE(m2.Matches("hi")); } @@ -1324,7 +1324,7 @@ TEST(StrEqTest, MatchesEqualString) { Matcher<const char*> m = StrEq(std::string("Hello")); EXPECT_TRUE(m.Matches("Hello")); EXPECT_FALSE(m.Matches("hello")); - EXPECT_FALSE(m.Matches(NULL)); + EXPECT_FALSE(m.Matches(nullptr)); Matcher<const std::string&> m2 = StrEq("Hello"); EXPECT_TRUE(m2.Matches("Hello")); @@ -1360,7 +1360,7 @@ TEST(StrEqTest, CanDescribeSelf) { TEST(StrNeTest, MatchesUnequalString) { Matcher<const char*> m = StrNe("Hello"); EXPECT_TRUE(m.Matches("")); - EXPECT_TRUE(m.Matches(NULL)); + EXPECT_TRUE(m.Matches(nullptr)); EXPECT_FALSE(m.Matches("Hello")); Matcher<std::string> m2 = StrNe(std::string("Hello")); @@ -1385,7 +1385,7 @@ TEST(StrCaseEqTest, MatchesEqualStringIgnoringCase) { EXPECT_TRUE(m.Matches("Hello")); EXPECT_TRUE(m.Matches("hello")); EXPECT_FALSE(m.Matches("Hi")); - EXPECT_FALSE(m.Matches(NULL)); + EXPECT_FALSE(m.Matches(nullptr)); Matcher<const std::string&> m2 = StrCaseEq("Hello"); EXPECT_TRUE(m2.Matches("hello")); @@ -1433,7 +1433,7 @@ TEST(StrCaseEqTest, CanDescribeSelf) { TEST(StrCaseNeTest, MatchesUnequalStringIgnoringCase) { Matcher<const char*> m = StrCaseNe("Hello"); EXPECT_TRUE(m.Matches("Hi")); - EXPECT_TRUE(m.Matches(NULL)); + EXPECT_TRUE(m.Matches(nullptr)); EXPECT_FALSE(m.Matches("Hello")); EXPECT_FALSE(m.Matches("hello")); @@ -1475,17 +1475,17 @@ TEST(HasSubstrTest, WorksForCStrings) { const Matcher<char*> m1 = HasSubstr("foo"); EXPECT_TRUE(m1.Matches(const_cast<char*>("I love food."))); EXPECT_FALSE(m1.Matches(const_cast<char*>("tofo"))); - EXPECT_FALSE(m1.Matches(NULL)); + EXPECT_FALSE(m1.Matches(nullptr)); const Matcher<const char*> m2 = HasSubstr("foo"); EXPECT_TRUE(m2.Matches("I love food.")); EXPECT_FALSE(m2.Matches("tofo")); - EXPECT_FALSE(m2.Matches(NULL)); + EXPECT_FALSE(m2.Matches(nullptr)); const Matcher<const char*> m_empty = HasSubstr(""); EXPECT_TRUE(m_empty.Matches("not empty")); EXPECT_TRUE(m_empty.Matches("")); - EXPECT_FALSE(m_empty.Matches(NULL)); + EXPECT_FALSE(m_empty.Matches(nullptr)); } #if GTEST_HAS_ABSL @@ -1720,7 +1720,7 @@ TEST(StartsWithTest, MatchesStringWithGivenPrefix) { const Matcher<const char*> m1 = StartsWith(std::string("")); EXPECT_TRUE(m1.Matches("Hi")); EXPECT_TRUE(m1.Matches("")); - EXPECT_FALSE(m1.Matches(NULL)); + EXPECT_FALSE(m1.Matches(nullptr)); const Matcher<const std::string&> m2 = StartsWith("Hi"); EXPECT_TRUE(m2.Matches("Hi")); @@ -1748,7 +1748,7 @@ TEST(EndsWithTest, MatchesStringWithGivenSuffix) { const Matcher<const char*> m1 = EndsWith(""); EXPECT_TRUE(m1.Matches("Hi")); EXPECT_TRUE(m1.Matches("")); - EXPECT_FALSE(m1.Matches(NULL)); + EXPECT_FALSE(m1.Matches(nullptr)); const Matcher<const std::string&> m2 = EndsWith(std::string("Hi")); EXPECT_TRUE(m2.Matches("Hi")); @@ -1786,7 +1786,7 @@ TEST(MatchesRegexTest, MatchesStringMatchingGivenRegex) { const Matcher<const char*> m1 = MatchesRegex("a.*z"); EXPECT_TRUE(m1.Matches("az")); EXPECT_TRUE(m1.Matches("abcz")); - EXPECT_FALSE(m1.Matches(NULL)); + EXPECT_FALSE(m1.Matches(nullptr)); const Matcher<const std::string&> m2 = MatchesRegex(new RE("a.*z")); EXPECT_TRUE(m2.Matches("azbz")); @@ -1824,7 +1824,7 @@ TEST(ContainsRegexTest, MatchesStringContainingGivenRegex) { const Matcher<const char*> m1 = ContainsRegex(std::string("a.*z")); EXPECT_TRUE(m1.Matches("az")); EXPECT_TRUE(m1.Matches("0abcz1")); - EXPECT_FALSE(m1.Matches(NULL)); + EXPECT_FALSE(m1.Matches(nullptr)); const Matcher<const std::string&> m2 = ContainsRegex(new RE("a.*z")); EXPECT_TRUE(m2.Matches("azbz")); @@ -1862,7 +1862,7 @@ TEST(StdWideStrEqTest, MatchesEqual) { Matcher<const wchar_t*> m = StrEq(::std::wstring(L"Hello")); EXPECT_TRUE(m.Matches(L"Hello")); EXPECT_FALSE(m.Matches(L"hello")); - EXPECT_FALSE(m.Matches(NULL)); + EXPECT_FALSE(m.Matches(nullptr)); Matcher<const ::std::wstring&> m2 = StrEq(L"Hello"); EXPECT_TRUE(m2.Matches(L"Hello")); @@ -1902,7 +1902,7 @@ TEST(StdWideStrEqTest, CanDescribeSelf) { TEST(StdWideStrNeTest, MatchesUnequalString) { Matcher<const wchar_t*> m = StrNe(L"Hello"); EXPECT_TRUE(m.Matches(L"")); - EXPECT_TRUE(m.Matches(NULL)); + EXPECT_TRUE(m.Matches(nullptr)); EXPECT_FALSE(m.Matches(L"Hello")); Matcher< ::std::wstring> m2 = StrNe(::std::wstring(L"Hello")); @@ -1920,7 +1920,7 @@ TEST(StdWideStrCaseEqTest, MatchesEqualStringIgnoringCase) { EXPECT_TRUE(m.Matches(L"Hello")); EXPECT_TRUE(m.Matches(L"hello")); EXPECT_FALSE(m.Matches(L"Hi")); - EXPECT_FALSE(m.Matches(NULL)); + EXPECT_FALSE(m.Matches(nullptr)); Matcher<const ::std::wstring&> m2 = StrCaseEq(L"Hello"); EXPECT_TRUE(m2.Matches(L"hello")); @@ -1960,7 +1960,7 @@ TEST(StdWideStrCaseEqTest, CanDescribeSelf) { TEST(StdWideStrCaseNeTest, MatchesUnequalStringIgnoringCase) { Matcher<const wchar_t*> m = StrCaseNe(L"Hello"); EXPECT_TRUE(m.Matches(L"Hi")); - EXPECT_TRUE(m.Matches(NULL)); + EXPECT_TRUE(m.Matches(nullptr)); EXPECT_FALSE(m.Matches(L"Hello")); EXPECT_FALSE(m.Matches(L"hello")); @@ -1990,12 +1990,12 @@ TEST(StdWideHasSubstrTest, WorksForCStrings) { const Matcher<wchar_t*> m1 = HasSubstr(L"foo"); EXPECT_TRUE(m1.Matches(const_cast<wchar_t*>(L"I love food."))); EXPECT_FALSE(m1.Matches(const_cast<wchar_t*>(L"tofo"))); - EXPECT_FALSE(m1.Matches(NULL)); + EXPECT_FALSE(m1.Matches(nullptr)); const Matcher<const wchar_t*> m2 = HasSubstr(L"foo"); EXPECT_TRUE(m2.Matches(L"I love food.")); EXPECT_FALSE(m2.Matches(L"tofo")); - EXPECT_FALSE(m2.Matches(NULL)); + EXPECT_FALSE(m2.Matches(nullptr)); } // Tests that HasSubstr(s) describes itself properly. @@ -2010,7 +2010,7 @@ TEST(StdWideStartsWithTest, MatchesStringWithGivenPrefix) { const Matcher<const wchar_t*> m1 = StartsWith(::std::wstring(L"")); EXPECT_TRUE(m1.Matches(L"Hi")); EXPECT_TRUE(m1.Matches(L"")); - EXPECT_FALSE(m1.Matches(NULL)); + EXPECT_FALSE(m1.Matches(nullptr)); const Matcher<const ::std::wstring&> m2 = StartsWith(L"Hi"); EXPECT_TRUE(m2.Matches(L"Hi")); @@ -2031,7 +2031,7 @@ TEST(StdWideEndsWithTest, MatchesStringWithGivenSuffix) { const Matcher<const wchar_t*> m1 = EndsWith(L""); EXPECT_TRUE(m1.Matches(L"Hi")); EXPECT_TRUE(m1.Matches(L"")); - EXPECT_FALSE(m1.Matches(NULL)); + EXPECT_FALSE(m1.Matches(nullptr)); const Matcher<const ::std::wstring&> m2 = EndsWith(::std::wstring(L"Hi")); EXPECT_TRUE(m2.Matches(L"Hi")); @@ -2053,7 +2053,7 @@ TEST(GlobalWideStrEqTest, MatchesEqual) { Matcher<const wchar_t*> m = StrEq(::wstring(L"Hello")); EXPECT_TRUE(m.Matches(L"Hello")); EXPECT_FALSE(m.Matches(L"hello")); - EXPECT_FALSE(m.Matches(NULL)); + EXPECT_FALSE(m.Matches(nullptr)); Matcher<const ::wstring&> m2 = StrEq(L"Hello"); EXPECT_TRUE(m2.Matches(L"Hello")); @@ -2093,7 +2093,7 @@ TEST(GlobalWideStrEqTest, CanDescribeSelf) { TEST(GlobalWideStrNeTest, MatchesUnequalString) { Matcher<const wchar_t*> m = StrNe(L"Hello"); EXPECT_TRUE(m.Matches(L"")); - EXPECT_TRUE(m.Matches(NULL)); + EXPECT_TRUE(m.Matches(nullptr)); EXPECT_FALSE(m.Matches(L"Hello")); Matcher< ::wstring> m2 = StrNe(::wstring(L"Hello")); @@ -2111,7 +2111,7 @@ TEST(GlobalWideStrCaseEqTest, MatchesEqualStringIgnoringCase) { EXPECT_TRUE(m.Matches(L"Hello")); EXPECT_TRUE(m.Matches(L"hello")); EXPECT_FALSE(m.Matches(L"Hi")); - EXPECT_FALSE(m.Matches(NULL)); + EXPECT_FALSE(m.Matches(nullptr)); Matcher<const ::wstring&> m2 = StrCaseEq(L"Hello"); EXPECT_TRUE(m2.Matches(L"hello")); @@ -2151,7 +2151,7 @@ TEST(GlobalWideStrCaseEqTest, CanDescribeSelf) { TEST(GlobalWideStrCaseNeTest, MatchesUnequalStringIgnoringCase) { Matcher<const wchar_t*> m = StrCaseNe(L"Hello"); EXPECT_TRUE(m.Matches(L"Hi")); - EXPECT_TRUE(m.Matches(NULL)); + EXPECT_TRUE(m.Matches(nullptr)); EXPECT_FALSE(m.Matches(L"Hello")); EXPECT_FALSE(m.Matches(L"hello")); @@ -2181,12 +2181,12 @@ TEST(GlobalWideHasSubstrTest, WorksForCStrings) { const Matcher<wchar_t*> m1 = HasSubstr(L"foo"); EXPECT_TRUE(m1.Matches(const_cast<wchar_t*>(L"I love food."))); EXPECT_FALSE(m1.Matches(const_cast<wchar_t*>(L"tofo"))); - EXPECT_FALSE(m1.Matches(NULL)); + EXPECT_FALSE(m1.Matches(nullptr)); const Matcher<const wchar_t*> m2 = HasSubstr(L"foo"); EXPECT_TRUE(m2.Matches(L"I love food.")); EXPECT_FALSE(m2.Matches(L"tofo")); - EXPECT_FALSE(m2.Matches(NULL)); + EXPECT_FALSE(m2.Matches(nullptr)); } // Tests that HasSubstr(s) describes itself properly. @@ -2201,7 +2201,7 @@ TEST(GlobalWideStartsWithTest, MatchesStringWithGivenPrefix) { const Matcher<const wchar_t*> m1 = StartsWith(::wstring(L"")); EXPECT_TRUE(m1.Matches(L"Hi")); EXPECT_TRUE(m1.Matches(L"")); - EXPECT_FALSE(m1.Matches(NULL)); + EXPECT_FALSE(m1.Matches(nullptr)); const Matcher<const ::wstring&> m2 = StartsWith(L"Hi"); EXPECT_TRUE(m2.Matches(L"Hi")); @@ -2222,7 +2222,7 @@ TEST(GlobalWideEndsWithTest, MatchesStringWithGivenSuffix) { const Matcher<const wchar_t*> m1 = EndsWith(L""); EXPECT_TRUE(m1.Matches(L"Hi")); EXPECT_TRUE(m1.Matches(L"")); - EXPECT_FALSE(m1.Matches(NULL)); + EXPECT_FALSE(m1.Matches(nullptr)); const Matcher<const ::wstring&> m2 = EndsWith(::wstring(L"Hi")); EXPECT_TRUE(m2.Matches(L"Hi")); @@ -3701,7 +3701,7 @@ TEST(PointeeTest, RawPointer) { EXPECT_TRUE(m.Matches(&n)); n = -1; EXPECT_FALSE(m.Matches(&n)); - EXPECT_FALSE(m.Matches(NULL)); + EXPECT_FALSE(m.Matches(nullptr)); } TEST(PointeeTest, RawPointerToConst) { @@ -3711,7 +3711,7 @@ TEST(PointeeTest, RawPointerToConst) { EXPECT_TRUE(m.Matches(&x)); x = -1; EXPECT_FALSE(m.Matches(&x)); - EXPECT_FALSE(m.Matches(NULL)); + EXPECT_FALSE(m.Matches(nullptr)); } TEST(PointeeTest, ReferenceToConstRawPointer) { @@ -3721,7 +3721,7 @@ TEST(PointeeTest, ReferenceToConstRawPointer) { EXPECT_TRUE(m.Matches(&n)); n = -1; EXPECT_FALSE(m.Matches(&n)); - EXPECT_FALSE(m.Matches(NULL)); + EXPECT_FALSE(m.Matches(nullptr)); } TEST(PointeeTest, ReferenceToNonConstRawPointer) { @@ -3732,7 +3732,7 @@ TEST(PointeeTest, ReferenceToNonConstRawPointer) { EXPECT_TRUE(m.Matches(p)); x = -1; EXPECT_FALSE(m.Matches(p)); - p = NULL; + p = nullptr; EXPECT_FALSE(m.Matches(p)); } @@ -3771,7 +3771,7 @@ TEST(WhenDynamicCastToTest, WrongTypes) { TEST(WhenDynamicCastToTest, AlreadyNull) { // Already NULL. - Base* as_base_ptr = NULL; + Base* as_base_ptr = nullptr; EXPECT_THAT(as_base_ptr, WhenDynamicCastTo<Derived*>(IsNull())); } @@ -3807,7 +3807,7 @@ TEST(WhenDynamicCastToTest, Describe) { TEST(WhenDynamicCastToTest, Explain) { Matcher<Base*> matcher = WhenDynamicCastTo<Derived*>(Pointee(_)); - Base* null = NULL; + Base* null = nullptr; EXPECT_THAT(Explain(matcher, null), HasSubstr("NULL")); Derived derived; EXPECT_TRUE(matcher.Matches(&derived)); @@ -3868,7 +3868,7 @@ TEST(PointeeTest, WorksWithConstPropagatingPointers) { TEST(PointeeTest, NeverMatchesNull) { const Matcher<const char*> m = Pointee(_); - EXPECT_FALSE(m.Matches(NULL)); + EXPECT_FALSE(m.Matches(nullptr)); } // Tests that we can write Pointee(value) instead of Pointee(Eq(value)). @@ -3879,7 +3879,7 @@ TEST(PointeeTest, MatchesAgainstAValue) { EXPECT_TRUE(m.Matches(&n)); n = -1; EXPECT_FALSE(m.Matches(&n)); - EXPECT_FALSE(m.Matches(NULL)); + EXPECT_FALSE(m.Matches(nullptr)); } TEST(PointeeTest, CanDescribeSelf) { @@ -3892,7 +3892,7 @@ TEST(PointeeTest, CanDescribeSelf) { TEST(PointeeTest, CanExplainMatchResult) { const Matcher<const std::string*> m = Pointee(StartsWith("Hi")); - EXPECT_EQ("", Explain(m, static_cast<const std::string*>(NULL))); + EXPECT_EQ("", Explain(m, static_cast<const std::string*>(nullptr))); const Matcher<long*> m2 = Pointee(GreaterThan(1)); // NOLINT long n = 3; // NOLINT @@ -3929,7 +3929,7 @@ MATCHER_P(UncopyableIs, inner_matcher, "") { // A user-defined struct for testing Field(). struct AStruct { - AStruct() : x(0), y(1.0), z(5), p(NULL) {} + AStruct() : x(0), y(1.0), z(5), p(nullptr) {} AStruct(const AStruct& rhs) : x(rhs.x), y(rhs.y), z(rhs.z.value()), p(rhs.p) {} @@ -3990,7 +3990,7 @@ TEST(FieldTest, WorksForUncopyableField) { // Tests that Field(&Foo::field, ...) works when field is a pointer. TEST(FieldTest, WorksForPointerField) { // Matching against NULL. - Matcher<AStruct> m = Field(&AStruct::p, static_cast<const char*>(NULL)); + Matcher<AStruct> m = Field(&AStruct::p, static_cast<const char*>(nullptr)); AStruct a; EXPECT_TRUE(m.Matches(a)); a.p = "hi"; @@ -4116,7 +4116,7 @@ TEST(FieldForPointerTest, WorksForReferenceToConstPointer) { // Tests that Field() does not match the NULL pointer. TEST(FieldForPointerTest, DoesNotMatchNull) { Matcher<const AStruct*> m = Field(&AStruct::x, _); - EXPECT_FALSE(m.Matches(NULL)); + EXPECT_FALSE(m.Matches(nullptr)); } // Tests that Field(&Foo::field, ...) works when the argument's type @@ -4154,7 +4154,7 @@ TEST(FieldForPointerTest, CanExplainMatchResult) { AStruct a; a.x = 1; - EXPECT_EQ("", Explain(m, static_cast<const AStruct*>(NULL))); + EXPECT_EQ("", Explain(m, static_cast<const AStruct*>(nullptr))); EXPECT_EQ("which points to an object whose given field is 1" + OfType("int"), Explain(m, &a)); @@ -4168,7 +4168,7 @@ TEST(FieldForPointerTest, CanExplainMatchResultWithFieldName) { AStruct a; a.x = 1; - EXPECT_EQ("", Explain(m, static_cast<const AStruct*>(NULL))); + EXPECT_EQ("", Explain(m, static_cast<const AStruct*>(nullptr))); EXPECT_EQ( "which points to an object whose field `field_name` is 1" + OfType("int"), Explain(m, &a)); @@ -4413,7 +4413,7 @@ TEST(PropertyForPointerTest, WorksForReferenceToConstPointer) { // Tests that Property() does not match the NULL pointer. TEST(PropertyForPointerTest, WorksForReferenceToNonConstProperty) { Matcher<const AClass*> m = Property(&AClass::x, _); - EXPECT_FALSE(m.Matches(NULL)); + EXPECT_FALSE(m.Matches(nullptr)); } // Tests that Property(&Foo::property, ...) works when the argument's @@ -4454,7 +4454,7 @@ TEST(PropertyForPointerTest, CanExplainMatchResult) { AClass a; a.set_n(1); - EXPECT_EQ("", Explain(m, static_cast<const AClass*>(NULL))); + EXPECT_EQ("", Explain(m, static_cast<const AClass*>(nullptr))); EXPECT_EQ( "which points to an object whose given property is 1" + OfType("int"), Explain(m, &a)); @@ -4470,7 +4470,7 @@ TEST(PropertyForPointerTest, CanExplainMatchResultWithPropertyName) { AClass a; a.set_n(1); - EXPECT_EQ("", Explain(m, static_cast<const AClass*>(NULL))); + EXPECT_EQ("", Explain(m, static_cast<const AClass*>(nullptr))); EXPECT_EQ("which points to an object whose property `fancy_name` is 1" + OfType("int"), Explain(m, &a)); @@ -4581,7 +4581,7 @@ TEST(ResultOfTest, WorksForCompatibleMatcherTypes) { // a NULL function pointer. TEST(ResultOfDeathTest, DiesOnNullFunctionPointers) { EXPECT_DEATH_IF_SUPPORTED( - ResultOf(static_cast<std::string (*)(int dummy)>(NULL), + ResultOf(static_cast<std::string (*)(int dummy)>(nullptr), Eq(std::string("foo"))), "NULL function pointer is passed into ResultOf\\(\\)\\."); } @@ -6181,7 +6181,7 @@ TEST_P(BipartiteRandomTest, LargerNets) { testing::internal::Int32 seed = GTEST_FLAG(random_seed); if (seed == 0) { - seed = static_cast<testing::internal::Int32>(time(NULL)); + seed = static_cast<testing::internal::Int32>(time(nullptr)); } for (; iters > 0; --iters, ++seed) { @@ -6684,7 +6684,7 @@ class SampleVariantIntString { template <typename T> friend const T& get(const SampleVariantIntString& value) { - return value.get_impl(static_cast<T*>(NULL)); + return value.get_impl(static_cast<T*>(nullptr)); } private: @@ -6743,7 +6743,7 @@ class SampleAnyType { template <typename T> friend const T* any_cast(const SampleAnyType* any) { - return any->get_impl(static_cast<T*>(NULL)); + return any->get_impl(static_cast<T*>(nullptr)); } private: @@ -6751,9 +6751,9 @@ class SampleAnyType { int i_; std::string s_; - const int* get_impl(int*) const { return index_ == 0 ? &i_ : NULL; } + const int* get_impl(int*) const { return index_ == 0 ? &i_ : nullptr; } const std::string* get_impl(std::string*) const { - return index_ == 1 ? &s_ : NULL; + return index_ == 1 ? &s_ : nullptr; } }; |