Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
testing::gmock_matchers_test Namespace Reference

Namespaces

namespace  convertible_from_any
 

Classes

class  AClass
 
class  AllArgsHelper
 
struct  AStruct
 
class  BacktrackingBPMTest
 
class  Base
 
class  BipartiteNonSquareTest
 
class  BipartiteRandomTest
 
class  BipartiteTest
 
class  ConstPropagatingPtr
 
class  ConvertibleToBool
 
class  Derived
 
class  DerivedClass
 
struct  DerivedStruct
 
class  DivisibleByImpl
 
class  EvenMatcherImpl
 
class  FloatingPointNearTest
 
class  FloatingPointTest
 
struct  Functor
 
class  GreaterThanMatcher
 
struct  IntReferenceWrapper
 
class  IntValue
 
class  IsGreaterThan
 
class  IsHalfOfMatcher
 
class  NewEvenMatcherImpl
 
struct  NonImplicitlyConstructibleTypeWithOperatorEq
 
class  NotCopyable
 
class  OptionalMatchersHelper
 
class  OtherDerived
 
struct  PolymorphicFunctor
 
class  PolymorphicIsEvenImpl
 
class  ReferencesBarOrIsZeroImpl
 
struct  ReferencingFunctor
 
class  SampleAnyType
 
class  SampleOptionalInt
 
class  SampleVariantIntString
 
class  Streamlike
 
struct  Type
 
class  Uncopyable
 
struct  Undefined
 
class  UnorderedElementsAreTest
 
class  Unprintable
 

Typedefs

typedef ::testing::tuple< long, int > Tuple2
 
typedef FloatingPointTest< float > FloatTest
 
typedef FloatingPointNearTest< float > FloatNearTest
 
typedef FloatingPointTest< double > DoubleTest
 
typedef FloatingPointNearTest< double > DoubleNearTest
 

Functions

Matcher< int > GreaterThan (int n)
 
std::string OfType (const std::string &type_name)
 
template<typename T >
std::string Describe (const Matcher< T > &m)
 
template<typename T >
std::string DescribeNegation (const Matcher< T > &m)
 
template<typename MatcherType , typename Value >
std::string Explain (const MatcherType &m, const Value &x)
 
 TEST (MonotonicMatcherTest, IsPrintable)
 
 TEST (MatchResultListenerTest, StreamingWorks)
 
 TEST (MatchResultListenerTest, CanAccessUnderlyingStream)
 
 TEST (MatchResultListenerTest, IsInterestedWorks)
 
 TEST (MatcherInterfaceTest, CanBeImplementedUsingPublishedAPI)
 
 TEST (MatcherInterfaceTest, CanBeImplementedUsingNewAPI)
 
 TEST (MatcherTest, CanBeDefaultConstructed)
 
 TEST (MatcherTest, CanBeConstructedFromMatcherInterface)
 
 TEST (MatcherTest, CanBeImplicitlyConstructedFromValue)
 
 TEST (MatcherTest, CanBeImplicitlyConstructedFromNULL)
 
 TEST (MatcherTest, CanBeConstructedFromUndefinedVariable)
 
 TEST (MatcherTest, CanAcceptAbstractClass)
 
 TEST (MatcherTest, IsCopyable)
 
 TEST (MatcherTest, CanDescribeItself)
 
 TEST (MatcherTest, MatchAndExplain)
 
 TEST (StringMatcherTest, CanBeImplicitlyConstructedFromCStringLiteral)
 
 TEST (StringMatcherTest, CanBeImplicitlyConstructedFromString)
 
 TEST (MakeMatcherTest, ConstructsMatcherFromMatcherInterface)
 
PolymorphicMatcher< ReferencesBarOrIsZeroImplReferencesBarOrIsZero ()
 
 TEST (MakePolymorphicMatcherTest, ConstructsMatcherUsingOldAPI)
 
PolymorphicMatcher< PolymorphicIsEvenImplPolymorphicIsEven ()
 
 TEST (MakePolymorphicMatcherTest, ConstructsMatcherUsingNewAPI)
 
 TEST (MatcherCastTest, FromPolymorphicMatcher)
 
bool IsPositiveIntValue (const IntValue &foo)
 
 TEST (MatcherCastTest, FromCompatibleType)
 
 TEST (MatcherCastTest, FromConstReferenceToNonReference)
 
 TEST (MatcherCastTest, FromReferenceToNonReference)
 
 TEST (MatcherCastTest, FromNonReferenceToConstReference)
 
 TEST (MatcherCastTest, FromNonReferenceToReference)
 
 TEST (MatcherCastTest, FromSameType)
 
 TEST (MatcherCastTest, FromAValue)
 
 TEST (MatcherCastTest, FromAnImplicitlyConvertibleValue)
 
 TEST (MatcherCastTest, NonImplicitlyConstructibleTypeWithOperatorEq)
 
bool operator== (const IntReferenceWrapper &a, const IntReferenceWrapper &b)
 
 TEST (MatcherCastTest, ValueIsNotCopied)
 
 TEST (SafeMatcherCastTest, FromPolymorphicMatcher)
 
 TEST (SafeMatcherCastTest, FromLosslesslyConvertibleArithmeticType)
 
 TEST (SafeMatcherCastTest, FromBaseClass)
 
 TEST (SafeMatcherCastTest, FromConstReferenceToReference)
 
 TEST (SafeMatcherCastTest, FromNonReferenceToConstReference)
 
 TEST (SafeMatcherCastTest, FromNonReferenceToReference)
 
 TEST (SafeMatcherCastTest, FromSameType)
 
 TEST (SafeMatcherCastTest, ValueIsNotCopied)
 
 TEST (ExpectThat, TakesLiterals)
 
 TEST (ExpectThat, TakesFunctions)
 
 TEST (ATest, MatchesAnyValue)
 
 TEST (ATest, WorksForDerivedClass)
 
 TEST (ATest, CanDescribeSelf)
 
 TEST (AnTest, MatchesAnyValue)
 
 TEST (AnTest, CanDescribeSelf)
 
 TEST (UnderscoreTest, MatchesAnyValue)
 
 TEST (UnderscoreTest, CanDescribeSelf)
 
 TEST (EqTest, MatchesEqualValue)
 
 TEST (EqTest, CanDescribeSelf)
 
 TEST (EqTest, IsPolymorphic)
 
 TEST (TypedEqTest, ChecksEqualityForGivenType)
 
 TEST (TypedEqTest, CanDescribeSelf)
 
 TEST (TypedEqTest, HasSpecifiedType)
 
 TEST (GeTest, ImplementsGreaterThanOrEqual)
 
 TEST (GeTest, CanDescribeSelf)
 
 TEST (GtTest, ImplementsGreaterThan)
 
 TEST (GtTest, CanDescribeSelf)
 
 TEST (LeTest, ImplementsLessThanOrEqual)
 
 TEST (LeTest, CanDescribeSelf)
 
 TEST (LtTest, ImplementsLessThan)
 
 TEST (LtTest, CanDescribeSelf)
 
 TEST (NeTest, ImplementsNotEqual)
 
 TEST (NeTest, CanDescribeSelf)
 
 TEST (IsNullTest, MatchesNullPointer)
 
 TEST (IsNullTest, LinkedPtr)
 
 TEST (IsNullTest, ReferenceToConstLinkedPtr)
 
 TEST (IsNullTest, CanDescribeSelf)
 
 TEST (NotNullTest, MatchesNonNullPointer)
 
 TEST (NotNullTest, LinkedPtr)
 
 TEST (NotNullTest, ReferenceToConstLinkedPtr)
 
 TEST (NotNullTest, CanDescribeSelf)
 
 TEST (RefTest, MatchesSameVariable)
 
 TEST (RefTest, CanDescribeSelf)
 
 TEST (RefTest, CanBeUsedAsMatcherForConstReference)
 
 TEST (RefTest, IsCovariant)
 
 TEST (RefTest, ExplainsResult)
 
 TEST (StrEqTest, MatchesEqualString)
 
 TEST (StrEqTest, CanDescribeSelf)
 
 TEST (StrNeTest, MatchesUnequalString)
 
 TEST (StrNeTest, CanDescribeSelf)
 
 TEST (StrCaseEqTest, MatchesEqualStringIgnoringCase)
 
 TEST (StrCaseEqTest, MatchesEqualStringWith0IgnoringCase)
 
 TEST (StrCaseEqTest, CanDescribeSelf)
 
 TEST (StrCaseNeTest, MatchesUnequalStringIgnoringCase)
 
 TEST (StrCaseNeTest, CanDescribeSelf)
 
 TEST (HasSubstrTest, WorksForStringClasses)
 
 TEST (HasSubstrTest, WorksForCStrings)
 
 TEST (HasSubstrTest, CanDescribeSelf)
 
 TEST (KeyTest, CanDescribeSelf)
 
 TEST (KeyTest, ExplainsResult)
 
 TEST (KeyTest, MatchesCorrectly)
 
 TEST (KeyTest, SafelyCastsInnerMatcher)
 
 TEST (KeyTest, InsideContainsUsingMap)
 
 TEST (KeyTest, InsideContainsUsingMultimap)
 
 TEST (PairTest, Typing)
 
 TEST (PairTest, CanDescribeSelf)
 
 TEST (PairTest, CanExplainMatchResultTo)
 
 TEST (PairTest, MatchesCorrectly)
 
 TEST (PairTest, SafelyCastsInnerMatchers)
 
 TEST (PairTest, InsideContainsUsingMap)
 
 TEST (StartsWithTest, MatchesStringWithGivenPrefix)
 
 TEST (StartsWithTest, CanDescribeSelf)
 
 TEST (EndsWithTest, MatchesStringWithGivenSuffix)
 
 TEST (EndsWithTest, CanDescribeSelf)
 
 TEST (MatchesRegexTest, MatchesStringMatchingGivenRegex)
 
 TEST (MatchesRegexTest, CanDescribeSelf)
 
 TEST (ContainsRegexTest, MatchesStringContainingGivenRegex)
 
 TEST (ContainsRegexTest, CanDescribeSelf)
 
 TEST (Eq2Test, MatchesEqualArguments)
 
 TEST (Eq2Test, CanDescribeSelf)
 
 TEST (Ge2Test, MatchesGreaterThanOrEqualArguments)
 
 TEST (Ge2Test, CanDescribeSelf)
 
 TEST (Gt2Test, MatchesGreaterThanArguments)
 
 TEST (Gt2Test, CanDescribeSelf)
 
 TEST (Le2Test, MatchesLessThanOrEqualArguments)
 
 TEST (Le2Test, CanDescribeSelf)
 
 TEST (Lt2Test, MatchesLessThanArguments)
 
 TEST (Lt2Test, CanDescribeSelf)
 
 TEST (Ne2Test, MatchesUnequalArguments)
 
 TEST (Ne2Test, CanDescribeSelf)
 
 TEST (FloatEq2Test, MatchesEqualArguments)
 
 TEST (FloatEq2Test, CanDescribeSelf)
 
 TEST (NanSensitiveFloatEqTest, MatchesEqualArgumentsWithNaN)
 
 TEST (NanSensitiveFloatEqTest, CanDescribeSelfWithNaNs)
 
 TEST (DoubleEq2Test, MatchesEqualArguments)
 
 TEST (DoubleEq2Test, CanDescribeSelf)
 
 TEST (NanSensitiveDoubleEqTest, MatchesEqualArgumentsWithNaN)
 
 TEST (NanSensitiveDoubleEqTest, CanDescribeSelfWithNaNs)
 
 TEST (FloatNear2Test, MatchesEqualArguments)
 
 TEST (FloatNear2Test, CanDescribeSelf)
 
 TEST (NanSensitiveFloatNearTest, MatchesNearbyArgumentsWithNaN)
 
 TEST (NanSensitiveFloatNearTest, CanDescribeSelfWithNaNs)
 
 TEST (DoubleNear2Test, MatchesEqualArguments)
 
 TEST (DoubleNear2Test, CanDescribeSelf)
 
 TEST (NanSensitiveDoubleNearTest, MatchesNearbyArgumentsWithNaN)
 
 TEST (NanSensitiveDoubleNearTest, CanDescribeSelfWithNaNs)
 
 TEST (NotTest, NegatesMatcher)
 
 TEST (NotTest, CanDescribeSelf)
 
 TEST (NotTest, NotMatcherSafelyCastsMonomorphicMatchers)
 
void AllOfMatches (int num, const Matcher< int > &m)
 
 TEST (AllOfTest, MatchesWhenAllMatch)
 
 TEST (AllOfTest, CanDescribeSelf)
 
 TEST (AllOfTest, CanDescribeNegation)
 
 TEST (AllOfTest, AllOfMatcherSafelyCastsMonomorphicMatchers)
 
 TEST (AllOfTest, ExplainsResult)
 
void AnyOfMatches (int num, const Matcher< int > &m)
 
 TEST (AnyOfTest, MatchesWhenAnyMatches)
 
 TEST (AnyOfTest, CanDescribeSelf)
 
 TEST (AnyOfTest, CanDescribeNegation)
 
 TEST (AnyOfTest, AnyOfMatcherSafelyCastsMonomorphicMatchers)
 
 TEST (AnyOfTest, ExplainsResult)
 
int IsPositive (double x)
 
bool ReferencesFooAndIsZero (const int &n)
 
 TEST (TrulyTest, MatchesWhatSatisfiesThePredicate)
 
 TEST (TrulyTest, CanBeUsedWithFunctor)
 
ConvertibleToBool IsNotZero (int number)
 
 TEST (TrulyTest, PredicateCanReturnAClassConvertibleToBool)
 
 TEST (TrulyTest, CanDescribeSelf)
 
 TEST (TrulyTest, WorksForByRefArguments)
 
 TEST (MatchesTest, IsSatisfiedByWhatMatchesTheMatcher)
 
 TEST (MatchesTest, WorksOnByRefArguments)
 
 TEST (MatchesTest, WorksWithMatcherOnNonRefType)
 
 TEST (ValueTest, WorksWithPolymorphicMatcher)
 
 TEST (ValueTest, WorksWithMonomorphicMatcher)
 
 TEST (ExplainMatchResultTest, WorksWithPolymorphicMatcher)
 
 TEST (ExplainMatchResultTest, WorksWithMonomorphicMatcher)
 
 MATCHER_P (Really, inner_matcher, "")
 
 TEST (ExplainMatchResultTest, WorksInsideMATCHER)
 
 TEST (DescribeMatcherTest, WorksWithValue)
 
 TEST (DescribeMatcherTest, WorksWithMonomorphicMatcher)
 
 TEST (DescribeMatcherTest, WorksWithPolymorphicMatcher)
 
 TEST (AllArgsTest, WorksForTuple)
 
 TEST (AllArgsTest, WorksForNonTuple)
 
 TEST (AllArgsTest, WorksInWithClause)
 
 TEST (AllArgsTest, WorksWithoutMatchers)
 
 TEST (MatcherAssertionTest, WorksWhenMatcherIsSatisfied)
 
 TEST (MatcherAssertionTest, WorksWhenMatcherIsNotSatisfied)
 
 TEST (MatcherAssertionTest, WorksForByRefArguments)
 
 TEST (MatcherAssertionTest, WorksForMonomorphicMatcher)
 
 TEST_F (FloatTest, FloatEqApproximatelyMatchesFloats)
 
 TEST_F (FloatTest, NanSensitiveFloatEqApproximatelyMatchesFloats)
 
 TEST_F (FloatTest, FloatEqCannotMatchNaN)
 
 TEST_F (FloatTest, NanSensitiveFloatEqCanMatchNaN)
 
 TEST_F (FloatTest, FloatEqCanDescribeSelf)
 
 TEST_F (FloatTest, NanSensitiveFloatEqCanDescribeSelf)
 
 TEST_F (FloatNearTest, FloatNearMatches)
 
 TEST_F (FloatNearTest, NanSensitiveFloatNearApproximatelyMatchesFloats)
 
 TEST_F (FloatNearTest, FloatNearCanDescribeSelf)
 
 TEST_F (FloatNearTest, NanSensitiveFloatNearCanDescribeSelf)
 
 TEST_F (FloatNearTest, FloatNearCannotMatchNaN)
 
 TEST_F (FloatNearTest, NanSensitiveFloatNearCanMatchNaN)
 
 TEST_F (DoubleTest, DoubleEqApproximatelyMatchesDoubles)
 
 TEST_F (DoubleTest, NanSensitiveDoubleEqApproximatelyMatchesDoubles)
 
 TEST_F (DoubleTest, DoubleEqCannotMatchNaN)
 
 TEST_F (DoubleTest, NanSensitiveDoubleEqCanMatchNaN)
 
 TEST_F (DoubleTest, DoubleEqCanDescribeSelf)
 
 TEST_F (DoubleTest, NanSensitiveDoubleEqCanDescribeSelf)
 
 TEST_F (DoubleNearTest, DoubleNearMatches)
 
 TEST_F (DoubleNearTest, NanSensitiveDoubleNearApproximatelyMatchesDoubles)
 
 TEST_F (DoubleNearTest, DoubleNearCanDescribeSelf)
 
 TEST_F (DoubleNearTest, ExplainsResultWhenMatchFails)
 
 TEST_F (DoubleNearTest, NanSensitiveDoubleNearCanDescribeSelf)
 
 TEST_F (DoubleNearTest, DoubleNearCannotMatchNaN)
 
 TEST_F (DoubleNearTest, NanSensitiveDoubleNearCanMatchNaN)
 
 TEST (PointeeTest, RawPointer)
 
 TEST (PointeeTest, RawPointerToConst)
 
 TEST (PointeeTest, ReferenceToConstRawPointer)
 
 TEST (PointeeTest, ReferenceToNonConstRawPointer)
 
 MATCHER_P (FieldIIs, inner_matcher, "")
 
 TEST (PointeeTest, WorksWithConstPropagatingPointers)
 
 TEST (PointeeTest, NeverMatchesNull)
 
 TEST (PointeeTest, MatchesAgainstAValue)
 
 TEST (PointeeTest, CanDescribeSelf)
 
 TEST (PointeeTest, CanExplainMatchResult)
 
 TEST (PointeeTest, AlwaysExplainsPointee)
 
bool ValueIsPositive (const Uncopyable &x)
 
 MATCHER_P (UncopyableIs, inner_matcher, "")
 
 TEST (FieldTest, WorksForNonConstField)
 
 TEST (FieldTest, WorksForConstField)
 
 TEST (FieldTest, WorksForUncopyableField)
 
 TEST (FieldTest, WorksForPointerField)
 
 TEST (FieldTest, WorksForByRefArgument)
 
 TEST (FieldTest, WorksForArgumentOfSubType)
 
 TEST (FieldTest, WorksForCompatibleMatcherType)
 
 TEST (FieldTest, CanDescribeSelf)
 
 TEST (FieldTest, CanDescribeSelfWithFieldName)
 
 TEST (FieldTest, CanExplainMatchResult)
 
 TEST (FieldTest, CanExplainMatchResultWithFieldName)
 
 TEST (FieldForPointerTest, WorksForPointerToConst)
 
 TEST (FieldForPointerTest, WorksForPointerToNonConst)
 
 TEST (FieldForPointerTest, WorksForReferenceToConstPointer)
 
 TEST (FieldForPointerTest, DoesNotMatchNull)
 
 TEST (FieldForPointerTest, WorksForArgumentOfSubType)
 
 TEST (FieldForPointerTest, CanDescribeSelf)
 
 TEST (FieldForPointerTest, CanDescribeSelfWithFieldName)
 
 TEST (FieldForPointerTest, CanExplainMatchResult)
 
 TEST (FieldForPointerTest, CanExplainMatchResultWithFieldName)
 
 TEST (PropertyTest, WorksForNonReferenceProperty)
 
 TEST (PropertyTest, WorksForReferenceToConstProperty)
 
 TEST (PropertyTest, WorksForReferenceToNonConstProperty)
 
 TEST (PropertyTest, WorksForByValueArgument)
 
 TEST (PropertyTest, WorksForArgumentOfSubType)
 
 TEST (PropertyTest, WorksForCompatibleMatcherType)
 
 TEST (PropertyTest, CanDescribeSelf)
 
 TEST (PropertyTest, CanDescribeSelfWithPropertyName)
 
 TEST (PropertyTest, CanExplainMatchResult)
 
 TEST (PropertyTest, CanExplainMatchResultWithPropertyName)
 
 TEST (PropertyForPointerTest, WorksForPointerToConst)
 
 TEST (PropertyForPointerTest, WorksForPointerToNonConst)
 
 TEST (PropertyForPointerTest, WorksForReferenceToConstPointer)
 
 TEST (PropertyForPointerTest, WorksForReferenceToNonConstProperty)
 
 TEST (PropertyForPointerTest, WorksForArgumentOfSubType)
 
 TEST (PropertyForPointerTest, CanDescribeSelf)
 
 TEST (PropertyForPointerTest, CanDescribeSelfWithPropertyDescription)
 
 TEST (PropertyForPointerTest, CanExplainMatchResult)
 
 TEST (PropertyForPointerTest, CanExplainMatchResultWithPropertyName)
 
std::string IntToStringFunction (int input)
 
 TEST (ResultOfTest, WorksForFunctionPointers)
 
 TEST (ResultOfTest, CanDescribeItself)
 
int IntFunction (int input)
 
 TEST (ResultOfTest, CanExplainMatchResult)
 
 TEST (ResultOfTest, WorksForNonReferenceResults)
 
double & DoubleFunction (double &input)
 
UncopyableRefUncopyableFunction (Uncopyable &obj)
 
 TEST (ResultOfTest, WorksForReferenceToNonConstResults)
 
const std::string & StringFunction (const std::string &input)
 
 TEST (ResultOfTest, WorksForReferenceToConstResults)
 
 TEST (ResultOfTest, WorksForCompatibleMatcherTypes)
 
 TEST (ResultOfDeathTest, DiesOnNullFunctionPointers)
 
 TEST (ResultOfTest, WorksForFunctionReferences)
 
 TEST (ResultOfTest, WorksForFunctors)
 
 TEST (ResultOfTest, WorksForPolymorphicFunctors)
 
const int * ReferencingFunction (const int &n)
 
 TEST (ResultOfTest, WorksForReferencingCallables)
 
PolymorphicMatcher< DivisibleByImplDivisibleBy (int n)
 
 TEST (ExplainMatchResultTest, AllOf_False_False)
 
 TEST (ExplainMatchResultTest, AllOf_False_True)
 
 TEST (ExplainMatchResultTest, AllOf_True_False)
 
 TEST (ExplainMatchResultTest, AllOf_True_True)
 
 TEST (ExplainMatchResultTest, AllOf_True_True_2)
 
 TEST (ExplainmatcherResultTest, MonomorphicMatcher)
 
 TEST (ByRefTest, AllowsNotCopyableConstValueInMatchers)
 
 TEST (ByRefTest, AllowsNotCopyableValueInMatchers)
 
 TEST (IsEmptyTest, ImplementsIsEmpty)
 
 TEST (IsEmptyTest, WorksWithString)
 
 TEST (IsEmptyTest, CanDescribeSelf)
 
 TEST (IsEmptyTest, ExplainsResult)
 
 TEST (IsTrueTest, IsTrueIsFalse)
 
 TEST (SizeIsTest, ImplementsSizeIs)
 
 TEST (SizeIsTest, WorksWithMap)
 
 TEST (SizeIsTest, WorksWithReferences)
 
 TEST (SizeIsTest, CanDescribeSelf)
 
 TEST (SizeIsTest, ExplainsResult)
 
 TEST (ContainerEqExtraTest, MultipleValuesMissing)
 
 TEST (ContainerEqExtraTest, MultipleValuesAdded)
 
 TEST (ContainerEqExtraTest, MultipleValuesAddedAndRemoved)
 
 TEST (ContainerEqExtraTest, MultiSetOfIntDuplicateDifference)
 
 TEST (ContainerEqExtraTest, WorksForMaps)
 
 TEST (ContainerEqExtraTest, WorksForNativeArray)
 
 TEST (ContainerEqExtraTest, WorksForTwoDimensionalNativeArray)
 
 TEST (ContainerEqExtraTest, WorksForNativeArrayAsTuple)
 
 TEST (ContainerEqExtraTest, CopiesNativeArrayParameter)
 
 TEST (WhenSortedByTest, WorksForEmptyContainer)
 
 TEST (WhenSortedByTest, WorksForNonEmptyContainer)
 
 TEST (WhenSortedByTest, WorksForNonVectorContainer)
 
 TEST (WhenSortedByTest, WorksForNativeArray)
 
 TEST (WhenSortedByTest, CanDescribeSelf)
 
 TEST (WhenSortedByTest, ExplainsMatchResult)
 
 TEST (WhenSortedTest, WorksForEmptyContainer)
 
 TEST (WhenSortedTest, WorksForNonEmptyContainer)
 
 TEST (WhenSortedTest, WorksForMapTypes)
 
 TEST (WhenSortedTest, WorksForMultiMapTypes)
 
 TEST (WhenSortedTest, WorksForPolymorphicMatcher)
 
 TEST (WhenSortedTest, WorksForVectorConstRefMatcher)
 
 TEST (StreamlikeTest, Iteration)
 
 TEST (BeginEndDistanceIsTest, WorksWithNonStdList)
 
 TEST (BeginEndDistanceIsTest, CanDescribeSelf)
 
 TEST (BeginEndDistanceIsTest, ExplainsResult)
 
 TEST (WhenSortedTest, WorksForStreamlike)
 
 TEST (WhenSortedTest, WorksForVectorConstRefMatcherOnStreamlike)
 
 TEST (IsSupersetOfTest, WorksForNativeArray)
 
 TEST (IsSupersetOfTest, WorksWithDuplicates)
 
 TEST (IsSupersetOfTest, WorksForEmpty)
 
 TEST (IsSupersetOfTest, WorksForStreamlike)
 
 TEST (IsSupersetOfTest, TakesStlContainer)
 
 TEST (IsSupersetOfTest, Describe)
 
 TEST (IsSupersetOfTest, DescribeNegation)
 
 TEST (IsSupersetOfTest, MatchAndExplain)
 
 TEST (IsSubsetOfTest, WorksForNativeArray)
 
 TEST (IsSubsetOfTest, WorksWithDuplicates)
 
 TEST (IsSubsetOfTest, WorksForEmpty)
 
 TEST (IsSubsetOfTest, WorksForStreamlike)
 
 TEST (IsSubsetOfTest, TakesStlContainer)
 
 TEST (IsSubsetOfTest, Describe)
 
 TEST (IsSubsetOfTest, DescribeNegation)
 
 TEST (IsSubsetOfTest, MatchAndExplain)
 
 TEST (ElemensAreStreamTest, WorksForStreamlike)
 
 TEST (ElemensAreArrayStreamTest, WorksForStreamlike)
 
 TEST (ElementsAreTest, WorksWithUncopyable)
 
 TEST (ElementsAreTest, TakesStlContainer)
 
 TEST (UnorderedElementsAreArrayTest, SucceedsWhenExpected)
 
 TEST (UnorderedElementsAreArrayTest, VectorBool)
 
 TEST (UnorderedElementsAreArrayTest, WorksForStreamlike)
 
 TEST (UnorderedElementsAreArrayTest, TakesStlContainer)
 
 TEST_F (UnorderedElementsAreTest, WorksWithUncopyable)
 
 TEST_F (UnorderedElementsAreTest, SucceedsWhenExpected)
 
 TEST_F (UnorderedElementsAreTest, FailsWhenAnElementMatchesNoMatcher)
 
 TEST_F (UnorderedElementsAreTest, WorksForStreamlike)
 
 TEST_F (UnorderedElementsAreTest, Performance)
 
 TEST_F (UnorderedElementsAreTest, PerformanceHalfStrict)
 
 TEST_F (UnorderedElementsAreTest, FailMessageCountWrong)
 
 TEST_F (UnorderedElementsAreTest, FailMessageCountWrongZero)
 
 TEST_F (UnorderedElementsAreTest, FailMessageUnmatchedMatchers)
 
 TEST_F (UnorderedElementsAreTest, FailMessageUnmatchedElements)
 
 TEST_F (UnorderedElementsAreTest, FailMessageUnmatchedMatcherAndElement)
 
 TEST_F (UnorderedElementsAreTest, FailMessageImperfectMatchOnly)
 
 TEST_F (UnorderedElementsAreTest, Describe)
 
 TEST_F (UnorderedElementsAreTest, DescribeNegation)
 
template<typename Graph >
ElementMatcherPairs FindBacktrackingMaxBPM (const Graph &g)
 
 TEST_P (BipartiteTest, Exhaustive)
 
 INSTANTIATE_TEST_CASE_P (AllGraphs, BipartiteTest, ::testing::Range(0, 5))
 
 TEST_F (BipartiteNonSquareTest, SimpleBacktracking)
 
 TEST_P (BipartiteNonSquareTest, Exhaustive)
 
 INSTANTIATE_TEST_CASE_P (AllGraphs, BipartiteNonSquareTest, testing::Values(std::make_pair(1, 2), std::make_pair(2, 1), std::make_pair(3, 2), std::make_pair(2, 3), std::make_pair(4, 1), std::make_pair(1, 4), std::make_pair(4, 3), std::make_pair(3, 4)))
 
 TEST_P (BipartiteRandomTest, LargerNets)
 
 INSTANTIATE_TEST_CASE_P (Samples, BipartiteRandomTest, testing::Values(std::make_pair(5, 10000), std::make_pair(6, 5000), std::make_pair(7, 2000), std::make_pair(8, 500), std::make_pair(9, 100)))
 
 TEST (IsReadableTypeNameTest, ReturnsTrueForShortNames)
 
 TEST (IsReadableTypeNameTest, ReturnsTrueForLongNonTemplateNonFunctionNames)
 
 TEST (IsReadableTypeNameTest, ReturnsFalseForLongTemplateNames)
 
 TEST (IsReadableTypeNameTest, ReturnsFalseForLongFunctionTypeNames)
 
 TEST (FormatMatcherDescriptionTest, WorksForEmptyDescription)
 
 TEST (PolymorphicMatcherTest, CanAccessMutableImpl)
 
 TEST (PolymorphicMatcherTest, CanAccessImpl)
 
 TEST (MatcherTupleTest, ExplainsMatchFailure)
 
 TEST (EachTest, ExplainsMatchResultCorrectly)
 
 TEST (EachTest, DescribesItselfCorrectly)
 
 TEST (EachTest, MatchesVectorWhenAllElementsMatch)
 
 TEST (EachTest, MatchesMapWhenAllElementsMatch)
 
 TEST (EachTest, AcceptsMatcher)
 
 TEST (EachTest, WorksForNativeArrayAsTuple)
 
PolymorphicMatcher< IsHalfOfMatcherIsHalfOf ()
 
 TEST (PointwiseTest, DescribesSelf)
 
 TEST (PointwiseTest, MakesCopyOfRhs)
 
 TEST (PointwiseTest, WorksForLhsNativeArray)
 
 TEST (PointwiseTest, WorksForRhsNativeArray)
 
 TEST (PointwiseTest, WorksForVectorOfBool)
 
 TEST (PointwiseTest, RejectsWrongSize)
 
 TEST (PointwiseTest, RejectsWrongContent)
 
 TEST (PointwiseTest, AcceptsCorrectContent)
 
 TEST (PointwiseTest, AllowsMonomorphicInnerMatcher)
 
 TEST (UnorderedPointwiseTest, DescribesSelf)
 
 TEST (UnorderedPointwiseTest, MakesCopyOfRhs)
 
 TEST (UnorderedPointwiseTest, WorksForLhsNativeArray)
 
 TEST (UnorderedPointwiseTest, WorksForRhsNativeArray)
 
 TEST (UnorderedPointwiseTest, RejectsWrongSize)
 
 TEST (UnorderedPointwiseTest, RejectsWrongContent)
 
 TEST (UnorderedPointwiseTest, AcceptsCorrectContentInSameOrder)
 
 TEST (UnorderedPointwiseTest, AcceptsCorrectContentInDifferentOrder)
 
 TEST (UnorderedPointwiseTest, AllowsMonomorphicInnerMatcher)
 
 TEST (OptionalTest, DescribesSelf)
 
 TEST (OptionalTest, ExplainsSelf)
 
 TEST (OptionalTest, MatchesNonEmptyOptional)
 
 TEST (OptionalTest, DoesNotMatchNullopt)
 
 TEST (VariantTest, DescribesSelf)
 
 TEST (VariantTest, ExplainsSelf)
 
 TEST (VariantTest, FullMatch)
 
 TEST (VariantTest, TypeDoesNotMatch)
 
 TEST (VariantTest, InnerDoesNotMatch)
 
 TEST (AnyWithTest, FullMatch)
 
 TEST (AnyWithTest, TestBadCastType)
 
 TEST (AnyWithTest, TestCompare)
 
 TEST (AnyWithTest, DescribesSelf)
 
 TEST (AnyWithTest, ExplainsSelf)
 

Variables

const int g_bar = 1
 
const int foo = 0
 

Typedef Documentation

◆ DoubleNearTest

◆ DoubleTest

◆ FloatNearTest

◆ FloatTest

◆ Tuple2

typedef ::testing::tuple<long, int> testing::gmock_matchers_test::Tuple2

Definition at line 2225 of file gmock-matchers_test.cc.

Function Documentation

◆ AllOfMatches()

void testing::gmock_matchers_test::AllOfMatches ( int num,
const Matcher< int > & m )

Definition at line 2485 of file gmock-matchers_test.cc.

2485 {
2487 EXPECT_TRUE(m.Matches(0));
2488 for (int i = 1; i <= num; ++i) {
2489 EXPECT_FALSE(m.Matches(i));
2490 }
2491 EXPECT_TRUE(m.Matches(num + 1));
2492}
bool Matches(GTEST_REFERENCE_TO_CONST_(T) x) const
#define SCOPED_TRACE(message)
Definition gtest.h:2202
#define EXPECT_TRUE(condition)
Definition gtest.h:1895
#define EXPECT_FALSE(condition)
Definition gtest.h:1898
std::string Describe(const Matcher< T > &m)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AnyOfMatches()

void testing::gmock_matchers_test::AnyOfMatches ( int num,
const Matcher< int > & m )

Definition at line 2683 of file gmock-matchers_test.cc.

2683 {
2685 EXPECT_FALSE(m.Matches(0));
2686 for (int i = 1; i <= num; ++i) {
2687 EXPECT_TRUE(m.Matches(i));
2688 }
2689 EXPECT_FALSE(m.Matches(num + 1));
2690}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Describe()

template<typename T >
std::string testing::gmock_matchers_test::Describe ( const Matcher< T > & m)

Definition at line 201 of file gmock-matchers_test.cc.

201 {
202 return DescribeMatcher<T>(m);
203}
Here is the call graph for this function:

◆ DescribeNegation()

template<typename T >
std::string testing::gmock_matchers_test::DescribeNegation ( const Matcher< T > & m)

Definition at line 207 of file gmock-matchers_test.cc.

207 {
208 return DescribeMatcher<T>(m, true);
209}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DivisibleBy()

PolymorphicMatcher< DivisibleByImpl > testing::gmock_matchers_test::DivisibleBy ( int n)

Definition at line 4639 of file gmock-matchers_test.cc.

4639 {
4640 return MakePolymorphicMatcher(DivisibleByImpl(n));
4641}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoubleFunction()

double & testing::gmock_matchers_test::DoubleFunction ( double & input)

Definition at line 4493 of file gmock-matchers_test.cc.

4493{ return input; } // NOLINT
Here is the caller graph for this function:

◆ Explain()

template<typename MatcherType , typename Value >
std::string testing::gmock_matchers_test::Explain ( const MatcherType & m,
const Value & x )

Definition at line 213 of file gmock-matchers_test.cc.

213 {
215 ExplainMatchResult(m, x, &listener);
216 return listener.str();
217}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindBacktrackingMaxBPM()

template<typename Graph >
ElementMatcherPairs testing::gmock_matchers_test::FindBacktrackingMaxBPM ( const Graph & g)

Definition at line 6024 of file gmock-matchers_test.cc.

6024 {
6025 return BacktrackingMaxBPMState<Graph>(&g).Compute();
6026}
Here is the caller graph for this function:

◆ GreaterThan()

Matcher< int > testing::gmock_matchers_test::GreaterThan ( int n)

Definition at line 187 of file gmock-matchers_test.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ INSTANTIATE_TEST_CASE_P() [1/3]

testing::gmock_matchers_test::INSTANTIATE_TEST_CASE_P ( AllGraphs ,
BipartiteNonSquareTest ,
testing::Values(std::make_pair(1, 2), std::make_pair(2, 1), std::make_pair(3, 2), std::make_pair(2, 3), std::make_pair(4, 1), std::make_pair(1, 4), std::make_pair(4, 3), std::make_pair(3, 4))  )

◆ INSTANTIATE_TEST_CASE_P() [2/3]

testing::gmock_matchers_test::INSTANTIATE_TEST_CASE_P ( AllGraphs ,
BipartiteTest ,
::testing::Range(0, 5)  )

◆ INSTANTIATE_TEST_CASE_P() [3/3]

testing::gmock_matchers_test::INSTANTIATE_TEST_CASE_P ( Samples ,
BipartiteRandomTest ,
testing::Values(std::make_pair(5, 10000), std::make_pair(6, 5000), std::make_pair(7, 2000), std::make_pair(8, 500), std::make_pair(9, 100))  )

◆ IntFunction()

int testing::gmock_matchers_test::IntFunction ( int input)

Definition at line 4470 of file gmock-matchers_test.cc.

4470{ return input == 42 ? 80 : 90; }
Here is the caller graph for this function:

◆ IntToStringFunction()

std::string testing::gmock_matchers_test::IntToStringFunction ( int input)

Definition at line 4448 of file gmock-matchers_test.cc.

4448 {
4449 return input == 1 ? "foo" : "bar";
4450}
Here is the caller graph for this function:

◆ IsHalfOf()

PolymorphicMatcher< IsHalfOfMatcher > testing::gmock_matchers_test::IsHalfOf ( )

Definition at line 6344 of file gmock-matchers_test.cc.

6344 {
6345 return MakePolymorphicMatcher(IsHalfOfMatcher());
6346}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsNotZero()

ConvertibleToBool testing::gmock_matchers_test::IsNotZero ( int number)

Definition at line 2951 of file gmock-matchers_test.cc.

◆ IsPositive()

int testing::gmock_matchers_test::IsPositive ( double x)

Definition at line 2901 of file gmock-matchers_test.cc.

2901 {
2902 return x > 0 ? 1 : 0;
2903}
Here is the caller graph for this function:

◆ IsPositiveIntValue()

bool testing::gmock_matchers_test::IsPositiveIntValue ( const IntValue & foo)

Definition at line 632 of file gmock-matchers_test.cc.

632 {
633 return foo.value() > 0;
634}
Here is the caller graph for this function:

◆ MATCHER_P() [1/3]

testing::gmock_matchers_test::MATCHER_P ( FieldIIs ,
inner_matcher ,
""  )

Definition at line 3703 of file gmock-matchers_test.cc.

3703 {
3704 return ExplainMatchResult(inner_matcher, arg.i, result_listener);
3705}
Here is the call graph for this function:

◆ MATCHER_P() [2/3]

testing::gmock_matchers_test::MATCHER_P ( Really ,
inner_matcher ,
""  )

Definition at line 3044 of file gmock-matchers_test.cc.

3044 {
3045 return ExplainMatchResult(inner_matcher, arg, result_listener);
3046}
Here is the call graph for this function:

◆ MATCHER_P() [3/3]

testing::gmock_matchers_test::MATCHER_P ( UncopyableIs ,
inner_matcher ,
""  )

Definition at line 3890 of file gmock-matchers_test.cc.

3890 {
3891 return ExplainMatchResult(inner_matcher, arg.value(), result_listener);
3892}
Here is the call graph for this function:

◆ OfType()

std::string testing::gmock_matchers_test::OfType ( const std::string & type_name)

Definition at line 191 of file gmock-matchers_test.cc.

191 {
192#if GTEST_HAS_RTTI
193 return " (of type " + type_name + ")";
194#else
195 return "";
196#endif
197}
Here is the caller graph for this function:

◆ operator==()

bool testing::gmock_matchers_test::operator== ( const IntReferenceWrapper & a,
const IntReferenceWrapper & b )

Definition at line 799 of file gmock-matchers_test.cc.

799 {
800 return a.value == b.value;
801}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181

◆ PolymorphicIsEven()

PolymorphicMatcher< PolymorphicIsEvenImpl > testing::gmock_matchers_test::PolymorphicIsEven ( )

Definition at line 584 of file gmock-matchers_test.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReferencesBarOrIsZero()

PolymorphicMatcher< ReferencesBarOrIsZeroImpl > testing::gmock_matchers_test::ReferencesBarOrIsZero ( )

Definition at line 541 of file gmock-matchers_test.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReferencesFooAndIsZero()

bool testing::gmock_matchers_test::ReferencesFooAndIsZero ( const int & n)

Definition at line 2922 of file gmock-matchers_test.cc.

2922 {
2923 return (&n == &foo) && (n == 0);
2924}
Here is the caller graph for this function:

◆ ReferencingFunction()

const int * testing::gmock_matchers_test::ReferencingFunction ( const int & n)

Definition at line 4593 of file gmock-matchers_test.cc.

4593{ return &n; }
Here is the caller graph for this function:

◆ RefUncopyableFunction()

Uncopyable & testing::gmock_matchers_test::RefUncopyableFunction ( Uncopyable & obj)

Definition at line 4495 of file gmock-matchers_test.cc.

4495 { // NOLINT
4496 return obj;
4497}
Here is the caller graph for this function:

◆ StringFunction()

const std::string & testing::gmock_matchers_test::StringFunction ( const std::string & input)

Definition at line 4519 of file gmock-matchers_test.cc.

4519{ return input; }
Here is the caller graph for this function:

◆ TEST() [1/350]

testing::gmock_matchers_test::TEST ( AllArgsTest ,
WorksForNonTuple  )

Definition at line 3073 of file gmock-matchers_test.cc.

3073 {
3074 EXPECT_THAT(42, AllArgs(Gt(0)));
3075 EXPECT_THAT('a', Not(AllArgs(Eq('b'))));
3076}
#define EXPECT_THAT(value, matcher)
Here is the call graph for this function:

◆ TEST() [2/350]

testing::gmock_matchers_test::TEST ( AllArgsTest ,
WorksForTuple  )

Definition at line 3068 of file gmock-matchers_test.cc.

3068 {
3069 EXPECT_THAT(make_tuple(1, 2L), AllArgs(Lt()));
3070 EXPECT_THAT(make_tuple(2L, 1), Not(AllArgs(Lt())));
3071}
Here is the call graph for this function:

◆ TEST() [3/350]

testing::gmock_matchers_test::TEST ( AllArgsTest ,
WorksInWithClause  )

Definition at line 3088 of file gmock-matchers_test.cc.

3088 {
3089 AllArgsHelper helper;
3090 ON_CALL(helper, Helper(_, _))
3091 .With(AllArgs(Lt()))
3092 .WillByDefault(Return(1));
3093 EXPECT_CALL(helper, Helper(_, _));
3094 EXPECT_CALL(helper, Helper(_, _))
3095 .With(AllArgs(Gt()))
3096 .WillOnce(Return(2));
3097
3098 EXPECT_EQ(1, helper.Helper('\1', 2));
3099 EXPECT_EQ(2, helper.Helper('a', 1));
3100}
#define EXPECT_CALL(obj, call)
#define ON_CALL(obj, call)
#define EXPECT_EQ(val1, val2)
Definition gtest.h:1954
Here is the call graph for this function:

◆ TEST() [4/350]

testing::gmock_matchers_test::TEST ( AllArgsTest ,
WorksWithoutMatchers  )

Definition at line 3119 of file gmock-matchers_test.cc.

3119 {
3121
3122 ON_CALL(helper, NoArgs).WillByDefault(Return(10));
3123 ON_CALL(helper, OneArg).WillByDefault(Return(20));
3124 ON_CALL(helper, TwoArgs).WillByDefault(Return(30));
3125
3126 EXPECT_EQ(10, helper.NoArgs());
3127 EXPECT_EQ(20, helper.OneArg(1));
3128 EXPECT_EQ(30, helper.TwoArgs('\1', 2));
3129
3130 EXPECT_CALL(helper, NoArgs).Times(1);
3131 EXPECT_CALL(helper, OneArg).WillOnce(Return(100));
3132 EXPECT_CALL(helper, OneArg(17)).WillOnce(Return(200));
3133 EXPECT_CALL(helper, TwoArgs).Times(0);
3134
3135 EXPECT_EQ(10, helper.NoArgs());
3136 EXPECT_EQ(100, helper.OneArg(1));
3137 EXPECT_EQ(200, helper.OneArg(17));
3138}
Here is the call graph for this function:

◆ TEST() [5/350]

testing::gmock_matchers_test::TEST ( AllOfTest ,
AllOfMatcherSafelyCastsMonomorphicMatchers  )

Definition at line 2625 of file gmock-matchers_test.cc.

2625 {
2626 // greater_than_5 and less_than_10 are monomorphic matchers.
2627 Matcher<int> greater_than_5 = Gt(5);
2628 Matcher<int> less_than_10 = Lt(10);
2629
2630 Matcher<const int&> m = AllOf(greater_than_5, less_than_10);
2631 Matcher<int&> m2 = AllOf(greater_than_5, less_than_10);
2632 Matcher<int&> m3 = AllOf(greater_than_5, m2);
2633
2634 // Tests that BothOf works when composing itself.
2635 Matcher<const int&> m4 = AllOf(greater_than_5, less_than_10, less_than_10);
2636 Matcher<int&> m5 = AllOf(greater_than_5, less_than_10, less_than_10);
2637}
Here is the call graph for this function:

◆ TEST() [6/350]

testing::gmock_matchers_test::TEST ( AllOfTest ,
CanDescribeNegation  )

Definition at line 2593 of file gmock-matchers_test.cc.

2593 {
2594 Matcher<int> m;
2595 m = AllOf(Le(2), Ge(1));
2596 EXPECT_EQ("(isn't <= 2) or "
2597 "(isn't >= 1)",
2598 DescribeNegation(m));
2599
2600 m = AllOf(Gt(0), Ne(1), Ne(2));
2601 EXPECT_EQ("(isn't > 0) or "
2602 "((is equal to 1) or "
2603 "(is equal to 2))",
2604 DescribeNegation(m));
2605
2606
2607 m = AllOf(Gt(0), Ne(1), Ne(2), Ne(3));
2608 EXPECT_EQ("((isn't > 0) or "
2609 "(is equal to 1)) or "
2610 "((is equal to 2) or "
2611 "(is equal to 3))",
2612 DescribeNegation(m));
2613
2614
2615 m = AllOf(Ge(0), Lt(10), Ne(3), Ne(5), Ne(7));
2616 EXPECT_EQ("((isn't >= 0) or "
2617 "(isn't < 10)) or "
2618 "((is equal to 3) or "
2619 "((is equal to 5) or "
2620 "(is equal to 7)))",
2621 DescribeNegation(m));
2622}
std::string DescribeNegation(const Matcher< T > &m)
Here is the call graph for this function:

◆ TEST() [7/350]

testing::gmock_matchers_test::TEST ( AllOfTest ,
CanDescribeSelf  )

Definition at line 2563 of file gmock-matchers_test.cc.

2563 {
2564 Matcher<int> m;
2565 m = AllOf(Le(2), Ge(1));
2566 EXPECT_EQ("(is <= 2) and (is >= 1)", Describe(m));
2567
2568 m = AllOf(Gt(0), Ne(1), Ne(2));
2569 EXPECT_EQ("(is > 0) and "
2570 "((isn't equal to 1) and "
2571 "(isn't equal to 2))",
2572 Describe(m));
2573
2574
2575 m = AllOf(Gt(0), Ne(1), Ne(2), Ne(3));
2576 EXPECT_EQ("((is > 0) and "
2577 "(isn't equal to 1)) and "
2578 "((isn't equal to 2) and "
2579 "(isn't equal to 3))",
2580 Describe(m));
2581
2582
2583 m = AllOf(Ge(0), Lt(10), Ne(3), Ne(5), Ne(7));
2584 EXPECT_EQ("((is >= 0) and "
2585 "(is < 10)) and "
2586 "((isn't equal to 3) and "
2587 "((isn't equal to 5) and "
2588 "(isn't equal to 7)))",
2589 Describe(m));
2590}
Here is the call graph for this function:

◆ TEST() [8/350]

testing::gmock_matchers_test::TEST ( AllOfTest ,
ExplainsResult  )

Definition at line 2639 of file gmock-matchers_test.cc.

2639 {
2640 Matcher<int> m;
2641
2642 // Successful match. Both matchers need to explain. The second
2643 // matcher doesn't give an explanation, so only the first matcher's
2644 // explanation is printed.
2645 m = AllOf(GreaterThan(10), Lt(30));
2646 EXPECT_EQ("which is 15 more than 10", Explain(m, 25));
2647
2648 // Successful match. Both matchers need to explain.
2649 m = AllOf(GreaterThan(10), GreaterThan(20));
2650 EXPECT_EQ("which is 20 more than 10, and which is 10 more than 20",
2651 Explain(m, 30));
2652
2653 // Successful match. All matchers need to explain. The second
2654 // matcher doesn't given an explanation.
2655 m = AllOf(GreaterThan(10), Lt(30), GreaterThan(20));
2656 EXPECT_EQ("which is 15 more than 10, and which is 5 more than 20",
2657 Explain(m, 25));
2658
2659 // Successful match. All matchers need to explain.
2660 m = AllOf(GreaterThan(10), GreaterThan(20), GreaterThan(30));
2661 EXPECT_EQ("which is 30 more than 10, and which is 20 more than 20, "
2662 "and which is 10 more than 30",
2663 Explain(m, 40));
2664
2665 // Failed match. The first matcher, which failed, needs to
2666 // explain.
2667 m = AllOf(GreaterThan(10), GreaterThan(20));
2668 EXPECT_EQ("which is 5 less than 10", Explain(m, 5));
2669
2670 // Failed match. The second matcher, which failed, needs to
2671 // explain. Since it doesn't given an explanation, nothing is
2672 // printed.
2673 m = AllOf(GreaterThan(10), Lt(30));
2674 EXPECT_EQ("", Explain(m, 40));
2675
2676 // Failed match. The second matcher, which failed, needs to
2677 // explain.
2678 m = AllOf(GreaterThan(10), GreaterThan(20));
2679 EXPECT_EQ("which is 5 less than 20", Explain(m, 15));
2680}
std::string Explain(const MatcherType &m, const Value &x)
Here is the call graph for this function:

◆ TEST() [9/350]

testing::gmock_matchers_test::TEST ( AllOfTest ,
MatchesWhenAllMatch  )

Definition at line 2496 of file gmock-matchers_test.cc.

2496 {
2497 Matcher<int> m;
2498 m = AllOf(Le(2), Ge(1));
2499 EXPECT_TRUE(m.Matches(1));
2500 EXPECT_TRUE(m.Matches(2));
2501 EXPECT_FALSE(m.Matches(0));
2502 EXPECT_FALSE(m.Matches(3));
2503
2504 m = AllOf(Gt(0), Ne(1), Ne(2));
2505 EXPECT_TRUE(m.Matches(3));
2506 EXPECT_FALSE(m.Matches(2));
2507 EXPECT_FALSE(m.Matches(1));
2508 EXPECT_FALSE(m.Matches(0));
2509
2510 m = AllOf(Gt(0), Ne(1), Ne(2), Ne(3));
2511 EXPECT_TRUE(m.Matches(4));
2512 EXPECT_FALSE(m.Matches(3));
2513 EXPECT_FALSE(m.Matches(2));
2514 EXPECT_FALSE(m.Matches(1));
2515 EXPECT_FALSE(m.Matches(0));
2516
2517 m = AllOf(Ge(0), Lt(10), Ne(3), Ne(5), Ne(7));
2518 EXPECT_TRUE(m.Matches(0));
2519 EXPECT_TRUE(m.Matches(1));
2520 EXPECT_FALSE(m.Matches(3));
2521
2522 // The following tests for varying number of sub-matchers. Due to the way
2523 // the sub-matchers are handled it is enough to test every sub-matcher once
2524 // with sub-matchers using the same matcher type. Varying matcher types are
2525 // checked for above.
2526 AllOfMatches(2, AllOf(Ne(1), Ne(2)));
2527 AllOfMatches(3, AllOf(Ne(1), Ne(2), Ne(3)));
2528 AllOfMatches(4, AllOf(Ne(1), Ne(2), Ne(3), Ne(4)));
2529 AllOfMatches(5, AllOf(Ne(1), Ne(2), Ne(3), Ne(4), Ne(5)));
2530 AllOfMatches(6, AllOf(Ne(1), Ne(2), Ne(3), Ne(4), Ne(5), Ne(6)));
2531 AllOfMatches(7, AllOf(Ne(1), Ne(2), Ne(3), Ne(4), Ne(5), Ne(6), Ne(7)));
2532 AllOfMatches(8, AllOf(Ne(1), Ne(2), Ne(3), Ne(4), Ne(5), Ne(6), Ne(7),
2533 Ne(8)));
2534 AllOfMatches(9, AllOf(Ne(1), Ne(2), Ne(3), Ne(4), Ne(5), Ne(6), Ne(7),
2535 Ne(8), Ne(9)));
2536 AllOfMatches(10, AllOf(Ne(1), Ne(2), Ne(3), Ne(4), Ne(5), Ne(6), Ne(7), Ne(8),
2537 Ne(9), Ne(10)));
2538}
void AllOfMatches(int num, const Matcher< int > &m)
Here is the call graph for this function:

◆ TEST() [10/350]

testing::gmock_matchers_test::TEST ( AnTest ,
CanDescribeSelf  )

Definition at line 984 of file gmock-matchers_test.cc.

984 {
985 EXPECT_EQ("is anything", Describe(An<int>()));
986}
Here is the call graph for this function:

◆ TEST() [11/350]

testing::gmock_matchers_test::TEST ( AnTest ,
MatchesAnyValue  )

Definition at line 969 of file gmock-matchers_test.cc.

969 {
970 // Tests a matcher for a value type.
971 Matcher<int> m1 = An<int>();
972 EXPECT_TRUE(m1.Matches(9143));
973 EXPECT_TRUE(m1.Matches(-1532));
974
975 // Tests a matcher for a reference type.
976 int a = 2;
977 int b = -6;
978 Matcher<int&> m2 = An<int&>();
979 EXPECT_TRUE(m2.Matches(a));
980 EXPECT_TRUE(m2.Matches(b));
981}
Here is the call graph for this function:

◆ TEST() [12/350]

testing::gmock_matchers_test::TEST ( AnyOfTest ,
AnyOfMatcherSafelyCastsMonomorphicMatchers  )

Definition at line 2837 of file gmock-matchers_test.cc.

2837 {
2838 // greater_than_5 and less_than_10 are monomorphic matchers.
2839 Matcher<int> greater_than_5 = Gt(5);
2840 Matcher<int> less_than_10 = Lt(10);
2841
2842 Matcher<const int&> m = AnyOf(greater_than_5, less_than_10);
2843 Matcher<int&> m2 = AnyOf(greater_than_5, less_than_10);
2844 Matcher<int&> m3 = AnyOf(greater_than_5, m2);
2845
2846 // Tests that EitherOf works when composing itself.
2847 Matcher<const int&> m4 = AnyOf(greater_than_5, less_than_10, less_than_10);
2848 Matcher<int&> m5 = AnyOf(greater_than_5, less_than_10, less_than_10);
2849}
Here is the call graph for this function:

◆ TEST() [13/350]

testing::gmock_matchers_test::TEST ( AnyOfTest ,
CanDescribeNegation  )

Definition at line 2809 of file gmock-matchers_test.cc.

2809 {
2810 Matcher<int> m;
2811 m = AnyOf(Le(1), Ge(3));
2812 EXPECT_EQ("(isn't <= 1) and (isn't >= 3)",
2813 DescribeNegation(m));
2814
2815 m = AnyOf(Lt(0), Eq(1), Eq(2));
2816 EXPECT_EQ("(isn't < 0) and "
2817 "((isn't equal to 1) and (isn't equal to 2))",
2818 DescribeNegation(m));
2819
2820 m = AnyOf(Lt(0), Eq(1), Eq(2), Eq(3));
2821 EXPECT_EQ("((isn't < 0) and "
2822 "(isn't equal to 1)) and "
2823 "((isn't equal to 2) and "
2824 "(isn't equal to 3))",
2825 DescribeNegation(m));
2826
2827 m = AnyOf(Le(0), Gt(10), 3, 5, 7);
2828 EXPECT_EQ("((isn't <= 0) and "
2829 "(isn't > 10)) and "
2830 "((isn't equal to 3) and "
2831 "((isn't equal to 5) and "
2832 "(isn't equal to 7)))",
2833 DescribeNegation(m));
2834}
Here is the call graph for this function:

◆ TEST() [14/350]

testing::gmock_matchers_test::TEST ( AnyOfTest ,
CanDescribeSelf  )

Definition at line 2781 of file gmock-matchers_test.cc.

2781 {
2782 Matcher<int> m;
2783 m = AnyOf(Le(1), Ge(3));
2784 EXPECT_EQ("(is <= 1) or (is >= 3)",
2785 Describe(m));
2786
2787 m = AnyOf(Lt(0), Eq(1), Eq(2));
2788 EXPECT_EQ("(is < 0) or "
2789 "((is equal to 1) or (is equal to 2))",
2790 Describe(m));
2791
2792 m = AnyOf(Lt(0), Eq(1), Eq(2), Eq(3));
2793 EXPECT_EQ("((is < 0) or "
2794 "(is equal to 1)) or "
2795 "((is equal to 2) or "
2796 "(is equal to 3))",
2797 Describe(m));
2798
2799 m = AnyOf(Le(0), Gt(10), 3, 5, 7);
2800 EXPECT_EQ("((is <= 0) or "
2801 "(is > 10)) or "
2802 "((is equal to 3) or "
2803 "((is equal to 5) or "
2804 "(is equal to 7)))",
2805 Describe(m));
2806}
Here is the call graph for this function:

◆ TEST() [15/350]

testing::gmock_matchers_test::TEST ( AnyOfTest ,
ExplainsResult  )

Definition at line 2851 of file gmock-matchers_test.cc.

2851 {
2852 Matcher<int> m;
2853
2854 // Failed match. Both matchers need to explain. The second
2855 // matcher doesn't give an explanation, so only the first matcher's
2856 // explanation is printed.
2857 m = AnyOf(GreaterThan(10), Lt(0));
2858 EXPECT_EQ("which is 5 less than 10", Explain(m, 5));
2859
2860 // Failed match. Both matchers need to explain.
2861 m = AnyOf(GreaterThan(10), GreaterThan(20));
2862 EXPECT_EQ("which is 5 less than 10, and which is 15 less than 20",
2863 Explain(m, 5));
2864
2865 // Failed match. All matchers need to explain. The second
2866 // matcher doesn't given an explanation.
2867 m = AnyOf(GreaterThan(10), Gt(20), GreaterThan(30));
2868 EXPECT_EQ("which is 5 less than 10, and which is 25 less than 30",
2869 Explain(m, 5));
2870
2871 // Failed match. All matchers need to explain.
2872 m = AnyOf(GreaterThan(10), GreaterThan(20), GreaterThan(30));
2873 EXPECT_EQ("which is 5 less than 10, and which is 15 less than 20, "
2874 "and which is 25 less than 30",
2875 Explain(m, 5));
2876
2877 // Successful match. The first matcher, which succeeded, needs to
2878 // explain.
2879 m = AnyOf(GreaterThan(10), GreaterThan(20));
2880 EXPECT_EQ("which is 5 more than 10", Explain(m, 15));
2881
2882 // Successful match. The second matcher, which succeeded, needs to
2883 // explain. Since it doesn't given an explanation, nothing is
2884 // printed.
2885 m = AnyOf(GreaterThan(10), Lt(30));
2886 EXPECT_EQ("", Explain(m, 0));
2887
2888 // Successful match. The second matcher, which succeeded, needs to
2889 // explain.
2890 m = AnyOf(GreaterThan(30), GreaterThan(20));
2891 EXPECT_EQ("which is 5 more than 20", Explain(m, 25));
2892}
Here is the call graph for this function:

◆ TEST() [16/350]

testing::gmock_matchers_test::TEST ( AnyOfTest ,
MatchesWhenAnyMatches  )

Definition at line 2694 of file gmock-matchers_test.cc.

2694 {
2695 Matcher<int> m;
2696 m = AnyOf(Le(1), Ge(3));
2697 EXPECT_TRUE(m.Matches(1));
2698 EXPECT_TRUE(m.Matches(4));
2699 EXPECT_FALSE(m.Matches(2));
2700
2701 m = AnyOf(Lt(0), Eq(1), Eq(2));
2702 EXPECT_TRUE(m.Matches(-1));
2703 EXPECT_TRUE(m.Matches(1));
2704 EXPECT_TRUE(m.Matches(2));
2705 EXPECT_FALSE(m.Matches(0));
2706
2707 m = AnyOf(Lt(0), Eq(1), Eq(2), Eq(3));
2708 EXPECT_TRUE(m.Matches(-1));
2709 EXPECT_TRUE(m.Matches(1));
2710 EXPECT_TRUE(m.Matches(2));
2711 EXPECT_TRUE(m.Matches(3));
2712 EXPECT_FALSE(m.Matches(0));
2713
2714 m = AnyOf(Le(0), Gt(10), 3, 5, 7);
2715 EXPECT_TRUE(m.Matches(0));
2716 EXPECT_TRUE(m.Matches(11));
2717 EXPECT_TRUE(m.Matches(3));
2718 EXPECT_FALSE(m.Matches(2));
2719
2720 // The following tests for varying number of sub-matchers. Due to the way
2721 // the sub-matchers are handled it is enough to test every sub-matcher once
2722 // with sub-matchers using the same matcher type. Varying matcher types are
2723 // checked for above.
2724 AnyOfMatches(2, AnyOf(1, 2));
2725 AnyOfMatches(3, AnyOf(1, 2, 3));
2726 AnyOfMatches(4, AnyOf(1, 2, 3, 4));
2727 AnyOfMatches(5, AnyOf(1, 2, 3, 4, 5));
2728 AnyOfMatches(6, AnyOf(1, 2, 3, 4, 5, 6));
2729 AnyOfMatches(7, AnyOf(1, 2, 3, 4, 5, 6, 7));
2730 AnyOfMatches(8, AnyOf(1, 2, 3, 4, 5, 6, 7, 8));
2731 AnyOfMatches(9, AnyOf(1, 2, 3, 4, 5, 6, 7, 8, 9));
2732 AnyOfMatches(10, AnyOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
2733}
void AnyOfMatches(int num, const Matcher< int > &m)
Here is the call graph for this function:

◆ TEST() [17/350]

testing::gmock_matchers_test::TEST ( AnyWithTest ,
DescribesSelf  )

Definition at line 6734 of file gmock-matchers_test.cc.

6734 {
6735 const Matcher<const SampleAnyType&> m = AnyWith<int>(Eq(1));
6736 EXPECT_THAT(Describe(m), ContainsRegex("is an 'any' type with value of type "
6737 "'.*' and the value is equal to 1"));
6738}
Here is the call graph for this function:

◆ TEST() [18/350]

testing::gmock_matchers_test::TEST ( AnyWithTest ,
ExplainsSelf  )

Definition at line 6740 of file gmock-matchers_test.cc.

6740 {
6741 const Matcher<const SampleAnyType&> m = AnyWith<int>(Eq(1));
6742
6743 EXPECT_THAT(Explain(m, SampleAnyType(1)), ContainsRegex("whose value 1"));
6745 HasSubstr("whose value is not of type '"));
6746 EXPECT_THAT(Explain(m, SampleAnyType(2)), "whose value 2 doesn't match");
6747}
Here is the call graph for this function:

◆ TEST() [19/350]

testing::gmock_matchers_test::TEST ( AnyWithTest ,
FullMatch  )

Definition at line 6702 of file gmock-matchers_test.cc.

6702 {
6703 Matcher<SampleAnyType> m = AnyWith<int>(Eq(1));
6705}
Here is the call graph for this function:

◆ TEST() [20/350]

testing::gmock_matchers_test::TEST ( AnyWithTest ,
TestBadCastType  )

Definition at line 6707 of file gmock-matchers_test.cc.

6707 {
6708 Matcher<SampleAnyType> m = AnyWith<std::string>(Eq("fail"));
6710}
Here is the call graph for this function:

◆ TEST() [21/350]

testing::gmock_matchers_test::TEST ( AnyWithTest ,
TestCompare  )

Definition at line 6730 of file gmock-matchers_test.cc.

6730 {
6731 EXPECT_THAT(SampleAnyType(1), AnyWith<int>(Gt(0)));
6732}
Here is the call graph for this function:

◆ TEST() [22/350]

testing::gmock_matchers_test::TEST ( ATest ,
CanDescribeSelf  )

Definition at line 964 of file gmock-matchers_test.cc.

964 {
965 EXPECT_EQ("is anything", Describe(A<bool>()));
966}
Here is the call graph for this function:

◆ TEST() [23/350]

testing::gmock_matchers_test::TEST ( ATest ,
MatchesAnyValue  )

Definition at line 940 of file gmock-matchers_test.cc.

940 {
941 // Tests a matcher for a value type.
943 EXPECT_TRUE(m1.Matches(91.43));
944 EXPECT_TRUE(m1.Matches(-15.32));
945
946 // Tests a matcher for a reference type.
947 int a = 2;
948 int b = -6;
949 Matcher<int&> m2 = A<int&>();
950 EXPECT_TRUE(m2.Matches(a));
951 EXPECT_TRUE(m2.Matches(b));
952}
#define A
Here is the call graph for this function:

◆ TEST() [24/350]

testing::gmock_matchers_test::TEST ( ATest ,
WorksForDerivedClass  )

Definition at line 954 of file gmock-matchers_test.cc.

954 {
955 Base base;
956 Derived derived;
957 EXPECT_THAT(&base, A<Base*>());
958 // This shouldn't compile: EXPECT_THAT(&base, A<Derived*>());
959 EXPECT_THAT(&derived, A<Base*>());
960 EXPECT_THAT(&derived, A<Derived*>());
961}

◆ TEST() [25/350]

testing::gmock_matchers_test::TEST ( BeginEndDistanceIsTest ,
CanDescribeSelf  )

Definition at line 5292 of file gmock-matchers_test.cc.

5292 {
5294 EXPECT_EQ("distance between begin() and end() is equal to 2", Describe(m));
5295 EXPECT_EQ("distance between begin() and end() isn't equal to 2",
5296 DescribeNegation(m));
5297}
internal::BeginEndDistanceIsMatcher< DistanceMatcher > BeginEndDistanceIs(const DistanceMatcher &distance_matcher)
Here is the call graph for this function:

◆ TEST() [26/350]

testing::gmock_matchers_test::TEST ( BeginEndDistanceIsTest ,
ExplainsResult  )

Definition at line 5299 of file gmock-matchers_test.cc.

5299 {
5302 Matcher<vector<int> > m3 = BeginEndDistanceIs(AnyOf(0, 3));
5304 vector<int> container;
5305 EXPECT_EQ("whose distance between begin() and end() 0 doesn't match",
5306 Explain(m1, container));
5307 EXPECT_EQ("whose distance between begin() and end() 0 matches",
5308 Explain(m2, container));
5309 EXPECT_EQ("whose distance between begin() and end() 0 matches",
5310 Explain(m3, container));
5311 EXPECT_EQ(
5312 "whose distance between begin() and end() 0 doesn't match, which is 1 "
5313 "less than 1",
5314 Explain(m4, container));
5315 container.push_back(0);
5316 container.push_back(0);
5317 EXPECT_EQ("whose distance between begin() and end() 2 matches",
5318 Explain(m1, container));
5319 EXPECT_EQ("whose distance between begin() and end() 2 doesn't match",
5320 Explain(m2, container));
5321 EXPECT_EQ("whose distance between begin() and end() 2 doesn't match",
5322 Explain(m3, container));
5323 EXPECT_EQ(
5324 "whose distance between begin() and end() 2 matches, which is 1 more "
5325 "than 1",
5326 Explain(m4, container));
5327}
Here is the call graph for this function:

◆ TEST() [27/350]

testing::gmock_matchers_test::TEST ( BeginEndDistanceIsTest ,
WorksWithNonStdList  )

Definition at line 5286 of file gmock-matchers_test.cc.

5286 {
5287 const int a[5] = {1, 2, 3, 4, 5};
5288 Streamlike<int> s(a, a + 5);
5290}
char * s
Here is the call graph for this function:

◆ TEST() [28/350]

testing::gmock_matchers_test::TEST ( ByRefTest ,
AllowsNotCopyableConstValueInMatchers  )

Definition at line 4704 of file gmock-matchers_test.cc.

4704 {
4705 const NotCopyable const_value1(1);
4706 const Matcher<const NotCopyable&> m = Eq(ByRef(const_value1));
4707
4708 const NotCopyable n1(1), n2(2);
4709 EXPECT_TRUE(m.Matches(n1));
4710 EXPECT_FALSE(m.Matches(n2));
4711}
Here is the call graph for this function:

◆ TEST() [29/350]

testing::gmock_matchers_test::TEST ( ByRefTest ,
AllowsNotCopyableValueInMatchers  )

Definition at line 4713 of file gmock-matchers_test.cc.

4713 {
4714 NotCopyable value2(2);
4715 const Matcher<NotCopyable&> m = Ge(ByRef(value2));
4716
4717 NotCopyable n1(1), n2(2);
4718 EXPECT_FALSE(m.Matches(n1));
4719 EXPECT_TRUE(m.Matches(n2));
4720}
Here is the call graph for this function:

◆ TEST() [30/350]

testing::gmock_matchers_test::TEST ( ContainerEqExtraTest ,
CopiesNativeArrayParameter  )

Definition at line 5033 of file gmock-matchers_test.cc.

5033 {
5034 std::string a1[][3] = {
5035 {"hi", "hello", "ciao"},
5036 {"bye", "see you", "ciao"}
5037 };
5038
5039 std::string a2[][3] = {
5040 {"hi", "hello", "ciao"},
5041 {"bye", "see you", "ciao"}
5042 };
5043
5044 const Matcher<const std::string(&)[2][3]> m = ContainerEq(a2);
5045 EXPECT_THAT(a1, m);
5046
5047 a2[0][0] = "ha";
5048 EXPECT_THAT(a1, m);
5049}
Here is the call graph for this function:

◆ TEST() [31/350]

testing::gmock_matchers_test::TEST ( ContainerEqExtraTest ,
MultipleValuesAdded  )

Definition at line 4939 of file gmock-matchers_test.cc.

4939 {
4940 static const int vals[] = {1, 1, 2, 3, 5, 8};
4941 static const int test_vals[] = {1, 2, 92, 3, 5, 8, 46};
4942 list<size_t> my_set(vals, vals + 6);
4943 list<size_t> test_set(test_vals, test_vals + 7);
4944 const Matcher<const list<size_t>&> m = ContainerEq(my_set);
4945 EXPECT_FALSE(m.Matches(test_set));
4946 EXPECT_EQ("which has these unexpected elements: 92, 46",
4947 Explain(m, test_set));
4948}
Here is the call graph for this function:

◆ TEST() [32/350]

testing::gmock_matchers_test::TEST ( ContainerEqExtraTest ,
MultipleValuesAddedAndRemoved  )

Definition at line 4951 of file gmock-matchers_test.cc.

4951 {
4952 static const int vals[] = {1, 1, 2, 3, 5, 8};
4953 static const int test_vals[] = {1, 2, 3, 92, 46};
4954 list<size_t> my_set(vals, vals + 6);
4955 list<size_t> test_set(test_vals, test_vals + 5);
4956 const Matcher<const list<size_t> > m = ContainerEq(my_set);
4957 EXPECT_FALSE(m.Matches(test_set));
4958 EXPECT_EQ("which has these unexpected elements: 92, 46,\n"
4959 "and doesn't have these expected elements: 5, 8",
4960 Explain(m, test_set));
4961}
Here is the call graph for this function:

◆ TEST() [33/350]

testing::gmock_matchers_test::TEST ( ContainerEqExtraTest ,
MultipleValuesMissing  )

Definition at line 4926 of file gmock-matchers_test.cc.

4926 {
4927 static const int vals[] = {1, 1, 2, 3, 5, 8};
4928 static const int test_vals[] = {2, 1, 5};
4929 vector<int> my_set(vals, vals + 6);
4930 vector<int> test_set(test_vals, test_vals + 3);
4931 const Matcher<vector<int> > m = ContainerEq(my_set);
4932 EXPECT_FALSE(m.Matches(test_set));
4933 EXPECT_EQ("which doesn't have these expected elements: 3, 8",
4934 Explain(m, test_set));
4935}
Here is the call graph for this function:

◆ TEST() [34/350]

testing::gmock_matchers_test::TEST ( ContainerEqExtraTest ,
MultiSetOfIntDuplicateDifference  )

Definition at line 4965 of file gmock-matchers_test.cc.

4965 {
4966 static const int vals[] = {1, 1, 2, 3, 5, 8};
4967 static const int test_vals[] = {1, 2, 3, 5, 8};
4968 vector<int> my_set(vals, vals + 6);
4969 vector<int> test_set(test_vals, test_vals + 5);
4970 const Matcher<vector<int> > m = ContainerEq(my_set);
4971 EXPECT_TRUE(m.Matches(my_set));
4972 EXPECT_FALSE(m.Matches(test_set));
4973 // There is nothing to report when both sets contain all the same values.
4974 EXPECT_EQ("", Explain(m, test_set));
4975}
Here is the call graph for this function:

◆ TEST() [35/350]

testing::gmock_matchers_test::TEST ( ContainerEqExtraTest ,
WorksForMaps  )

Definition at line 4979 of file gmock-matchers_test.cc.

4979 {
4980 map<int, std::string> my_map;
4981 my_map[0] = "a";
4982 my_map[1] = "b";
4983
4984 map<int, std::string> test_map;
4985 test_map[0] = "aa";
4986 test_map[1] = "b";
4987
4988 const Matcher<const map<int, std::string>&> m = ContainerEq(my_map);
4989 EXPECT_TRUE(m.Matches(my_map));
4990 EXPECT_FALSE(m.Matches(test_map));
4991
4992 EXPECT_EQ("which has these unexpected elements: (0, \"aa\"),\n"
4993 "and doesn't have these expected elements: (0, \"a\")",
4994 Explain(m, test_map));
4995}
Here is the call graph for this function:

◆ TEST() [36/350]

testing::gmock_matchers_test::TEST ( ContainerEqExtraTest ,
WorksForNativeArray  )

Definition at line 4997 of file gmock-matchers_test.cc.

4997 {
4998 int a1[] = {1, 2, 3};
4999 int a2[] = {1, 2, 3};
5000 int b[] = {1, 2, 4};
5001
5002 EXPECT_THAT(a1, ContainerEq(a2));
5003 EXPECT_THAT(a1, Not(ContainerEq(b)));
5004}
Here is the call graph for this function:

◆ TEST() [37/350]

testing::gmock_matchers_test::TEST ( ContainerEqExtraTest ,
WorksForNativeArrayAsTuple  )

Definition at line 5020 of file gmock-matchers_test.cc.

5020 {
5021 const int a1[] = {1, 2, 3};
5022 const int a2[] = {1, 2, 3};
5023 const int b[] = {1, 2, 3, 4};
5024
5025 const int* const p1 = a1;
5026 EXPECT_THAT(make_tuple(p1, 3), ContainerEq(a2));
5027 EXPECT_THAT(make_tuple(p1, 3), Not(ContainerEq(b)));
5028
5029 const int c[] = {1, 3, 2};
5030 EXPECT_THAT(make_tuple(p1, 3), Not(ContainerEq(c)));
5031}
Here is the call graph for this function:

◆ TEST() [38/350]

testing::gmock_matchers_test::TEST ( ContainerEqExtraTest ,
WorksForTwoDimensionalNativeArray  )

Definition at line 5006 of file gmock-matchers_test.cc.

5006 {
5007 const char a1[][3] = {"hi", "lo"};
5008 const char a2[][3] = {"hi", "lo"};
5009 const char b[][3] = {"lo", "hi"};
5010
5011 // Tests using ContainerEq() in the first dimension.
5012 EXPECT_THAT(a1, ContainerEq(a2));
5013 EXPECT_THAT(a1, Not(ContainerEq(b)));
5014
5015 // Tests using ContainerEq() in the second dimension.
5016 EXPECT_THAT(a1, ElementsAre(ContainerEq(a2[0]), ContainerEq(a2[1])));
5017 EXPECT_THAT(a1, ElementsAre(Not(ContainerEq(b[0])), ContainerEq(a2[1])));
5018}
Here is the call graph for this function:

◆ TEST() [39/350]

testing::gmock_matchers_test::TEST ( ContainsRegexTest ,
CanDescribeSelf  )

Definition at line 1828 of file gmock-matchers_test.cc.

1828 {
1829 Matcher<const std::string> m1 = ContainsRegex("Hi.*");
1830 EXPECT_EQ("contains regular expression \"Hi.*\"", Describe(m1));
1831
1832 Matcher<const char*> m2 = ContainsRegex(new RE("a.*"));
1833 EXPECT_EQ("contains regular expression \"a.*\"", Describe(m2));
1834
1835#if GTEST_HAS_ABSL
1836 Matcher<const absl::string_view> m3 = ContainsRegex(new RE("0.*"));
1837 EXPECT_EQ("contains regular expression \"0.*\"", Describe(m3));
1838#endif // GTEST_HAS_ABSL
1839}
Here is the call graph for this function:

◆ TEST() [40/350]

testing::gmock_matchers_test::TEST ( ContainsRegexTest ,
MatchesStringContainingGivenRegex  )

Definition at line 1804 of file gmock-matchers_test.cc.

1804 {
1805 const Matcher<const char*> m1 = ContainsRegex(std::string("a.*z"));
1806 EXPECT_TRUE(m1.Matches("az"));
1807 EXPECT_TRUE(m1.Matches("0abcz1"));
1808 EXPECT_FALSE(m1.Matches(NULL));
1809
1810 const Matcher<const std::string&> m2 = ContainsRegex(new RE("a.*z"));
1811 EXPECT_TRUE(m2.Matches("azbz"));
1812 EXPECT_TRUE(m2.Matches("az1"));
1813 EXPECT_FALSE(m2.Matches("1a"));
1814
1815#if GTEST_HAS_ABSL
1816 const Matcher<const absl::string_view&> m3 = ContainsRegex(new RE("a.*z"));
1817 EXPECT_TRUE(m3.Matches(absl::string_view("azbz")));
1818 EXPECT_TRUE(m3.Matches(absl::string_view("az1")));
1819 EXPECT_FALSE(m3.Matches(absl::string_view("1a")));
1820 // Default-constructed absl::string_view should not match anything, in order
1821 // to distinguish it from an empty string.
1822 EXPECT_FALSE(m3.Matches(absl::string_view()));
1823 const Matcher<const absl::string_view&> m4 = ContainsRegex("");
1824 EXPECT_FALSE(m4.Matches(absl::string_view()));
1825#endif // GTEST_HAS_ABSL
1826}
Here is the call graph for this function:

◆ TEST() [41/350]

testing::gmock_matchers_test::TEST ( DescribeMatcherTest ,
WorksWithMonomorphicMatcher  )

Definition at line 3057 of file gmock-matchers_test.cc.

3057 {
3058 const Matcher<int> monomorphic = Le(0);
3059 EXPECT_EQ("is <= 0", DescribeMatcher<int>(monomorphic));
3060 EXPECT_EQ("isn't <= 0", DescribeMatcher<int>(monomorphic, true));
3061}
Here is the call graph for this function:

◆ TEST() [42/350]

testing::gmock_matchers_test::TEST ( DescribeMatcherTest ,
WorksWithPolymorphicMatcher  )

Definition at line 3063 of file gmock-matchers_test.cc.

3063 {
3064 EXPECT_EQ("is even", DescribeMatcher<int>(PolymorphicIsEven()));
3065 EXPECT_EQ("is odd", DescribeMatcher<int>(PolymorphicIsEven(), true));
3066}
PolymorphicMatcher< PolymorphicIsEvenImpl > PolymorphicIsEven()
Here is the call graph for this function:

◆ TEST() [43/350]

testing::gmock_matchers_test::TEST ( DescribeMatcherTest ,
WorksWithValue  )

Definition at line 3052 of file gmock-matchers_test.cc.

3052 {
3053 EXPECT_EQ("is equal to 42", DescribeMatcher<int>(42));
3054 EXPECT_EQ("isn't equal to 42", DescribeMatcher<int>(42, true));
3055}
Here is the call graph for this function:

◆ TEST() [44/350]

testing::gmock_matchers_test::TEST ( DoubleEq2Test ,
CanDescribeSelf  )

Definition at line 2362 of file gmock-matchers_test.cc.

2362 {
2364 EXPECT_EQ("are an almost-equal pair", Describe(m));
2365}
Here is the call graph for this function:

◆ TEST() [45/350]

testing::gmock_matchers_test::TEST ( DoubleEq2Test ,
MatchesEqualArguments  )

Definition at line 2353 of file gmock-matchers_test.cc.

2353 {
2354 typedef ::testing::tuple<double, double> Tpl;
2355 Matcher<const Tpl&> m = DoubleEq();
2356 EXPECT_TRUE(m.Matches(Tpl(1.0, 1.0)));
2357 EXPECT_TRUE(m.Matches(Tpl(0.3, 0.1 + 0.1 + 0.1)));
2358 EXPECT_FALSE(m.Matches(Tpl(1.1, 1.0)));
2359}
Here is the call graph for this function:

◆ TEST() [46/350]

testing::gmock_matchers_test::TEST ( DoubleNear2Test ,
CanDescribeSelf  )

Definition at line 2434 of file gmock-matchers_test.cc.

2434 {
2436 EXPECT_EQ("are an almost-equal pair", Describe(m));
2437}
Here is the call graph for this function:

◆ TEST() [47/350]

testing::gmock_matchers_test::TEST ( DoubleNear2Test ,
MatchesEqualArguments  )

Definition at line 2425 of file gmock-matchers_test.cc.

2425 {
2426 typedef ::testing::tuple<double, double> Tpl;
2427 Matcher<const Tpl&> m = DoubleNear(0.5);
2428 EXPECT_TRUE(m.Matches(Tpl(1.0, 1.0)));
2429 EXPECT_TRUE(m.Matches(Tpl(1.3, 1.0)));
2430 EXPECT_FALSE(m.Matches(Tpl(1.8, 1.0)));
2431}
Here is the call graph for this function:

◆ TEST() [48/350]

testing::gmock_matchers_test::TEST ( EachTest ,
AcceptsMatcher  )

Definition at line 6307 of file gmock-matchers_test.cc.

6307 {
6308 const int a[] = {1, 2, 3};
6309 EXPECT_THAT(a, Each(Gt(0)));
6310 EXPECT_THAT(a, Not(Each(Gt(1))));
6311}
internal::EachMatcher< M > Each(M matcher)
Here is the call graph for this function:

◆ TEST() [49/350]

testing::gmock_matchers_test::TEST ( EachTest ,
DescribesItselfCorrectly  )

Definition at line 6261 of file gmock-matchers_test.cc.

6261 {
6262 Matcher<vector<int> > m = Each(1);
6263 EXPECT_EQ("only contains elements that is equal to 1", Describe(m));
6264
6265 Matcher<vector<int> > m2 = Not(m);
6266 EXPECT_EQ("contains some element that isn't equal to 1", Describe(m2));
6267}
Here is the call graph for this function:

◆ TEST() [50/350]

testing::gmock_matchers_test::TEST ( EachTest ,
ExplainsMatchResultCorrectly  )

Definition at line 6236 of file gmock-matchers_test.cc.

6236 {
6237 set<int> a; // empty
6238
6239 Matcher<set<int> > m = Each(2);
6240 EXPECT_EQ("", Explain(m, a));
6241
6242 Matcher<const int(&)[1]> n = Each(1); // NOLINT
6243
6244 const int b[1] = {1};
6245 EXPECT_EQ("", Explain(n, b));
6246
6247 n = Each(3);
6248 EXPECT_EQ("whose element #0 doesn't match", Explain(n, b));
6249
6250 a.insert(1);
6251 a.insert(2);
6252 a.insert(3);
6253 m = Each(GreaterThan(0));
6254 EXPECT_EQ("", Explain(m, a));
6255
6256 m = Each(GreaterThan(10));
6257 EXPECT_EQ("whose element #0 doesn't match, which is 9 less than 10",
6258 Explain(m, a));
6259}
Here is the call graph for this function:

◆ TEST() [51/350]

testing::gmock_matchers_test::TEST ( EachTest ,
MatchesMapWhenAllElementsMatch  )

Definition at line 6289 of file gmock-matchers_test.cc.

6289 {
6290 map<const char*, int> my_map;
6291 const char* bar = "a string";
6292 my_map[bar] = 2;
6293 EXPECT_THAT(my_map, Each(make_pair(bar, 2)));
6294
6295 map<std::string, int> another_map;
6296 EXPECT_THAT(another_map, Each(make_pair(std::string("fee"), 1)));
6297 another_map["fee"] = 1;
6298 EXPECT_THAT(another_map, Each(make_pair(std::string("fee"), 1)));
6299 another_map["fie"] = 2;
6300 another_map["foe"] = 3;
6301 another_map["fum"] = 4;
6302 EXPECT_THAT(another_map, Not(Each(make_pair(std::string("fee"), 1))));
6303 EXPECT_THAT(another_map, Not(Each(make_pair(std::string("fum"), 1))));
6304 EXPECT_THAT(another_map, Each(Pair(_, Gt(0))));
6305}
Here is the call graph for this function:

◆ TEST() [52/350]

testing::gmock_matchers_test::TEST ( EachTest ,
MatchesVectorWhenAllElementsMatch  )

Definition at line 6269 of file gmock-matchers_test.cc.

6269 {
6270 vector<int> some_vector;
6271 EXPECT_THAT(some_vector, Each(1));
6272 some_vector.push_back(3);
6273 EXPECT_THAT(some_vector, Not(Each(1)));
6274 EXPECT_THAT(some_vector, Each(3));
6275 some_vector.push_back(1);
6276 some_vector.push_back(2);
6277 EXPECT_THAT(some_vector, Not(Each(3)));
6278 EXPECT_THAT(some_vector, Each(Lt(3.5)));
6279
6280 vector<std::string> another_vector;
6281 another_vector.push_back("fee");
6282 EXPECT_THAT(another_vector, Each(std::string("fee")));
6283 another_vector.push_back("fie");
6284 another_vector.push_back("foe");
6285 another_vector.push_back("fum");
6286 EXPECT_THAT(another_vector, Not(Each(std::string("fee"))));
6287}
Here is the call graph for this function:

◆ TEST() [53/350]

testing::gmock_matchers_test::TEST ( EachTest ,
WorksForNativeArrayAsTuple  )

Definition at line 6313 of file gmock-matchers_test.cc.

6313 {
6314 const int a[] = {1, 2};
6315 const int* const pointer = a;
6316 EXPECT_THAT(make_tuple(pointer, 2), Each(Gt(0)));
6317 EXPECT_THAT(make_tuple(pointer, 2), Not(Each(Gt(1))));
6318}
const GenericPointer< typename T::ValueType > & pointer
Definition pointer.h:1181
Here is the call graph for this function:

◆ TEST() [54/350]

testing::gmock_matchers_test::TEST ( ElemensAreArrayStreamTest ,
WorksForStreamlike  )

Definition at line 5600 of file gmock-matchers_test.cc.

5600 {
5601 const int a[5] = {1, 2, 3, 4, 5};
5602 Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a));
5603
5604 vector<int> expected;
5605 expected.push_back(1);
5606 expected.push_back(2);
5607 expected.push_back(3);
5608 expected.push_back(4);
5609 expected.push_back(5);
5610 EXPECT_THAT(s, ElementsAreArray(expected));
5611
5612 expected[3] = 0;
5613 EXPECT_THAT(s, Not(ElementsAreArray(expected)));
5614}
#define GTEST_ARRAY_SIZE_(array)
Here is the call graph for this function:

◆ TEST() [55/350]

testing::gmock_matchers_test::TEST ( ElemensAreStreamTest ,
WorksForStreamlike  )

Definition at line 5593 of file gmock-matchers_test.cc.

5593 {
5594 const int a[5] = {1, 2, 3, 4, 5};
5595 Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a));
5596 EXPECT_THAT(s, ElementsAre(1, 2, 3, 4, 5));
5597 EXPECT_THAT(s, Not(ElementsAre(2, 1, 4, 5, 3)));
5598}
Here is the call graph for this function:

◆ TEST() [56/350]

testing::gmock_matchers_test::TEST ( ElementsAreTest ,
TakesStlContainer  )

Definition at line 5623 of file gmock-matchers_test.cc.

5623 {
5624 const int actual[] = {3, 1, 2};
5625
5626 ::std::list<int> expected;
5627 expected.push_back(3);
5628 expected.push_back(1);
5629 expected.push_back(2);
5630 EXPECT_THAT(actual, ElementsAreArray(expected));
5631
5632 expected.push_back(4);
5633 EXPECT_THAT(actual, Not(ElementsAreArray(expected)));
5634}
Here is the call graph for this function:

◆ TEST() [57/350]

testing::gmock_matchers_test::TEST ( ElementsAreTest ,
WorksWithUncopyable  )

Definition at line 5616 of file gmock-matchers_test.cc.

5616 {
5617 Uncopyable objs[2];
5618 objs[0].set_value(-3);
5619 objs[1].set_value(1);
5620 EXPECT_THAT(objs, ElementsAre(UncopyableIs(-3), Truly(ValueIsPositive)));
5621}
Here is the call graph for this function:

◆ TEST() [58/350]

testing::gmock_matchers_test::TEST ( EndsWithTest ,
CanDescribeSelf  )

Definition at line 1758 of file gmock-matchers_test.cc.

1758 {
1759 Matcher<const std::string> m = EndsWith("Hi");
1760 EXPECT_EQ("ends with \"Hi\"", Describe(m));
1761}
Here is the call graph for this function:

◆ TEST() [59/350]

testing::gmock_matchers_test::TEST ( EndsWithTest ,
MatchesStringWithGivenSuffix  )

Definition at line 1726 of file gmock-matchers_test.cc.

1726 {
1727 const Matcher<const char*> m1 = EndsWith("");
1728 EXPECT_TRUE(m1.Matches("Hi"));
1729 EXPECT_TRUE(m1.Matches(""));
1730 EXPECT_FALSE(m1.Matches(NULL));
1731
1732 const Matcher<const std::string&> m2 = EndsWith(std::string("Hi"));
1733 EXPECT_TRUE(m2.Matches("Hi"));
1734 EXPECT_TRUE(m2.Matches("Wow Hi Hi"));
1735 EXPECT_TRUE(m2.Matches("Super Hi"));
1736 EXPECT_FALSE(m2.Matches("i"));
1737 EXPECT_FALSE(m2.Matches("Hi "));
1738
1739#if GTEST_HAS_GLOBAL_STRING
1740 const Matcher<const ::string&> m3 = EndsWith(::string("Hi"));
1741 EXPECT_TRUE(m3.Matches("Hi"));
1742 EXPECT_TRUE(m3.Matches("Wow Hi Hi"));
1743 EXPECT_TRUE(m3.Matches("Super Hi"));
1744 EXPECT_FALSE(m3.Matches("i"));
1745 EXPECT_FALSE(m3.Matches("Hi "));
1746#endif // GTEST_HAS_GLOBAL_STRING
1747
1748#if GTEST_HAS_ABSL
1749 const Matcher<const absl::string_view&> m4 = EndsWith("");
1750 EXPECT_TRUE(m4.Matches("Hi"));
1751 EXPECT_TRUE(m4.Matches(""));
1752 // Default-constructed absl::string_view should not match anything, in order
1753 // to distinguish it from an empty string.
1754 EXPECT_FALSE(m4.Matches(absl::string_view()));
1755#endif // GTEST_HAS_ABSL
1756}
Here is the call graph for this function:

◆ TEST() [60/350]

testing::gmock_matchers_test::TEST ( Eq2Test ,
CanDescribeSelf  )

Definition at line 2236 of file gmock-matchers_test.cc.

2236 {
2237 Matcher<const Tuple2&> m = Eq();
2238 EXPECT_EQ("are an equal pair", Describe(m));
2239}
Here is the call graph for this function:

◆ TEST() [61/350]

testing::gmock_matchers_test::TEST ( Eq2Test ,
MatchesEqualArguments  )

Definition at line 2229 of file gmock-matchers_test.cc.

2229 {
2230 Matcher<const Tuple2&> m = Eq();
2231 EXPECT_TRUE(m.Matches(Tuple2(5L, 5)));
2232 EXPECT_FALSE(m.Matches(Tuple2(5L, 6)));
2233}
::testing::tuple< long, int > Tuple2
Here is the call graph for this function:

◆ TEST() [62/350]

testing::gmock_matchers_test::TEST ( EqTest ,
CanDescribeSelf  )

Definition at line 1032 of file gmock-matchers_test.cc.

1032 {
1034 EXPECT_EQ("is equal to 1-byte object <61>", Describe(m));
1035}
Here is the call graph for this function:

◆ TEST() [63/350]

testing::gmock_matchers_test::TEST ( EqTest ,
IsPolymorphic  )

Definition at line 1039 of file gmock-matchers_test.cc.

1039 {
1040 Matcher<int> m1 = Eq(1);
1041 EXPECT_TRUE(m1.Matches(1));
1042 EXPECT_FALSE(m1.Matches(2));
1043
1044 Matcher<char> m2 = Eq(1);
1045 EXPECT_TRUE(m2.Matches('\1'));
1046 EXPECT_FALSE(m2.Matches('a'));
1047}
Here is the call graph for this function:

◆ TEST() [64/350]

testing::gmock_matchers_test::TEST ( EqTest ,
MatchesEqualValue  )

Definition at line 1011 of file gmock-matchers_test.cc.

1011 {
1012 // 2 C-strings with same content but different addresses.
1013 const char a1[] = "hi";
1014 const char a2[] = "hi";
1015
1016 Matcher<const char*> m1 = Eq(a1);
1017 EXPECT_TRUE(m1.Matches(a1));
1018 EXPECT_FALSE(m1.Matches(a2));
1019}
Here is the call graph for this function:

◆ TEST() [65/350]

testing::gmock_matchers_test::TEST ( ExpectThat ,
TakesFunctions  )

Definition at line 930 of file gmock-matchers_test.cc.

930 {
931 struct Helper {
932 static void Func() {}
933 };
934 void (*func)() = Helper::Func;
935 EXPECT_THAT(func, Helper::Func);
936 EXPECT_THAT(func, &Helper::Func);
937}

◆ TEST() [66/350]

testing::gmock_matchers_test::TEST ( ExpectThat ,
TakesLiterals  )

Definition at line 924 of file gmock-matchers_test.cc.

924 {
925 EXPECT_THAT(1, 1);
926 EXPECT_THAT(1.0, 1.0);
927 EXPECT_THAT(std::string(), "");
928}

◆ TEST() [67/350]

testing::gmock_matchers_test::TEST ( ExplainmatcherResultTest ,
MonomorphicMatcher  )

Definition at line 4676 of file gmock-matchers_test.cc.

4676 {
4677 const Matcher<int> m = GreaterThan(5);
4678 EXPECT_EQ("which is 1 more than 5", Explain(m, 6));
4679}
Here is the call graph for this function:

◆ TEST() [68/350]

testing::gmock_matchers_test::TEST ( ExplainMatchResultTest ,
AllOf_False_False  )

Definition at line 4645 of file gmock-matchers_test.cc.

4645 {
4646 const Matcher<int> m = AllOf(DivisibleBy(4), DivisibleBy(3));
4647 EXPECT_EQ("which is 1 modulo 4", Explain(m, 5));
4648}
PolymorphicMatcher< DivisibleByImpl > DivisibleBy(int n)
Here is the call graph for this function:

◆ TEST() [69/350]

testing::gmock_matchers_test::TEST ( ExplainMatchResultTest ,
AllOf_False_True  )

Definition at line 4652 of file gmock-matchers_test.cc.

4652 {
4653 const Matcher<int> m = AllOf(DivisibleBy(4), DivisibleBy(3));
4654 EXPECT_EQ("which is 2 modulo 4", Explain(m, 6));
4655}
Here is the call graph for this function:

◆ TEST() [70/350]

testing::gmock_matchers_test::TEST ( ExplainMatchResultTest ,
AllOf_True_False  )

Definition at line 4659 of file gmock-matchers_test.cc.

4659 {
4660 const Matcher<int> m = AllOf(Ge(1), DivisibleBy(3));
4661 EXPECT_EQ("which is 2 modulo 3", Explain(m, 5));
4662}
Here is the call graph for this function:

◆ TEST() [71/350]

testing::gmock_matchers_test::TEST ( ExplainMatchResultTest ,
AllOf_True_True  )

Definition at line 4666 of file gmock-matchers_test.cc.

4666 {
4667 const Matcher<int> m = AllOf(DivisibleBy(2), DivisibleBy(3));
4668 EXPECT_EQ("which is 0 modulo 2, and which is 0 modulo 3", Explain(m, 6));
4669}
Here is the call graph for this function:

◆ TEST() [72/350]

testing::gmock_matchers_test::TEST ( ExplainMatchResultTest ,
AllOf_True_True_2  )

Definition at line 4671 of file gmock-matchers_test.cc.

4671 {
4672 const Matcher<int> m = AllOf(Ge(2), Le(3));
4673 EXPECT_EQ("", Explain(m, 2));
4674}
Here is the call graph for this function:

◆ TEST() [73/350]

testing::gmock_matchers_test::TEST ( ExplainMatchResultTest ,
WorksInsideMATCHER  )

Definition at line 3048 of file gmock-matchers_test.cc.

3048 {
3049 EXPECT_THAT(0, Really(Eq(0)));
3050}
Here is the call graph for this function:

◆ TEST() [74/350]

testing::gmock_matchers_test::TEST ( ExplainMatchResultTest ,
WorksWithMonomorphicMatcher  )

Definition at line 3032 of file gmock-matchers_test.cc.

3032 {
3033 const Matcher<int> is_even = PolymorphicIsEven();
3034 StringMatchResultListener listener1;
3035 EXPECT_TRUE(ExplainMatchResult(is_even, 42, &listener1));
3036 EXPECT_EQ("% 2 == 0", listener1.str());
3037
3038 const Matcher<const double&> is_zero = Eq(0);
3039 StringMatchResultListener listener2;
3040 EXPECT_FALSE(ExplainMatchResult(is_zero, 1.5, &listener2));
3041 EXPECT_EQ("", listener2.str());
3042}
Here is the call graph for this function:

◆ TEST() [75/350]

testing::gmock_matchers_test::TEST ( ExplainMatchResultTest ,
WorksWithPolymorphicMatcher  )

Definition at line 3022 of file gmock-matchers_test.cc.

3022 {
3023 StringMatchResultListener listener1;
3024 EXPECT_TRUE(ExplainMatchResult(PolymorphicIsEven(), 42, &listener1));
3025 EXPECT_EQ("% 2 == 0", listener1.str());
3026
3027 StringMatchResultListener listener2;
3028 EXPECT_FALSE(ExplainMatchResult(Ge(42), 1.5, &listener2));
3029 EXPECT_EQ("", listener2.str());
3030}
Here is the call graph for this function:

◆ TEST() [76/350]

testing::gmock_matchers_test::TEST ( FieldForPointerTest ,
CanDescribeSelf  )

Definition at line 4100 of file gmock-matchers_test.cc.

4100 {
4101 Matcher<const AStruct*> m = Field(&AStruct::x, Ge(0));
4102
4103 EXPECT_EQ("is an object whose given field is >= 0", Describe(m));
4104 EXPECT_EQ("is an object whose given field isn't >= 0", DescribeNegation(m));
4105}
Here is the call graph for this function:

◆ TEST() [77/350]

testing::gmock_matchers_test::TEST ( FieldForPointerTest ,
CanDescribeSelfWithFieldName  )

Definition at line 4107 of file gmock-matchers_test.cc.

4107 {
4108 Matcher<const AStruct*> m = Field("field_name", &AStruct::x, Ge(0));
4109
4110 EXPECT_EQ("is an object whose field `field_name` is >= 0", Describe(m));
4111 EXPECT_EQ("is an object whose field `field_name` isn't >= 0",
4112 DescribeNegation(m));
4113}
Here is the call graph for this function:

◆ TEST() [78/350]

testing::gmock_matchers_test::TEST ( FieldForPointerTest ,
CanExplainMatchResult  )

Definition at line 4116 of file gmock-matchers_test.cc.

4116 {
4117 Matcher<const AStruct*> m = Field(&AStruct::x, Ge(0));
4118
4119 AStruct a;
4120 a.x = 1;
4121 EXPECT_EQ("", Explain(m, static_cast<const AStruct*>(NULL)));
4122 EXPECT_EQ("which points to an object whose given field is 1" + OfType("int"),
4123 Explain(m, &a));
4124
4125 m = Field(&AStruct::x, GreaterThan(0));
4126 EXPECT_EQ("which points to an object whose given field is 1" + OfType("int") +
4127 ", which is 1 more than 0", Explain(m, &a));
4128}
std::string OfType(const std::string &type_name)
Here is the call graph for this function:

◆ TEST() [79/350]

testing::gmock_matchers_test::TEST ( FieldForPointerTest ,
CanExplainMatchResultWithFieldName  )

Definition at line 4130 of file gmock-matchers_test.cc.

4130 {
4131 Matcher<const AStruct*> m = Field("field_name", &AStruct::x, Ge(0));
4132
4133 AStruct a;
4134 a.x = 1;
4135 EXPECT_EQ("", Explain(m, static_cast<const AStruct*>(NULL)));
4136 EXPECT_EQ(
4137 "which points to an object whose field `field_name` is 1" + OfType("int"),
4138 Explain(m, &a));
4139
4140 m = Field("field_name", &AStruct::x, GreaterThan(0));
4141 EXPECT_EQ("which points to an object whose field `field_name` is 1" +
4142 OfType("int") + ", which is 1 more than 0",
4143 Explain(m, &a));
4144}
Here is the call graph for this function:

◆ TEST() [80/350]

testing::gmock_matchers_test::TEST ( FieldForPointerTest ,
DoesNotMatchNull  )

Definition at line 4081 of file gmock-matchers_test.cc.

4081 {
4082 Matcher<const AStruct*> m = Field(&AStruct::x, _);
4083 EXPECT_FALSE(m.Matches(NULL));
4084}
Here is the call graph for this function:

◆ TEST() [81/350]

testing::gmock_matchers_test::TEST ( FieldForPointerTest ,
WorksForArgumentOfSubType  )

Definition at line 4088 of file gmock-matchers_test.cc.

4088 {
4089 // Note that the matcher expects DerivedStruct but we say AStruct
4090 // inside Field().
4091 Matcher<DerivedStruct*> m = Field(&AStruct::x, Ge(0));
4092
4094 EXPECT_TRUE(m.Matches(&d));
4095 d.x = -1;
4096 EXPECT_FALSE(m.Matches(&d));
4097}
CK_ULONG d
Here is the call graph for this function:

◆ TEST() [82/350]

testing::gmock_matchers_test::TEST ( FieldForPointerTest ,
WorksForPointerToConst  )

Definition at line 4051 of file gmock-matchers_test.cc.

4051 {
4052 Matcher<const AStruct*> m = Field(&AStruct::x, Ge(0));
4053
4054 AStruct a;
4055 EXPECT_TRUE(m.Matches(&a));
4056 a.x = -1;
4057 EXPECT_FALSE(m.Matches(&a));
4058}
Here is the call graph for this function:

◆ TEST() [83/350]

testing::gmock_matchers_test::TEST ( FieldForPointerTest ,
WorksForPointerToNonConst  )

Definition at line 4061 of file gmock-matchers_test.cc.

4061 {
4062 Matcher<AStruct*> m = Field(&AStruct::x, Ge(0));
4063
4064 AStruct a;
4065 EXPECT_TRUE(m.Matches(&a));
4066 a.x = -1;
4067 EXPECT_FALSE(m.Matches(&a));
4068}
Here is the call graph for this function:

◆ TEST() [84/350]

testing::gmock_matchers_test::TEST ( FieldForPointerTest ,
WorksForReferenceToConstPointer  )

Definition at line 4071 of file gmock-matchers_test.cc.

4071 {
4072 Matcher<AStruct* const&> m = Field(&AStruct::x, Ge(0));
4073
4074 AStruct a;
4075 EXPECT_TRUE(m.Matches(&a));
4076 a.x = -1;
4077 EXPECT_FALSE(m.Matches(&a));
4078}
Here is the call graph for this function:

◆ TEST() [85/350]

testing::gmock_matchers_test::TEST ( FieldTest ,
CanDescribeSelf  )

Definition at line 4008 of file gmock-matchers_test.cc.

4008 {
4009 Matcher<const AStruct&> m = Field(&AStruct::x, Ge(0));
4010
4011 EXPECT_EQ("is an object whose given field is >= 0", Describe(m));
4012 EXPECT_EQ("is an object whose given field isn't >= 0", DescribeNegation(m));
4013}
Here is the call graph for this function:

◆ TEST() [86/350]

testing::gmock_matchers_test::TEST ( FieldTest ,
CanDescribeSelfWithFieldName  )

Definition at line 4015 of file gmock-matchers_test.cc.

4015 {
4016 Matcher<const AStruct&> m = Field("field_name", &AStruct::x, Ge(0));
4017
4018 EXPECT_EQ("is an object whose field `field_name` is >= 0", Describe(m));
4019 EXPECT_EQ("is an object whose field `field_name` isn't >= 0",
4020 DescribeNegation(m));
4021}
Here is the call graph for this function:

◆ TEST() [87/350]

testing::gmock_matchers_test::TEST ( FieldTest ,
CanExplainMatchResult  )

Definition at line 4024 of file gmock-matchers_test.cc.

4024 {
4025 Matcher<const AStruct&> m = Field(&AStruct::x, Ge(0));
4026
4027 AStruct a;
4028 a.x = 1;
4029 EXPECT_EQ("whose given field is 1" + OfType("int"), Explain(m, a));
4030
4031 m = Field(&AStruct::x, GreaterThan(0));
4032 EXPECT_EQ(
4033 "whose given field is 1" + OfType("int") + ", which is 1 more than 0",
4034 Explain(m, a));
4035}
Here is the call graph for this function:

◆ TEST() [88/350]

testing::gmock_matchers_test::TEST ( FieldTest ,
CanExplainMatchResultWithFieldName  )

Definition at line 4037 of file gmock-matchers_test.cc.

4037 {
4038 Matcher<const AStruct&> m = Field("field_name", &AStruct::x, Ge(0));
4039
4040 AStruct a;
4041 a.x = 1;
4042 EXPECT_EQ("whose field `field_name` is 1" + OfType("int"), Explain(m, a));
4043
4044 m = Field("field_name", &AStruct::x, GreaterThan(0));
4045 EXPECT_EQ("whose field `field_name` is 1" + OfType("int") +
4046 ", which is 1 more than 0",
4047 Explain(m, a));
4048}
Here is the call graph for this function:

◆ TEST() [89/350]

testing::gmock_matchers_test::TEST ( FieldTest ,
WorksForArgumentOfSubType  )

Definition at line 3983 of file gmock-matchers_test.cc.

3983 {
3984 // Note that the matcher expects DerivedStruct but we say AStruct
3985 // inside Field().
3986 Matcher<const DerivedStruct&> m = Field(&AStruct::x, Ge(0));
3987
3989 EXPECT_TRUE(m.Matches(d));
3990 d.x = -1;
3991 EXPECT_FALSE(m.Matches(d));
3992}
Here is the call graph for this function:

◆ TEST() [90/350]

testing::gmock_matchers_test::TEST ( FieldTest ,
WorksForByRefArgument  )

Definition at line 3972 of file gmock-matchers_test.cc.

3972 {
3973 Matcher<const AStruct&> m = Field(&AStruct::x, Ge(0));
3974
3975 AStruct a;
3976 EXPECT_TRUE(m.Matches(a));
3977 a.x = -1;
3979}
Here is the call graph for this function:

◆ TEST() [91/350]

testing::gmock_matchers_test::TEST ( FieldTest ,
WorksForCompatibleMatcherType  )

Definition at line 3996 of file gmock-matchers_test.cc.

3996 {
3997 // The field is an int, but the inner matcher expects a signed char.
3998 Matcher<const AStruct&> m = Field(&AStruct::x,
3999 Matcher<signed char>(Ge(0)));
4000
4001 AStruct a;
4002 EXPECT_TRUE(m.Matches(a));
4003 a.x = -1;
4005}
Here is the call graph for this function:

◆ TEST() [92/350]

testing::gmock_matchers_test::TEST ( FieldTest ,
WorksForConstField  )

Definition at line 3931 of file gmock-matchers_test.cc.

3931 {
3932 AStruct a;
3933
3934 Matcher<AStruct> m = Field(&AStruct::y, Ge(0.0));
3935 Matcher<AStruct> m_with_name = Field("y", &AStruct::y, Ge(0.0));
3936 EXPECT_TRUE(m.Matches(a));
3937 EXPECT_TRUE(m_with_name.Matches(a));
3938 m = Field(&AStruct::y, Le(0.0));
3939 m_with_name = Field("y", &AStruct::y, Le(0.0));
3941 EXPECT_FALSE(m_with_name.Matches(a));
3942}
Here is the call graph for this function:

◆ TEST() [93/350]

testing::gmock_matchers_test::TEST ( FieldTest ,
WorksForNonConstField  )

Definition at line 3918 of file gmock-matchers_test.cc.

3918 {
3919 Matcher<AStruct> m = Field(&AStruct::x, Ge(0));
3920 Matcher<AStruct> m_with_name = Field("x", &AStruct::x, Ge(0));
3921
3922 AStruct a;
3923 EXPECT_TRUE(m.Matches(a));
3924 EXPECT_TRUE(m_with_name.Matches(a));
3925 a.x = -1;
3927 EXPECT_FALSE(m_with_name.Matches(a));
3928}
Here is the call graph for this function:

◆ TEST() [94/350]

testing::gmock_matchers_test::TEST ( FieldTest ,
WorksForPointerField  )

Definition at line 3955 of file gmock-matchers_test.cc.

3955 {
3956 // Matching against NULL.
3957 Matcher<AStruct> m = Field(&AStruct::p, static_cast<const char*>(NULL));
3958 AStruct a;
3959 EXPECT_TRUE(m.Matches(a));
3960 a.p = "hi";
3962
3963 // Matching a pointer that is not NULL.
3964 m = Field(&AStruct::p, StartsWith("hi"));
3965 a.p = "hill";
3966 EXPECT_TRUE(m.Matches(a));
3967 a.p = "hole";
3969}
Here is the call graph for this function:

◆ TEST() [95/350]

testing::gmock_matchers_test::TEST ( FieldTest ,
WorksForUncopyableField  )

Definition at line 3945 of file gmock-matchers_test.cc.

3945 {
3946 AStruct a;
3947
3948 Matcher<AStruct> m = Field(&AStruct::z, Truly(ValueIsPositive));
3949 EXPECT_TRUE(m.Matches(a));
3950 m = Field(&AStruct::z, Not(Truly(ValueIsPositive)));
3952}
Here is the call graph for this function:

◆ TEST() [96/350]

testing::gmock_matchers_test::TEST ( FloatEq2Test ,
CanDescribeSelf  )

Definition at line 2327 of file gmock-matchers_test.cc.

2327 {
2329 EXPECT_EQ("are an almost-equal pair", Describe(m));
2330}
Here is the call graph for this function:

◆ TEST() [97/350]

testing::gmock_matchers_test::TEST ( FloatEq2Test ,
MatchesEqualArguments  )

Definition at line 2318 of file gmock-matchers_test.cc.

2318 {
2319 typedef ::testing::tuple<float, float> Tpl;
2320 Matcher<const Tpl&> m = FloatEq();
2321 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
2322 EXPECT_TRUE(m.Matches(Tpl(0.3f, 0.1f + 0.1f + 0.1f)));
2323 EXPECT_FALSE(m.Matches(Tpl(1.1f, 1.0f)));
2324}
Here is the call graph for this function:

◆ TEST() [98/350]

testing::gmock_matchers_test::TEST ( FloatNear2Test ,
CanDescribeSelf  )

Definition at line 2397 of file gmock-matchers_test.cc.

2397 {
2399 EXPECT_EQ("are an almost-equal pair", Describe(m));
2400}
Here is the call graph for this function:

◆ TEST() [99/350]

testing::gmock_matchers_test::TEST ( FloatNear2Test ,
MatchesEqualArguments  )

Definition at line 2388 of file gmock-matchers_test.cc.

2388 {
2389 typedef ::testing::tuple<float, float> Tpl;
2390 Matcher<const Tpl&> m = FloatNear(0.5f);
2391 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
2392 EXPECT_TRUE(m.Matches(Tpl(1.3f, 1.0f)));
2393 EXPECT_FALSE(m.Matches(Tpl(1.8f, 1.0f)));
2394}
Here is the call graph for this function:

◆ TEST() [100/350]

testing::gmock_matchers_test::TEST ( FormatMatcherDescriptionTest ,
WorksForEmptyDescription  )

Definition at line 6176 of file gmock-matchers_test.cc.

6176 {
6177 EXPECT_EQ("is even",
6178 FormatMatcherDescription(false, "IsEven", Strings()));
6179 EXPECT_EQ("not (is even)",
6180 FormatMatcherDescription(true, "IsEven", Strings()));
6181
6182 const char* params[] = {"5"};
6183 EXPECT_EQ("equals 5",
6184 FormatMatcherDescription(false, "Equals",
6185 Strings(params, params + 1)));
6186
6187 const char* params2[] = {"5", "8"};
6188 EXPECT_EQ("is in range (5, 8)",
6189 FormatMatcherDescription(false, "IsInRange",
6190 Strings(params2, params2 + 2)));
6191}
::std::vector< ::std::string > Strings
account_query_db::get_accounts_by_authorizers_params params

◆ TEST() [101/350]

testing::gmock_matchers_test::TEST ( Ge2Test ,
CanDescribeSelf  )

Definition at line 2251 of file gmock-matchers_test.cc.

2251 {
2252 Matcher<const Tuple2&> m = Ge();
2253 EXPECT_EQ("are a pair where the first >= the second", Describe(m));
2254}
Here is the call graph for this function:

◆ TEST() [102/350]

testing::gmock_matchers_test::TEST ( Ge2Test ,
MatchesGreaterThanOrEqualArguments  )

Definition at line 2243 of file gmock-matchers_test.cc.

2243 {
2244 Matcher<const Tuple2&> m = Ge();
2245 EXPECT_TRUE(m.Matches(Tuple2(5L, 4)));
2246 EXPECT_TRUE(m.Matches(Tuple2(5L, 5)));
2247 EXPECT_FALSE(m.Matches(Tuple2(5L, 6)));
2248}
Here is the call graph for this function:

◆ TEST() [103/350]

testing::gmock_matchers_test::TEST ( GeTest ,
CanDescribeSelf  )

Definition at line 1094 of file gmock-matchers_test.cc.

1094 {
1095 Matcher<int> m = Ge(5);
1096 EXPECT_EQ("is >= 5", Describe(m));
1097}
Here is the call graph for this function:

◆ TEST() [104/350]

testing::gmock_matchers_test::TEST ( GeTest ,
ImplementsGreaterThanOrEqual  )

Definition at line 1086 of file gmock-matchers_test.cc.

1086 {
1087 Matcher<int> m1 = Ge(0);
1088 EXPECT_TRUE(m1.Matches(1));
1089 EXPECT_TRUE(m1.Matches(0));
1090 EXPECT_FALSE(m1.Matches(-1));
1091}
Here is the call graph for this function:

◆ TEST() [105/350]

testing::gmock_matchers_test::TEST ( Gt2Test ,
CanDescribeSelf  )

Definition at line 2266 of file gmock-matchers_test.cc.

2266 {
2267 Matcher<const Tuple2&> m = Gt();
2268 EXPECT_EQ("are a pair where the first > the second", Describe(m));
2269}
Here is the call graph for this function:

◆ TEST() [106/350]

testing::gmock_matchers_test::TEST ( Gt2Test ,
MatchesGreaterThanArguments  )

Definition at line 2258 of file gmock-matchers_test.cc.

2258 {
2259 Matcher<const Tuple2&> m = Gt();
2260 EXPECT_TRUE(m.Matches(Tuple2(5L, 4)));
2261 EXPECT_FALSE(m.Matches(Tuple2(5L, 5)));
2262 EXPECT_FALSE(m.Matches(Tuple2(5L, 6)));
2263}
Here is the call graph for this function:

◆ TEST() [107/350]

testing::gmock_matchers_test::TEST ( GtTest ,
CanDescribeSelf  )

Definition at line 1108 of file gmock-matchers_test.cc.

1108 {
1109 Matcher<int> m = Gt(5);
1110 EXPECT_EQ("is > 5", Describe(m));
1111}
Here is the call graph for this function:

◆ TEST() [108/350]

testing::gmock_matchers_test::TEST ( GtTest ,
ImplementsGreaterThan  )

Definition at line 1100 of file gmock-matchers_test.cc.

1100 {
1101 Matcher<double> m1 = Gt(0);
1102 EXPECT_TRUE(m1.Matches(1.0));
1103 EXPECT_FALSE(m1.Matches(0.0));
1104 EXPECT_FALSE(m1.Matches(-1.0));
1105}
Here is the call graph for this function:

◆ TEST() [109/350]

testing::gmock_matchers_test::TEST ( HasSubstrTest ,
CanDescribeSelf  )

Definition at line 1498 of file gmock-matchers_test.cc.

1498 {
1499 Matcher<std::string> m = HasSubstr("foo\n\"");
1500 EXPECT_EQ("has substring \"foo\\n\\\"\"", Describe(m));
1501}
Here is the call graph for this function:

◆ TEST() [110/350]

testing::gmock_matchers_test::TEST ( HasSubstrTest ,
WorksForCStrings  )

Definition at line 1466 of file gmock-matchers_test.cc.

1466 {
1467 const Matcher<char*> m1 = HasSubstr("foo");
1468 EXPECT_TRUE(m1.Matches(const_cast<char*>("I love food.")));
1469 EXPECT_FALSE(m1.Matches(const_cast<char*>("tofo")));
1470 EXPECT_FALSE(m1.Matches(NULL));
1471
1472 const Matcher<const char*> m2 = HasSubstr("foo");
1473 EXPECT_TRUE(m2.Matches("I love food."));
1474 EXPECT_FALSE(m2.Matches("tofo"));
1475 EXPECT_FALSE(m2.Matches(NULL));
1476}
Here is the call graph for this function:

◆ TEST() [111/350]

testing::gmock_matchers_test::TEST ( HasSubstrTest ,
WorksForStringClasses  )

Definition at line 1455 of file gmock-matchers_test.cc.

1455 {
1456 const Matcher<std::string> m1 = HasSubstr("foo");
1457 EXPECT_TRUE(m1.Matches(std::string("I love food.")));
1458 EXPECT_FALSE(m1.Matches(std::string("tofo")));
1459
1460 const Matcher<const std::string&> m2 = HasSubstr("foo");
1461 EXPECT_TRUE(m2.Matches(std::string("I love food.")));
1462 EXPECT_FALSE(m2.Matches(std::string("tofo")));
1463}
Here is the call graph for this function:

◆ TEST() [112/350]

testing::gmock_matchers_test::TEST ( IsEmptyTest ,
CanDescribeSelf  )

Definition at line 4740 of file gmock-matchers_test.cc.

4740 {
4741 Matcher<vector<int> > m = IsEmpty();
4742 EXPECT_EQ("is empty", Describe(m));
4743 EXPECT_EQ("isn't empty", DescribeNegation(m));
4744}
Here is the call graph for this function:

◆ TEST() [113/350]

testing::gmock_matchers_test::TEST ( IsEmptyTest ,
ExplainsResult  )

Definition at line 4746 of file gmock-matchers_test.cc.

4746 {
4747 Matcher<vector<int> > m = IsEmpty();
4748 vector<int> container;
4749 EXPECT_EQ("", Explain(m, container));
4750 container.push_back(0);
4751 EXPECT_EQ("whose size is 1", Explain(m, container));
4752}
Here is the call graph for this function:

◆ TEST() [114/350]

testing::gmock_matchers_test::TEST ( IsEmptyTest ,
ImplementsIsEmpty  )

Definition at line 4722 of file gmock-matchers_test.cc.

4722 {
4723 vector<int> container;
4724 EXPECT_THAT(container, IsEmpty());
4725 container.push_back(0);
4726 EXPECT_THAT(container, Not(IsEmpty()));
4727 container.push_back(1);
4728 EXPECT_THAT(container, Not(IsEmpty()));
4729}
Here is the call graph for this function:

◆ TEST() [115/350]

testing::gmock_matchers_test::TEST ( IsEmptyTest ,
WorksWithString  )

Definition at line 4731 of file gmock-matchers_test.cc.

4731 {
4732 std::string text;
4733 EXPECT_THAT(text, IsEmpty());
4734 text = "foo";
4735 EXPECT_THAT(text, Not(IsEmpty()));
4736 text = std::string("\0", 1);
4737 EXPECT_THAT(text, Not(IsEmpty()));
4738}
Here is the call graph for this function:

◆ TEST() [116/350]

testing::gmock_matchers_test::TEST ( IsNullTest ,
CanDescribeSelf  )

Definition at line 1212 of file gmock-matchers_test.cc.

1212 {
1213 Matcher<int*> m = IsNull();
1214 EXPECT_EQ("is NULL", Describe(m));
1215 EXPECT_EQ("isn't NULL", DescribeNegation(m));
1216}
Here is the call graph for this function:

◆ TEST() [117/350]

testing::gmock_matchers_test::TEST ( IsNullTest ,
LinkedPtr  )

Definition at line 1184 of file gmock-matchers_test.cc.

1184 {
1185 const Matcher<linked_ptr<int> > m = IsNull();
1186 const linked_ptr<int> null_p;
1187 const linked_ptr<int> non_null_p(new int);
1188
1189 EXPECT_TRUE(m.Matches(null_p));
1190 EXPECT_FALSE(m.Matches(non_null_p));
1191}
Here is the call graph for this function:

◆ TEST() [118/350]

testing::gmock_matchers_test::TEST ( IsNullTest ,
MatchesNullPointer  )

Definition at line 1156 of file gmock-matchers_test.cc.

1156 {
1157 Matcher<int*> m1 = IsNull();
1158 int* p1 = NULL;
1159 int n = 0;
1160 EXPECT_TRUE(m1.Matches(p1));
1161 EXPECT_FALSE(m1.Matches(&n));
1162
1163 Matcher<const char*> m2 = IsNull();
1164 const char* p2 = NULL;
1165 EXPECT_TRUE(m2.Matches(p2));
1166 EXPECT_FALSE(m2.Matches("hi"));
1167
1168#if !GTEST_OS_SYMBIAN
1169 // Nokia's Symbian compiler generates:
1170 // gmock-matchers.h: ambiguous access to overloaded function
1171 // gmock-matchers.h: 'testing::Matcher<void *>::Matcher(void *)'
1172 // gmock-matchers.h: 'testing::Matcher<void *>::Matcher(const testing::
1173 // MatcherInterface<void *> *)'
1174 // gmock-matchers.h: (point of instantiation: 'testing::
1175 // gmock_matchers_test::IsNullTest_MatchesNullPointer_Test::TestBody()')
1176 // gmock-matchers.h: (instantiating: 'testing::PolymorphicMatc
1177 Matcher<void*> m3 = IsNull();
1178 void* p3 = NULL;
1179 EXPECT_TRUE(m3.Matches(p3));
1180 EXPECT_FALSE(m3.Matches(reinterpret_cast<void*>(0xbeef)));
1181#endif
1182}
Here is the call graph for this function:

◆ TEST() [119/350]

testing::gmock_matchers_test::TEST ( IsNullTest ,
ReferenceToConstLinkedPtr  )

Definition at line 1193 of file gmock-matchers_test.cc.

1193 {
1194 const Matcher<const linked_ptr<double>&> m = IsNull();
1195 const linked_ptr<double> null_p;
1196 const linked_ptr<double> non_null_p(new double);
1197
1198 EXPECT_TRUE(m.Matches(null_p));
1199 EXPECT_FALSE(m.Matches(non_null_p));
1200}
Here is the call graph for this function:

◆ TEST() [120/350]

testing::gmock_matchers_test::TEST ( IsReadableTypeNameTest ,
ReturnsFalseForLongFunctionTypeNames  )

Definition at line 6170 of file gmock-matchers_test.cc.

6170 {
6171 EXPECT_FALSE(IsReadableTypeName("void (&)(int, bool, char, float)"));
6172}

◆ TEST() [121/350]

testing::gmock_matchers_test::TEST ( IsReadableTypeNameTest ,
ReturnsFalseForLongTemplateNames  )

Definition at line 6164 of file gmock-matchers_test.cc.

6164 {
6166 IsReadableTypeName("basic_string<char, std::char_traits<char> >"));
6167 EXPECT_FALSE(IsReadableTypeName("std::vector<int, std::alloc_traits<int> >"));
6168}

◆ TEST() [122/350]

testing::gmock_matchers_test::TEST ( IsReadableTypeNameTest ,
ReturnsTrueForLongNonTemplateNonFunctionNames  )

Definition at line 6158 of file gmock-matchers_test.cc.

6158 {
6159 EXPECT_TRUE(IsReadableTypeName("my_long_namespace::MyClassName"));
6160 EXPECT_TRUE(IsReadableTypeName("int [5][6][7][8][9][10][11]"));
6161 EXPECT_TRUE(IsReadableTypeName("my_namespace::MyOuterClass::MyInnerClass"));
6162}

◆ TEST() [123/350]

testing::gmock_matchers_test::TEST ( IsReadableTypeNameTest ,
ReturnsTrueForShortNames  )

Definition at line 6151 of file gmock-matchers_test.cc.

6151 {
6152 EXPECT_TRUE(IsReadableTypeName("int"));
6153 EXPECT_TRUE(IsReadableTypeName("const unsigned char*"));
6154 EXPECT_TRUE(IsReadableTypeName("MyMap<int, void*>"));
6155 EXPECT_TRUE(IsReadableTypeName("void (*)(int, bool)"));
6156}

◆ TEST() [124/350]

testing::gmock_matchers_test::TEST ( IsSubsetOfTest ,
Describe  )

Definition at line 5530 of file gmock-matchers_test.cc.

5530 {
5531 typedef std::vector<int> IntVec;
5532 IntVec expected;
5533 expected.push_back(111);
5534 expected.push_back(222);
5535 expected.push_back(333);
5536
5538 Describe<IntVec>(IsSubsetOf(expected)),
5539 Eq("an injection from elements to requirements exists such that:\n"
5540 " - an element is equal to 111\n"
5541 " - an element is equal to 222\n"
5542 " - an element is equal to 333"));
5543}
Here is the call graph for this function:

◆ TEST() [125/350]

testing::gmock_matchers_test::TEST ( IsSubsetOfTest ,
DescribeNegation  )

Definition at line 5545 of file gmock-matchers_test.cc.

5545 {
5546 typedef std::vector<int> IntVec;
5547 IntVec expected;
5548 expected.push_back(111);
5549 expected.push_back(222);
5550 expected.push_back(333);
5552 DescribeNegation<IntVec>(IsSubsetOf(expected)),
5553 Eq("no injection from elements to requirements exists such that:\n"
5554 " - an element is equal to 111\n"
5555 " - an element is equal to 222\n"
5556 " - an element is equal to 333"));
5557}
Here is the call graph for this function:

◆ TEST() [126/350]

testing::gmock_matchers_test::TEST ( IsSubsetOfTest ,
MatchAndExplain  )

Definition at line 5559 of file gmock-matchers_test.cc.

5559 {
5560 std::vector<int> v;
5561 v.push_back(2);
5562 v.push_back(3);
5563 std::vector<int> expected;
5564 expected.push_back(1);
5565 expected.push_back(2);
5567 ASSERT_FALSE(ExplainMatchResult(IsSubsetOf(expected), v, &listener))
5568 << listener.str();
5569 EXPECT_THAT(listener.str(),
5570 Eq("where the following elements don't match any matchers:\n"
5571 "element #1: 3"));
5572
5573 expected.push_back(3);
5574 listener.Clear();
5575 ASSERT_TRUE(ExplainMatchResult(IsSubsetOf(expected), v, &listener))
5576 << listener.str();
5577 EXPECT_THAT(listener.str(), Eq("where:\n"
5578 " - element #0 is matched by matcher #1,\n"
5579 " - element #1 is matched by matcher #2"));
5580}
#define ASSERT_FALSE(condition)
Definition gtest.h:1904
#define ASSERT_TRUE(condition)
Definition gtest.h:1901
Here is the call graph for this function:

◆ TEST() [127/350]

testing::gmock_matchers_test::TEST ( IsSubsetOfTest ,
TakesStlContainer  )

Definition at line 5517 of file gmock-matchers_test.cc.

5517 {
5518 const int actual[] = {3, 1, 2};
5519
5520 ::std::list<int> expected;
5521 expected.push_back(1);
5522 expected.push_back(3);
5523 EXPECT_THAT(actual, Not(IsSubsetOf(expected)));
5524
5525 expected.push_back(2);
5526 expected.push_back(4);
5527 EXPECT_THAT(actual, IsSubsetOf(expected));
5528}
Here is the call graph for this function:

◆ TEST() [128/350]

testing::gmock_matchers_test::TEST ( IsSubsetOfTest ,
WorksForEmpty  )

Definition at line 5487 of file gmock-matchers_test.cc.

5487 {
5488 vector<int> numbers;
5489 vector<int> expected;
5490 EXPECT_THAT(numbers, IsSubsetOf(expected));
5491 expected.push_back(1);
5492 EXPECT_THAT(numbers, IsSubsetOf(expected));
5493 expected.clear();
5494 numbers.push_back(1);
5495 numbers.push_back(2);
5496 EXPECT_THAT(numbers, Not(IsSubsetOf(expected)));
5497 expected.push_back(1);
5498 EXPECT_THAT(numbers, Not(IsSubsetOf(expected)));
5499 expected.push_back(2);
5500 EXPECT_THAT(numbers, IsSubsetOf(expected));
5501 expected.push_back(3);
5502 EXPECT_THAT(numbers, IsSubsetOf(expected));
5503}
Here is the call graph for this function:

◆ TEST() [129/350]

testing::gmock_matchers_test::TEST ( IsSubsetOfTest ,
WorksForNativeArray  )

Definition at line 5468 of file gmock-matchers_test.cc.

5468 {
5469 const int subset[] = {1, 4};
5470 const int superset[] = {1, 2, 4};
5471 const int disjoint[] = {1, 0, 3};
5472 EXPECT_THAT(subset, IsSubsetOf(subset));
5473 EXPECT_THAT(subset, IsSubsetOf(superset));
5474 EXPECT_THAT(superset, Not(IsSubsetOf(subset)));
5475 EXPECT_THAT(subset, Not(IsSubsetOf(disjoint)));
5476 EXPECT_THAT(disjoint, Not(IsSubsetOf(subset)));
5477}
Here is the call graph for this function:

◆ TEST() [130/350]

testing::gmock_matchers_test::TEST ( IsSubsetOfTest ,
WorksForStreamlike  )

Definition at line 5505 of file gmock-matchers_test.cc.

5505 {
5506 const int a[5] = {1, 2};
5507 Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a));
5508
5509 vector<int> expected;
5510 expected.push_back(1);
5511 EXPECT_THAT(s, Not(IsSubsetOf(expected)));
5512 expected.push_back(2);
5513 expected.push_back(5);
5514 EXPECT_THAT(s, IsSubsetOf(expected));
5515}
Here is the call graph for this function:

◆ TEST() [131/350]

testing::gmock_matchers_test::TEST ( IsSubsetOfTest ,
WorksWithDuplicates  )

Definition at line 5479 of file gmock-matchers_test.cc.

5479 {
5480 const int not_enough[] = {1, 2};
5481 const int enough[] = {1, 1, 2};
5482 const int actual[] = {1, 1};
5483 EXPECT_THAT(actual, Not(IsSubsetOf(not_enough)));
5484 EXPECT_THAT(actual, IsSubsetOf(enough));
5485}
Here is the call graph for this function:

◆ TEST() [132/350]

testing::gmock_matchers_test::TEST ( IsSupersetOfTest ,
Describe  )

Definition at line 5409 of file gmock-matchers_test.cc.

5409 {
5410 typedef std::vector<int> IntVec;
5411 IntVec expected;
5412 expected.push_back(111);
5413 expected.push_back(222);
5414 expected.push_back(333);
5416 Describe<IntVec>(IsSupersetOf(expected)),
5417 Eq("a surjection from elements to requirements exists such that:\n"
5418 " - an element is equal to 111\n"
5419 " - an element is equal to 222\n"
5420 " - an element is equal to 333"));
5421}
Here is the call graph for this function:

◆ TEST() [133/350]

testing::gmock_matchers_test::TEST ( IsSupersetOfTest ,
DescribeNegation  )

Definition at line 5423 of file gmock-matchers_test.cc.

5423 {
5424 typedef std::vector<int> IntVec;
5425 IntVec expected;
5426 expected.push_back(111);
5427 expected.push_back(222);
5428 expected.push_back(333);
5430 DescribeNegation<IntVec>(IsSupersetOf(expected)),
5431 Eq("no surjection from elements to requirements exists such that:\n"
5432 " - an element is equal to 111\n"
5433 " - an element is equal to 222\n"
5434 " - an element is equal to 333"));
5435}
Here is the call graph for this function:

◆ TEST() [134/350]

testing::gmock_matchers_test::TEST ( IsSupersetOfTest ,
MatchAndExplain  )

Definition at line 5437 of file gmock-matchers_test.cc.

5437 {
5438 std::vector<int> v;
5439 v.push_back(2);
5440 v.push_back(3);
5441 std::vector<int> expected;
5442 expected.push_back(1);
5443 expected.push_back(2);
5445 ASSERT_FALSE(ExplainMatchResult(IsSupersetOf(expected), v, &listener))
5446 << listener.str();
5447 EXPECT_THAT(listener.str(),
5448 Eq("where the following matchers don't match any elements:\n"
5449 "matcher #0: is equal to 1"));
5450
5451 v.push_back(1);
5452 listener.Clear();
5453 ASSERT_TRUE(ExplainMatchResult(IsSupersetOf(expected), v, &listener))
5454 << listener.str();
5455 EXPECT_THAT(listener.str(), Eq("where:\n"
5456 " - element #0 is matched by matcher #1,\n"
5457 " - element #2 is matched by matcher #0"));
5458}
Here is the call graph for this function:

◆ TEST() [135/350]

testing::gmock_matchers_test::TEST ( IsSupersetOfTest ,
TakesStlContainer  )

Definition at line 5397 of file gmock-matchers_test.cc.

5397 {
5398 const int actual[] = {3, 1, 2};
5399
5400 ::std::list<int> expected;
5401 expected.push_back(1);
5402 expected.push_back(3);
5403 EXPECT_THAT(actual, IsSupersetOf(expected));
5404
5405 expected.push_back(4);
5406 EXPECT_THAT(actual, Not(IsSupersetOf(expected)));
5407}
Here is the call graph for this function:

◆ TEST() [136/350]

testing::gmock_matchers_test::TEST ( IsSupersetOfTest ,
WorksForEmpty  )

Definition at line 5365 of file gmock-matchers_test.cc.

5365 {
5366 vector<int> numbers;
5367 vector<int> expected;
5368 EXPECT_THAT(numbers, IsSupersetOf(expected));
5369 expected.push_back(1);
5370 EXPECT_THAT(numbers, Not(IsSupersetOf(expected)));
5371 expected.clear();
5372 numbers.push_back(1);
5373 numbers.push_back(2);
5374 EXPECT_THAT(numbers, IsSupersetOf(expected));
5375 expected.push_back(1);
5376 EXPECT_THAT(numbers, IsSupersetOf(expected));
5377 expected.push_back(2);
5378 EXPECT_THAT(numbers, IsSupersetOf(expected));
5379 expected.push_back(3);
5380 EXPECT_THAT(numbers, Not(IsSupersetOf(expected)));
5381}
Here is the call graph for this function:

◆ TEST() [137/350]

testing::gmock_matchers_test::TEST ( IsSupersetOfTest ,
WorksForNativeArray  )

Definition at line 5346 of file gmock-matchers_test.cc.

5346 {
5347 const int subset[] = {1, 4};
5348 const int superset[] = {1, 2, 4};
5349 const int disjoint[] = {1, 0, 3};
5350 EXPECT_THAT(subset, IsSupersetOf(subset));
5351 EXPECT_THAT(subset, Not(IsSupersetOf(superset)));
5352 EXPECT_THAT(superset, IsSupersetOf(subset));
5353 EXPECT_THAT(subset, Not(IsSupersetOf(disjoint)));
5354 EXPECT_THAT(disjoint, Not(IsSupersetOf(subset)));
5355}
Here is the call graph for this function:

◆ TEST() [138/350]

testing::gmock_matchers_test::TEST ( IsSupersetOfTest ,
WorksForStreamlike  )

Definition at line 5383 of file gmock-matchers_test.cc.

5383 {
5384 const int a[5] = {1, 2, 3, 4, 5};
5385 Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a));
5386
5387 vector<int> expected;
5388 expected.push_back(1);
5389 expected.push_back(2);
5390 expected.push_back(5);
5391 EXPECT_THAT(s, IsSupersetOf(expected));
5392
5393 expected.push_back(0);
5394 EXPECT_THAT(s, Not(IsSupersetOf(expected)));
5395}
Here is the call graph for this function:

◆ TEST() [139/350]

testing::gmock_matchers_test::TEST ( IsSupersetOfTest ,
WorksWithDuplicates  )

Definition at line 5357 of file gmock-matchers_test.cc.

5357 {
5358 const int not_enough[] = {1, 2};
5359 const int enough[] = {1, 1, 2};
5360 const int expected[] = {1, 1};
5361 EXPECT_THAT(not_enough, Not(IsSupersetOf(expected)));
5362 EXPECT_THAT(enough, IsSupersetOf(expected));
5363}
Here is the call graph for this function:

◆ TEST() [140/350]

testing::gmock_matchers_test::TEST ( IsTrueTest ,
IsTrueIsFalse  )

Definition at line 4754 of file gmock-matchers_test.cc.

4754 {
4755 EXPECT_THAT(true, IsTrue());
4756 EXPECT_THAT(false, IsFalse());
4757 EXPECT_THAT(true, Not(IsFalse()));
4758 EXPECT_THAT(false, Not(IsTrue()));
4759 EXPECT_THAT(0, Not(IsTrue()));
4760 EXPECT_THAT(0, IsFalse());
4761 EXPECT_THAT(NULL, Not(IsTrue()));
4762 EXPECT_THAT(NULL, IsFalse());
4763 EXPECT_THAT(-1, IsTrue());
4764 EXPECT_THAT(-1, Not(IsFalse()));
4765 EXPECT_THAT(1, IsTrue());
4766 EXPECT_THAT(1, Not(IsFalse()));
4767 EXPECT_THAT(2, IsTrue());
4768 EXPECT_THAT(2, Not(IsFalse()));
4769 int a = 42;
4770 EXPECT_THAT(a, IsTrue());
4771 EXPECT_THAT(a, Not(IsFalse()));
4772 EXPECT_THAT(&a, IsTrue());
4773 EXPECT_THAT(&a, Not(IsFalse()));
4774 EXPECT_THAT(false, Not(IsTrue()));
4775 EXPECT_THAT(true, Not(IsFalse()));
4776#if GTEST_LANG_CXX11
4777 EXPECT_THAT(std::true_type(), IsTrue());
4778 EXPECT_THAT(std::true_type(), Not(IsFalse()));
4779 EXPECT_THAT(std::false_type(), IsFalse());
4780 EXPECT_THAT(std::false_type(), Not(IsTrue()));
4781 EXPECT_THAT(nullptr, Not(IsTrue()));
4782 EXPECT_THAT(nullptr, IsFalse());
4783 std::unique_ptr<int> null_unique;
4784 std::unique_ptr<int> nonnull_unique(new int(0));
4785 EXPECT_THAT(null_unique, Not(IsTrue()));
4786 EXPECT_THAT(null_unique, IsFalse());
4787 EXPECT_THAT(nonnull_unique, IsTrue());
4788 EXPECT_THAT(nonnull_unique, Not(IsFalse()));
4789#endif // GTEST_LANG_CXX11
4790}
Here is the call graph for this function:

◆ TEST() [141/350]

testing::gmock_matchers_test::TEST ( KeyTest ,
CanDescribeSelf  )

Definition at line 1503 of file gmock-matchers_test.cc.

1503 {
1504 Matcher<const pair<std::string, int>&> m = Key("foo");
1505 EXPECT_EQ("has a key that is equal to \"foo\"", Describe(m));
1506 EXPECT_EQ("doesn't have a key that is equal to \"foo\"", DescribeNegation(m));
1507}
Here is the call graph for this function:

◆ TEST() [142/350]

testing::gmock_matchers_test::TEST ( KeyTest ,
ExplainsResult  )

Definition at line 1509 of file gmock-matchers_test.cc.

1509 {
1510 Matcher<pair<int, bool> > m = Key(GreaterThan(10));
1511 EXPECT_EQ("whose first field is a value which is 5 less than 10",
1512 Explain(m, make_pair(5, true)));
1513 EXPECT_EQ("whose first field is a value which is 5 more than 10",
1514 Explain(m, make_pair(15, true)));
1515}
Here is the call graph for this function:

◆ TEST() [143/350]

testing::gmock_matchers_test::TEST ( KeyTest ,
InsideContainsUsingMap  )

Definition at line 1562 of file gmock-matchers_test.cc.

1562 {
1563 map<int, char> container;
1564 container.insert(make_pair(1, 'a'));
1565 container.insert(make_pair(2, 'b'));
1566 container.insert(make_pair(4, 'c'));
1567 EXPECT_THAT(container, Contains(Key(1)));
1568 EXPECT_THAT(container, Not(Contains(Key(3))));
1569}
Here is the call graph for this function:

◆ TEST() [144/350]

testing::gmock_matchers_test::TEST ( KeyTest ,
InsideContainsUsingMultimap  )

Definition at line 1571 of file gmock-matchers_test.cc.

1571 {
1572 multimap<int, char> container;
1573 container.insert(make_pair(1, 'a'));
1574 container.insert(make_pair(2, 'b'));
1575 container.insert(make_pair(4, 'c'));
1576
1577 EXPECT_THAT(container, Not(Contains(Key(25))));
1578 container.insert(make_pair(25, 'd'));
1579 EXPECT_THAT(container, Contains(Key(25)));
1580 container.insert(make_pair(25, 'e'));
1581 EXPECT_THAT(container, Contains(Key(25)));
1582
1583 EXPECT_THAT(container, Contains(Key(1)));
1584 EXPECT_THAT(container, Not(Contains(Key(3))));
1585}
Here is the call graph for this function:

◆ TEST() [145/350]

testing::gmock_matchers_test::TEST ( KeyTest ,
MatchesCorrectly  )

Definition at line 1517 of file gmock-matchers_test.cc.

1517 {
1518 pair<int, std::string> p(25, "foo");
1519 EXPECT_THAT(p, Key(25));
1520 EXPECT_THAT(p, Not(Key(42)));
1521 EXPECT_THAT(p, Key(Ge(20)));
1522 EXPECT_THAT(p, Not(Key(Lt(25))));
1523}
const mie::Vuint & p
Definition bn.cpp:27
Here is the call graph for this function:

◆ TEST() [146/350]

testing::gmock_matchers_test::TEST ( KeyTest ,
SafelyCastsInnerMatcher  )

Definition at line 1554 of file gmock-matchers_test.cc.

1554 {
1555 Matcher<int> is_positive = Gt(0);
1556 Matcher<int> is_negative = Lt(0);
1557 pair<char, bool> p('a', true);
1558 EXPECT_THAT(p, Key(is_positive));
1559 EXPECT_THAT(p, Not(Key(is_negative)));
1560}
Here is the call graph for this function:

◆ TEST() [147/350]

testing::gmock_matchers_test::TEST ( Le2Test ,
CanDescribeSelf  )

Definition at line 2281 of file gmock-matchers_test.cc.

2281 {
2282 Matcher<const Tuple2&> m = Le();
2283 EXPECT_EQ("are a pair where the first <= the second", Describe(m));
2284}
Here is the call graph for this function:

◆ TEST() [148/350]

testing::gmock_matchers_test::TEST ( Le2Test ,
MatchesLessThanOrEqualArguments  )

Definition at line 2273 of file gmock-matchers_test.cc.

2273 {
2274 Matcher<const Tuple2&> m = Le();
2275 EXPECT_TRUE(m.Matches(Tuple2(5L, 6)));
2276 EXPECT_TRUE(m.Matches(Tuple2(5L, 5)));
2277 EXPECT_FALSE(m.Matches(Tuple2(5L, 4)));
2278}
Here is the call graph for this function:

◆ TEST() [149/350]

testing::gmock_matchers_test::TEST ( LeTest ,
CanDescribeSelf  )

Definition at line 1122 of file gmock-matchers_test.cc.

1122 {
1123 Matcher<int> m = Le(5);
1124 EXPECT_EQ("is <= 5", Describe(m));
1125}
Here is the call graph for this function:

◆ TEST() [150/350]

testing::gmock_matchers_test::TEST ( LeTest ,
ImplementsLessThanOrEqual  )

Definition at line 1114 of file gmock-matchers_test.cc.

1114 {
1115 Matcher<char> m1 = Le('b');
1116 EXPECT_TRUE(m1.Matches('a'));
1117 EXPECT_TRUE(m1.Matches('b'));
1118 EXPECT_FALSE(m1.Matches('c'));
1119}
Here is the call graph for this function:

◆ TEST() [151/350]

testing::gmock_matchers_test::TEST ( Lt2Test ,
CanDescribeSelf  )

Definition at line 2296 of file gmock-matchers_test.cc.

2296 {
2297 Matcher<const Tuple2&> m = Lt();
2298 EXPECT_EQ("are a pair where the first < the second", Describe(m));
2299}
Here is the call graph for this function:

◆ TEST() [152/350]

testing::gmock_matchers_test::TEST ( Lt2Test ,
MatchesLessThanArguments  )

Definition at line 2288 of file gmock-matchers_test.cc.

2288 {
2289 Matcher<const Tuple2&> m = Lt();
2290 EXPECT_TRUE(m.Matches(Tuple2(5L, 6)));
2291 EXPECT_FALSE(m.Matches(Tuple2(5L, 5)));
2292 EXPECT_FALSE(m.Matches(Tuple2(5L, 4)));
2293}
Here is the call graph for this function:

◆ TEST() [153/350]

testing::gmock_matchers_test::TEST ( LtTest ,
CanDescribeSelf  )

Definition at line 1136 of file gmock-matchers_test.cc.

1136 {
1137 Matcher<int> m = Lt(5);
1138 EXPECT_EQ("is < 5", Describe(m));
1139}
Here is the call graph for this function:

◆ TEST() [154/350]

testing::gmock_matchers_test::TEST ( LtTest ,
ImplementsLessThan  )

Definition at line 1128 of file gmock-matchers_test.cc.

1128 {
1129 Matcher<const std::string&> m1 = Lt("Hello");
1130 EXPECT_TRUE(m1.Matches("Abc"));
1131 EXPECT_FALSE(m1.Matches("Hello"));
1132 EXPECT_FALSE(m1.Matches("Hello, world!"));
1133}
Here is the call graph for this function:

◆ TEST() [155/350]

testing::gmock_matchers_test::TEST ( MakeMatcherTest ,
ConstructsMatcherFromMatcherInterface  )

Definition at line 515 of file gmock-matchers_test.cc.

515 {
516 const MatcherInterface<int>* dummy_impl = NULL;
517 Matcher<int> m = MakeMatcher(dummy_impl);
518}
Here is the call graph for this function:

◆ TEST() [156/350]

testing::gmock_matchers_test::TEST ( MakePolymorphicMatcherTest ,
ConstructsMatcherUsingNewAPI  )

Definition at line 588 of file gmock-matchers_test.cc.

588 {
589 // Using PolymorphicIsEven() as a Matcher<int>.
590 const Matcher<int> m1 = PolymorphicIsEven();
591 EXPECT_TRUE(m1.Matches(42));
592 EXPECT_FALSE(m1.Matches(43));
593 EXPECT_EQ("is even", Describe(m1));
594
595 const Matcher<int> not_m1 = Not(m1);
596 EXPECT_EQ("is odd", Describe(not_m1));
597
598 EXPECT_EQ("% 2 == 0", Explain(m1, 42));
599
600 // Using PolymorphicIsEven() as a Matcher<char>.
601 const Matcher<char> m2 = PolymorphicIsEven();
602 EXPECT_TRUE(m2.Matches('\x42'));
603 EXPECT_FALSE(m2.Matches('\x43'));
604 EXPECT_EQ("is even", Describe(m2));
605
606 const Matcher<char> not_m2 = Not(m2);
607 EXPECT_EQ("is odd", Describe(not_m2));
608
609 EXPECT_EQ("% 2 == 0", Explain(m2, '\x42'));
610}
Here is the call graph for this function:

◆ TEST() [157/350]

testing::gmock_matchers_test::TEST ( MakePolymorphicMatcherTest ,
ConstructsMatcherUsingOldAPI  )

Definition at line 545 of file gmock-matchers_test.cc.

545 {
546 // Using a polymorphic matcher to match a reference type.
548 EXPECT_TRUE(m1.Matches(0));
549 // Verifies that the identity of a by-reference argument is preserved.
550 EXPECT_TRUE(m1.Matches(g_bar));
551 EXPECT_FALSE(m1.Matches(1));
552 EXPECT_EQ("g_bar or zero", Describe(m1));
553
554 // Using a polymorphic matcher to match a value type.
556 EXPECT_TRUE(m2.Matches(0.0));
557 EXPECT_FALSE(m2.Matches(0.1));
558 EXPECT_EQ("g_bar or zero", Describe(m2));
559}
PolymorphicMatcher< ReferencesBarOrIsZeroImpl > ReferencesBarOrIsZero()
Here is the call graph for this function:

◆ TEST() [158/350]

testing::gmock_matchers_test::TEST ( MatcherAssertionTest ,
WorksForByRefArguments  )

Definition at line 3176 of file gmock-matchers_test.cc.

3176 {
3177 // We use a static variable here as EXPECT_FATAL_FAILURE() cannot
3178 // reference auto variables.
3179 static int n;
3180 n = 0;
3181 EXPECT_THAT(n, AllOf(Le(7), Ref(n)));
3183 "Value of: n\n"
3184 "Expected: does not reference the variable @");
3185 // Tests the "Actual" part.
3187 "Actual: 0" + OfType("int") + ", which is located @");
3188}
#define ASSERT_THAT(value, matcher)
#define EXPECT_FATAL_FAILURE(statement, substr)
Definition gtest-spi.h:137
internal::NotMatcher< InnerMatcher > Not(InnerMatcher m)
internal::RefMatcher< T & > Ref(T &x)
Here is the call graph for this function:

◆ TEST() [159/350]

testing::gmock_matchers_test::TEST ( MatcherAssertionTest ,
WorksForMonomorphicMatcher  )

Definition at line 3204 of file gmock-matchers_test.cc.

3204 {
3205 Matcher<const char*> starts_with_he = StartsWith("he");
3206 ASSERT_THAT("hello", starts_with_he);
3207
3208 Matcher<const std::string&> ends_with_ok = EndsWith("ok");
3209 ASSERT_THAT("book", ends_with_ok);
3210 const std::string bad = "bad";
3211 EXPECT_NONFATAL_FAILURE(EXPECT_THAT(bad, ends_with_ok),
3212 "Value of: bad\n"
3213 "Expected: ends with \"ok\"\n"
3214 " Actual: \"bad\"");
3215 Matcher<int> is_greater_than_5 = Gt(5);
3216 EXPECT_NONFATAL_FAILURE(EXPECT_THAT(5, is_greater_than_5),
3217 "Value of: 5\n"
3218 "Expected: is > 5\n"
3219 " Actual: 5" + OfType("int"));
3220}
#define EXPECT_NONFATAL_FAILURE(statement, substr)
Definition gtest-spi.h:203
Here is the call graph for this function:

◆ TEST() [160/350]

testing::gmock_matchers_test::TEST ( MatcherAssertionTest ,
WorksWhenMatcherIsNotSatisfied  )

Definition at line 3151 of file gmock-matchers_test.cc.

3151 {
3152 // 'n' must be static as it is used in an EXPECT_FATAL_FAILURE(),
3153 // which cannot reference auto variables.
3154 static unsigned short n; // NOLINT
3155 n = 5;
3156
3157 // VC++ prior to version 8.0 SP1 has a bug where it will not see any
3158 // functions declared in the namespace scope from within nested classes.
3159 // EXPECT/ASSERT_(NON)FATAL_FAILURE macros use nested classes so that all
3160 // namespace-level functions invoked inside them need to be explicitly
3161 // resolved.
3163 "Value of: n\n"
3164 "Expected: is > 10\n"
3165 " Actual: 5" + OfType("unsigned short"));
3166 n = 0;
3169 "Value of: n\n"
3170 "Expected: (is <= 7) and (is >= 5)\n"
3171 " Actual: 0" + OfType("unsigned short"));
3172}
internal::Le2Matcher Le()
internal::Gt2Matcher Gt()
internal::AllOfResult2< M1, M2 >::type AllOf(M1 m1, M2 m2)
internal::Ge2Matcher Ge()
Here is the call graph for this function:

◆ TEST() [161/350]

testing::gmock_matchers_test::TEST ( MatcherAssertionTest ,
WorksWhenMatcherIsSatisfied  )

Definition at line 3142 of file gmock-matchers_test.cc.

3142 {
3143 ASSERT_THAT(5, Ge(2)) << "This should succeed.";
3144 ASSERT_THAT("Foo", EndsWith("oo"));
3145 EXPECT_THAT(2, AllOf(Le(7), Ge(0))) << "This should succeed too.";
3146 EXPECT_THAT("Hello", StartsWith("Hell"));
3147}
Here is the call graph for this function:

◆ TEST() [162/350]

testing::gmock_matchers_test::TEST ( MatcherCastTest ,
FromAnImplicitlyConvertibleValue  )

Definition at line 705 of file gmock-matchers_test.cc.

705 {
706 const int kExpected = 'c';
707 Matcher<int> m = MatcherCast<int>('c');
708 EXPECT_TRUE(m.Matches(kExpected));
709 EXPECT_FALSE(m.Matches(kExpected + 1));
710}
Here is the call graph for this function:

◆ TEST() [163/350]

testing::gmock_matchers_test::TEST ( MatcherCastTest ,
FromAValue  )

Definition at line 697 of file gmock-matchers_test.cc.

697 {
698 Matcher<int> m = MatcherCast<int>(42);
699 EXPECT_TRUE(m.Matches(42));
700 EXPECT_FALSE(m.Matches(239));
701}
Here is the call graph for this function:

◆ TEST() [164/350]

testing::gmock_matchers_test::TEST ( MatcherCastTest ,
FromCompatibleType  )

Definition at line 638 of file gmock-matchers_test.cc.

638 {
639 Matcher<double> m1 = Eq(2.0);
640 Matcher<int> m2 = MatcherCast<int>(m1);
641 EXPECT_TRUE(m2.Matches(2));
642 EXPECT_FALSE(m2.Matches(3));
643
644 Matcher<IntValue> m3 = Truly(IsPositiveIntValue);
645 Matcher<int> m4 = MatcherCast<int>(m3);
646 // In the following, the arguments 1 and 0 are statically converted
647 // to IntValue objects, and then tested by the IsPositiveIntValue()
648 // predicate.
649 EXPECT_TRUE(m4.Matches(1));
650 EXPECT_FALSE(m4.Matches(0));
651}
Here is the call graph for this function:

◆ TEST() [165/350]

testing::gmock_matchers_test::TEST ( MatcherCastTest ,
FromConstReferenceToNonReference  )

Definition at line 654 of file gmock-matchers_test.cc.

654 {
655 Matcher<const int&> m1 = Eq(0);
656 Matcher<int> m2 = MatcherCast<int>(m1);
657 EXPECT_TRUE(m2.Matches(0));
658 EXPECT_FALSE(m2.Matches(1));
659}
Here is the call graph for this function:

◆ TEST() [166/350]

testing::gmock_matchers_test::TEST ( MatcherCastTest ,
FromNonReferenceToConstReference  )

Definition at line 670 of file gmock-matchers_test.cc.

670 {
671 Matcher<int> m1 = Eq(0);
672 Matcher<const int&> m2 = MatcherCast<const int&>(m1);
673 EXPECT_TRUE(m2.Matches(0));
674 EXPECT_FALSE(m2.Matches(1));
675}
Here is the call graph for this function:

◆ TEST() [167/350]

testing::gmock_matchers_test::TEST ( MatcherCastTest ,
FromNonReferenceToReference  )

Definition at line 678 of file gmock-matchers_test.cc.

678 {
679 Matcher<int> m1 = Eq(0);
680 Matcher<int&> m2 = MatcherCast<int&>(m1);
681 int n = 0;
682 EXPECT_TRUE(m2.Matches(n));
683 n = 1;
684 EXPECT_FALSE(m2.Matches(n));
685}
Here is the call graph for this function:

◆ TEST() [168/350]

testing::gmock_matchers_test::TEST ( MatcherCastTest ,
FromPolymorphicMatcher  )

Definition at line 613 of file gmock-matchers_test.cc.

613 {
614 Matcher<int> m = MatcherCast<int>(Eq(5));
615 EXPECT_TRUE(m.Matches(5));
616 EXPECT_FALSE(m.Matches(6));
617}
Here is the call graph for this function:

◆ TEST() [169/350]

testing::gmock_matchers_test::TEST ( MatcherCastTest ,
FromReferenceToNonReference  )

Definition at line 662 of file gmock-matchers_test.cc.

662 {
663 Matcher<int&> m1 = Eq(0);
664 Matcher<int> m2 = MatcherCast<int>(m1);
665 EXPECT_TRUE(m2.Matches(0));
666 EXPECT_FALSE(m2.Matches(1));
667}
Here is the call graph for this function:

◆ TEST() [170/350]

testing::gmock_matchers_test::TEST ( MatcherCastTest ,
FromSameType  )

Definition at line 688 of file gmock-matchers_test.cc.

688 {
689 Matcher<int> m1 = Eq(0);
690 Matcher<int> m2 = MatcherCast<int>(m1);
691 EXPECT_TRUE(m2.Matches(0));
692 EXPECT_FALSE(m2.Matches(1));
693}
Here is the call graph for this function:

◆ TEST() [171/350]

testing::gmock_matchers_test::TEST ( MatcherCastTest ,
NonImplicitlyConstructibleTypeWithOperatorEq  )

Definition at line 728 of file gmock-matchers_test.cc.

728 {
730 MatcherCast<NonImplicitlyConstructibleTypeWithOperatorEq>(42);
732
734 MatcherCast<NonImplicitlyConstructibleTypeWithOperatorEq>(239);
736
737 // When updating the following lines please also change the comment to
738 // namespace convertible_from_any.
739 Matcher<int> m3 =
741 EXPECT_TRUE(m3.Matches(42));
742 EXPECT_FALSE(m3.Matches(239));
743}
Here is the call graph for this function:

◆ TEST() [172/350]

testing::gmock_matchers_test::TEST ( MatcherCastTest ,
ValueIsNotCopied  )

Definition at line 803 of file gmock-matchers_test.cc.

803 {
804 int n = 42;
805 Matcher<IntReferenceWrapper> m = MatcherCast<IntReferenceWrapper>(n);
806 // Verify that the matcher holds a reference to n, not to its temporary copy.
807 EXPECT_TRUE(m.Matches(n));
808}
Here is the call graph for this function:

◆ TEST() [173/350]

testing::gmock_matchers_test::TEST ( MatcherInterfaceTest ,
CanBeImplementedUsingNewAPI  )

Definition at line 300 of file gmock-matchers_test.cc.

300 {
301 Matcher<int> m = MakeMatcher(new NewEvenMatcherImpl);
302 EXPECT_TRUE(m.Matches(2));
303 EXPECT_FALSE(m.Matches(3));
304 EXPECT_EQ("value % 2 == 0", Explain(m, 2));
305 EXPECT_EQ("value % 2 == 1", Explain(m, 3));
306}
Here is the call graph for this function:

◆ TEST() [174/350]

testing::gmock_matchers_test::TEST ( MatcherInterfaceTest ,
CanBeImplementedUsingPublishedAPI  )

◆ TEST() [175/350]

testing::gmock_matchers_test::TEST ( MatcherTest ,
CanAcceptAbstractClass  )

Definition at line 350 of file gmock-matchers_test.cc.

#define _(str)
Definition localize.hpp:7

◆ TEST() [176/350]

testing::gmock_matchers_test::TEST ( MatcherTest ,
CanBeConstructedFromMatcherInterface  )

Definition at line 314 of file gmock-matchers_test.cc.

314 {
315 const MatcherInterface<int>* impl = new EvenMatcherImpl;
316 Matcher<int> m(impl);
317 EXPECT_TRUE(m.Matches(4));
318 EXPECT_FALSE(m.Matches(5));
319}
Here is the call graph for this function:

◆ TEST() [177/350]

testing::gmock_matchers_test::TEST ( MatcherTest ,
CanBeConstructedFromUndefinedVariable  )

Definition at line 343 of file gmock-matchers_test.cc.

343 {
344 Matcher<int> m1 = Undefined::kInt;
345 EXPECT_TRUE(m1.Matches(1));
346 EXPECT_FALSE(m1.Matches(2));
347}
Here is the call graph for this function:

◆ TEST() [178/350]

testing::gmock_matchers_test::TEST ( MatcherTest ,
CanBeDefaultConstructed  )

Definition at line 309 of file gmock-matchers_test.cc.

309 {
311}

◆ TEST() [179/350]

testing::gmock_matchers_test::TEST ( MatcherTest ,
CanBeImplicitlyConstructedFromNULL  )

Definition at line 329 of file gmock-matchers_test.cc.

329 {
330 Matcher<int*> m1 = NULL;
331 EXPECT_TRUE(m1.Matches(NULL));
332 int n = 0;
333 EXPECT_FALSE(m1.Matches(&n));
334}
Here is the call graph for this function:

◆ TEST() [180/350]

testing::gmock_matchers_test::TEST ( MatcherTest ,
CanBeImplicitlyConstructedFromValue  )

Definition at line 322 of file gmock-matchers_test.cc.

322 {
323 Matcher<int> m1 = 5;
324 EXPECT_TRUE(m1.Matches(5));
325 EXPECT_FALSE(m1.Matches(6));
326}
Here is the call graph for this function:

◆ TEST() [181/350]

testing::gmock_matchers_test::TEST ( MatcherTest ,
CanDescribeItself  )

Definition at line 367 of file gmock-matchers_test.cc.

367 {
368 EXPECT_EQ("is an even number",
370}
Here is the call graph for this function:

◆ TEST() [182/350]

testing::gmock_matchers_test::TEST ( MatcherTest ,
IsCopyable  )

Definition at line 353 of file gmock-matchers_test.cc.

353 {
354 // Tests the copy constructor.
355 Matcher<bool> m1 = Eq(false);
356 EXPECT_TRUE(m1.Matches(false));
357 EXPECT_FALSE(m1.Matches(true));
358
359 // Tests the assignment operator.
360 m1 = Eq(true);
361 EXPECT_TRUE(m1.Matches(true));
362 EXPECT_FALSE(m1.Matches(false));
363}
Here is the call graph for this function:

◆ TEST() [183/350]

testing::gmock_matchers_test::TEST ( MatcherTest ,
MatchAndExplain  )

Definition at line 373 of file gmock-matchers_test.cc.

373 {
376 EXPECT_TRUE(m.MatchAndExplain(42, &listener1));
377 EXPECT_EQ("which is 42 more than 0", listener1.str());
378
380 EXPECT_FALSE(m.MatchAndExplain(-9, &listener2));
381 EXPECT_EQ("which is 9 less than 0", listener2.str());
382}
bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) x, MatchResultListener *listener) const
Here is the call graph for this function:

◆ TEST() [184/350]

testing::gmock_matchers_test::TEST ( MatcherTupleTest ,
ExplainsMatchFailure  )

Definition at line 6210 of file gmock-matchers_test.cc.

6210 {
6211 stringstream ss1;
6212 ExplainMatchFailureTupleTo(make_tuple(Matcher<char>(Eq('a')), GreaterThan(5)),
6213 make_tuple('a', 10), &ss1);
6214 EXPECT_EQ("", ss1.str()); // Successful match.
6215
6216 stringstream ss2;
6217 ExplainMatchFailureTupleTo(make_tuple(GreaterThan(5), Matcher<char>(Eq('a'))),
6218 make_tuple(2, 'b'), &ss2);
6219 EXPECT_EQ(" Expected arg #0: is > 5\n"
6220 " Actual: 2, which is 3 less than 5\n"
6221 " Expected arg #1: is equal to 'a' (97, 0x61)\n"
6222 " Actual: 'b' (98, 0x62)\n",
6223 ss2.str()); // Failed match where both arguments need explanation.
6224
6225 stringstream ss3;
6226 ExplainMatchFailureTupleTo(make_tuple(GreaterThan(5), Matcher<char>(Eq('a'))),
6227 make_tuple(2, 'a'), &ss3);
6228 EXPECT_EQ(" Expected arg #0: is > 5\n"
6229 " Actual: 2, which is 3 less than 5\n",
6230 ss3.str()); // Failed match where only one argument needs
6231 // explanation.
6232}
Here is the call graph for this function:

◆ TEST() [185/350]

testing::gmock_matchers_test::TEST ( MatchesRegexTest ,
CanDescribeSelf  )

Definition at line 1789 of file gmock-matchers_test.cc.

1789 {
1790 Matcher<const std::string> m1 = MatchesRegex(std::string("Hi.*"));
1791 EXPECT_EQ("matches regular expression \"Hi.*\"", Describe(m1));
1792
1793 Matcher<const char*> m2 = MatchesRegex(new RE("a.*"));
1794 EXPECT_EQ("matches regular expression \"a.*\"", Describe(m2));
1795
1796#if GTEST_HAS_ABSL
1797 Matcher<const absl::string_view> m3 = MatchesRegex(new RE("0.*"));
1798 EXPECT_EQ("matches regular expression \"0.*\"", Describe(m3));
1799#endif // GTEST_HAS_ABSL
1800}
Here is the call graph for this function:

◆ TEST() [186/350]

testing::gmock_matchers_test::TEST ( MatchesRegexTest ,
MatchesStringMatchingGivenRegex  )

Definition at line 1765 of file gmock-matchers_test.cc.

1765 {
1766 const Matcher<const char*> m1 = MatchesRegex("a.*z");
1767 EXPECT_TRUE(m1.Matches("az"));
1768 EXPECT_TRUE(m1.Matches("abcz"));
1769 EXPECT_FALSE(m1.Matches(NULL));
1770
1771 const Matcher<const std::string&> m2 = MatchesRegex(new RE("a.*z"));
1772 EXPECT_TRUE(m2.Matches("azbz"));
1773 EXPECT_FALSE(m2.Matches("az1"));
1774 EXPECT_FALSE(m2.Matches("1az"));
1775
1776#if GTEST_HAS_ABSL
1777 const Matcher<const absl::string_view&> m3 = MatchesRegex("a.*z");
1778 EXPECT_TRUE(m3.Matches(absl::string_view("az")));
1779 EXPECT_TRUE(m3.Matches(absl::string_view("abcz")));
1780 EXPECT_FALSE(m3.Matches(absl::string_view("1az")));
1781 // Default-constructed absl::string_view should not match anything, in order
1782 // to distinguish it from an empty string.
1783 EXPECT_FALSE(m3.Matches(absl::string_view()));
1784 const Matcher<const absl::string_view&> m4 = MatchesRegex("");
1785 EXPECT_FALSE(m4.Matches(absl::string_view()));
1786#endif // GTEST_HAS_ABSL
1787}
Here is the call graph for this function:

◆ TEST() [187/350]

testing::gmock_matchers_test::TEST ( MatchesTest ,
IsSatisfiedByWhatMatchesTheMatcher  )

Definition at line 2982 of file gmock-matchers_test.cc.

2982 {
2983 EXPECT_TRUE(Matches(Ge(0))(1));
2984 EXPECT_FALSE(Matches(Eq('a'))('b'));
2985}
Here is the call graph for this function:

◆ TEST() [188/350]

testing::gmock_matchers_test::TEST ( MatchesTest ,
WorksOnByRefArguments  )

Definition at line 2989 of file gmock-matchers_test.cc.

2989 {
2990 int m = 0, n = 0;
2991 EXPECT_TRUE(Matches(AllOf(Ref(n), Eq(0)))(n));
2992 EXPECT_FALSE(Matches(Ref(m))(n));
2993}
Here is the call graph for this function:

◆ TEST() [189/350]

testing::gmock_matchers_test::TEST ( MatchesTest ,
WorksWithMatcherOnNonRefType  )

Definition at line 2997 of file gmock-matchers_test.cc.

2997 {
2998 Matcher<int> eq5 = Eq(5);
2999 EXPECT_TRUE(Matches(eq5)(5));
3000 EXPECT_FALSE(Matches(eq5)(2));
3001}
Here is the call graph for this function:

◆ TEST() [190/350]

testing::gmock_matchers_test::TEST ( MatchResultListenerTest ,
CanAccessUnderlyingStream  )

◆ TEST() [191/350]

testing::gmock_matchers_test::TEST ( MatchResultListenerTest ,
IsInterestedWorks  )

Definition at line 248 of file gmock-matchers_test.cc.

248 {
249 EXPECT_TRUE(StringMatchResultListener().IsInterested());
250 EXPECT_TRUE(StreamMatchResultListener(&std::cout).IsInterested());
251
252 EXPECT_FALSE(DummyMatchResultListener().IsInterested());
253 EXPECT_FALSE(StreamMatchResultListener(NULL).IsInterested());
254}

◆ TEST() [192/350]

testing::gmock_matchers_test::TEST ( MatchResultListenerTest ,
StreamingWorks  )

Definition at line 225 of file gmock-matchers_test.cc.

225 {
227 listener << "hi" << 5;
228 EXPECT_EQ("hi5", listener.str());
229
230 listener.Clear();
231 EXPECT_EQ("", listener.str());
232
233 listener << 42;
234 EXPECT_EQ("42", listener.str());
235
236 // Streaming shouldn't crash when the underlying ostream is NULL.
238 dummy << "hi" << 5;
239}
Here is the call graph for this function:

◆ TEST() [193/350]

testing::gmock_matchers_test::TEST ( MonotonicMatcherTest ,
IsPrintable  )

Definition at line 219 of file gmock-matchers_test.cc.

219 {
220 stringstream ss;
221 ss << GreaterThan(5);
222 EXPECT_EQ("is > 5", ss.str());
223}
Here is the call graph for this function:

◆ TEST() [194/350]

testing::gmock_matchers_test::TEST ( NanSensitiveDoubleEqTest ,
CanDescribeSelfWithNaNs  )

Definition at line 2381 of file gmock-matchers_test.cc.

2381 {
2382 Matcher<const ::testing::tuple<double, double>&> m = NanSensitiveDoubleEq();
2383 EXPECT_EQ("are an almost-equal pair", Describe(m));
2384}
Here is the call graph for this function:

◆ TEST() [195/350]

testing::gmock_matchers_test::TEST ( NanSensitiveDoubleEqTest ,
MatchesEqualArgumentsWithNaN  )

Definition at line 2369 of file gmock-matchers_test.cc.

2369 {
2370 typedef ::testing::tuple<double, double> Tpl;
2371 Matcher<const Tpl&> m = NanSensitiveDoubleEq();
2372 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
2373 EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(),
2374 std::numeric_limits<double>::quiet_NaN())));
2375 EXPECT_FALSE(m.Matches(Tpl(1.1f, 1.0f)));
2376 EXPECT_FALSE(m.Matches(Tpl(1.0f, std::numeric_limits<double>::quiet_NaN())));
2377 EXPECT_FALSE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(), 1.0f)));
2378}
Here is the call graph for this function:

◆ TEST() [196/350]

testing::gmock_matchers_test::TEST ( NanSensitiveDoubleNearTest ,
CanDescribeSelfWithNaNs  )

Definition at line 2454 of file gmock-matchers_test.cc.

2454 {
2456 NanSensitiveDoubleNear(0.5f);
2457 EXPECT_EQ("are an almost-equal pair", Describe(m));
2458}
Here is the call graph for this function:

◆ TEST() [197/350]

testing::gmock_matchers_test::TEST ( NanSensitiveDoubleNearTest ,
MatchesNearbyArgumentsWithNaN  )

Definition at line 2441 of file gmock-matchers_test.cc.

2441 {
2442 typedef ::testing::tuple<double, double> Tpl;
2443 Matcher<const Tpl&> m = NanSensitiveDoubleNear(0.5f);
2444 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
2445 EXPECT_TRUE(m.Matches(Tpl(1.1f, 1.0f)));
2446 EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(),
2447 std::numeric_limits<double>::quiet_NaN())));
2448 EXPECT_FALSE(m.Matches(Tpl(1.6f, 1.0f)));
2449 EXPECT_FALSE(m.Matches(Tpl(1.0f, std::numeric_limits<double>::quiet_NaN())));
2450 EXPECT_FALSE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(), 1.0f)));
2451}
Here is the call graph for this function:

◆ TEST() [198/350]

testing::gmock_matchers_test::TEST ( NanSensitiveFloatEqTest ,
CanDescribeSelfWithNaNs  )

Definition at line 2346 of file gmock-matchers_test.cc.

2346 {
2347 Matcher<const ::testing::tuple<float, float>&> m = NanSensitiveFloatEq();
2348 EXPECT_EQ("are an almost-equal pair", Describe(m));
2349}
Here is the call graph for this function:

◆ TEST() [199/350]

testing::gmock_matchers_test::TEST ( NanSensitiveFloatEqTest ,
MatchesEqualArgumentsWithNaN  )

Definition at line 2334 of file gmock-matchers_test.cc.

2334 {
2335 typedef ::testing::tuple<float, float> Tpl;
2336 Matcher<const Tpl&> m = NanSensitiveFloatEq();
2337 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
2338 EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(),
2339 std::numeric_limits<float>::quiet_NaN())));
2340 EXPECT_FALSE(m.Matches(Tpl(1.1f, 1.0f)));
2341 EXPECT_FALSE(m.Matches(Tpl(1.0f, std::numeric_limits<float>::quiet_NaN())));
2342 EXPECT_FALSE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(), 1.0f)));
2343}
Here is the call graph for this function:

◆ TEST() [200/350]

testing::gmock_matchers_test::TEST ( NanSensitiveFloatNearTest ,
CanDescribeSelfWithNaNs  )

Definition at line 2417 of file gmock-matchers_test.cc.

2417 {
2419 NanSensitiveFloatNear(0.5f);
2420 EXPECT_EQ("are an almost-equal pair", Describe(m));
2421}
Here is the call graph for this function:

◆ TEST() [201/350]

testing::gmock_matchers_test::TEST ( NanSensitiveFloatNearTest ,
MatchesNearbyArgumentsWithNaN  )

Definition at line 2404 of file gmock-matchers_test.cc.

2404 {
2405 typedef ::testing::tuple<float, float> Tpl;
2406 Matcher<const Tpl&> m = NanSensitiveFloatNear(0.5f);
2407 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
2408 EXPECT_TRUE(m.Matches(Tpl(1.1f, 1.0f)));
2409 EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(),
2410 std::numeric_limits<float>::quiet_NaN())));
2411 EXPECT_FALSE(m.Matches(Tpl(1.6f, 1.0f)));
2412 EXPECT_FALSE(m.Matches(Tpl(1.0f, std::numeric_limits<float>::quiet_NaN())));
2413 EXPECT_FALSE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(), 1.0f)));
2414}
Here is the call graph for this function:

◆ TEST() [202/350]

testing::gmock_matchers_test::TEST ( Ne2Test ,
CanDescribeSelf  )

Definition at line 2311 of file gmock-matchers_test.cc.

2311 {
2312 Matcher<const Tuple2&> m = Ne();
2313 EXPECT_EQ("are an unequal pair", Describe(m));
2314}
Here is the call graph for this function:

◆ TEST() [203/350]

testing::gmock_matchers_test::TEST ( Ne2Test ,
MatchesUnequalArguments  )

Definition at line 2303 of file gmock-matchers_test.cc.

2303 {
2304 Matcher<const Tuple2&> m = Ne();
2305 EXPECT_TRUE(m.Matches(Tuple2(5L, 6)));
2306 EXPECT_TRUE(m.Matches(Tuple2(5L, 4)));
2307 EXPECT_FALSE(m.Matches(Tuple2(5L, 5)));
2308}
Here is the call graph for this function:

◆ TEST() [204/350]

testing::gmock_matchers_test::TEST ( NeTest ,
CanDescribeSelf  )

Definition at line 1150 of file gmock-matchers_test.cc.

1150 {
1151 Matcher<int> m = Ne(5);
1152 EXPECT_EQ("isn't equal to 5", Describe(m));
1153}
Here is the call graph for this function:

◆ TEST() [205/350]

testing::gmock_matchers_test::TEST ( NeTest ,
ImplementsNotEqual  )

Definition at line 1142 of file gmock-matchers_test.cc.

1142 {
1143 Matcher<int> m1 = Ne(0);
1144 EXPECT_TRUE(m1.Matches(1));
1145 EXPECT_TRUE(m1.Matches(-1));
1146 EXPECT_FALSE(m1.Matches(0));
1147}
Here is the call graph for this function:

◆ TEST() [206/350]

testing::gmock_matchers_test::TEST ( NotNullTest ,
CanDescribeSelf  )

Definition at line 1260 of file gmock-matchers_test.cc.

1260 {
1261 Matcher<int*> m = NotNull();
1262 EXPECT_EQ("isn't NULL", Describe(m));
1263}
Here is the call graph for this function:

◆ TEST() [207/350]

testing::gmock_matchers_test::TEST ( NotNullTest ,
LinkedPtr  )

Definition at line 1232 of file gmock-matchers_test.cc.

1232 {
1233 const Matcher<linked_ptr<int> > m = NotNull();
1234 const linked_ptr<int> null_p;
1235 const linked_ptr<int> non_null_p(new int);
1236
1237 EXPECT_FALSE(m.Matches(null_p));
1238 EXPECT_TRUE(m.Matches(non_null_p));
1239}
Here is the call graph for this function:

◆ TEST() [208/350]

testing::gmock_matchers_test::TEST ( NotNullTest ,
MatchesNonNullPointer  )

Definition at line 1219 of file gmock-matchers_test.cc.

1219 {
1220 Matcher<int*> m1 = NotNull();
1221 int* p1 = NULL;
1222 int n = 0;
1223 EXPECT_FALSE(m1.Matches(p1));
1224 EXPECT_TRUE(m1.Matches(&n));
1225
1226 Matcher<const char*> m2 = NotNull();
1227 const char* p2 = NULL;
1228 EXPECT_FALSE(m2.Matches(p2));
1229 EXPECT_TRUE(m2.Matches("hi"));
1230}
Here is the call graph for this function:

◆ TEST() [209/350]

testing::gmock_matchers_test::TEST ( NotNullTest ,
ReferenceToConstLinkedPtr  )

Definition at line 1241 of file gmock-matchers_test.cc.

1241 {
1242 const Matcher<const linked_ptr<double>&> m = NotNull();
1243 const linked_ptr<double> null_p;
1244 const linked_ptr<double> non_null_p(new double);
1245
1246 EXPECT_FALSE(m.Matches(null_p));
1247 EXPECT_TRUE(m.Matches(non_null_p));
1248}
Here is the call graph for this function:

◆ TEST() [210/350]

testing::gmock_matchers_test::TEST ( NotTest ,
CanDescribeSelf  )

Definition at line 2469 of file gmock-matchers_test.cc.

2469 {
2470 Matcher<int> m = Not(Eq(5));
2471 EXPECT_EQ("isn't equal to 5", Describe(m));
2472}
Here is the call graph for this function:

◆ TEST() [211/350]

testing::gmock_matchers_test::TEST ( NotTest ,
NegatesMatcher  )

Definition at line 2461 of file gmock-matchers_test.cc.

2461 {
2462 Matcher<int> m;
2463 m = Not(Eq(2));
2464 EXPECT_TRUE(m.Matches(3));
2465 EXPECT_FALSE(m.Matches(2));
2466}
Here is the call graph for this function:

◆ TEST() [212/350]

testing::gmock_matchers_test::TEST ( NotTest ,
NotMatcherSafelyCastsMonomorphicMatchers  )

Definition at line 2475 of file gmock-matchers_test.cc.

2475 {
2476 // greater_than_5 is a monomorphic matcher.
2477 Matcher<int> greater_than_5 = Gt(5);
2478
2479 Matcher<const int&> m = Not(greater_than_5);
2480 Matcher<int&> m2 = Not(greater_than_5);
2481 Matcher<int&> m3 = Not(m);
2482}
Here is the call graph for this function:

◆ TEST() [213/350]

testing::gmock_matchers_test::TEST ( OptionalTest ,
DescribesSelf  )

Definition at line 6590 of file gmock-matchers_test.cc.

6590 {
6591 const Matcher<SampleOptionalInt> m = Optional(Eq(1));
6592 EXPECT_EQ("value is equal to 1", Describe(m));
6593}
Unary< NodeType::optional > Optional
Definition Regexp.cpp:53
Here is the call graph for this function:

◆ TEST() [214/350]

testing::gmock_matchers_test::TEST ( OptionalTest ,
DoesNotMatchNullopt  )

Definition at line 6611 of file gmock-matchers_test.cc.

Here is the call graph for this function:

◆ TEST() [215/350]

testing::gmock_matchers_test::TEST ( OptionalTest ,
ExplainsSelf  )

Definition at line 6595 of file gmock-matchers_test.cc.

6595 {
6596 const Matcher<SampleOptionalInt> m = Optional(Eq(1));
6597 EXPECT_EQ("whose value 1 matches", Explain(m, SampleOptionalInt(1)));
6598 EXPECT_EQ("whose value 2 doesn't match", Explain(m, SampleOptionalInt(2)));
6599}
Here is the call graph for this function:

◆ TEST() [216/350]

testing::gmock_matchers_test::TEST ( OptionalTest ,
MatchesNonEmptyOptional  )

Definition at line 6601 of file gmock-matchers_test.cc.

6601 {
6603 const Matcher<SampleOptionalInt> m2 = Optional(Eq(2));
6604 const Matcher<SampleOptionalInt> m3 = Optional(Lt(3));
6605 SampleOptionalInt opt(1);
6606 EXPECT_TRUE(m1.Matches(opt));
6607 EXPECT_FALSE(m2.Matches(opt));
6608 EXPECT_TRUE(m3.Matches(opt));
6609}
Here is the call graph for this function:

◆ TEST() [217/350]

testing::gmock_matchers_test::TEST ( PairTest ,
CanDescribeSelf  )

Definition at line 1597 of file gmock-matchers_test.cc.

1597 {
1598 Matcher<const pair<std::string, int>&> m1 = Pair("foo", 42);
1599 EXPECT_EQ("has a first field that is equal to \"foo\""
1600 ", and has a second field that is equal to 42",
1601 Describe(m1));
1602 EXPECT_EQ("has a first field that isn't equal to \"foo\""
1603 ", or has a second field that isn't equal to 42",
1604 DescribeNegation(m1));
1605 // Double and triple negation (1 or 2 times not and description of negation).
1606 Matcher<const pair<int, int>&> m2 = Not(Pair(Not(13), 42));
1607 EXPECT_EQ("has a first field that isn't equal to 13"
1608 ", and has a second field that is equal to 42",
1609 DescribeNegation(m2));
1610}
Here is the call graph for this function:

◆ TEST() [218/350]

testing::gmock_matchers_test::TEST ( PairTest ,
CanExplainMatchResultTo  )

Definition at line 1612 of file gmock-matchers_test.cc.

1612 {
1613 // If neither field matches, Pair() should explain about the first
1614 // field.
1615 const Matcher<pair<int, int> > m = Pair(GreaterThan(0), GreaterThan(0));
1616 EXPECT_EQ("whose first field does not match, which is 1 less than 0",
1617 Explain(m, make_pair(-1, -2)));
1618
1619 // If the first field matches but the second doesn't, Pair() should
1620 // explain about the second field.
1621 EXPECT_EQ("whose second field does not match, which is 2 less than 0",
1622 Explain(m, make_pair(1, -2)));
1623
1624 // If the first field doesn't match but the second does, Pair()
1625 // should explain about the first field.
1626 EXPECT_EQ("whose first field does not match, which is 1 less than 0",
1627 Explain(m, make_pair(-1, 2)));
1628
1629 // If both fields match, Pair() should explain about them both.
1630 EXPECT_EQ("whose both fields match, where the first field is a value "
1631 "which is 1 more than 0, and the second field is a value "
1632 "which is 2 more than 0",
1633 Explain(m, make_pair(1, 2)));
1634
1635 // If only the first match has an explanation, only this explanation should
1636 // be printed.
1637 const Matcher<pair<int, int> > explain_first = Pair(GreaterThan(0), 0);
1638 EXPECT_EQ("whose both fields match, where the first field is a value "
1639 "which is 1 more than 0",
1640 Explain(explain_first, make_pair(1, 0)));
1641
1642 // If only the second match has an explanation, only this explanation should
1643 // be printed.
1644 const Matcher<pair<int, int> > explain_second = Pair(0, GreaterThan(0));
1645 EXPECT_EQ("whose both fields match, where the second field is a value "
1646 "which is 1 more than 0",
1647 Explain(explain_second, make_pair(0, 1)));
1648}
Here is the call graph for this function:

◆ TEST() [219/350]

testing::gmock_matchers_test::TEST ( PairTest ,
InsideContainsUsingMap  )

Definition at line 1680 of file gmock-matchers_test.cc.

1680 {
1681 map<int, char> container;
1682 container.insert(make_pair(1, 'a'));
1683 container.insert(make_pair(2, 'b'));
1684 container.insert(make_pair(4, 'c'));
1685 EXPECT_THAT(container, Contains(Pair(1, 'a')));
1686 EXPECT_THAT(container, Contains(Pair(1, _)));
1687 EXPECT_THAT(container, Contains(Pair(_, 'a')));
1688 EXPECT_THAT(container, Not(Contains(Pair(3, _))));
1689}
Here is the call graph for this function:

◆ TEST() [220/350]

testing::gmock_matchers_test::TEST ( PairTest ,
MatchesCorrectly  )

Definition at line 1650 of file gmock-matchers_test.cc.

1650 {
1651 pair<int, std::string> p(25, "foo");
1652
1653 // Both fields match.
1654 EXPECT_THAT(p, Pair(25, "foo"));
1655 EXPECT_THAT(p, Pair(Ge(20), HasSubstr("o")));
1656
1657 // 'first' doesnt' match, but 'second' matches.
1658 EXPECT_THAT(p, Not(Pair(42, "foo")));
1659 EXPECT_THAT(p, Not(Pair(Lt(25), "foo")));
1660
1661 // 'first' matches, but 'second' doesn't match.
1662 EXPECT_THAT(p, Not(Pair(25, "bar")));
1663 EXPECT_THAT(p, Not(Pair(25, Not("foo"))));
1664
1665 // Neither field matches.
1666 EXPECT_THAT(p, Not(Pair(13, "bar")));
1667 EXPECT_THAT(p, Not(Pair(Lt(13), HasSubstr("a"))));
1668}
Here is the call graph for this function:

◆ TEST() [221/350]

testing::gmock_matchers_test::TEST ( PairTest ,
SafelyCastsInnerMatchers  )

Definition at line 1670 of file gmock-matchers_test.cc.

1670 {
1671 Matcher<int> is_positive = Gt(0);
1672 Matcher<int> is_negative = Lt(0);
1673 pair<char, bool> p('a', true);
1674 EXPECT_THAT(p, Pair(is_positive, _));
1675 EXPECT_THAT(p, Not(Pair(is_negative, _)));
1676 EXPECT_THAT(p, Pair(_, is_positive));
1677 EXPECT_THAT(p, Not(Pair(_, is_negative)));
1678}
Here is the call graph for this function:

◆ TEST() [222/350]

testing::gmock_matchers_test::TEST ( PairTest ,
Typing  )

Definition at line 1587 of file gmock-matchers_test.cc.

1587 {
1588 // Test verifies the following type conversions can be compiled.
1589 Matcher<const pair<const char*, int>&> m1 = Pair("foo", 42);
1590 Matcher<const pair<const char*, int> > m2 = Pair("foo", 42);
1591 Matcher<pair<const char*, int> > m3 = Pair("foo", 42);
1592
1593 Matcher<pair<int, const std::string> > m4 = Pair(25, "42");
1594 Matcher<pair<const std::string, int> > m5 = Pair("25", 42);
1595}
Here is the call graph for this function:

◆ TEST() [223/350]

testing::gmock_matchers_test::TEST ( PointeeTest ,
AlwaysExplainsPointee  )

Definition at line 3867 of file gmock-matchers_test.cc.

3867 {
3868 const Matcher<int*> m = Pointee(0);
3869 int n = 42;
3870 EXPECT_EQ("which points to 42" + OfType("int"), Explain(m, &n));
3871}
Here is the call graph for this function:

◆ TEST() [224/350]

testing::gmock_matchers_test::TEST ( PointeeTest ,
CanDescribeSelf  )

Definition at line 3849 of file gmock-matchers_test.cc.

3849 {
3850 const Matcher<int*> m = Pointee(Gt(3));
3851 EXPECT_EQ("points to a value that is > 3", Describe(m));
3852 EXPECT_EQ("does not point to a value that is > 3",
3853 DescribeNegation(m));
3854}
Here is the call graph for this function:

◆ TEST() [225/350]

testing::gmock_matchers_test::TEST ( PointeeTest ,
CanExplainMatchResult  )

Definition at line 3856 of file gmock-matchers_test.cc.

3856 {
3857 const Matcher<const std::string*> m = Pointee(StartsWith("Hi"));
3858
3859 EXPECT_EQ("", Explain(m, static_cast<const std::string*>(NULL)));
3860
3861 const Matcher<long*> m2 = Pointee(GreaterThan(1)); // NOLINT
3862 long n = 3; // NOLINT
3863 EXPECT_EQ("which points to 3" + OfType("long") + ", which is 2 more than 1",
3864 Explain(m2, &n));
3865}
Here is the call graph for this function:

◆ TEST() [226/350]

testing::gmock_matchers_test::TEST ( PointeeTest ,
MatchesAgainstAValue  )

Definition at line 3839 of file gmock-matchers_test.cc.

3839 {
3840 const Matcher<int*> m = Pointee(5);
3841
3842 int n = 5;
3843 EXPECT_TRUE(m.Matches(&n));
3844 n = -1;
3845 EXPECT_FALSE(m.Matches(&n));
3846 EXPECT_FALSE(m.Matches(NULL));
3847}
Here is the call graph for this function:

◆ TEST() [227/350]

testing::gmock_matchers_test::TEST ( PointeeTest ,
NeverMatchesNull  )

Definition at line 3833 of file gmock-matchers_test.cc.

3833 {
3834 const Matcher<const char*> m = Pointee(_);
3835 EXPECT_FALSE(m.Matches(NULL));
3836}
Here is the call graph for this function:

◆ TEST() [228/350]

testing::gmock_matchers_test::TEST ( PointeeTest ,
RawPointer  )

Definition at line 3661 of file gmock-matchers_test.cc.

3661 {
3662 const Matcher<int*> m = Pointee(Ge(0));
3663
3664 int n = 1;
3665 EXPECT_TRUE(m.Matches(&n));
3666 n = -1;
3667 EXPECT_FALSE(m.Matches(&n));
3668 EXPECT_FALSE(m.Matches(NULL));
3669}
Here is the call graph for this function:

◆ TEST() [229/350]

testing::gmock_matchers_test::TEST ( PointeeTest ,
RawPointerToConst  )

Definition at line 3671 of file gmock-matchers_test.cc.

3671 {
3672 const Matcher<const double*> m = Pointee(Ge(0));
3673
3674 double x = 1;
3675 EXPECT_TRUE(m.Matches(&x));
3676 x = -1;
3677 EXPECT_FALSE(m.Matches(&x));
3678 EXPECT_FALSE(m.Matches(NULL));
3679}
Here is the call graph for this function:

◆ TEST() [230/350]

testing::gmock_matchers_test::TEST ( PointeeTest ,
ReferenceToConstRawPointer  )

Definition at line 3681 of file gmock-matchers_test.cc.

3681 {
3682 const Matcher<int* const &> m = Pointee(Ge(0));
3683
3684 int n = 1;
3685 EXPECT_TRUE(m.Matches(&n));
3686 n = -1;
3687 EXPECT_FALSE(m.Matches(&n));
3688 EXPECT_FALSE(m.Matches(NULL));
3689}
Here is the call graph for this function:

◆ TEST() [231/350]

testing::gmock_matchers_test::TEST ( PointeeTest ,
ReferenceToNonConstRawPointer  )

Definition at line 3691 of file gmock-matchers_test.cc.

3691 {
3692 const Matcher<double* &> m = Pointee(Ge(0));
3693
3694 double x = 1.0;
3695 double* p = &x;
3696 EXPECT_TRUE(m.Matches(p));
3697 x = -1;
3699 p = NULL;
3701}
Here is the call graph for this function:

◆ TEST() [232/350]

testing::gmock_matchers_test::TEST ( PointeeTest ,
WorksWithConstPropagatingPointers  )

Definition at line 3821 of file gmock-matchers_test.cc.

3821 {
3822 const Matcher< ConstPropagatingPtr<int> > m = Pointee(Lt(5));
3823 int three = 3;
3824 const ConstPropagatingPtr<int> co(&three);
3825 ConstPropagatingPtr<int> o(&three);
3826 EXPECT_TRUE(m.Matches(o));
3827 EXPECT_TRUE(m.Matches(co));
3828 *o = 6;
3829 EXPECT_FALSE(m.Matches(o));
3831}
Here is the call graph for this function:

◆ TEST() [233/350]

testing::gmock_matchers_test::TEST ( PointwiseTest ,
AcceptsCorrectContent  )

Definition at line 6437 of file gmock-matchers_test.cc.

6437 {
6438 const double lhs[3] = {1, 2, 3};
6439 const int rhs[3] = {2, 4, 6};
6440 EXPECT_THAT(lhs, Pointwise(IsHalfOf(), rhs));
6441 EXPECT_EQ("", Explain(Pointwise(IsHalfOf(), rhs), lhs));
6442}
Here is the call graph for this function:

◆ TEST() [234/350]

testing::gmock_matchers_test::TEST ( PointwiseTest ,
AllowsMonomorphicInnerMatcher  )

Definition at line 6444 of file gmock-matchers_test.cc.

6444 {
6445 const double lhs[3] = {1, 2, 3};
6446 const int rhs[3] = {2, 4, 6};
6447 const Matcher<tuple<const double&, const int&> > m1 = IsHalfOf();
6448 EXPECT_THAT(lhs, Pointwise(m1, rhs));
6449 EXPECT_EQ("", Explain(Pointwise(m1, rhs), lhs));
6450
6451 // This type works as a tuple<const double&, const int&> can be
6452 // implicitly cast to tuple<double, int>.
6453 const Matcher<tuple<double, int> > m2 = IsHalfOf();
6454 EXPECT_THAT(lhs, Pointwise(m2, rhs));
6455 EXPECT_EQ("", Explain(Pointwise(m2, rhs), lhs));
6456}
Here is the call graph for this function:

◆ TEST() [235/350]

testing::gmock_matchers_test::TEST ( PointwiseTest ,
DescribesSelf  )

Definition at line 6348 of file gmock-matchers_test.cc.

6348 {
6349 vector<int> rhs;
6350 rhs.push_back(1);
6351 rhs.push_back(2);
6352 rhs.push_back(3);
6353 const Matcher<const vector<int>&> m = Pointwise(IsHalfOf(), rhs);
6354 EXPECT_EQ("contains 3 values, where each value and its corresponding value "
6355 "in { 1, 2, 3 } are a pair where the first is half of the second",
6356 Describe(m));
6357 EXPECT_EQ("doesn't contain exactly 3 values, or contains a value x at some "
6358 "index i where x and the i-th value of { 1, 2, 3 } are a pair "
6359 "where the first isn't half of the second",
6360 DescribeNegation(m));
6361}
PolymorphicMatcher< IsHalfOfMatcher > IsHalfOf()
Here is the call graph for this function:

◆ TEST() [236/350]

testing::gmock_matchers_test::TEST ( PointwiseTest ,
MakesCopyOfRhs  )

Definition at line 6363 of file gmock-matchers_test.cc.

6363 {
6364 list<signed char> rhs;
6365 rhs.push_back(2);
6366 rhs.push_back(4);
6367
6368 int lhs[] = {1, 2};
6369 const Matcher<const int (&)[2]> m = Pointwise(IsHalfOf(), rhs);
6370 EXPECT_THAT(lhs, m);
6371
6372 // Changing rhs now shouldn't affect m, which made a copy of rhs.
6373 rhs.push_back(6);
6374 EXPECT_THAT(lhs, m);
6375}
Here is the call graph for this function:

◆ TEST() [237/350]

testing::gmock_matchers_test::TEST ( PointwiseTest ,
RejectsWrongContent  )

Definition at line 6428 of file gmock-matchers_test.cc.

6428 {
6429 const double lhs[3] = {1, 2, 3};
6430 const int rhs[3] = {2, 6, 4};
6431 EXPECT_THAT(lhs, Not(Pointwise(IsHalfOf(), rhs)));
6432 EXPECT_EQ("where the value pair (2, 6) at index #1 don't match, "
6433 "where the second/2 is 3",
6434 Explain(Pointwise(IsHalfOf(), rhs), lhs));
6435}
Here is the call graph for this function:

◆ TEST() [238/350]

testing::gmock_matchers_test::TEST ( PointwiseTest ,
RejectsWrongSize  )

Definition at line 6417 of file gmock-matchers_test.cc.

6417 {
6418 const double lhs[2] = {1, 2};
6419 const int rhs[1] = {0};
6420 EXPECT_THAT(lhs, Not(Pointwise(Gt(), rhs)));
6421 EXPECT_EQ("which contains 2 values",
6422 Explain(Pointwise(Gt(), rhs), lhs));
6423
6424 const int rhs2[3] = {0, 1, 2};
6425 EXPECT_THAT(lhs, Not(Pointwise(Gt(), rhs2)));
6426}
Here is the call graph for this function:

◆ TEST() [239/350]

testing::gmock_matchers_test::TEST ( PointwiseTest ,
WorksForLhsNativeArray  )

Definition at line 6377 of file gmock-matchers_test.cc.

6377 {
6378 const int lhs[] = {1, 2, 3};
6379 vector<int> rhs;
6380 rhs.push_back(2);
6381 rhs.push_back(4);
6382 rhs.push_back(6);
6383 EXPECT_THAT(lhs, Pointwise(Lt(), rhs));
6384 EXPECT_THAT(lhs, Not(Pointwise(Gt(), rhs)));
6385}
Here is the call graph for this function:

◆ TEST() [240/350]

testing::gmock_matchers_test::TEST ( PointwiseTest ,
WorksForRhsNativeArray  )

Definition at line 6387 of file gmock-matchers_test.cc.

6387 {
6388 const int rhs[] = {1, 2, 3};
6389 vector<int> lhs;
6390 lhs.push_back(2);
6391 lhs.push_back(4);
6392 lhs.push_back(6);
6393 EXPECT_THAT(lhs, Pointwise(Gt(), rhs));
6394 EXPECT_THAT(lhs, Not(Pointwise(Lt(), rhs)));
6395}
Here is the call graph for this function:

◆ TEST() [241/350]

testing::gmock_matchers_test::TEST ( PointwiseTest ,
WorksForVectorOfBool  )

Definition at line 6398 of file gmock-matchers_test.cc.

6398 {
6399 vector<bool> rhs(3, false);
6400 rhs[1] = true;
6401 vector<bool> lhs = rhs;
6402 EXPECT_THAT(lhs, Pointwise(Eq(), rhs));
6403 rhs[0] = true;
6404 EXPECT_THAT(lhs, Not(Pointwise(Eq(), rhs)));
6405}
Here is the call graph for this function:

◆ TEST() [242/350]

testing::gmock_matchers_test::TEST ( PolymorphicMatcherTest ,
CanAccessImpl  )

Definition at line 6204 of file gmock-matchers_test.cc.

Here is the call graph for this function:

◆ TEST() [243/350]

testing::gmock_matchers_test::TEST ( PolymorphicMatcherTest ,
CanAccessMutableImpl  )

Definition at line 6194 of file gmock-matchers_test.cc.

6194 {
6196 DivisibleByImpl& impl = m.mutable_impl();
6197 EXPECT_EQ(42, impl.divider());
6198
6199 impl.set_divider(0);
6200 EXPECT_EQ(0, m.mutable_impl().divider());
6201}
Here is the call graph for this function:

◆ TEST() [244/350]

testing::gmock_matchers_test::TEST ( PropertyForPointerTest ,
CanDescribeSelf  )

Definition at line 4395 of file gmock-matchers_test.cc.

4395 {
4396 Matcher<const AClass*> m = Property(&AClass::n, Ge(0));
4397
4398 EXPECT_EQ("is an object whose given property is >= 0", Describe(m));
4399 EXPECT_EQ("is an object whose given property isn't >= 0",
4400 DescribeNegation(m));
4401}
Here is the call graph for this function:

◆ TEST() [245/350]

testing::gmock_matchers_test::TEST ( PropertyForPointerTest ,
CanDescribeSelfWithPropertyDescription  )

Definition at line 4403 of file gmock-matchers_test.cc.

4403 {
4404 Matcher<const AClass*> m = Property("fancy_name", &AClass::n, Ge(0));
4405
4406 EXPECT_EQ("is an object whose property `fancy_name` is >= 0", Describe(m));
4407 EXPECT_EQ("is an object whose property `fancy_name` isn't >= 0",
4408 DescribeNegation(m));
4409}
Here is the call graph for this function:

◆ TEST() [246/350]

testing::gmock_matchers_test::TEST ( PropertyForPointerTest ,
CanExplainMatchResult  )

Definition at line 4412 of file gmock-matchers_test.cc.

4412 {
4413 Matcher<const AClass*> m = Property(&AClass::n, Ge(0));
4414
4415 AClass a;
4416 a.set_n(1);
4417 EXPECT_EQ("", Explain(m, static_cast<const AClass*>(NULL)));
4418 EXPECT_EQ(
4419 "which points to an object whose given property is 1" + OfType("int"),
4420 Explain(m, &a));
4421
4422 m = Property(&AClass::n, GreaterThan(0));
4423 EXPECT_EQ("which points to an object whose given property is 1" +
4424 OfType("int") + ", which is 1 more than 0",
4425 Explain(m, &a));
4426}
Here is the call graph for this function:

◆ TEST() [247/350]

testing::gmock_matchers_test::TEST ( PropertyForPointerTest ,
CanExplainMatchResultWithPropertyName  )

Definition at line 4428 of file gmock-matchers_test.cc.

4428 {
4429 Matcher<const AClass*> m = Property("fancy_name", &AClass::n, Ge(0));
4430
4431 AClass a;
4432 a.set_n(1);
4433 EXPECT_EQ("", Explain(m, static_cast<const AClass*>(NULL)));
4434 EXPECT_EQ("which points to an object whose property `fancy_name` is 1" +
4435 OfType("int"),
4436 Explain(m, &a));
4437
4438 m = Property("fancy_name", &AClass::n, GreaterThan(0));
4439 EXPECT_EQ("which points to an object whose property `fancy_name` is 1" +
4440 OfType("int") + ", which is 1 more than 0",
4441 Explain(m, &a));
4442}
Here is the call graph for this function:

◆ TEST() [248/350]

testing::gmock_matchers_test::TEST ( PropertyForPointerTest ,
WorksForArgumentOfSubType  )

Definition at line 4381 of file gmock-matchers_test.cc.

4381 {
4382 // The matcher expects a DerivedClass, but inside the Property() we
4383 // say AClass.
4384 Matcher<const DerivedClass*> m = Property(&AClass::n, Ge(0));
4385
4387 d.set_n(1);
4388 EXPECT_TRUE(m.Matches(&d));
4389
4390 d.set_n(-1);
4391 EXPECT_FALSE(m.Matches(&d));
4392}
Here is the call graph for this function:

◆ TEST() [249/350]

testing::gmock_matchers_test::TEST ( PropertyForPointerTest ,
WorksForPointerToConst  )

Definition at line 4337 of file gmock-matchers_test.cc.

4337 {
4338 Matcher<const AClass*> m = Property(&AClass::n, Ge(0));
4339
4340 AClass a;
4341 a.set_n(1);
4342 EXPECT_TRUE(m.Matches(&a));
4343
4344 a.set_n(-1);
4345 EXPECT_FALSE(m.Matches(&a));
4346}
Here is the call graph for this function:

◆ TEST() [250/350]

testing::gmock_matchers_test::TEST ( PropertyForPointerTest ,
WorksForPointerToNonConst  )

Definition at line 4349 of file gmock-matchers_test.cc.

4349 {
4350 Matcher<AClass*> m = Property(&AClass::s, StartsWith("hi"));
4351
4352 AClass a;
4353 a.set_s("hill");
4354 EXPECT_TRUE(m.Matches(&a));
4355
4356 a.set_s("hole");
4357 EXPECT_FALSE(m.Matches(&a));
4358}
void set_s(const std::string &new_s)
Here is the call graph for this function:

◆ TEST() [251/350]

testing::gmock_matchers_test::TEST ( PropertyForPointerTest ,
WorksForReferenceToConstPointer  )

Definition at line 4362 of file gmock-matchers_test.cc.

4362 {
4363 Matcher<AClass* const&> m = Property(&AClass::s, StartsWith("hi"));
4364
4365 AClass a;
4366 a.set_s("hill");
4367 EXPECT_TRUE(m.Matches(&a));
4368
4369 a.set_s("hole");
4370 EXPECT_FALSE(m.Matches(&a));
4371}
Here is the call graph for this function:

◆ TEST() [252/350]

testing::gmock_matchers_test::TEST ( PropertyForPointerTest ,
WorksForReferenceToNonConstProperty  )

Definition at line 4374 of file gmock-matchers_test.cc.

4374 {
4375 Matcher<const AClass*> m = Property(&AClass::x, _);
4376 EXPECT_FALSE(m.Matches(NULL));
4377}
Here is the call graph for this function:

◆ TEST() [253/350]

testing::gmock_matchers_test::TEST ( PropertyTest ,
CanDescribeSelf  )

Definition at line 4293 of file gmock-matchers_test.cc.

4293 {
4294 Matcher<const AClass&> m = Property(&AClass::n, Ge(0));
4295
4296 EXPECT_EQ("is an object whose given property is >= 0", Describe(m));
4297 EXPECT_EQ("is an object whose given property isn't >= 0",
4298 DescribeNegation(m));
4299}
Here is the call graph for this function:

◆ TEST() [254/350]

testing::gmock_matchers_test::TEST ( PropertyTest ,
CanDescribeSelfWithPropertyName  )

Definition at line 4301 of file gmock-matchers_test.cc.

4301 {
4302 Matcher<const AClass&> m = Property("fancy_name", &AClass::n, Ge(0));
4303
4304 EXPECT_EQ("is an object whose property `fancy_name` is >= 0", Describe(m));
4305 EXPECT_EQ("is an object whose property `fancy_name` isn't >= 0",
4306 DescribeNegation(m));
4307}
Here is the call graph for this function:

◆ TEST() [255/350]

testing::gmock_matchers_test::TEST ( PropertyTest ,
CanExplainMatchResult  )

Definition at line 4310 of file gmock-matchers_test.cc.

4310 {
4311 Matcher<const AClass&> m = Property(&AClass::n, Ge(0));
4312
4313 AClass a;
4314 a.set_n(1);
4315 EXPECT_EQ("whose given property is 1" + OfType("int"), Explain(m, a));
4316
4317 m = Property(&AClass::n, GreaterThan(0));
4318 EXPECT_EQ(
4319 "whose given property is 1" + OfType("int") + ", which is 1 more than 0",
4320 Explain(m, a));
4321}
Here is the call graph for this function:

◆ TEST() [256/350]

testing::gmock_matchers_test::TEST ( PropertyTest ,
CanExplainMatchResultWithPropertyName  )

Definition at line 4323 of file gmock-matchers_test.cc.

4323 {
4324 Matcher<const AClass&> m = Property("fancy_name", &AClass::n, Ge(0));
4325
4326 AClass a;
4327 a.set_n(1);
4328 EXPECT_EQ("whose property `fancy_name` is 1" + OfType("int"), Explain(m, a));
4329
4330 m = Property("fancy_name", &AClass::n, GreaterThan(0));
4331 EXPECT_EQ("whose property `fancy_name` is 1" + OfType("int") +
4332 ", which is 1 more than 0",
4333 Explain(m, a));
4334}
Here is the call graph for this function:

◆ TEST() [257/350]

testing::gmock_matchers_test::TEST ( PropertyTest ,
WorksForArgumentOfSubType  )

Definition at line 4261 of file gmock-matchers_test.cc.

4261 {
4262 // The matcher expects a DerivedClass, but inside the Property() we
4263 // say AClass.
4264 Matcher<const DerivedClass&> m = Property(&AClass::n, Ge(0));
4265
4267 d.set_n(1);
4268 EXPECT_TRUE(m.Matches(d));
4269
4270 d.set_n(-1);
4271 EXPECT_FALSE(m.Matches(d));
4272}
Here is the call graph for this function:

◆ TEST() [258/350]

testing::gmock_matchers_test::TEST ( PropertyTest ,
WorksForByValueArgument  )

Definition at line 4248 of file gmock-matchers_test.cc.

4248 {
4249 Matcher<AClass> m = Property(&AClass::s, StartsWith("hi"));
4250
4251 AClass a;
4252 a.set_s("hill");
4253 EXPECT_TRUE(m.Matches(a));
4254
4255 a.set_s("hole");
4257}
Here is the call graph for this function:

◆ TEST() [259/350]

testing::gmock_matchers_test::TEST ( PropertyTest ,
WorksForCompatibleMatcherType  )

Definition at line 4276 of file gmock-matchers_test.cc.

4276 {
4277 // n() returns an int but the inner matcher expects a signed char.
4278 Matcher<const AClass&> m = Property(&AClass::n,
4279 Matcher<signed char>(Ge(0)));
4280
4281 Matcher<const AClass&> m_with_name =
4282 Property("n", &AClass::n, Matcher<signed char>(Ge(0)));
4283
4284 AClass a;
4285 EXPECT_TRUE(m.Matches(a));
4286 EXPECT_TRUE(m_with_name.Matches(a));
4287 a.set_n(-1);
4289 EXPECT_FALSE(m_with_name.Matches(a));
4290}
Here is the call graph for this function:

◆ TEST() [260/350]

testing::gmock_matchers_test::TEST ( PropertyTest ,
WorksForNonReferenceProperty  )

Definition at line 4187 of file gmock-matchers_test.cc.

4187 {
4188 Matcher<const AClass&> m = Property(&AClass::n, Ge(0));
4189 Matcher<const AClass&> m_with_name = Property("n", &AClass::n, Ge(0));
4190
4191 AClass a;
4192 a.set_n(1);
4193 EXPECT_TRUE(m.Matches(a));
4194 EXPECT_TRUE(m_with_name.Matches(a));
4195
4196 a.set_n(-1);
4198 EXPECT_FALSE(m_with_name.Matches(a));
4199}
Here is the call graph for this function:

◆ TEST() [261/350]

testing::gmock_matchers_test::TEST ( PropertyTest ,
WorksForReferenceToConstProperty  )

Definition at line 4203 of file gmock-matchers_test.cc.

4203 {
4204 Matcher<const AClass&> m = Property(&AClass::s, StartsWith("hi"));
4205 Matcher<const AClass&> m_with_name =
4206 Property("s", &AClass::s, StartsWith("hi"));
4207
4208 AClass a;
4209 a.set_s("hill");
4210 EXPECT_TRUE(m.Matches(a));
4211 EXPECT_TRUE(m_with_name.Matches(a));
4212
4213 a.set_s("hole");
4215 EXPECT_FALSE(m_with_name.Matches(a));
4216}
Here is the call graph for this function:

◆ TEST() [262/350]

testing::gmock_matchers_test::TEST ( PropertyTest ,
WorksForReferenceToNonConstProperty  )

Definition at line 4235 of file gmock-matchers_test.cc.

4235 {
4236 double x = 0.0;
4237 AClass a;
4238
4239 Matcher<const AClass&> m = Property(&AClass::x, Ref(x));
4241
4242 m = Property(&AClass::x, Not(Ref(x)));
4243 EXPECT_TRUE(m.Matches(a));
4244}
Here is the call graph for this function:

◆ TEST() [263/350]

testing::gmock_matchers_test::TEST ( RefTest ,
CanBeUsedAsMatcherForConstReference  )

Definition at line 1286 of file gmock-matchers_test.cc.

1286 {
1287 int a = 0;
1288 int b = 0;
1289 Matcher<const int&> m = Ref(a);
1290 EXPECT_TRUE(m.Matches(a));
1291 EXPECT_FALSE(m.Matches(b));
1292}
Here is the call graph for this function:

◆ TEST() [264/350]

testing::gmock_matchers_test::TEST ( RefTest ,
CanDescribeSelf  )

Definition at line 1276 of file gmock-matchers_test.cc.

1276 {
1277 int n = 5;
1278 Matcher<int&> m = Ref(n);
1279 stringstream ss;
1280 ss << "references the variable @" << &n << " 5";
1281 EXPECT_EQ(ss.str(), Describe(m));
1282}
Here is the call graph for this function:

◆ TEST() [265/350]

testing::gmock_matchers_test::TEST ( RefTest ,
ExplainsResult  )

Definition at line 1312 of file gmock-matchers_test.cc.

1312 {
1313 int n = 0;
1315 StartsWith("which is located @"));
1316
1317 int m = 0;
1319 StartsWith("which is located @"));
1320}
Here is the call graph for this function:

◆ TEST() [266/350]

testing::gmock_matchers_test::TEST ( RefTest ,
IsCovariant  )

Definition at line 1298 of file gmock-matchers_test.cc.

1298 {
1299 Base base, base2;
1300 Derived derived;
1301 Matcher<const Base&> m1 = Ref(base);
1302 EXPECT_TRUE(m1.Matches(base));
1303 EXPECT_FALSE(m1.Matches(base2));
1304 EXPECT_FALSE(m1.Matches(derived));
1305
1306 m1 = Ref(derived);
1307 EXPECT_TRUE(m1.Matches(derived));
1308 EXPECT_FALSE(m1.Matches(base));
1309 EXPECT_FALSE(m1.Matches(base2));
1310}
Here is the call graph for this function:

◆ TEST() [267/350]

testing::gmock_matchers_test::TEST ( RefTest ,
MatchesSameVariable  )

Definition at line 1267 of file gmock-matchers_test.cc.

1267 {
1268 int a = 0;
1269 int b = 0;
1270 Matcher<int&> m = Ref(a);
1271 EXPECT_TRUE(m.Matches(a));
1272 EXPECT_FALSE(m.Matches(b));
1273}
Here is the call graph for this function:

◆ TEST() [268/350]

testing::gmock_matchers_test::TEST ( ResultOfDeathTest ,
DiesOnNullFunctionPointers  )

Definition at line 4542 of file gmock-matchers_test.cc.

4542 {
4544 ResultOf(static_cast<std::string (*)(int dummy)>(NULL),
4545 Eq(std::string("foo"))),
4546 "NULL function pointer is passed into ResultOf\\(\\)\\.");
4547}
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex)
Here is the call graph for this function:

◆ TEST() [269/350]

testing::gmock_matchers_test::TEST ( ResultOfTest ,
CanDescribeItself  )

Definition at line 4460 of file gmock-matchers_test.cc.

4460 {
4461 Matcher<int> matcher = ResultOf(&IntToStringFunction, StrEq("foo"));
4462
4463 EXPECT_EQ("is mapped by the given callable to a value that "
4464 "is equal to \"foo\"", Describe(matcher));
4465 EXPECT_EQ("is mapped by the given callable to a value that "
4466 "isn't equal to \"foo\"", DescribeNegation(matcher));
4467}
Here is the call graph for this function:

◆ TEST() [270/350]

testing::gmock_matchers_test::TEST ( ResultOfTest ,
CanExplainMatchResult  )

Definition at line 4472 of file gmock-matchers_test.cc.

4472 {
4473 Matcher<int> matcher = ResultOf(&IntFunction, Ge(85));
4474 EXPECT_EQ("which is mapped by the given callable to 90" + OfType("int"),
4475 Explain(matcher, 36));
4476
4477 matcher = ResultOf(&IntFunction, GreaterThan(85));
4478 EXPECT_EQ("which is mapped by the given callable to 90" + OfType("int") +
4479 ", which is 5 more than 85", Explain(matcher, 36));
4480}
Here is the call graph for this function:

◆ TEST() [271/350]

testing::gmock_matchers_test::TEST ( ResultOfTest ,
WorksForCompatibleMatcherTypes  )

Definition at line 4532 of file gmock-matchers_test.cc.

4532 {
4533 // IntFunction() returns int but the inner matcher expects a signed char.
4534 Matcher<int> matcher = ResultOf(IntFunction, Matcher<signed char>(Ge(85)));
4535
4536 EXPECT_TRUE(matcher.Matches(36));
4537 EXPECT_FALSE(matcher.Matches(42));
4538}
Here is the call graph for this function:

◆ TEST() [272/350]

testing::gmock_matchers_test::TEST ( ResultOfTest ,
WorksForFunctionPointers  )

Definition at line 4452 of file gmock-matchers_test.cc.

4452 {
4453 Matcher<int> matcher = ResultOf(&IntToStringFunction, Eq(std::string("foo")));
4454
4455 EXPECT_TRUE(matcher.Matches(1));
4456 EXPECT_FALSE(matcher.Matches(2));
4457}
Here is the call graph for this function:

◆ TEST() [273/350]

testing::gmock_matchers_test::TEST ( ResultOfTest ,
WorksForFunctionReferences  )

Definition at line 4551 of file gmock-matchers_test.cc.

4551 {
4552 Matcher<int> matcher = ResultOf(IntToStringFunction, StrEq("foo"));
4553 EXPECT_TRUE(matcher.Matches(1));
4554 EXPECT_FALSE(matcher.Matches(2));
4555}
Here is the call graph for this function:

◆ TEST() [274/350]

testing::gmock_matchers_test::TEST ( ResultOfTest ,
WorksForFunctors  )

Definition at line 4565 of file gmock-matchers_test.cc.

4565 {
4566 Matcher<int> matcher = ResultOf(Functor(), Eq(std::string("foo")));
4567
4568 EXPECT_TRUE(matcher.Matches(1));
4569 EXPECT_FALSE(matcher.Matches(2));
4570}
Here is the call graph for this function:

◆ TEST() [275/350]

testing::gmock_matchers_test::TEST ( ResultOfTest ,
WorksForNonReferenceResults  )

Definition at line 4484 of file gmock-matchers_test.cc.

4484 {
4485 Matcher<int> matcher = ResultOf(&IntFunction, Eq(80));
4486
4487 EXPECT_TRUE(matcher.Matches(42));
4488 EXPECT_FALSE(matcher.Matches(36));
4489}
Here is the call graph for this function:

◆ TEST() [276/350]

testing::gmock_matchers_test::TEST ( ResultOfTest ,
WorksForPolymorphicFunctors  )

Definition at line 4581 of file gmock-matchers_test.cc.

4581 {
4582 Matcher<int> matcher_int = ResultOf(PolymorphicFunctor(), Ge(5));
4583
4584 EXPECT_TRUE(matcher_int.Matches(10));
4585 EXPECT_FALSE(matcher_int.Matches(2));
4586
4587 Matcher<const char*> matcher_string = ResultOf(PolymorphicFunctor(), Ge(5));
4588
4589 EXPECT_TRUE(matcher_string.Matches("long string"));
4590 EXPECT_FALSE(matcher_string.Matches("shrt"));
4591}
Here is the call graph for this function:

◆ TEST() [277/350]

testing::gmock_matchers_test::TEST ( ResultOfTest ,
WorksForReferenceToConstResults  )

Definition at line 4521 of file gmock-matchers_test.cc.

4521 {
4522 std::string s = "foo";
4523 std::string s2 = s;
4524 Matcher<const std::string&> matcher = ResultOf(&StringFunction, Ref(s));
4525
4526 EXPECT_TRUE(matcher.Matches(s));
4527 EXPECT_FALSE(matcher.Matches(s2));
4528}
Here is the call graph for this function:

◆ TEST() [278/350]

testing::gmock_matchers_test::TEST ( ResultOfTest ,
WorksForReferenceToNonConstResults  )

Definition at line 4499 of file gmock-matchers_test.cc.

4499 {
4500 double x = 3.14;
4501 double x2 = x;
4502 Matcher<double&> matcher = ResultOf(&DoubleFunction, Ref(x));
4503
4504 EXPECT_TRUE(matcher.Matches(x));
4505 EXPECT_FALSE(matcher.Matches(x2));
4506
4507 // Test that ResultOf works with uncopyable objects
4508 Uncopyable obj(0);
4509 Uncopyable obj2(0);
4510 Matcher<Uncopyable&> matcher2 =
4511 ResultOf(&RefUncopyableFunction, Ref(obj));
4512
4513 EXPECT_TRUE(matcher2.Matches(obj));
4514 EXPECT_FALSE(matcher2.Matches(obj2));
4515}
Here is the call graph for this function:

◆ TEST() [279/350]

testing::gmock_matchers_test::TEST ( ResultOfTest ,
WorksForReferencingCallables  )

Definition at line 4600 of file gmock-matchers_test.cc.

4600 {
4601 const int n = 1;
4602 const int n2 = 1;
4603 Matcher<const int&> matcher2 = ResultOf(ReferencingFunction, Eq(&n));
4604 EXPECT_TRUE(matcher2.Matches(n));
4605 EXPECT_FALSE(matcher2.Matches(n2));
4606
4607 Matcher<const int&> matcher3 = ResultOf(ReferencingFunctor(), Eq(&n));
4608 EXPECT_TRUE(matcher3.Matches(n));
4609 EXPECT_FALSE(matcher3.Matches(n2));
4610}
Here is the call graph for this function:

◆ TEST() [280/350]

testing::gmock_matchers_test::TEST ( SafeMatcherCastTest ,
FromBaseClass  )

Definition at line 849 of file gmock-matchers_test.cc.

849 {
850 Derived d, d2;
851 Matcher<Base*> m1 = Eq(&d);
852 Matcher<Derived*> m2 = SafeMatcherCast<Derived*>(m1);
853 EXPECT_TRUE(m2.Matches(&d));
854 EXPECT_FALSE(m2.Matches(&d2));
855
856 Matcher<Base&> m3 = Ref(d);
857 Matcher<Derived&> m4 = SafeMatcherCast<Derived&>(m3);
858 EXPECT_TRUE(m4.Matches(d));
859 EXPECT_FALSE(m4.Matches(d2));
860}
Here is the call graph for this function:

◆ TEST() [281/350]

testing::gmock_matchers_test::TEST ( SafeMatcherCastTest ,
FromConstReferenceToReference  )

Definition at line 863 of file gmock-matchers_test.cc.

863 {
864 int n = 0;
865 Matcher<const int&> m1 = Ref(n);
866 Matcher<int&> m2 = SafeMatcherCast<int&>(m1);
867 int n1 = 0;
868 EXPECT_TRUE(m2.Matches(n));
869 EXPECT_FALSE(m2.Matches(n1));
870}
Here is the call graph for this function:

◆ TEST() [282/350]

testing::gmock_matchers_test::TEST ( SafeMatcherCastTest ,
FromLosslesslyConvertibleArithmeticType  )

Definition at line 836 of file gmock-matchers_test.cc.

836 {
837 Matcher<double> m1 = DoubleEq(1.0);
838 Matcher<float> m2 = SafeMatcherCast<float>(m1);
839 EXPECT_TRUE(m2.Matches(1.0f));
840 EXPECT_FALSE(m2.Matches(2.0f));
841
842 Matcher<char> m3 = SafeMatcherCast<char>(TypedEq<int>('a'));
843 EXPECT_TRUE(m3.Matches('a'));
844 EXPECT_FALSE(m3.Matches('b'));
845}
Here is the call graph for this function:

◆ TEST() [283/350]

testing::gmock_matchers_test::TEST ( SafeMatcherCastTest ,
FromNonReferenceToConstReference  )

Definition at line 873 of file gmock-matchers_test.cc.

873 {
874 Matcher<int> m1 = Eq(0);
875 Matcher<const int&> m2 = SafeMatcherCast<const int&>(m1);
876 EXPECT_TRUE(m2.Matches(0));
877 EXPECT_FALSE(m2.Matches(1));
878}
Here is the call graph for this function:

◆ TEST() [284/350]

testing::gmock_matchers_test::TEST ( SafeMatcherCastTest ,
FromNonReferenceToReference  )

Definition at line 881 of file gmock-matchers_test.cc.

881 {
882 Matcher<int> m1 = Eq(0);
883 Matcher<int&> m2 = SafeMatcherCast<int&>(m1);
884 int n = 0;
885 EXPECT_TRUE(m2.Matches(n));
886 n = 1;
887 EXPECT_FALSE(m2.Matches(n));
888}
Here is the call graph for this function:

◆ TEST() [285/350]

testing::gmock_matchers_test::TEST ( SafeMatcherCastTest ,
FromPolymorphicMatcher  )

Definition at line 827 of file gmock-matchers_test.cc.

827 {
828 Matcher<char> m2 = SafeMatcherCast<char>(Eq(32));
829 EXPECT_TRUE(m2.Matches(' '));
830 EXPECT_FALSE(m2.Matches('\n'));
831}
Here is the call graph for this function:

◆ TEST() [286/350]

testing::gmock_matchers_test::TEST ( SafeMatcherCastTest ,
FromSameType  )

Definition at line 891 of file gmock-matchers_test.cc.

891 {
892 Matcher<int> m1 = Eq(0);
893 Matcher<int> m2 = SafeMatcherCast<int>(m1);
894 EXPECT_TRUE(m2.Matches(0));
895 EXPECT_FALSE(m2.Matches(1));
896}
Here is the call graph for this function:

◆ TEST() [287/350]

testing::gmock_matchers_test::TEST ( SafeMatcherCastTest ,
ValueIsNotCopied  )

Definition at line 917 of file gmock-matchers_test.cc.

917 {
918 int n = 42;
919 Matcher<IntReferenceWrapper> m = SafeMatcherCast<IntReferenceWrapper>(n);
920 // Verify that the matcher holds a reference to n, not to its temporary copy.
921 EXPECT_TRUE(m.Matches(n));
922}
Here is the call graph for this function:

◆ TEST() [288/350]

testing::gmock_matchers_test::TEST ( SizeIsTest ,
CanDescribeSelf  )

Definition at line 4824 of file gmock-matchers_test.cc.

4824 {
4825 Matcher<vector<int> > m = SizeIs(2);
4826 EXPECT_EQ("size is equal to 2", Describe(m));
4827 EXPECT_EQ("size isn't equal to 2", DescribeNegation(m));
4828}
Here is the call graph for this function:

◆ TEST() [289/350]

testing::gmock_matchers_test::TEST ( SizeIsTest ,
ExplainsResult  )

Definition at line 4830 of file gmock-matchers_test.cc.

4830 {
4831 Matcher<vector<int> > m1 = SizeIs(2);
4832 Matcher<vector<int> > m2 = SizeIs(Lt(2u));
4833 Matcher<vector<int> > m3 = SizeIs(AnyOf(0, 3));
4834 Matcher<vector<int> > m4 = SizeIs(GreaterThan(1));
4835 vector<int> container;
4836 EXPECT_EQ("whose size 0 doesn't match", Explain(m1, container));
4837 EXPECT_EQ("whose size 0 matches", Explain(m2, container));
4838 EXPECT_EQ("whose size 0 matches", Explain(m3, container));
4839 EXPECT_EQ("whose size 0 doesn't match, which is 1 less than 1",
4840 Explain(m4, container));
4841 container.push_back(0);
4842 container.push_back(0);
4843 EXPECT_EQ("whose size 2 matches", Explain(m1, container));
4844 EXPECT_EQ("whose size 2 doesn't match", Explain(m2, container));
4845 EXPECT_EQ("whose size 2 doesn't match", Explain(m3, container));
4846 EXPECT_EQ("whose size 2 matches, which is 1 more than 1",
4847 Explain(m4, container));
4848}
Here is the call graph for this function:

◆ TEST() [290/350]

testing::gmock_matchers_test::TEST ( SizeIsTest ,
ImplementsSizeIs  )

Definition at line 4792 of file gmock-matchers_test.cc.

4792 {
4793 vector<int> container;
4794 EXPECT_THAT(container, SizeIs(0));
4795 EXPECT_THAT(container, Not(SizeIs(1)));
4796 container.push_back(0);
4797 EXPECT_THAT(container, Not(SizeIs(0)));
4798 EXPECT_THAT(container, SizeIs(1));
4799 container.push_back(0);
4800 EXPECT_THAT(container, Not(SizeIs(0)));
4801 EXPECT_THAT(container, SizeIs(2));
4802}
Here is the call graph for this function:

◆ TEST() [291/350]

testing::gmock_matchers_test::TEST ( SizeIsTest ,
WorksWithMap  )

Definition at line 4804 of file gmock-matchers_test.cc.

4804 {
4805 map<std::string, int> container;
4806 EXPECT_THAT(container, SizeIs(0));
4807 EXPECT_THAT(container, Not(SizeIs(1)));
4808 container.insert(make_pair("foo", 1));
4809 EXPECT_THAT(container, Not(SizeIs(0)));
4810 EXPECT_THAT(container, SizeIs(1));
4811 container.insert(make_pair("bar", 2));
4812 EXPECT_THAT(container, Not(SizeIs(0)));
4813 EXPECT_THAT(container, SizeIs(2));
4814}
Here is the call graph for this function:

◆ TEST() [292/350]

testing::gmock_matchers_test::TEST ( SizeIsTest ,
WorksWithReferences  )

Definition at line 4816 of file gmock-matchers_test.cc.

4816 {
4817 vector<int> container;
4818 Matcher<const vector<int>&> m = SizeIs(1);
4819 EXPECT_THAT(container, Not(m));
4820 container.push_back(0);
4821 EXPECT_THAT(container, m);
4822}
Here is the call graph for this function:

◆ TEST() [293/350]

testing::gmock_matchers_test::TEST ( StartsWithTest ,
CanDescribeSelf  )

Definition at line 1719 of file gmock-matchers_test.cc.

1719 {
1720 Matcher<const std::string> m = StartsWith("Hi");
1721 EXPECT_EQ("starts with \"Hi\"", Describe(m));
1722}
Here is the call graph for this function:

◆ TEST() [294/350]

testing::gmock_matchers_test::TEST ( StartsWithTest ,
MatchesStringWithGivenPrefix  )

Definition at line 1705 of file gmock-matchers_test.cc.

1705 {
1706 const Matcher<const char*> m1 = StartsWith(std::string(""));
1707 EXPECT_TRUE(m1.Matches("Hi"));
1708 EXPECT_TRUE(m1.Matches(""));
1709 EXPECT_FALSE(m1.Matches(NULL));
1710
1711 const Matcher<const std::string&> m2 = StartsWith("Hi");
1712 EXPECT_TRUE(m2.Matches("Hi"));
1713 EXPECT_TRUE(m2.Matches("Hi Hi!"));
1714 EXPECT_TRUE(m2.Matches("High"));
1715 EXPECT_FALSE(m2.Matches("H"));
1716 EXPECT_FALSE(m2.Matches(" Hi"));
1717}
Here is the call graph for this function:

◆ TEST() [295/350]

testing::gmock_matchers_test::TEST ( StrCaseEqTest ,
CanDescribeSelf  )

Definition at line 1424 of file gmock-matchers_test.cc.

1424 {
1425 Matcher<std::string> m = StrCaseEq("Hi");
1426 EXPECT_EQ("is equal to (ignoring case) \"Hi\"", Describe(m));
1427}
Here is the call graph for this function:

◆ TEST() [296/350]

testing::gmock_matchers_test::TEST ( StrCaseEqTest ,
MatchesEqualStringIgnoringCase  )

Definition at line 1379 of file gmock-matchers_test.cc.

1379 {
1380 Matcher<const char*> m = StrCaseEq(std::string("Hello"));
1381 EXPECT_TRUE(m.Matches("Hello"));
1382 EXPECT_TRUE(m.Matches("hello"));
1383 EXPECT_FALSE(m.Matches("Hi"));
1384 EXPECT_FALSE(m.Matches(NULL));
1385
1386 Matcher<const std::string&> m2 = StrCaseEq("Hello");
1387 EXPECT_TRUE(m2.Matches("hello"));
1388 EXPECT_FALSE(m2.Matches("Hi"));
1389
1390#if GTEST_HAS_ABSL
1391 Matcher<const absl::string_view&> m3 = StrCaseEq(std::string("Hello"));
1392 EXPECT_TRUE(m3.Matches(absl::string_view("Hello")));
1393 EXPECT_TRUE(m3.Matches(absl::string_view("hello")));
1394 EXPECT_FALSE(m3.Matches(absl::string_view("Hi")));
1395 EXPECT_FALSE(m3.Matches(absl::string_view()));
1396#endif // GTEST_HAS_ABSL
1397}
Here is the call graph for this function:

◆ TEST() [297/350]

testing::gmock_matchers_test::TEST ( StrCaseEqTest ,
MatchesEqualStringWith0IgnoringCase  )

Definition at line 1399 of file gmock-matchers_test.cc.

1399 {
1400 std::string str1("oabocdooeoo");
1401 std::string str2("OABOCDOOEOO");
1402 Matcher<const std::string&> m0 = StrCaseEq(str1);
1403 EXPECT_FALSE(m0.Matches(str2 + std::string(1, '\0')));
1404
1405 str1[3] = str2[3] = '\0';
1406 Matcher<const std::string&> m1 = StrCaseEq(str1);
1407 EXPECT_TRUE(m1.Matches(str2));
1408
1409 str1[0] = str1[6] = str1[7] = str1[10] = '\0';
1410 str2[0] = str2[6] = str2[7] = str2[10] = '\0';
1411 Matcher<const std::string&> m2 = StrCaseEq(str1);
1412 str1[9] = str2[9] = '\0';
1413 EXPECT_FALSE(m2.Matches(str2));
1414
1415 Matcher<const std::string&> m3 = StrCaseEq(str1);
1416 EXPECT_TRUE(m3.Matches(str2));
1417
1418 EXPECT_FALSE(m3.Matches(str2 + "x"));
1419 str2.append(1, '\0');
1420 EXPECT_FALSE(m3.Matches(str2));
1421 EXPECT_FALSE(m3.Matches(std::string(str2, 0, 9)));
1422}
Here is the call graph for this function:

◆ TEST() [298/350]

testing::gmock_matchers_test::TEST ( StrCaseNeTest ,
CanDescribeSelf  )

Definition at line 1449 of file gmock-matchers_test.cc.

1449 {
1450 Matcher<const char*> m = StrCaseNe("Hi");
1451 EXPECT_EQ("isn't equal to (ignoring case) \"Hi\"", Describe(m));
1452}
Here is the call graph for this function:

◆ TEST() [299/350]

testing::gmock_matchers_test::TEST ( StrCaseNeTest ,
MatchesUnequalStringIgnoringCase  )

Definition at line 1429 of file gmock-matchers_test.cc.

1429 {
1430 Matcher<const char*> m = StrCaseNe("Hello");
1431 EXPECT_TRUE(m.Matches("Hi"));
1432 EXPECT_TRUE(m.Matches(NULL));
1433 EXPECT_FALSE(m.Matches("Hello"));
1434 EXPECT_FALSE(m.Matches("hello"));
1435
1436 Matcher<std::string> m2 = StrCaseNe(std::string("Hello"));
1437 EXPECT_TRUE(m2.Matches(""));
1438 EXPECT_FALSE(m2.Matches("Hello"));
1439
1440#if GTEST_HAS_ABSL
1441 Matcher<const absl::string_view> m3 = StrCaseNe("Hello");
1442 EXPECT_TRUE(m3.Matches(absl::string_view("Hi")));
1443 EXPECT_TRUE(m3.Matches(absl::string_view()));
1444 EXPECT_FALSE(m3.Matches(absl::string_view("Hello")));
1445 EXPECT_FALSE(m3.Matches(absl::string_view("hello")));
1446#endif // GTEST_HAS_ABSL
1447}
Here is the call graph for this function:

◆ TEST() [300/350]

testing::gmock_matchers_test::TEST ( StreamlikeTest ,
Iteration  )

Definition at line 5261 of file gmock-matchers_test.cc.

5261 {
5262 const int a[5] = {2, 1, 4, 5, 3};
5263 Streamlike<int> s(a, a + 5);
5264 Streamlike<int>::const_iterator it = s.begin();
5265 const int* ip = a;
5266 while (it != s.end()) {
5267 SCOPED_TRACE(ip - a);
5268 EXPECT_EQ(*ip++, *it++);
5269 }
5270}

◆ TEST() [301/350]

testing::gmock_matchers_test::TEST ( StrEqTest ,
CanDescribeSelf  )

Definition at line 1342 of file gmock-matchers_test.cc.

1342 {
1343 Matcher<std::string> m = StrEq("Hi-\'\"?\\\a\b\f\n\r\t\v\xD3");
1344 EXPECT_EQ("is equal to \"Hi-\'\\\"?\\\\\\a\\b\\f\\n\\r\\t\\v\\xD3\"",
1345 Describe(m));
1346
1347 std::string str("01204500800");
1348 str[3] = '\0';
1349 Matcher<std::string> m2 = StrEq(str);
1350 EXPECT_EQ("is equal to \"012\\04500800\"", Describe(m2));
1351 str[0] = str[6] = str[7] = str[9] = str[10] = '\0';
1352 Matcher<std::string> m3 = StrEq(str);
1353 EXPECT_EQ("is equal to \"\\012\\045\\0\\08\\0\\0\"", Describe(m3));
1354}
Here is the call graph for this function:

◆ TEST() [302/350]

testing::gmock_matchers_test::TEST ( StrEqTest ,
MatchesEqualString  )

Definition at line 1324 of file gmock-matchers_test.cc.

1324 {
1325 Matcher<const char*> m = StrEq(std::string("Hello"));
1326 EXPECT_TRUE(m.Matches("Hello"));
1327 EXPECT_FALSE(m.Matches("hello"));
1328 EXPECT_FALSE(m.Matches(NULL));
1329
1330 Matcher<const std::string&> m2 = StrEq("Hello");
1331 EXPECT_TRUE(m2.Matches("Hello"));
1332 EXPECT_FALSE(m2.Matches("Hi"));
1333
1334#if GTEST_HAS_ABSL
1335 Matcher<const absl::string_view&> m3 = StrEq("Hello");
1336 EXPECT_TRUE(m3.Matches(absl::string_view("Hello")));
1337 EXPECT_FALSE(m3.Matches(absl::string_view("hello")));
1338 EXPECT_FALSE(m3.Matches(absl::string_view()));
1339#endif // GTEST_HAS_ABSL
1340}
Here is the call graph for this function:

◆ TEST() [303/350]

testing::gmock_matchers_test::TEST ( StringMatcherTest ,
CanBeImplicitlyConstructedFromCStringLiteral  )

Definition at line 386 of file gmock-matchers_test.cc.

386 {
387 Matcher<std::string> m1 = "hi";
388 EXPECT_TRUE(m1.Matches("hi"));
389 EXPECT_FALSE(m1.Matches("hello"));
390
392 EXPECT_TRUE(m2.Matches("hi"));
393 EXPECT_FALSE(m2.Matches("hello"));
394}
Here is the call graph for this function:

◆ TEST() [304/350]

testing::gmock_matchers_test::TEST ( StringMatcherTest ,
CanBeImplicitlyConstructedFromString  )

Definition at line 398 of file gmock-matchers_test.cc.

398 {
399 Matcher<std::string> m1 = std::string("hi");
400 EXPECT_TRUE(m1.Matches("hi"));
401 EXPECT_FALSE(m1.Matches("hello"));
402
403 Matcher<const std::string&> m2 = std::string("hi");
404 EXPECT_TRUE(m2.Matches("hi"));
405 EXPECT_FALSE(m2.Matches("hello"));
406}
Here is the call graph for this function:

◆ TEST() [305/350]

testing::gmock_matchers_test::TEST ( StrNeTest ,
CanDescribeSelf  )

Definition at line 1374 of file gmock-matchers_test.cc.

1374 {
1375 Matcher<const char*> m = StrNe("Hi");
1376 EXPECT_EQ("isn't equal to \"Hi\"", Describe(m));
1377}
Here is the call graph for this function:

◆ TEST() [306/350]

testing::gmock_matchers_test::TEST ( StrNeTest ,
MatchesUnequalString  )

Definition at line 1356 of file gmock-matchers_test.cc.

1356 {
1357 Matcher<const char*> m = StrNe("Hello");
1358 EXPECT_TRUE(m.Matches(""));
1359 EXPECT_TRUE(m.Matches(NULL));
1360 EXPECT_FALSE(m.Matches("Hello"));
1361
1362 Matcher<std::string> m2 = StrNe(std::string("Hello"));
1363 EXPECT_TRUE(m2.Matches("hello"));
1364 EXPECT_FALSE(m2.Matches("Hello"));
1365
1366#if GTEST_HAS_ABSL
1367 Matcher<const absl::string_view> m3 = StrNe("Hello");
1368 EXPECT_TRUE(m3.Matches(absl::string_view("")));
1369 EXPECT_TRUE(m3.Matches(absl::string_view()));
1370 EXPECT_FALSE(m3.Matches(absl::string_view("Hello")));
1371#endif // GTEST_HAS_ABSL
1372}
Here is the call graph for this function:

◆ TEST() [307/350]

testing::gmock_matchers_test::TEST ( TrulyTest ,
CanBeUsedWithFunctor  )

Definition at line 2935 of file gmock-matchers_test.cc.

Here is the call graph for this function:

◆ TEST() [308/350]

testing::gmock_matchers_test::TEST ( TrulyTest ,
CanDescribeSelf  )

Definition at line 2965 of file gmock-matchers_test.cc.

2965 {
2966 Matcher<double> m = Truly(IsPositive);
2967 EXPECT_EQ("satisfies the given predicate",
2968 Describe(m));
2969}
Here is the call graph for this function:

◆ TEST() [309/350]

testing::gmock_matchers_test::TEST ( TrulyTest ,
MatchesWhatSatisfiesThePredicate  )

Definition at line 2928 of file gmock-matchers_test.cc.

2928 {
2929 Matcher<double> m = Truly(IsPositive);
2930 EXPECT_TRUE(m.Matches(2.0));
2931 EXPECT_FALSE(m.Matches(-1.5));
2932}
Here is the call graph for this function:

◆ TEST() [310/350]

testing::gmock_matchers_test::TEST ( TrulyTest ,
PredicateCanReturnAClassConvertibleToBool  )

Definition at line 2958 of file gmock-matchers_test.cc.

2958 {
2959 Matcher<int> m = Truly(IsNotZero);
2960 EXPECT_TRUE(m.Matches(1));
2961 EXPECT_FALSE(m.Matches(0));
2962}
Here is the call graph for this function:

◆ TEST() [311/350]

testing::gmock_matchers_test::TEST ( TrulyTest ,
WorksForByRefArguments  )

Definition at line 2973 of file gmock-matchers_test.cc.

2973 {
2974 Matcher<const int&> m = Truly(ReferencesFooAndIsZero);
2976 int n = 0;
2977 EXPECT_FALSE(m.Matches(n));
2978}
Here is the call graph for this function:

◆ TEST() [312/350]

testing::gmock_matchers_test::TEST ( TypedEqTest ,
CanDescribeSelf  )

Definition at line 1061 of file gmock-matchers_test.cc.

1061 {
1062 EXPECT_EQ("is equal to 2", Describe(TypedEq<int>(2)));
1063}
Here is the call graph for this function:

◆ TEST() [313/350]

testing::gmock_matchers_test::TEST ( TypedEqTest ,
ChecksEqualityForGivenType  )

Definition at line 1050 of file gmock-matchers_test.cc.

1050 {
1051 Matcher<char> m1 = TypedEq<char>('a');
1052 EXPECT_TRUE(m1.Matches('a'));
1053 EXPECT_FALSE(m1.Matches('b'));
1054
1055 Matcher<int> m2 = TypedEq<int>(6);
1056 EXPECT_TRUE(m2.Matches(6));
1057 EXPECT_FALSE(m2.Matches(7));
1058}
Here is the call graph for this function:

◆ TEST() [314/350]

testing::gmock_matchers_test::TEST ( TypedEqTest ,
HasSpecifiedType  )

Definition at line 1079 of file gmock-matchers_test.cc.

1079 {
1080 // Verfies that the type of TypedEq<T>(v) is Matcher<T>.
1081 Type<Matcher<int> >::IsTypeOf(TypedEq<int>(5));
1082 Type<Matcher<double> >::IsTypeOf(TypedEq<double>(5));
1083}

◆ TEST() [315/350]

testing::gmock_matchers_test::TEST ( UnderscoreTest ,
CanDescribeSelf  )

Definition at line 1005 of file gmock-matchers_test.cc.

1005 {
1006 Matcher<int> m = _;
1007 EXPECT_EQ("is anything", Describe(m));
1008}
Here is the call graph for this function:

◆ TEST() [316/350]

testing::gmock_matchers_test::TEST ( UnderscoreTest ,
MatchesAnyValue  )

Definition at line 990 of file gmock-matchers_test.cc.

990 {
991 // Uses _ as a matcher for a value type.
992 Matcher<int> m1 = _;
993 EXPECT_TRUE(m1.Matches(123));
994 EXPECT_TRUE(m1.Matches(-242));
995
996 // Uses _ as a matcher for a reference type.
997 bool a = false;
998 const bool b = true;
1000 EXPECT_TRUE(m2.Matches(a));
1001 EXPECT_TRUE(m2.Matches(b));
1002}
Here is the call graph for this function:

◆ TEST() [317/350]

testing::gmock_matchers_test::TEST ( UnorderedElementsAreArrayTest ,
SucceedsWhenExpected  )

Definition at line 5638 of file gmock-matchers_test.cc.

5638 {
5639 const int a[] = {0, 1, 2, 3, 4};
5640 std::vector<int> s(a, a + GTEST_ARRAY_SIZE_(a));
5641 do {
5643 EXPECT_TRUE(ExplainMatchResult(UnorderedElementsAreArray(a),
5644 s, &listener)) << listener.str();
5645 } while (std::next_permutation(s.begin(), s.end()));
5646}
internal::UnorderedElementsAreArrayMatcher< typename ::std::iterator_traits< Iter >::value_type > UnorderedElementsAreArray(Iter first, Iter last)
Here is the call graph for this function:

◆ TEST() [318/350]

testing::gmock_matchers_test::TEST ( UnorderedElementsAreArrayTest ,
TakesStlContainer  )

Definition at line 5677 of file gmock-matchers_test.cc.

5677 {
5678 const int actual[] = {3, 1, 2};
5679
5680 ::std::list<int> expected;
5681 expected.push_back(1);
5682 expected.push_back(2);
5683 expected.push_back(3);
5684 EXPECT_THAT(actual, UnorderedElementsAreArray(expected));
5685
5686 expected.push_back(4);
5687 EXPECT_THAT(actual, Not(UnorderedElementsAreArray(expected)));
5688}
Here is the call graph for this function:

◆ TEST() [319/350]

testing::gmock_matchers_test::TEST ( UnorderedElementsAreArrayTest ,
VectorBool  )

Definition at line 5648 of file gmock-matchers_test.cc.

5648 {
5649 const bool a[] = {0, 1, 0, 1, 1};
5650 const bool b[] = {1, 0, 1, 1, 0};
5651 std::vector<bool> expected(a, a + GTEST_ARRAY_SIZE_(a));
5652 std::vector<bool> actual(b, b + GTEST_ARRAY_SIZE_(b));
5653 StringMatchResultListener listener;
5654 EXPECT_TRUE(ExplainMatchResult(UnorderedElementsAreArray(expected),
5655 actual, &listener)) << listener.str();
5656}
Here is the call graph for this function:

◆ TEST() [320/350]

testing::gmock_matchers_test::TEST ( UnorderedElementsAreArrayTest ,
WorksForStreamlike  )

Definition at line 5658 of file gmock-matchers_test.cc.

5658 {
5659 // Streamlike 'container' provides only minimal iterator support.
5660 // Its iterators are tagged with input_iterator_tag, and it has no
5661 // size() or empty() methods.
5662 const int a[5] = {2, 1, 4, 5, 3};
5663 Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a));
5664
5665 ::std::vector<int> expected;
5666 expected.push_back(1);
5667 expected.push_back(2);
5668 expected.push_back(3);
5669 expected.push_back(4);
5670 expected.push_back(5);
5672
5673 expected.push_back(6);
5674 EXPECT_THAT(s, Not(UnorderedElementsAreArray(expected)));
5675}
Here is the call graph for this function:

◆ TEST() [321/350]

testing::gmock_matchers_test::TEST ( UnorderedPointwiseTest ,
AcceptsCorrectContentInDifferentOrder  )

Definition at line 6554 of file gmock-matchers_test.cc.

6554 {
6555 const double lhs[3] = {1, 2, 3};
6556 const int rhs[3] = {6, 4, 2};
6557 EXPECT_THAT(lhs, UnorderedPointwise(IsHalfOf(), rhs));
6558}
Here is the call graph for this function:

◆ TEST() [322/350]

testing::gmock_matchers_test::TEST ( UnorderedPointwiseTest ,
AcceptsCorrectContentInSameOrder  )

Definition at line 6548 of file gmock-matchers_test.cc.

6548 {
6549 const double lhs[3] = {1, 2, 3};
6550 const int rhs[3] = {2, 4, 6};
6551 EXPECT_THAT(lhs, UnorderedPointwise(IsHalfOf(), rhs));
6552}
Here is the call graph for this function:

◆ TEST() [323/350]

testing::gmock_matchers_test::TEST ( UnorderedPointwiseTest ,
AllowsMonomorphicInnerMatcher  )

Definition at line 6560 of file gmock-matchers_test.cc.

6560 {
6561 const double lhs[3] = {1, 2, 3};
6562 const int rhs[3] = {4, 6, 2};
6563 const Matcher<tuple<const double&, const int&> > m1 = IsHalfOf();
6564 EXPECT_THAT(lhs, UnorderedPointwise(m1, rhs));
6565
6566 // This type works as a tuple<const double&, const int&> can be
6567 // implicitly cast to tuple<double, int>.
6568 const Matcher<tuple<double, int> > m2 = IsHalfOf();
6569 EXPECT_THAT(lhs, UnorderedPointwise(m2, rhs));
6570}
Here is the call graph for this function:

◆ TEST() [324/350]

testing::gmock_matchers_test::TEST ( UnorderedPointwiseTest ,
DescribesSelf  )

Definition at line 6458 of file gmock-matchers_test.cc.

6458 {
6459 vector<int> rhs;
6460 rhs.push_back(1);
6461 rhs.push_back(2);
6462 rhs.push_back(3);
6463 const Matcher<const vector<int>&> m = UnorderedPointwise(IsHalfOf(), rhs);
6464 EXPECT_EQ(
6465 "has 3 elements and there exists some permutation of elements such "
6466 "that:\n"
6467 " - element #0 and 1 are a pair where the first is half of the second, "
6468 "and\n"
6469 " - element #1 and 2 are a pair where the first is half of the second, "
6470 "and\n"
6471 " - element #2 and 3 are a pair where the first is half of the second",
6472 Describe(m));
6473 EXPECT_EQ(
6474 "doesn't have 3 elements, or there exists no permutation of elements "
6475 "such that:\n"
6476 " - element #0 and 1 are a pair where the first is half of the second, "
6477 "and\n"
6478 " - element #1 and 2 are a pair where the first is half of the second, "
6479 "and\n"
6480 " - element #2 and 3 are a pair where the first is half of the second",
6481 DescribeNegation(m));
6482}
Here is the call graph for this function:

◆ TEST() [325/350]

testing::gmock_matchers_test::TEST ( UnorderedPointwiseTest ,
MakesCopyOfRhs  )

Definition at line 6484 of file gmock-matchers_test.cc.

6484 {
6485 list<signed char> rhs;
6486 rhs.push_back(2);
6487 rhs.push_back(4);
6488
6489 int lhs[] = {2, 1};
6490 const Matcher<const int (&)[2]> m = UnorderedPointwise(IsHalfOf(), rhs);
6491 EXPECT_THAT(lhs, m);
6492
6493 // Changing rhs now shouldn't affect m, which made a copy of rhs.
6494 rhs.push_back(6);
6495 EXPECT_THAT(lhs, m);
6496}
Here is the call graph for this function:

◆ TEST() [326/350]

testing::gmock_matchers_test::TEST ( UnorderedPointwiseTest ,
RejectsWrongContent  )

Definition at line 6539 of file gmock-matchers_test.cc.

6539 {
6540 const double lhs[3] = {1, 2, 3};
6541 const int rhs[3] = {2, 6, 6};
6542 EXPECT_THAT(lhs, Not(UnorderedPointwise(IsHalfOf(), rhs)));
6543 EXPECT_EQ("where the following elements don't match any matchers:\n"
6544 "element #1: 2",
6545 Explain(UnorderedPointwise(IsHalfOf(), rhs), lhs));
6546}
Here is the call graph for this function:

◆ TEST() [327/350]

testing::gmock_matchers_test::TEST ( UnorderedPointwiseTest ,
RejectsWrongSize  )

Definition at line 6528 of file gmock-matchers_test.cc.

6528 {
6529 const double lhs[2] = {1, 2};
6530 const int rhs[1] = {0};
6531 EXPECT_THAT(lhs, Not(UnorderedPointwise(Gt(), rhs)));
6532 EXPECT_EQ("which has 2 elements",
6533 Explain(UnorderedPointwise(Gt(), rhs), lhs));
6534
6535 const int rhs2[3] = {0, 1, 2};
6536 EXPECT_THAT(lhs, Not(UnorderedPointwise(Gt(), rhs2)));
6537}
Here is the call graph for this function:

◆ TEST() [328/350]

testing::gmock_matchers_test::TEST ( UnorderedPointwiseTest ,
WorksForLhsNativeArray  )

Definition at line 6498 of file gmock-matchers_test.cc.

6498 {
6499 const int lhs[] = {1, 2, 3};
6500 vector<int> rhs;
6501 rhs.push_back(4);
6502 rhs.push_back(6);
6503 rhs.push_back(2);
6504 EXPECT_THAT(lhs, UnorderedPointwise(Lt(), rhs));
6505 EXPECT_THAT(lhs, Not(UnorderedPointwise(Gt(), rhs)));
6506}
Here is the call graph for this function:

◆ TEST() [329/350]

testing::gmock_matchers_test::TEST ( UnorderedPointwiseTest ,
WorksForRhsNativeArray  )

Definition at line 6508 of file gmock-matchers_test.cc.

6508 {
6509 const int rhs[] = {1, 2, 3};
6510 vector<int> lhs;
6511 lhs.push_back(4);
6512 lhs.push_back(2);
6513 lhs.push_back(6);
6514 EXPECT_THAT(lhs, UnorderedPointwise(Gt(), rhs));
6515 EXPECT_THAT(lhs, Not(UnorderedPointwise(Lt(), rhs)));
6516}
Here is the call graph for this function:

◆ TEST() [330/350]

testing::gmock_matchers_test::TEST ( ValueTest ,
WorksWithMonomorphicMatcher  )

Definition at line 3011 of file gmock-matchers_test.cc.

3011 {
3012 const Matcher<int> is_zero = Eq(0);
3013 EXPECT_TRUE(Value(0, is_zero));
3014 EXPECT_FALSE(Value('a', is_zero));
3015
3016 int n = 0;
3017 const Matcher<const int&> ref_n = Ref(n);
3018 EXPECT_TRUE(Value(n, ref_n));
3019 EXPECT_FALSE(Value(1, ref_n));
3020}
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition document.h:2110
Here is the call graph for this function:

◆ TEST() [331/350]

testing::gmock_matchers_test::TEST ( ValueTest ,
WorksWithPolymorphicMatcher  )

Definition at line 3006 of file gmock-matchers_test.cc.

3006 {
3007 EXPECT_TRUE(Value("hi", StartsWith("h")));
3008 EXPECT_FALSE(Value(5, Gt(10)));
3009}
Here is the call graph for this function:

◆ TEST() [332/350]

testing::gmock_matchers_test::TEST ( VariantTest ,
DescribesSelf  )

Definition at line 6641 of file gmock-matchers_test.cc.

6641 {
6642 const Matcher<SampleVariantIntString> m = VariantWith<int>(Eq(1));
6643 EXPECT_THAT(Describe(m), ContainsRegex("is a variant<> with value of type "
6644 "'.*' and the value is equal to 1"));
6645}
Here is the call graph for this function:

◆ TEST() [333/350]

testing::gmock_matchers_test::TEST ( VariantTest ,
ExplainsSelf  )

Definition at line 6647 of file gmock-matchers_test.cc.

6647 {
6648 const Matcher<SampleVariantIntString> m = VariantWith<int>(Eq(1));
6650 ContainsRegex("whose value 1"));
6652 HasSubstr("whose value is not of type '"));
6654 "whose value 2 doesn't match");
6655}
Here is the call graph for this function:

◆ TEST() [334/350]

testing::gmock_matchers_test::TEST ( VariantTest ,
FullMatch  )

Definition at line 6657 of file gmock-matchers_test.cc.

6657 {
6658 Matcher<SampleVariantIntString> m = VariantWith<int>(Eq(1));
6660
6661 m = VariantWith<std::string>(Eq("1"));
6663}
Here is the call graph for this function:

◆ TEST() [335/350]

testing::gmock_matchers_test::TEST ( VariantTest ,
InnerDoesNotMatch  )

Definition at line 6673 of file gmock-matchers_test.cc.

6673 {
6674 Matcher<SampleVariantIntString> m = VariantWith<int>(Eq(1));
6676
6677 m = VariantWith<std::string>(Eq("1"));
6679}
Here is the call graph for this function:

◆ TEST() [336/350]

testing::gmock_matchers_test::TEST ( VariantTest ,
TypeDoesNotMatch  )

Definition at line 6665 of file gmock-matchers_test.cc.

6665 {
6666 Matcher<SampleVariantIntString> m = VariantWith<int>(Eq(1));
6668
6669 m = VariantWith<std::string>(Eq("1"));
6671}
Here is the call graph for this function:

◆ TEST() [337/350]

testing::gmock_matchers_test::TEST ( WhenSortedByTest ,
CanDescribeSelf  )

Definition at line 5089 of file gmock-matchers_test.cc.

5089 {
5090 const Matcher<vector<int> > m = WhenSortedBy(less<int>(), ElementsAre(1, 2));
5091 EXPECT_EQ("(when sorted) has 2 elements where\n"
5092 "element #0 is equal to 1,\n"
5093 "element #1 is equal to 2",
5094 Describe(m));
5095 EXPECT_EQ("(when sorted) doesn't have 2 elements, or\n"
5096 "element #0 isn't equal to 1, or\n"
5097 "element #1 isn't equal to 2",
5098 DescribeNegation(m));
5099}
Here is the call graph for this function:

◆ TEST() [338/350]

testing::gmock_matchers_test::TEST ( WhenSortedByTest ,
ExplainsMatchResult  )

Definition at line 5101 of file gmock-matchers_test.cc.

5101 {
5102 const int a[] = {2, 1};
5103 EXPECT_EQ("which is { 1, 2 } when sorted, whose element #0 doesn't match",
5104 Explain(WhenSortedBy(less<int>(), ElementsAre(2, 3)), a));
5105 EXPECT_EQ("which is { 1, 2 } when sorted",
5106 Explain(WhenSortedBy(less<int>(), ElementsAre(1, 2)), a));
5107}
Here is the call graph for this function:

◆ TEST() [339/350]

testing::gmock_matchers_test::TEST ( WhenSortedByTest ,
WorksForEmptyContainer  )

Definition at line 5051 of file gmock-matchers_test.cc.

5051 {
5052 const vector<int> numbers;
5053 EXPECT_THAT(numbers, WhenSortedBy(less<int>(), ElementsAre()));
5054 EXPECT_THAT(numbers, Not(WhenSortedBy(less<int>(), ElementsAre(1))));
5055}
Here is the call graph for this function:

◆ TEST() [340/350]

testing::gmock_matchers_test::TEST ( WhenSortedByTest ,
WorksForNativeArray  )

Definition at line 5080 of file gmock-matchers_test.cc.

5080 {
5081 const int numbers[] = {1, 3, 2, 4};
5082 const int sorted_numbers[] = {1, 2, 3, 4};
5083 EXPECT_THAT(numbers, WhenSortedBy(less<int>(), ElementsAre(1, 2, 3, 4)));
5084 EXPECT_THAT(numbers, WhenSortedBy(less<int>(),
5085 ElementsAreArray(sorted_numbers)));
5086 EXPECT_THAT(numbers, Not(WhenSortedBy(less<int>(), ElementsAre(1, 3, 2, 4))));
5087}
Here is the call graph for this function:

◆ TEST() [341/350]

testing::gmock_matchers_test::TEST ( WhenSortedByTest ,
WorksForNonEmptyContainer  )

Definition at line 5057 of file gmock-matchers_test.cc.

5057 {
5058 vector<unsigned> numbers;
5059 numbers.push_back(3);
5060 numbers.push_back(1);
5061 numbers.push_back(2);
5062 numbers.push_back(2);
5063 EXPECT_THAT(numbers, WhenSortedBy(greater<unsigned>(),
5064 ElementsAre(3, 2, 2, 1)));
5065 EXPECT_THAT(numbers, Not(WhenSortedBy(greater<unsigned>(),
5066 ElementsAre(1, 2, 2, 3))));
5067}
Here is the call graph for this function:

◆ TEST() [342/350]

testing::gmock_matchers_test::TEST ( WhenSortedByTest ,
WorksForNonVectorContainer  )

Definition at line 5069 of file gmock-matchers_test.cc.

5069 {
5070 list<std::string> words;
5071 words.push_back("say");
5072 words.push_back("hello");
5073 words.push_back("world");
5074 EXPECT_THAT(words, WhenSortedBy(less<std::string>(),
5075 ElementsAre("hello", "say", "world")));
5076 EXPECT_THAT(words, Not(WhenSortedBy(less<std::string>(),
5077 ElementsAre("say", "hello", "world"))));
5078}
Here is the call graph for this function:

◆ TEST() [343/350]

testing::gmock_matchers_test::TEST ( WhenSortedTest ,
WorksForEmptyContainer  )

Definition at line 5112 of file gmock-matchers_test.cc.

5112 {
5113 const vector<int> numbers;
5114 EXPECT_THAT(numbers, WhenSorted(ElementsAre()));
5115 EXPECT_THAT(numbers, Not(WhenSorted(ElementsAre(1))));
5116}
Here is the call graph for this function:

◆ TEST() [344/350]

testing::gmock_matchers_test::TEST ( WhenSortedTest ,
WorksForMapTypes  )

Definition at line 5128 of file gmock-matchers_test.cc.

5128 {
5129 map<std::string, int> word_counts;
5130 word_counts["and"] = 1;
5131 word_counts["the"] = 1;
5132 word_counts["buffalo"] = 2;
5133 EXPECT_THAT(word_counts,
5134 WhenSorted(ElementsAre(Pair("and", 1), Pair("buffalo", 2),
5135 Pair("the", 1))));
5136 EXPECT_THAT(word_counts,
5137 Not(WhenSorted(ElementsAre(Pair("and", 1), Pair("the", 1),
5138 Pair("buffalo", 2)))));
5139}
Here is the call graph for this function:

◆ TEST() [345/350]

testing::gmock_matchers_test::TEST ( WhenSortedTest ,
WorksForMultiMapTypes  )

Definition at line 5141 of file gmock-matchers_test.cc.

5141 {
5142 multimap<int, int> ifib;
5143 ifib.insert(make_pair(8, 6));
5144 ifib.insert(make_pair(2, 3));
5145 ifib.insert(make_pair(1, 1));
5146 ifib.insert(make_pair(3, 4));
5147 ifib.insert(make_pair(1, 2));
5148 ifib.insert(make_pair(5, 5));
5149 EXPECT_THAT(ifib, WhenSorted(ElementsAre(Pair(1, 1),
5150 Pair(1, 2),
5151 Pair(2, 3),
5152 Pair(3, 4),
5153 Pair(5, 5),
5154 Pair(8, 6))));
5155 EXPECT_THAT(ifib, Not(WhenSorted(ElementsAre(Pair(8, 6),
5156 Pair(2, 3),
5157 Pair(1, 1),
5158 Pair(3, 4),
5159 Pair(1, 2),
5160 Pair(5, 5)))));
5161}
Here is the call graph for this function:

◆ TEST() [346/350]

testing::gmock_matchers_test::TEST ( WhenSortedTest ,
WorksForNonEmptyContainer  )

Definition at line 5118 of file gmock-matchers_test.cc.

5118 {
5119 list<std::string> words;
5120 words.push_back("3");
5121 words.push_back("1");
5122 words.push_back("2");
5123 words.push_back("2");
5124 EXPECT_THAT(words, WhenSorted(ElementsAre("1", "2", "2", "3")));
5125 EXPECT_THAT(words, Not(WhenSorted(ElementsAre("3", "1", "2", "2"))));
5126}
Here is the call graph for this function:

◆ TEST() [347/350]

testing::gmock_matchers_test::TEST ( WhenSortedTest ,
WorksForPolymorphicMatcher  )

Definition at line 5163 of file gmock-matchers_test.cc.

5163 {
5164 std::deque<int> d;
5165 d.push_back(2);
5166 d.push_back(1);
5167 EXPECT_THAT(d, WhenSorted(ElementsAre(1, 2)));
5168 EXPECT_THAT(d, Not(WhenSorted(ElementsAre(2, 1))));
5169}
Here is the call graph for this function:

◆ TEST() [348/350]

testing::gmock_matchers_test::TEST ( WhenSortedTest ,
WorksForStreamlike  )

Definition at line 5329 of file gmock-matchers_test.cc.

5329 {
5330 // Streamlike 'container' provides only minimal iterator support.
5331 // Its iterators are tagged with input_iterator_tag.
5332 const int a[5] = {2, 1, 4, 5, 3};
5333 Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a));
5334 EXPECT_THAT(s, WhenSorted(ElementsAre(1, 2, 3, 4, 5)));
5335 EXPECT_THAT(s, Not(WhenSorted(ElementsAre(2, 1, 4, 5, 3))));
5336}
Here is the call graph for this function:

◆ TEST() [349/350]

testing::gmock_matchers_test::TEST ( WhenSortedTest ,
WorksForVectorConstRefMatcher  )

Definition at line 5171 of file gmock-matchers_test.cc.

5171 {
5172 std::deque<int> d;
5173 d.push_back(2);
5174 d.push_back(1);
5175 Matcher<const std::vector<int>&> vector_match = ElementsAre(1, 2);
5176 EXPECT_THAT(d, WhenSorted(vector_match));
5177 Matcher<const std::vector<int>&> not_vector_match = ElementsAre(2, 1);
5178 EXPECT_THAT(d, Not(WhenSorted(not_vector_match)));
5179}
Here is the call graph for this function:

◆ TEST() [350/350]

testing::gmock_matchers_test::TEST ( WhenSortedTest ,
WorksForVectorConstRefMatcherOnStreamlike  )

Definition at line 5338 of file gmock-matchers_test.cc.

5338 {
5339 const int a[] = {2, 1, 4, 5, 3};
5340 Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a));
5341 Matcher<const std::vector<int>&> vector_match = ElementsAre(1, 2, 3, 4, 5);
5342 EXPECT_THAT(s, WhenSorted(vector_match));
5343 EXPECT_THAT(s, Not(WhenSorted(ElementsAre(2, 1, 4, 5, 3))));
5344}
Here is the call graph for this function:

◆ TEST_F() [1/40]

testing::gmock_matchers_test::TEST_F ( BipartiteNonSquareTest ,
SimpleBacktracking  )

Definition at line 6068 of file gmock-matchers_test.cc.

6068 {
6069 // .......
6070 // 0:-----\ :
6071 // 1:---\ | :
6072 // 2:---\ | :
6073 // 3:-\ | | :
6074 // :.......:
6075 // 0 1 2
6076 MatchMatrix g(4, 3);
6077 static const int kEdges[][2] = {{0, 2}, {1, 1}, {2, 1}, {3, 0}};
6078 for (size_t i = 0; i < GTEST_ARRAY_SIZE_(kEdges); ++i) {
6079 g.SetEdge(kEdges[i][0], kEdges[i][1], true);
6080 }
6082 ElementsAre(Pair(3, 0),
6083 Pair(AnyOf(1, 2), 1),
6084 Pair(0, 2))) << g.DebugString();
6085}
ElementMatcherPairs FindBacktrackingMaxBPM(const Graph &g)
Here is the call graph for this function:

◆ TEST_F() [2/40]

testing::gmock_matchers_test::TEST_F ( DoubleNearTest ,
DoubleNearCanDescribeSelf  )

Definition at line 3599 of file gmock-matchers_test.cc.

3599 {
3600 Matcher<double> m1 = DoubleNear(2.0, 0.5);
3601 EXPECT_EQ("is approximately 2 (absolute error <= 0.5)", Describe(m1));
3602 EXPECT_EQ(
3603 "isn't approximately 2 (absolute error > 0.5)", DescribeNegation(m1));
3604
3605 Matcher<double> m2 = DoubleNear(0.5, 0.5);
3606 EXPECT_EQ("is approximately 0.5 (absolute error <= 0.5)", Describe(m2));
3607 EXPECT_EQ(
3608 "isn't approximately 0.5 (absolute error > 0.5)", DescribeNegation(m2));
3609
3610 Matcher<double> m3 = DoubleNear(nan1_, 0.0);
3611 EXPECT_EQ("never matches", Describe(m3));
3612 EXPECT_EQ("is anything", DescribeNegation(m3));
3613}
Here is the call graph for this function:

◆ TEST_F() [3/40]

testing::gmock_matchers_test::TEST_F ( DoubleNearTest ,
DoubleNearCannotMatchNaN  )

Definition at line 3645 of file gmock-matchers_test.cc.

3645 {
3646 // DoubleNear never matches NaN.
3647 Matcher<double> m = DoubleNear(ParentType::nan1_, 0.1);
3648 EXPECT_FALSE(m.Matches(nan1_));
3649 EXPECT_FALSE(m.Matches(nan2_));
3650 EXPECT_FALSE(m.Matches(1.0));
3651}
Here is the call graph for this function:

◆ TEST_F() [4/40]

testing::gmock_matchers_test::TEST_F ( DoubleNearTest ,
DoubleNearMatches  )

Definition at line 3591 of file gmock-matchers_test.cc.

3591 {
3592 TestNearMatches(&DoubleNear);
3593}

◆ TEST_F() [5/40]

testing::gmock_matchers_test::TEST_F ( DoubleNearTest ,
ExplainsResultWhenMatchFails  )

Definition at line 3615 of file gmock-matchers_test.cc.

3615 {
3616 EXPECT_EQ("", Explain(DoubleNear(2.0, 0.1), 2.05));
3617 EXPECT_EQ("which is 0.2 from 2", Explain(DoubleNear(2.0, 0.1), 2.2));
3618 EXPECT_EQ("which is -0.3 from 2", Explain(DoubleNear(2.0, 0.1), 1.7));
3619
3620 const std::string explanation =
3621 Explain(DoubleNear(2.1, 1e-10), 2.1 + 1.2e-10);
3622 // Different C++ implementations may print floating-point numbers
3623 // slightly differently.
3624 EXPECT_TRUE(explanation == "which is 1.2e-10 from 2.1" || // GCC
3625 explanation == "which is 1.2e-010 from 2.1") // MSVC
3626 << " where explanation is \"" << explanation << "\".";
3627}
Here is the call graph for this function:

◆ TEST_F() [6/40]

testing::gmock_matchers_test::TEST_F ( DoubleNearTest ,
NanSensitiveDoubleNearApproximatelyMatchesDoubles  )

Definition at line 3595 of file gmock-matchers_test.cc.

3595 {
3596 TestNearMatches(&NanSensitiveDoubleNear);
3597}

◆ TEST_F() [7/40]

testing::gmock_matchers_test::TEST_F ( DoubleNearTest ,
NanSensitiveDoubleNearCanDescribeSelf  )

Definition at line 3629 of file gmock-matchers_test.cc.

3629 {
3630 Matcher<double> m1 = NanSensitiveDoubleNear(2.0, 0.5);
3631 EXPECT_EQ("is approximately 2 (absolute error <= 0.5)", Describe(m1));
3632 EXPECT_EQ(
3633 "isn't approximately 2 (absolute error > 0.5)", DescribeNegation(m1));
3634
3635 Matcher<double> m2 = NanSensitiveDoubleNear(0.5, 0.5);
3636 EXPECT_EQ("is approximately 0.5 (absolute error <= 0.5)", Describe(m2));
3637 EXPECT_EQ(
3638 "isn't approximately 0.5 (absolute error > 0.5)", DescribeNegation(m2));
3639
3640 Matcher<double> m3 = NanSensitiveDoubleNear(nan1_, 0.1);
3641 EXPECT_EQ("is NaN", Describe(m3));
3642 EXPECT_EQ("isn't NaN", DescribeNegation(m3));
3643}
Here is the call graph for this function:

◆ TEST_F() [8/40]

testing::gmock_matchers_test::TEST_F ( DoubleNearTest ,
NanSensitiveDoubleNearCanMatchNaN  )

Definition at line 3653 of file gmock-matchers_test.cc.

3653 {
3654 // NanSensitiveDoubleNear will match NaN.
3655 Matcher<double> m = NanSensitiveDoubleNear(nan1_, 0.1);
3656 EXPECT_TRUE(m.Matches(nan1_));
3657 EXPECT_TRUE(m.Matches(nan2_));
3658 EXPECT_FALSE(m.Matches(1.0));
3659}
Here is the call graph for this function:

◆ TEST_F() [9/40]

testing::gmock_matchers_test::TEST_F ( DoubleTest ,
DoubleEqApproximatelyMatchesDoubles  )

Definition at line 3535 of file gmock-matchers_test.cc.

3535 {
3536 TestMatches(&DoubleEq);
3537}

◆ TEST_F() [10/40]

testing::gmock_matchers_test::TEST_F ( DoubleTest ,
DoubleEqCanDescribeSelf  )

Definition at line 3559 of file gmock-matchers_test.cc.

3559 {
3560 Matcher<double> m1 = DoubleEq(2.0);
3561 EXPECT_EQ("is approximately 2", Describe(m1));
3562 EXPECT_EQ("isn't approximately 2", DescribeNegation(m1));
3563
3564 Matcher<double> m2 = DoubleEq(0.5);
3565 EXPECT_EQ("is approximately 0.5", Describe(m2));
3566 EXPECT_EQ("isn't approximately 0.5", DescribeNegation(m2));
3567
3568 Matcher<double> m3 = DoubleEq(nan1_);
3569 EXPECT_EQ("never matches", Describe(m3));
3570 EXPECT_EQ("is anything", DescribeNegation(m3));
3571}
Here is the call graph for this function:

◆ TEST_F() [11/40]

testing::gmock_matchers_test::TEST_F ( DoubleTest ,
DoubleEqCannotMatchNaN  )

Definition at line 3543 of file gmock-matchers_test.cc.

3543 {
3544 // DoubleEq never matches NaN.
3545 Matcher<double> m = DoubleEq(nan1_);
3546 EXPECT_FALSE(m.Matches(nan1_));
3547 EXPECT_FALSE(m.Matches(nan2_));
3548 EXPECT_FALSE(m.Matches(1.0));
3549}
Here is the call graph for this function:

◆ TEST_F() [12/40]

testing::gmock_matchers_test::TEST_F ( DoubleTest ,
NanSensitiveDoubleEqApproximatelyMatchesDoubles  )

Definition at line 3539 of file gmock-matchers_test.cc.

3539 {
3540 TestMatches(&NanSensitiveDoubleEq);
3541}

◆ TEST_F() [13/40]

testing::gmock_matchers_test::TEST_F ( DoubleTest ,
NanSensitiveDoubleEqCanDescribeSelf  )

Definition at line 3573 of file gmock-matchers_test.cc.

3573 {
3574 Matcher<double> m1 = NanSensitiveDoubleEq(2.0);
3575 EXPECT_EQ("is approximately 2", Describe(m1));
3576 EXPECT_EQ("isn't approximately 2", DescribeNegation(m1));
3577
3578 Matcher<double> m2 = NanSensitiveDoubleEq(0.5);
3579 EXPECT_EQ("is approximately 0.5", Describe(m2));
3580 EXPECT_EQ("isn't approximately 0.5", DescribeNegation(m2));
3581
3582 Matcher<double> m3 = NanSensitiveDoubleEq(nan1_);
3583 EXPECT_EQ("is NaN", Describe(m3));
3584 EXPECT_EQ("isn't NaN", DescribeNegation(m3));
3585}
Here is the call graph for this function:

◆ TEST_F() [14/40]

testing::gmock_matchers_test::TEST_F ( DoubleTest ,
NanSensitiveDoubleEqCanMatchNaN  )

Definition at line 3551 of file gmock-matchers_test.cc.

3551 {
3552 // NanSensitiveDoubleEq will match NaN.
3553 Matcher<double> m = NanSensitiveDoubleEq(nan1_);
3554 EXPECT_TRUE(m.Matches(nan1_));
3555 EXPECT_TRUE(m.Matches(nan2_));
3556 EXPECT_FALSE(m.Matches(1.0));
3557}
Here is the call graph for this function:

◆ TEST_F() [15/40]

testing::gmock_matchers_test::TEST_F ( FloatNearTest ,
FloatNearCanDescribeSelf  )

Definition at line 3484 of file gmock-matchers_test.cc.

3484 {
3485 Matcher<float> m1 = FloatNear(2.0f, 0.5f);
3486 EXPECT_EQ("is approximately 2 (absolute error <= 0.5)", Describe(m1));
3487 EXPECT_EQ(
3488 "isn't approximately 2 (absolute error > 0.5)", DescribeNegation(m1));
3489
3490 Matcher<float> m2 = FloatNear(0.5f, 0.5f);
3491 EXPECT_EQ("is approximately 0.5 (absolute error <= 0.5)", Describe(m2));
3492 EXPECT_EQ(
3493 "isn't approximately 0.5 (absolute error > 0.5)", DescribeNegation(m2));
3494
3495 Matcher<float> m3 = FloatNear(nan1_, 0.0);
3496 EXPECT_EQ("never matches", Describe(m3));
3497 EXPECT_EQ("is anything", DescribeNegation(m3));
3498}
Here is the call graph for this function:

◆ TEST_F() [16/40]

testing::gmock_matchers_test::TEST_F ( FloatNearTest ,
FloatNearCannotMatchNaN  )

Definition at line 3516 of file gmock-matchers_test.cc.

3516 {
3517 // FloatNear never matches NaN.
3518 Matcher<float> m = FloatNear(ParentType::nan1_, 0.1f);
3519 EXPECT_FALSE(m.Matches(nan1_));
3520 EXPECT_FALSE(m.Matches(nan2_));
3521 EXPECT_FALSE(m.Matches(1.0));
3522}
Here is the call graph for this function:

◆ TEST_F() [17/40]

testing::gmock_matchers_test::TEST_F ( FloatNearTest ,
FloatNearMatches  )

Definition at line 3476 of file gmock-matchers_test.cc.

3476 {
3477 TestNearMatches(&FloatNear);
3478}

◆ TEST_F() [18/40]

testing::gmock_matchers_test::TEST_F ( FloatNearTest ,
NanSensitiveFloatNearApproximatelyMatchesFloats  )

Definition at line 3480 of file gmock-matchers_test.cc.

3480 {
3481 TestNearMatches(&NanSensitiveFloatNear);
3482}

◆ TEST_F() [19/40]

testing::gmock_matchers_test::TEST_F ( FloatNearTest ,
NanSensitiveFloatNearCanDescribeSelf  )

Definition at line 3500 of file gmock-matchers_test.cc.

3500 {
3501 Matcher<float> m1 = NanSensitiveFloatNear(2.0f, 0.5f);
3502 EXPECT_EQ("is approximately 2 (absolute error <= 0.5)", Describe(m1));
3503 EXPECT_EQ(
3504 "isn't approximately 2 (absolute error > 0.5)", DescribeNegation(m1));
3505
3506 Matcher<float> m2 = NanSensitiveFloatNear(0.5f, 0.5f);
3507 EXPECT_EQ("is approximately 0.5 (absolute error <= 0.5)", Describe(m2));
3508 EXPECT_EQ(
3509 "isn't approximately 0.5 (absolute error > 0.5)", DescribeNegation(m2));
3510
3511 Matcher<float> m3 = NanSensitiveFloatNear(nan1_, 0.1f);
3512 EXPECT_EQ("is NaN", Describe(m3));
3513 EXPECT_EQ("isn't NaN", DescribeNegation(m3));
3514}
Here is the call graph for this function:

◆ TEST_F() [20/40]

testing::gmock_matchers_test::TEST_F ( FloatNearTest ,
NanSensitiveFloatNearCanMatchNaN  )

Definition at line 3524 of file gmock-matchers_test.cc.

3524 {
3525 // NanSensitiveFloatNear will match NaN.
3526 Matcher<float> m = NanSensitiveFloatNear(nan1_, 0.1f);
3527 EXPECT_TRUE(m.Matches(nan1_));
3528 EXPECT_TRUE(m.Matches(nan2_));
3529 EXPECT_FALSE(m.Matches(1.0));
3530}
Here is the call graph for this function:

◆ TEST_F() [21/40]

testing::gmock_matchers_test::TEST_F ( FloatTest ,
FloatEqApproximatelyMatchesFloats  )

Definition at line 3420 of file gmock-matchers_test.cc.

3420 {
3421 TestMatches(&FloatEq);
3422}

◆ TEST_F() [22/40]

testing::gmock_matchers_test::TEST_F ( FloatTest ,
FloatEqCanDescribeSelf  )

Definition at line 3444 of file gmock-matchers_test.cc.

3444 {
3445 Matcher<float> m1 = FloatEq(2.0f);
3446 EXPECT_EQ("is approximately 2", Describe(m1));
3447 EXPECT_EQ("isn't approximately 2", DescribeNegation(m1));
3448
3449 Matcher<float> m2 = FloatEq(0.5f);
3450 EXPECT_EQ("is approximately 0.5", Describe(m2));
3451 EXPECT_EQ("isn't approximately 0.5", DescribeNegation(m2));
3452
3453 Matcher<float> m3 = FloatEq(nan1_);
3454 EXPECT_EQ("never matches", Describe(m3));
3455 EXPECT_EQ("is anything", DescribeNegation(m3));
3456}
Here is the call graph for this function:

◆ TEST_F() [23/40]

testing::gmock_matchers_test::TEST_F ( FloatTest ,
FloatEqCannotMatchNaN  )

Definition at line 3428 of file gmock-matchers_test.cc.

3428 {
3429 // FloatEq never matches NaN.
3430 Matcher<float> m = FloatEq(nan1_);
3431 EXPECT_FALSE(m.Matches(nan1_));
3432 EXPECT_FALSE(m.Matches(nan2_));
3433 EXPECT_FALSE(m.Matches(1.0));
3434}
Here is the call graph for this function:

◆ TEST_F() [24/40]

testing::gmock_matchers_test::TEST_F ( FloatTest ,
NanSensitiveFloatEqApproximatelyMatchesFloats  )

Definition at line 3424 of file gmock-matchers_test.cc.

3424 {
3425 TestMatches(&NanSensitiveFloatEq);
3426}

◆ TEST_F() [25/40]

testing::gmock_matchers_test::TEST_F ( FloatTest ,
NanSensitiveFloatEqCanDescribeSelf  )

Definition at line 3458 of file gmock-matchers_test.cc.

3458 {
3459 Matcher<float> m1 = NanSensitiveFloatEq(2.0f);
3460 EXPECT_EQ("is approximately 2", Describe(m1));
3461 EXPECT_EQ("isn't approximately 2", DescribeNegation(m1));
3462
3463 Matcher<float> m2 = NanSensitiveFloatEq(0.5f);
3464 EXPECT_EQ("is approximately 0.5", Describe(m2));
3465 EXPECT_EQ("isn't approximately 0.5", DescribeNegation(m2));
3466
3467 Matcher<float> m3 = NanSensitiveFloatEq(nan1_);
3468 EXPECT_EQ("is NaN", Describe(m3));
3469 EXPECT_EQ("isn't NaN", DescribeNegation(m3));
3470}
Here is the call graph for this function:

◆ TEST_F() [26/40]

testing::gmock_matchers_test::TEST_F ( FloatTest ,
NanSensitiveFloatEqCanMatchNaN  )

Definition at line 3436 of file gmock-matchers_test.cc.

3436 {
3437 // NanSensitiveFloatEq will match NaN.
3438 Matcher<float> m = NanSensitiveFloatEq(nan1_);
3439 EXPECT_TRUE(m.Matches(nan1_));
3440 EXPECT_TRUE(m.Matches(nan2_));
3441 EXPECT_FALSE(m.Matches(1.0));
3442}
Here is the call graph for this function:

◆ TEST_F() [27/40]

testing::gmock_matchers_test::TEST_F ( UnorderedElementsAreTest ,
Describe  )

Definition at line 5909 of file gmock-matchers_test.cc.

5909 {
5910 EXPECT_THAT(Describe<IntVec>(UnorderedElementsAre()),
5911 Eq("is empty"));
5913 Describe<IntVec>(UnorderedElementsAre(345)),
5914 Eq("has 1 element and that element is equal to 345"));
5916 Describe<IntVec>(UnorderedElementsAre(111, 222, 333)),
5917 Eq("has 3 elements and there exists some permutation "
5918 "of elements such that:\n"
5919 " - element #0 is equal to 111, and\n"
5920 " - element #1 is equal to 222, and\n"
5921 " - element #2 is equal to 333"));
5922}
internal::UnorderedElementsAreMatcher< ::testing::tuple<> > UnorderedElementsAre()
Here is the call graph for this function:

◆ TEST_F() [28/40]

testing::gmock_matchers_test::TEST_F ( UnorderedElementsAreTest ,
DescribeNegation  )

Definition at line 5924 of file gmock-matchers_test.cc.

5924 {
5925 EXPECT_THAT(DescribeNegation<IntVec>(UnorderedElementsAre()),
5926 Eq("isn't empty"));
5928 DescribeNegation<IntVec>(UnorderedElementsAre(345)),
5929 Eq("doesn't have 1 element, or has 1 element that isn't equal to 345"));
5931 DescribeNegation<IntVec>(UnorderedElementsAre(123, 234, 345)),
5932 Eq("doesn't have 3 elements, or there exists no permutation "
5933 "of elements such that:\n"
5934 " - element #0 is equal to 123, and\n"
5935 " - element #1 is equal to 234, and\n"
5936 " - element #2 is equal to 345"));
5937}
Here is the call graph for this function:

◆ TEST_F() [29/40]

testing::gmock_matchers_test::TEST_F ( UnorderedElementsAreTest ,
FailMessageCountWrong  )

Definition at line 5811 of file gmock-matchers_test.cc.

5811 {
5812 std::vector<int> v;
5813 v.push_back(4);
5815 EXPECT_FALSE(ExplainMatchResult(UnorderedElementsAre(1, 2, 3),
5816 v, &listener)) << listener.str();
5817 EXPECT_THAT(listener.str(), Eq("which has 1 element"));
5818}
Here is the call graph for this function:

◆ TEST_F() [30/40]

testing::gmock_matchers_test::TEST_F ( UnorderedElementsAreTest ,
FailMessageCountWrongZero  )

Definition at line 5820 of file gmock-matchers_test.cc.

5820 {
5821 std::vector<int> v;
5823 EXPECT_FALSE(ExplainMatchResult(UnorderedElementsAre(1, 2, 3),
5824 v, &listener)) << listener.str();
5825 EXPECT_THAT(listener.str(), Eq(""));
5826}
Here is the call graph for this function:

◆ TEST_F() [31/40]

testing::gmock_matchers_test::TEST_F ( UnorderedElementsAreTest ,
FailMessageImperfectMatchOnly  )

Definition at line 5879 of file gmock-matchers_test.cc.

5879 {
5880 // A situation where all elements and matchers have a match
5881 // associated with them, but the max matching is not perfect.
5882 std::vector<std::string> v;
5883 v.push_back("a");
5884 v.push_back("b");
5885 v.push_back("c");
5887 EXPECT_FALSE(ExplainMatchResult(
5888 UnorderedElementsAre("a", "a", AnyOf("b", "c")), v, &listener))
5889 << listener.str();
5890
5891 std::string prefix =
5892 "where no permutation of the elements can satisfy all matchers, "
5893 "and the closest match is 2 of 3 matchers with the "
5894 "pairings:\n";
5895
5896 // We have to be a bit loose here, because there are 4 valid max matches.
5898 listener.str(),
5899 AnyOf(prefix + "{\n " + EMString(0, 0) +
5900 ",\n " + EMString(1, 2) + "\n}",
5901 prefix + "{\n " + EMString(0, 1) +
5902 ",\n " + EMString(1, 2) + "\n}",
5903 prefix + "{\n " + EMString(0, 0) +
5904 ",\n " + EMString(2, 2) + "\n}",
5905 prefix + "{\n " + EMString(0, 1) +
5906 ",\n " + EMString(2, 2) + "\n}"));
5907}
Here is the call graph for this function:

◆ TEST_F() [32/40]

testing::gmock_matchers_test::TEST_F ( UnorderedElementsAreTest ,
FailMessageUnmatchedElements  )

Definition at line 5841 of file gmock-matchers_test.cc.

5841 {
5842 std::vector<int> v;
5843 v.push_back(1);
5844 v.push_back(2);
5846 EXPECT_FALSE(ExplainMatchResult(UnorderedElementsAre(1, 1),
5847 v, &listener)) << listener.str();
5849 listener.str(),
5850 Eq("where the following elements don't match any matchers:\n"
5851 "element #1: 2"));
5852}
Here is the call graph for this function:

◆ TEST_F() [33/40]

testing::gmock_matchers_test::TEST_F ( UnorderedElementsAreTest ,
FailMessageUnmatchedMatcherAndElement  )

Definition at line 5854 of file gmock-matchers_test.cc.

5854 {
5855 std::vector<int> v;
5856 v.push_back(2);
5857 v.push_back(3);
5859 EXPECT_FALSE(ExplainMatchResult(UnorderedElementsAre(1, 2),
5860 v, &listener)) << listener.str();
5862 listener.str(),
5863 Eq("where"
5864 " the following matchers don't match any elements:\n"
5865 "matcher #0: is equal to 1\n"
5866 "and"
5867 " where"
5868 " the following elements don't match any matchers:\n"
5869 "element #1: 3"));
5870}
Here is the call graph for this function:

◆ TEST_F() [34/40]

testing::gmock_matchers_test::TEST_F ( UnorderedElementsAreTest ,
FailMessageUnmatchedMatchers  )

Definition at line 5828 of file gmock-matchers_test.cc.

5828 {
5829 std::vector<int> v;
5830 v.push_back(1);
5831 v.push_back(1);
5833 EXPECT_FALSE(ExplainMatchResult(UnorderedElementsAre(1, 2),
5834 v, &listener)) << listener.str();
5836 listener.str(),
5837 Eq("where the following matchers don't match any elements:\n"
5838 "matcher #1: is equal to 2"));
5839}
Here is the call graph for this function:

◆ TEST_F() [35/40]

testing::gmock_matchers_test::TEST_F ( UnorderedElementsAreTest ,
FailsWhenAnElementMatchesNoMatcher  )

Definition at line 5749 of file gmock-matchers_test.cc.

5749 {
5750 const int a[] = {1, 2, 3};
5751 std::vector<int> s(a, a + GTEST_ARRAY_SIZE_(a));
5752 std::vector<Matcher<int> > mv;
5753 mv.push_back(1);
5754 mv.push_back(2);
5755 mv.push_back(2);
5756 // The element with value '3' matches nothing: fail fast.
5758 EXPECT_FALSE(ExplainMatchResult(UnorderedElementsAreArray(mv),
5759 s, &listener)) << listener.str();
5760}
Here is the call graph for this function:

◆ TEST_F() [36/40]

testing::gmock_matchers_test::TEST_F ( UnorderedElementsAreTest ,
Performance  )

Definition at line 5779 of file gmock-matchers_test.cc.

5779 {
5780 std::vector<int> s;
5781 std::vector<Matcher<int> > mv;
5782 for (int i = 0; i < 100; ++i) {
5783 s.push_back(i);
5784 mv.push_back(_);
5785 }
5786 mv[50] = Eq(0);
5788 EXPECT_TRUE(ExplainMatchResult(UnorderedElementsAreArray(mv),
5789 s, &listener)) << listener.str();
5790}
Here is the call graph for this function:

◆ TEST_F() [37/40]

testing::gmock_matchers_test::TEST_F ( UnorderedElementsAreTest ,
PerformanceHalfStrict  )

Definition at line 5795 of file gmock-matchers_test.cc.

5795 {
5796 std::vector<int> s;
5797 std::vector<Matcher<int> > mv;
5798 for (int i = 0; i < 100; ++i) {
5799 s.push_back(i);
5800 if (i & 1) {
5801 mv.push_back(_);
5802 } else {
5803 mv.push_back(i);
5804 }
5805 }
5806 StringMatchResultListener listener;
5807 EXPECT_TRUE(ExplainMatchResult(UnorderedElementsAreArray(mv),
5808 s, &listener)) << listener.str();
5809}
Here is the call graph for this function:

◆ TEST_F() [38/40]

testing::gmock_matchers_test::TEST_F ( UnorderedElementsAreTest ,
SucceedsWhenExpected  )

Definition at line 5739 of file gmock-matchers_test.cc.

5739 {
5740 const int a[] = {1, 2, 3};
5741 std::vector<int> s(a, a + GTEST_ARRAY_SIZE_(a));
5742 do {
5744 EXPECT_TRUE(ExplainMatchResult(UnorderedElementsAre(1, 2, 3),
5745 s, &listener)) << listener.str();
5746 } while (std::next_permutation(s.begin(), s.end()));
5747}
Here is the call graph for this function:

◆ TEST_F() [39/40]

testing::gmock_matchers_test::TEST_F ( UnorderedElementsAreTest ,
WorksForStreamlike  )

Definition at line 5762 of file gmock-matchers_test.cc.

5762 {
5763 // Streamlike 'container' provides only minimal iterator support.
5764 // Its iterators are tagged with input_iterator_tag, and it has no
5765 // size() or empty() methods.
5766 const int a[5] = {2, 1, 4, 5, 3};
5767 Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a));
5768
5769 EXPECT_THAT(s, UnorderedElementsAre(1, 2, 3, 4, 5));
5770 EXPECT_THAT(s, Not(UnorderedElementsAre(2, 2, 3, 4, 5)));
5771}
Here is the call graph for this function:

◆ TEST_F() [40/40]

testing::gmock_matchers_test::TEST_F ( UnorderedElementsAreTest ,
WorksWithUncopyable  )

Definition at line 5731 of file gmock-matchers_test.cc.

5731 {
5732 Uncopyable objs[2];
5733 objs[0].set_value(-3);
5734 objs[1].set_value(1);
5735 EXPECT_THAT(objs,
5736 UnorderedElementsAre(Truly(ValueIsPositive), UncopyableIs(-3)));
5737}
Here is the call graph for this function:

◆ TEST_P() [1/3]

testing::gmock_matchers_test::TEST_P ( BipartiteNonSquareTest ,
Exhaustive  )

Definition at line 6088 of file gmock-matchers_test.cc.

6088 {
6089 size_t nlhs = GetParam().first;
6090 size_t nrhs = GetParam().second;
6091 MatchMatrix graph(nlhs, nrhs);
6092 do {
6093 EXPECT_EQ(FindBacktrackingMaxBPM(graph).size(),
6094 internal::FindMaxBipartiteMatching(graph).size())
6095 << "graph: " << graph.DebugString()
6096 << "\nbacktracking: "
6097 << PrintToString(FindBacktrackingMaxBPM(graph))
6098 << "\nmax flow: "
6099 << PrintToString(internal::FindMaxBipartiteMatching(graph));
6100 } while (graph.NextGraph());
6101}
Here is the call graph for this function:

◆ TEST_P() [2/3]

testing::gmock_matchers_test::TEST_P ( BipartiteRandomTest ,
LargerNets  )

Definition at line 6119 of file gmock-matchers_test.cc.

6119 {
6120 int nodes = GetParam().first;
6121 int iters = GetParam().second;
6122 MatchMatrix graph(nodes, nodes);
6123
6124 testing::internal::Int32 seed = GTEST_FLAG(random_seed);
6125 if (seed == 0) {
6126 seed = static_cast<testing::internal::Int32>(time(NULL));
6127 }
6128
6129 for (; iters > 0; --iters, ++seed) {
6130 srand(static_cast<int>(seed));
6131 graph.Randomize();
6132 EXPECT_EQ(FindBacktrackingMaxBPM(graph).size(),
6133 internal::FindMaxBipartiteMatching(graph).size())
6134 << " graph: " << graph.DebugString()
6135 << "\nTo reproduce the failure, rerun the test with the flag"
6136 " --" << GTEST_FLAG_PREFIX_ << "random_seed=" << seed;
6137 }
6138}
#define GTEST_FLAG_PREFIX_
Definition gtest-port.h:293
#define GTEST_FLAG(name)
TypeWithSize< 4 >::Int Int32
Here is the call graph for this function:

◆ TEST_P() [3/3]

testing::gmock_matchers_test::TEST_P ( BipartiteTest ,
Exhaustive  )

Definition at line 6035 of file gmock-matchers_test.cc.

6035 {
6036 int nodes = GetParam();
6037 MatchMatrix graph(nodes, nodes);
6038 do {
6039 ElementMatcherPairs matches =
6040 internal::FindMaxBipartiteMatching(graph);
6041 EXPECT_EQ(FindBacktrackingMaxBPM(graph).size(), matches.size())
6042 << "graph: " << graph.DebugString();
6043 // Check that all elements of matches are in the graph.
6044 // Check that elements of first and second are unique.
6045 std::vector<bool> seen_element(graph.LhsSize());
6046 std::vector<bool> seen_matcher(graph.RhsSize());
6047 SCOPED_TRACE(PrintToString(matches));
6048 for (size_t i = 0; i < matches.size(); ++i) {
6049 size_t ilhs = matches[i].first;
6050 size_t irhs = matches[i].second;
6051 EXPECT_TRUE(graph.HasEdge(ilhs, irhs));
6052 EXPECT_FALSE(seen_element[ilhs]);
6053 EXPECT_FALSE(seen_matcher[irhs]);
6054 seen_element[ilhs] = true;
6055 seen_matcher[irhs] = true;
6056 }
6057 } while (graph.NextGraph());
6058}
::std::vector< ElementMatcherPair > ElementMatcherPairs
Here is the call graph for this function:

◆ ValueIsPositive()

bool testing::gmock_matchers_test::ValueIsPositive ( const Uncopyable & x)

Definition at line 3888 of file gmock-matchers_test.cc.

3888{ return x.value() > 0; }
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ foo

const int testing::gmock_matchers_test::foo = 0

Definition at line 2918 of file gmock-matchers_test.cc.

◆ g_bar

const int testing::gmock_matchers_test::g_bar = 1

Definition at line 522 of file gmock-matchers_test.cc.