54#include "gtest/gtest.h"
55#include "gtest/gtest-spi.h"
57#if GTEST_HAS_STD_FORWARD_LIST_
58# include <forward_list>
79using std::stringstream;
99using testing::IsEmpty;
158using testing::make_tuple;
167 *os <<
"is > " <<
rhs_;
172 const int diff = lhs -
rhs_;
174 *listener <<
"which is " << diff <<
" more than " <<
rhs_;
175 }
else if (diff == 0) {
176 *listener <<
"which is the same as " <<
rhs_;
178 *listener <<
"which is " << -diff <<
" less than " <<
rhs_;
194 return " (of type " + type_name +
")";
217template <
typename MatcherType,
typename Value>
221 return listener.
str();
224TEST(MatchResultListenerTest, StreamingWorks) {
226 listener <<
"hi" << 5;
240TEST(MatchResultListenerTest, CanAccessUnderlyingStream) {
247TEST(MatchResultListenerTest, IsInterestedWorks) {
265 *os <<
"is an even number";
274TEST(MatcherInterfaceTest, CanBeImplementedUsingPublishedAPI) {
283 const bool match = x % 2 == 0;
285 *listener <<
"value % " << 2;
286 if (listener->
stream() != NULL) {
289 *listener->
stream() <<
" == " << (x % 2);
295 *os <<
"is an even number";
299TEST(MatcherInterfaceTest, CanBeImplementedUsingNewAPI) {
308TEST(MatcherTest, CanBeDefaultConstructed) {
313TEST(MatcherTest, CanBeConstructedFromMatcherInterface) {
321TEST(MatcherTest, CanBeImplicitlyConstructedFromValue) {
328TEST(MatcherTest, CanBeImplicitlyConstructedFromNULL) {
350TEST(MatcherTest, CanDescribeItself) {
356TEST(MatcherTest, MatchAndExplain) {
369TEST(StringMatcherTest, CanBeImplicitlyConstructedFromCStringLiteral) {
381TEST(StringMatcherTest, CanBeImplicitlyConstructedFromString) {
391#if GTEST_HAS_STRING_PIECE_
394TEST(StringPieceMatcherTest, CanBeImplicitlyConstructedFromCStringLiteral) {
406TEST(StringPieceMatcherTest, CanBeImplicitlyConstructedFromString) {
418TEST(StringPieceMatcherTest, CanBeImplicitlyConstructedFromStringPiece) {
432TEST(MakeMatcherTest, ConstructsMatcherFromMatcherInterface) {
442 template <
typename T>
446 return p == &
g_bar || x == 0;
449 void DescribeTo(ostream* os)
const { *os <<
"g_bar or zero"; }
452 *os <<
"doesn't reference g_bar and is not zero";
462TEST(MakePolymorphicMatcherTest, ConstructsMatcherUsingOldAPI) {
488 template <
typename T>
491 *listener <<
"% " << 2;
492 if (listener->
stream() != NULL) {
495 *listener->
stream() <<
" == " << (x % 2);
505TEST(MakePolymorphicMatcherTest, ConstructsMatcherUsingNewAPI) {
530TEST(MatcherCastTest, FromPolymorphicMatcher) {
550 return foo.value() > 0;
555TEST(MatcherCastTest, FromCompatibleType) {
571TEST(MatcherCastTest, FromConstReferenceToNonReference) {
579TEST(MatcherCastTest, FromReferenceToNonReference) {
587TEST(MatcherCastTest, FromNonReferenceToConstReference) {
595TEST(MatcherCastTest, FromNonReferenceToReference) {
605TEST(MatcherCastTest, FromSameType) {
615 template <
typename T>
623 return a.value ==
b.value;
627 return os <<
a.value;
630TEST(MatcherCastTest, ConversionConstructorIsUsed) {
636TEST(MatcherCastTest, FromConvertibleFromAny) {
649 return a.value ==
b.value;
652TEST(MatcherCastTest, ValueIsNotCopied) {
676TEST(SafeMatcherCastTest, FromPolymorphicMatcher) {
685TEST(SafeMatcherCastTest, FromLosslesslyConvertibleArithmeticType) {
698TEST(SafeMatcherCastTest, FromBaseClass) {
712TEST(SafeMatcherCastTest, FromConstReferenceToReference) {
722TEST(SafeMatcherCastTest, FromNonReferenceToConstReference) {
730TEST(SafeMatcherCastTest, FromNonReferenceToReference) {
740TEST(SafeMatcherCastTest, FromSameType) {
747TEST(SafeMatcherCastTest, ConversionConstructorIsUsed) {
753TEST(SafeMatcherCastTest, FromConvertibleFromAny) {
760TEST(SafeMatcherCastTest, ValueIsNotCopied) {
767TEST(ExpectThat, TakesLiterals) {
773TEST(ExpectThat, TakesFunctions) {
775 static void Func() {}
777 void (*func)() = Helper::Func;
797TEST(ATest, WorksForDerivedClass) {
833TEST(UnderscoreTest, MatchesAnyValue) {
848TEST(UnderscoreTest, CanDescribeSelf) {
854TEST(EqTest, MatchesEqualValue) {
856 const char a1[] =
"hi";
857 const char a2[] =
"hi";
893TEST(TypedEqTest, ChecksEqualityForGivenType) {
904TEST(TypedEqTest, CanDescribeSelf) {
918 template <
typename T2>
922TEST(TypedEqTest, HasSpecifiedType) {
929TEST(GeTest, ImplementsGreaterThanOrEqual) {
943TEST(GtTest, ImplementsGreaterThan) {
957TEST(LeTest, ImplementsLessThanOrEqual) {
971TEST(LtTest, ImplementsLessThan) {
985TEST(NeTest, ImplementsNotEqual) {
999TEST(IsNullTest, MatchesNullPointer) {
1007 const char* p2 = NULL;
1011#if !GTEST_OS_SYMBIAN
1036TEST(IsNullTest, ReferenceToConstLinkedPtr) {
1045#if GTEST_HAS_STD_FUNCTION_
1046TEST(IsNullTest, StdFunction) {
1062TEST(NotNullTest, MatchesNonNullPointer) {
1070 const char* p2 = NULL;
1084TEST(NotNullTest, ReferenceToConstLinkedPtr) {
1093#if GTEST_HAS_STD_FUNCTION_
1094TEST(NotNullTest, StdFunction) {
1103TEST(NotNullTest, CanDescribeSelf) {
1110TEST(RefTest, MatchesSameVariable) {
1123 ss <<
"references the variable @" << &n <<
" 5";
1129TEST(RefTest, CanBeUsedAsMatcherForConstReference) {
1167TEST(StrEqTest, MatchesEqualString) {
1180 EXPECT_EQ(
"is equal to \"Hi-\'\\\"?\\\\\\a\\b\\f\\n\\r\\t\\v\\xD3\"",
1183 string str(
"01204500800");
1192TEST(StrNeTest, MatchesUnequalString) {
1208TEST(StrCaseEqTest, MatchesEqualStringIgnoringCase) {
1220TEST(StrCaseEqTest, MatchesEqualStringWith0IgnoringCase) {
1221 string str1(
"oabocdooeoo");
1222 string str2(
"OABOCDOOEOO");
1240 str2.append(1,
'\0');
1245TEST(StrCaseEqTest, CanDescribeSelf) {
1250TEST(StrCaseNeTest, MatchesUnequalStringIgnoringCase) {
1262TEST(StrCaseNeTest, CanDescribeSelf) {
1268TEST(HasSubstrTest, WorksForStringClasses) {
1279TEST(HasSubstrTest, WorksForCStrings) {
1292TEST(HasSubstrTest, CanDescribeSelf) {
1305 EXPECT_EQ(
"whose first field is a value which is 5 less than 10",
1306 Explain(m, make_pair(5,
true)));
1307 EXPECT_EQ(
"whose first field is a value which is 5 more than 10",
1308 Explain(m, make_pair(15,
true)));
1312 pair<int, std::string> p(25,
"foo");
1319TEST(KeyTest, SafelyCastsInnerMatcher) {
1322 pair<char, bool> p(
'a',
true);
1327TEST(KeyTest, InsideContainsUsingMap) {
1329 container.insert(make_pair(1,
'a'));
1330 container.insert(make_pair(2,
'b'));
1331 container.insert(make_pair(4,
'c'));
1336TEST(KeyTest, InsideContainsUsingMultimap) {
1337 multimap<int, char> container;
1338 container.insert(make_pair(1,
'a'));
1339 container.insert(make_pair(2,
'b'));
1340 container.insert(make_pair(4,
'c'));
1343 container.insert(make_pair(25,
'd'));
1345 container.insert(make_pair(25,
'e'));
1364 EXPECT_EQ(
"has a first field that is equal to \"foo\""
1365 ", and has a second field that is equal to 42",
1367 EXPECT_EQ(
"has a first field that isn't equal to \"foo\""
1368 ", or has a second field that isn't equal to 42",
1372 EXPECT_EQ(
"has a first field that isn't equal to 13"
1373 ", and has a second field that is equal to 42",
1377TEST(PairTest, CanExplainMatchResultTo) {
1381 EXPECT_EQ(
"whose first field does not match, which is 1 less than 0",
1382 Explain(m, make_pair(-1, -2)));
1386 EXPECT_EQ(
"whose second field does not match, which is 2 less than 0",
1387 Explain(m, make_pair(1, -2)));
1391 EXPECT_EQ(
"whose first field does not match, which is 1 less than 0",
1392 Explain(m, make_pair(-1, 2)));
1395 EXPECT_EQ(
"whose both fields match, where the first field is a value "
1396 "which is 1 more than 0, and the second field is a value "
1397 "which is 2 more than 0",
1403 EXPECT_EQ(
"whose both fields match, where the first field is a value "
1404 "which is 1 more than 0",
1405 Explain(explain_first, make_pair(1, 0)));
1410 EXPECT_EQ(
"whose both fields match, where the second field is a value "
1411 "which is 1 more than 0",
1412 Explain(explain_second, make_pair(0, 1)));
1416 pair<int, std::string> p(25,
"foo");
1435TEST(PairTest, SafelyCastsInnerMatchers) {
1438 pair<char, bool> p(
'a',
true);
1445TEST(PairTest, InsideContainsUsingMap) {
1447 container.insert(make_pair(1,
'a'));
1448 container.insert(make_pair(2,
'b'));
1449 container.insert(make_pair(4,
'c'));
1458TEST(StartsWithTest, MatchesStringWithGivenPrefix) {
1472TEST(StartsWithTest, CanDescribeSelf) {
1479TEST(EndsWithTest, MatchesStringWithGivenSuffix) {
1493TEST(EndsWithTest, CanDescribeSelf) {
1500TEST(MatchesRegexTest, MatchesStringMatchingGivenRegex) {
1512TEST(MatchesRegexTest, CanDescribeSelf) {
1522TEST(ContainsRegexTest, MatchesStringContainingGivenRegex) {
1534TEST(ContainsRegexTest, CanDescribeSelf) {
1543#if GTEST_HAS_STD_WSTRING
1544TEST(StdWideStrEqTest, MatchesEqual) {
1558 ::std::wstring
str(
L"01204500800");
1567TEST(StdWideStrEqTest, CanDescribeSelf) {
1569 EXPECT_EQ(
"is equal to L\"Hi-\'\\\"?\\\\\\a\\b\\f\\n\\r\\t\\v\"",
1573 EXPECT_EQ(
"is equal to L\"\\xD3\\x576\\x8D3\\xC74D\"",
1576 ::std::wstring
str(
L"01204500800");
1585TEST(StdWideStrNeTest, MatchesUnequalString) {
1596TEST(StdWideStrNeTest, CanDescribeSelf) {
1601TEST(StdWideStrCaseEqTest, MatchesEqualStringIgnoringCase) {
1613TEST(StdWideStrCaseEqTest, MatchesEqualStringWith0IgnoringCase) {
1614 ::std::wstring
str1(
L"oabocdooeoo");
1615 ::std::wstring
str2(
L"OABOCDOOEOO");
1633 str2.append(1,
L'\0');
1638TEST(StdWideStrCaseEqTest, CanDescribeSelf) {
1643TEST(StdWideStrCaseNeTest, MatchesUnequalStringIgnoringCase) {
1655TEST(StdWideStrCaseNeTest, CanDescribeSelf) {
1661TEST(StdWideHasSubstrTest, WorksForStringClasses) {
1672TEST(StdWideHasSubstrTest, WorksForCStrings) {
1685TEST(StdWideHasSubstrTest, CanDescribeSelf) {
1692TEST(StdWideStartsWithTest, MatchesStringWithGivenPrefix) {
1706TEST(StdWideStartsWithTest, CanDescribeSelf) {
1713TEST(StdWideEndsWithTest, MatchesStringWithGivenSuffix) {
1727TEST(StdWideEndsWithTest, CanDescribeSelf) {
1734#if GTEST_HAS_GLOBAL_WSTRING
1735TEST(GlobalWideStrEqTest, MatchesEqual) {
1749 ::wstring
str(
L"01204500800");
1758TEST(GlobalWideStrEqTest, CanDescribeSelf) {
1760 EXPECT_EQ(
"is equal to L\"Hi-\'\\\"?\\\\\\a\\b\\f\\n\\r\\t\\v\"",
1764 EXPECT_EQ(
"is equal to L\"\\xD3\\x576\\x8D3\\xC74D\"",
1767 ::wstring
str(
L"01204500800");
1776TEST(GlobalWideStrNeTest, MatchesUnequalString) {
1787TEST(GlobalWideStrNeTest, CanDescribeSelf) {
1792TEST(GlobalWideStrCaseEqTest, MatchesEqualStringIgnoringCase) {
1804TEST(GlobalWideStrCaseEqTest, MatchesEqualStringWith0IgnoringCase) {
1805 ::wstring
str1(
L"oabocdooeoo");
1806 ::wstring
str2(
L"OABOCDOOEOO");
1824 str2.append(1,
L'\0');
1829TEST(GlobalWideStrCaseEqTest, CanDescribeSelf) {
1834TEST(GlobalWideStrCaseNeTest, MatchesUnequalStringIgnoringCase) {
1846TEST(GlobalWideStrCaseNeTest, CanDescribeSelf) {
1852TEST(GlobalWideHasSubstrTest, WorksForStringClasses) {
1863TEST(GlobalWideHasSubstrTest, WorksForCStrings) {
1876TEST(GlobalWideHasSubstrTest, CanDescribeSelf) {
1883TEST(GlobalWideStartsWithTest, MatchesStringWithGivenPrefix) {
1897TEST(GlobalWideStartsWithTest, CanDescribeSelf) {
1904TEST(GlobalWideEndsWithTest, MatchesStringWithGivenSuffix) {
1918TEST(GlobalWideEndsWithTest, CanDescribeSelf) {
1930TEST(Eq2Test, MatchesEqualArguments) {
1944TEST(Ge2Test, MatchesGreaterThanOrEqualArguments) {
1959TEST(Gt2Test, MatchesGreaterThanArguments) {
1974TEST(Le2Test, MatchesLessThanOrEqualArguments) {
1989TEST(Lt2Test, MatchesLessThanArguments) {
2004TEST(Ne2Test, MatchesUnequalArguments) {
2032TEST(NotTest, NotMatcherSafelyCastsMonomorphicMatchers) {
2045 for (
int i = 1; i <= num; ++i) {
2053TEST(AllOfTest, MatchesWhenAllMatch) {
2099TEST(AllOfTest, VariadicMatchesWhenAllMatch) {
2102 ::testing::AllOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
2127 "((isn't equal to 1) and "
2128 "(isn't equal to 2))",
2134 "(isn't equal to 1)) and "
2135 "((isn't equal to 2) and "
2136 "(isn't equal to 3))",
2143 "((isn't equal to 3) and "
2144 "((isn't equal to 5) and "
2145 "(isn't equal to 7)))",
2150TEST(AllOfTest, CanDescribeNegation) {
2159 "((is equal to 1) or "
2166 "(is equal to 1)) or "
2167 "((is equal to 2) or "
2175 "((is equal to 3) or "
2176 "((is equal to 5) or "
2177 "(is equal to 7)))",
2182TEST(AllOfTest, AllOfMatcherSafelyCastsMonomorphicMatchers) {
2207 EXPECT_EQ(
"which is 20 more than 10, and which is 10 more than 20",
2213 EXPECT_EQ(
"which is 15 more than 10, and which is 5 more than 20",
2218 EXPECT_EQ(
"which is 30 more than 10, and which is 20 more than 20, "
2219 "and which is 10 more than 30",
2243 for (
int i = 1; i <= num; ++i) {
2251TEST(AnyOfTest, MatchesWhenAnyMatches) {
2289 AnyOfMatches(10,
AnyOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
2294TEST(AnyOfTest, VariadicMatchesWhenAnyMatches) {
2297 Matcher<int> m =
::testing::AnyOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
2301 AnyOfMatches(50,
AnyOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
2302 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2303 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
2304 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
2305 41, 42, 43, 44, 45, 46, 47, 48, 49, 50));
2319 "((is equal to 1) or (is equal to 2))",
2324 "(is equal to 1)) or "
2325 "((is equal to 2) or "
2332 "((is equal to 3) or "
2333 "((is equal to 5) or "
2334 "(is equal to 7)))",
2339TEST(AnyOfTest, CanDescribeNegation) {
2342 EXPECT_EQ(
"(isn't <= 1) and (isn't >= 3)",
2347 "((isn't equal to 1) and (isn't equal to 2))",
2352 "(isn't equal to 1)) and "
2353 "((isn't equal to 2) and "
2354 "(isn't equal to 3))",
2359 "(isn't > 10)) and "
2360 "((isn't equal to 3) and "
2361 "((isn't equal to 5) and "
2362 "(isn't equal to 7)))",
2367TEST(AnyOfTest, AnyOfMatcherSafelyCastsMonomorphicMatchers) {
2392 EXPECT_EQ(
"which is 5 less than 10, and which is 15 less than 20",
2398 EXPECT_EQ(
"which is 5 less than 10, and which is 25 less than 30",
2403 EXPECT_EQ(
"which is 5 less than 10, and which is 15 less than 20, "
2404 "and which is 25 less than 30",
2432 return x > 0 ? 1 : 0;
2453 return (&n == &
foo) && (n == 0);
2458TEST(TrulyTest, MatchesWhatSatisfiesThePredicate) {
2465TEST(TrulyTest, CanBeUsedWithFunctor) {
2488TEST(TrulyTest, PredicateCanReturnAClassConvertibleToBool) {
2497 EXPECT_EQ(
"satisfies the given predicate",
2503TEST(TrulyTest, WorksForByRefArguments) {
2512TEST(MatchesTest, IsSatisfiedByWhatMatchesTheMatcher) {
2519TEST(MatchesTest, WorksOnByRefArguments) {
2527TEST(MatchesTest, WorksWithMatcherOnNonRefType) {
2536TEST(ValueTest, WorksWithPolymorphicMatcher) {
2541TEST(ValueTest, WorksWithMonomorphicMatcher) {
2552TEST(ExplainMatchResultTest, WorksWithPolymorphicMatcher) {
2562TEST(ExplainMatchResultTest, WorksWithMonomorphicMatcher) {
2578TEST(ExplainMatchResultTest, WorksInsideMATCHER) {
2587TEST(AllArgsTest, WorksForNonTuple) {
2602TEST(AllArgsTest, WorksInWithClause) {
2606 .WillByDefault(
Return(1));
2618TEST(MatcherAssertionTest, WorksWhenMatcherIsSatisfied) {
2627TEST(MatcherAssertionTest, WorksWhenMatcherIsNotSatisfied) {
2630 static unsigned short n;
2640 "Expected: is > 10\n"
2641 " Actual: 5" +
OfType(
"unsigned short"));
2646 "Expected: (is <= 7) and (is >= 5)\n"
2647 " Actual: 0" +
OfType(
"unsigned short"));
2652TEST(MatcherAssertionTest, WorksForByRefArguments) {
2660 "Expected: does not reference the variable @");
2663 "Actual: 0" +
OfType(
"int") +
", which is located @");
2666#if !GTEST_OS_SYMBIAN
2680TEST(MatcherAssertionTest, WorksForMonomorphicMatcher) {
2686 const string bad =
"bad";
2689 "Expected: ends with \"ok\"\n"
2690 " Actual: \"bad\"");
2694 "Expected: is > 5\n"
2695 " Actual: 5" +
OfType(
"int"));
2700template <
typename RawType>
2805 template <
typename T>
2812template <
typename RawType>
2821 (*matcher_maker)(RawType, RawType)) {
3101 EXPECT_TRUE(explanation ==
"which is 1.2e-10 from 2.1" ||
3102 explanation ==
"which is 1.2e-010 from 2.1")
3103 <<
" where explanation is \"" << explanation <<
"\".";
3148TEST(PointeeTest, RawPointerToConst) {
3158TEST(PointeeTest, ReferenceToConstRawPointer) {
3168TEST(PointeeTest, ReferenceToNonConstRawPointer) {
3186TEST(WhenDynamicCastToTest, SameType) {
3191 Base* as_base_ptr = &derived;
3198TEST(WhenDynamicCastToTest, WrongTypes) {
3201 OtherDerived other_derived;
3206 Base* as_base_ptr = &derived;
3209 as_base_ptr = &other_derived;
3214TEST(WhenDynamicCastToTest, AlreadyNull) {
3216 Base* as_base_ptr = NULL;
3220struct AmbiguousCastTypes {
3221 class VirtualDerived :
public virtual Base {};
3222 class DerivedSub1 :
public VirtualDerived {};
3223 class DerivedSub2 :
public VirtualDerived {};
3224 class ManyDerivedInHierarchy :
public DerivedSub1,
public DerivedSub2 {};
3227TEST(WhenDynamicCastToTest, AmbiguousCast) {
3228 AmbiguousCastTypes::DerivedSub1 sub1;
3229 AmbiguousCastTypes::ManyDerivedInHierarchy many_derived;
3232 static_cast<AmbiguousCastTypes::DerivedSub1*
>(&many_derived);
3235 as_base_ptr = &sub1;
3246 EXPECT_EQ(prefix +
"does not point to a value that is anything",
3261 HasSubstr(
"which cannot be dynamic_cast"));
3264TEST(WhenDynamicCastToTest, GoodReference) {
3267 Base& as_base_ref = derived;
3272TEST(WhenDynamicCastToTest, BadReference) {
3274 Base& as_base_ref = derived;
3281template <
typename T>
3300TEST(PointeeTest, WorksWithConstPropagatingPointers) {
3312TEST(PointeeTest, NeverMatchesNull) {
3318TEST(PointeeTest, MatchesAgainstAValue) {
3328TEST(PointeeTest, CanDescribeSelf) {
3331 EXPECT_EQ(
"does not point to a value that is > 3",
3335TEST(PointeeTest, CanExplainMatchResult) {
3342 EXPECT_EQ(
"which points to 3" +
OfType(
"long") +
", which is 2 more than 1",
3346TEST(PointeeTest, AlwaysExplainsPointee) {
3397TEST(FieldTest, WorksForNonConstField) {
3407TEST(FieldTest, WorksForConstField) {
3417TEST(FieldTest, WorksForUncopyableField) {
3427TEST(FieldTest, WorksForPointerField) {
3444TEST(FieldTest, WorksForByRefArgument) {
3455TEST(FieldTest, WorksForArgumentOfSubType) {
3468TEST(FieldTest, WorksForCompatibleMatcherType) {
3488TEST(FieldTest, CanExplainMatchResult) {
3497 "whose given field is 1" +
OfType(
"int") +
", which is 1 more than 0",
3502TEST(FieldForPointerTest, WorksForPointerToConst) {
3512TEST(FieldForPointerTest, WorksForPointerToNonConst) {
3522TEST(FieldForPointerTest, WorksForReferenceToConstPointer) {
3532TEST(FieldForPointerTest, DoesNotMatchNull) {
3539TEST(FieldForPointerTest, WorksForArgumentOfSubType) {
3551TEST(FieldForPointerTest, CanDescribeSelf) {
3559TEST(FieldForPointerTest, CanExplainMatchResult) {
3565 EXPECT_EQ(
"which points to an object whose given field is 1" +
OfType(
"int"),
3569 EXPECT_EQ(
"which points to an object whose given field is 1" +
OfType(
"int") +
3570 ", which is 1 more than 0",
Explain(m, &
a));
3584 const string&
s()
const {
return s_; }
3589 double&
x()
const {
return x_; }
3609TEST(PropertyTest, WorksForNonReferenceProperty) {
3622TEST(PropertyTest, WorksForReferenceToConstProperty) {
3635TEST(PropertyTest, WorksForReferenceToNonConstProperty) {
3648TEST(PropertyTest, WorksForByValueArgument) {
3661TEST(PropertyTest, WorksForArgumentOfSubType) {
3676TEST(PropertyTest, WorksForCompatibleMatcherType) {
3688TEST(PropertyTest, CanDescribeSelf) {
3692 EXPECT_EQ(
"is an object whose given property isn't >= 0",
3697TEST(PropertyTest, CanExplainMatchResult) {
3706 "whose given property is 1" +
OfType(
"int") +
", which is 1 more than 0",
3711TEST(PropertyForPointerTest, WorksForPointerToConst) {
3723TEST(PropertyForPointerTest, WorksForPointerToNonConst) {
3736TEST(PropertyForPointerTest, WorksForReferenceToConstPointer) {
3748TEST(PropertyForPointerTest, WorksForReferenceToNonConstProperty) {
3755TEST(PropertyForPointerTest, WorksForArgumentOfSubType) {
3769TEST(PropertyForPointerTest, CanDescribeSelf) {
3773 EXPECT_EQ(
"is an object whose given property isn't >= 0",
3778TEST(PropertyForPointerTest, CanExplainMatchResult) {
3785 "which points to an object whose given property is 1" +
OfType(
"int"),
3789 EXPECT_EQ(
"which points to an object whose given property is 1" +
3790 OfType(
"int") +
", which is 1 more than 0",
3800TEST(ResultOfTest, WorksForFunctionPointers) {
3808TEST(ResultOfTest, CanDescribeItself) {
3811 EXPECT_EQ(
"is mapped by the given callable to a value that "
3812 "is equal to \"foo\"",
Describe(matcher));
3813 EXPECT_EQ(
"is mapped by the given callable to a value that "
3820TEST(ResultOfTest, CanExplainMatchResult) {
3822 EXPECT_EQ(
"which is mapped by the given callable to 90" +
OfType(
"int"),
3826 EXPECT_EQ(
"which is mapped by the given callable to 90" +
OfType(
"int") +
3827 ", which is 5 more than 85",
Explain(matcher, 36));
3832TEST(ResultOfTest, WorksForNonReferenceResults) {
3847TEST(ResultOfTest, WorksForReferenceToNonConstResults) {
3869TEST(ResultOfTest, WorksForReferenceToConstResults) {
3880TEST(ResultOfTest, WorksForCompatibleMatcherTypes) {
3890TEST(ResultOfDeathTest, DiesOnNullFunctionPointers) {
3892 ResultOf(
static_cast<string(*)(
int dummy)
>(NULL),
Eq(
string(
"foo"))),
3893 "NULL function pointer is passed into ResultOf\\(\\)\\.");
3898TEST(ResultOfTest, WorksForFunctionReferences) {
3906struct Functor :
public ::std::unary_function<int, string> {
3912TEST(ResultOfTest, WorksForFunctors) {
3928TEST(ResultOfTest, WorksForPolymorphicFunctors) {
3947TEST(ResultOfTest, WorksForReferencingCallables) {
3964 template <
typename T>
3966 *listener <<
"which is " << (n %
divider_) <<
" modulo "
3972 *os <<
"is divisible by " <<
divider_;
3976 *os <<
"is not divisible by " <<
divider_;
3992TEST(ExplainMatchResultTest, AllOf_False_False) {
3999TEST(ExplainMatchResultTest, AllOf_False_True) {
4006TEST(ExplainMatchResultTest, AllOf_True_False) {
4013TEST(ExplainMatchResultTest, AllOf_True_True) {
4018TEST(ExplainMatchResultTest, AllOf_True_True_2) {
4023TEST(ExplainmatcherResultTest, MonomorphicMatcher) {
4051TEST(ByRefTest, AllowsNotCopyableConstValueInMatchers) {
4060TEST(ByRefTest, AllowsNotCopyableValueInMatchers) {
4069TEST(IsEmptyTest, ImplementsIsEmpty) {
4072 container.push_back(0);
4074 container.push_back(1);
4078TEST(IsEmptyTest, WorksWithString) {
4087TEST(IsEmptyTest, CanDescribeSelf) {
4097 container.push_back(0);
4101TEST(SizeIsTest, ImplementsSizeIs) {
4105 container.push_back(0);
4108 container.push_back(0);
4117 container.insert(make_pair(
"foo", 1));
4120 container.insert(make_pair(
"bar", 2));
4125TEST(SizeIsTest, WorksWithReferences) {
4129 container.push_back(0);
4148 EXPECT_EQ(
"whose size 0 doesn't match, which is 1 less than 1",
4150 container.push_back(0);
4151 container.push_back(0);
4155 EXPECT_EQ(
"whose size 2 matches, which is 1 more than 1",
4159#if GTEST_HAS_TYPED_TEST
4163template <
typename T>
4166typedef testing::Types<
4171 ContainerEqTestTypes;
4177 static const int vals[] = {1, 1, 2, 3, 5, 8};
4178 TypeParam my_set(vals, vals + 6);
4186 static const int vals[] = {1, 1, 2, 3, 5, 8};
4187 static const int test_vals[] = {2, 1, 8, 5};
4188 TypeParam my_set(vals, vals + 6);
4189 TypeParam test_set(test_vals, test_vals + 4);
4192 EXPECT_EQ(
"which doesn't have these expected elements: 3",
4198 static const int vals[] = {1, 1, 2, 3, 5, 8};
4199 static const int test_vals[] = {1, 2, 3, 5, 8, 46};
4200 TypeParam my_set(vals, vals + 6);
4201 TypeParam test_set(test_vals, test_vals + 6);
4204 EXPECT_EQ(
"which has these unexpected elements: 46",
Explain(m, test_set));
4208TYPED_TEST(ContainerEqTest, ValueAddedAndRemoved) {
4209 static const int vals[] = {1, 1, 2, 3, 5, 8};
4210 static const int test_vals[] = {1, 2, 3, 8, 46};
4211 TypeParam my_set(vals, vals + 6);
4212 TypeParam test_set(test_vals, test_vals + 5);
4215 EXPECT_EQ(
"which has these unexpected elements: 46,\n"
4216 "and doesn't have these expected elements: 5",
4221TYPED_TEST(ContainerEqTest, DuplicateDifference) {
4222 static const int vals[] = {1, 1, 2, 3, 5, 8};
4223 static const int test_vals[] = {1, 2, 3, 5, 8};
4224 TypeParam my_set(vals, vals + 6);
4225 TypeParam test_set(test_vals, test_vals + 5);
4235TEST(ContainerEqExtraTest, MultipleValuesMissing) {
4236 static const int vals[] = {1, 1, 2, 3, 5, 8};
4237 static const int test_vals[] = {2, 1, 5};
4242 EXPECT_EQ(
"which doesn't have these expected elements: 3, 8",
4248TEST(ContainerEqExtraTest, MultipleValuesAdded) {
4249 static const int vals[] = {1, 1, 2, 3, 5, 8};
4250 static const int test_vals[] = {1, 2, 92, 3, 5, 8, 46};
4251 list<size_t> my_set(vals, vals + 6);
4252 list<size_t> test_set(test_vals, test_vals + 7);
4255 EXPECT_EQ(
"which has these unexpected elements: 92, 46",
4260TEST(ContainerEqExtraTest, MultipleValuesAddedAndRemoved) {
4261 static const int vals[] = {1, 1, 2, 3, 5, 8};
4262 static const int test_vals[] = {1, 2, 3, 92, 46};
4263 list<size_t> my_set(vals, vals + 6);
4264 list<size_t> test_set(test_vals, test_vals + 5);
4267 EXPECT_EQ(
"which has these unexpected elements: 92, 46,\n"
4268 "and doesn't have these expected elements: 5, 8",
4274TEST(ContainerEqExtraTest, MultiSetOfIntDuplicateDifference) {
4275 static const int vals[] = {1, 1, 2, 3, 5, 8};
4276 static const int test_vals[] = {1, 2, 3, 5, 8};
4288TEST(ContainerEqExtraTest, WorksForMaps) {
4301 EXPECT_EQ(
"which has these unexpected elements: (0, \"aa\"),\n"
4302 "and doesn't have these expected elements: (0, \"a\")",
4306TEST(ContainerEqExtraTest, WorksForNativeArray) {
4307 int a1[] = {1, 2, 3};
4308 int a2[] = {1, 2, 3};
4309 int b[] = {1, 2, 4};
4315TEST(ContainerEqExtraTest, WorksForTwoDimensionalNativeArray) {
4316 const char a1[][3] = {
"hi",
"lo"};
4317 const char a2[][3] = {
"hi",
"lo"};
4318 const char b[][3] = {
"lo",
"hi"};
4329TEST(ContainerEqExtraTest, WorksForNativeArrayAsTuple) {
4330 const int a1[] = {1, 2, 3};
4331 const int a2[] = {1, 2, 3};
4332 const int b[] = {1, 2, 3, 4};
4334 const int*
const p1 = a1;
4338 const int c[] = {1, 3, 2};
4342TEST(ContainerEqExtraTest, CopiesNativeArrayParameter) {
4343 std::string a1[][3] = {
4344 {
"hi",
"hello",
"ciao"},
4345 {
"bye",
"see you",
"ciao"}
4348 std::string a2[][3] = {
4349 {
"hi",
"hello",
"ciao"},
4350 {
"bye",
"see you",
"ciao"}
4360TEST(WhenSortedByTest, WorksForEmptyContainer) {
4366TEST(WhenSortedByTest, WorksForNonEmptyContainer) {
4368 numbers.push_back(3);
4369 numbers.push_back(1);
4370 numbers.push_back(2);
4371 numbers.push_back(2);
4378TEST(WhenSortedByTest, WorksForNonVectorContainer) {
4380 words.push_back(
"say");
4381 words.push_back(
"hello");
4382 words.push_back(
"world");
4389TEST(WhenSortedByTest, WorksForNativeArray) {
4390 const int numbers[] = {1, 3, 2, 4};
4391 const int sorted_numbers[] = {1, 2, 3, 4};
4398TEST(WhenSortedByTest, CanDescribeSelf) {
4400 EXPECT_EQ(
"(when sorted) has 2 elements where\n"
4401 "element #0 is equal to 1,\n"
4402 "element #1 is equal to 2",
4404 EXPECT_EQ(
"(when sorted) doesn't have 2 elements, or\n"
4405 "element #0 isn't equal to 1, or\n"
4406 "element #1 isn't equal to 2",
4410TEST(WhenSortedByTest, ExplainsMatchResult) {
4411 const int a[] = {2, 1};
4412 EXPECT_EQ(
"which is { 1, 2 } when sorted, whose element #0 doesn't match",
4414 EXPECT_EQ(
"which is { 1, 2 } when sorted",
4421TEST(WhenSortedTest, WorksForEmptyContainer) {
4427TEST(WhenSortedTest, WorksForNonEmptyContainer) {
4429 words.push_back(
"3");
4430 words.push_back(
"1");
4431 words.push_back(
"2");
4432 words.push_back(
"2");
4437TEST(WhenSortedTest, WorksForMapTypes) {
4439 word_counts[
"and"] = 1;
4440 word_counts[
"the"] = 1;
4441 word_counts[
"buffalo"] = 2;
4445 Pair(
"and", 1),
Pair(
"the", 1),
Pair(
"buffalo", 2)))));
4448TEST(WhenSortedTest, WorksForMultiMapTypes) {
4449 multimap<int, int> ifib;
4450 ifib.insert(make_pair(8, 6));
4451 ifib.insert(make_pair(2, 3));
4452 ifib.insert(make_pair(1, 1));
4453 ifib.insert(make_pair(3, 4));
4454 ifib.insert(make_pair(1, 2));
4455 ifib.insert(make_pair(5, 5));
4470TEST(WhenSortedTest, WorksForPolymorphicMatcher) {
4478TEST(WhenSortedTest, WorksForVectorConstRefMatcher) {
4490template <
typename T>
4498 template <
typename InIter>
4509 class ConstIter :
public std::iterator<std::input_iterator_tag,
4513 const value_type&> {
4516 typename std::list<value_type>::iterator pos)
4522 s_->remainder_.erase(
pos_++);
4542 return a.s_ ==
b.s_ &&
a.pos_ ==
b.pos_;
4550 typename std::list<value_type>::iterator
pos_;
4555 typedef typename std::list<value_type>::const_iterator Iter;
4556 const char* sep =
"";
4557 for (Iter it =
s.remainder_.begin(); it !=
s.remainder_.end(); ++it) {
4569 const int a[5] = {2, 1, 4, 5, 3};
4573 while (it !=
s.end()) {
4579#if GTEST_HAS_STD_FORWARD_LIST_
4580TEST(BeginEndDistanceIsTest, WorksWithForwardList) {
4581 std::forward_list<int> container;
4584 container.push_front(0);
4587 container.push_front(0);
4593TEST(BeginEndDistanceIsTest, WorksWithNonStdList) {
4594 const int a[5] = {1, 2, 3, 4, 5};
4599TEST(BeginEndDistanceIsTest, CanDescribeSelf) {
4602 EXPECT_EQ(
"distance between begin() and end() isn't equal to 2",
4606TEST(BeginEndDistanceIsTest, ExplainsResult) {
4612 EXPECT_EQ(
"whose distance between begin() and end() 0 doesn't match",
4614 EXPECT_EQ(
"whose distance between begin() and end() 0 matches",
4616 EXPECT_EQ(
"whose distance between begin() and end() 0 matches",
4619 "whose distance between begin() and end() 0 doesn't match, which is 1 "
4622 container.push_back(0);
4623 container.push_back(0);
4624 EXPECT_EQ(
"whose distance between begin() and end() 2 matches",
4626 EXPECT_EQ(
"whose distance between begin() and end() 2 doesn't match",
4628 EXPECT_EQ(
"whose distance between begin() and end() 2 doesn't match",
4631 "whose distance between begin() and end() 2 matches, which is 1 more "
4636TEST(WhenSortedTest, WorksForStreamlike) {
4639 const int a[5] = {2, 1, 4, 5, 3};
4645TEST(WhenSortedTest, WorksForVectorConstRefMatcherOnStreamlike) {
4646 const int a[] = {2, 1, 4, 5, 3};
4656TEST(ElemensAreStreamTest, WorksForStreamlike) {
4657 const int a[5] = {1, 2, 3, 4, 5};
4663TEST(ElemensAreArrayStreamTest, WorksForStreamlike) {
4664 const int a[5] = {1, 2, 3, 4, 5};
4668 expected.push_back(1);
4669 expected.push_back(2);
4670 expected.push_back(3);
4671 expected.push_back(4);
4672 expected.push_back(5);
4679TEST(ElementsAreTest, WorksWithUncopyable) {
4686TEST(ElementsAreTest, TakesStlContainer) {
4687 const int actual[] = {3, 1, 2};
4689 ::std::list<int> expected;
4690 expected.push_back(3);
4691 expected.push_back(1);
4692 expected.push_back(2);
4695 expected.push_back(4);
4701TEST(UnorderedElementsAreArrayTest, SucceedsWhenExpected) {
4702 const int a[] = {0, 1, 2, 3, 4};
4707 s, &listener)) << listener.
str();
4708 }
while (std::next_permutation(
s.begin(),
s.end()));
4711TEST(UnorderedElementsAreArrayTest, VectorBool) {
4712 const bool a[] = {0, 1, 0, 1, 1};
4713 const bool b[] = {1, 0, 1, 1, 0};
4718 actual, &listener)) << listener.
str();
4721TEST(UnorderedElementsAreArrayTest, WorksForStreamlike) {
4725 const int a[5] = {2, 1, 4, 5, 3};
4728 ::std::vector<int> expected;
4729 expected.push_back(1);
4730 expected.push_back(2);
4731 expected.push_back(3);
4732 expected.push_back(4);
4733 expected.push_back(5);
4736 expected.push_back(6);
4740TEST(UnorderedElementsAreArrayTest, TakesStlContainer) {
4741 const int actual[] = {3, 1, 2};
4743 ::std::list<int> expected;
4744 expected.push_back(1);
4745 expected.push_back(2);
4746 expected.push_back(3);
4749 expected.push_back(4);
4753#if GTEST_HAS_STD_INITIALIZER_LIST_
4755TEST(UnorderedElementsAreArrayTest, TakesInitializerList) {
4756 const int a[5] = {2, 1, 4, 5, 3};
4761TEST(UnorderedElementsAreArrayTest, TakesInitializerListOfCStrings) {
4762 const string a[5] = {
"a",
"b",
"c",
"d",
"e"};
4767TEST(UnorderedElementsAreArrayTest, TakesInitializerListOfSameTypedMatchers) {
4768 const int a[5] = {2, 1, 4, 5, 3};
4775TEST(UnorderedElementsAreArrayTest,
4776 TakesInitializerListOfDifferentTypedMatchers) {
4777 const int a[5] = {2, 1, 4, 5, 3};
4803 const int a[] = {1, 2, 3};
4808 s, &listener)) << listener.
str();
4809 }
while (std::next_permutation(
s.begin(),
s.end()));
4813 const int a[] = {1, 2, 3};
4815 std::vector<Matcher<int> > mv;
4822 s, &listener)) << listener.
str();
4829 const int a[5] = {2, 1, 4, 5, 3};
4844 std::vector<Matcher<int> > mv;
4845 for (
int i = 0; i < 100; ++i) {
4852 s, &listener)) << listener.
str();
4860 std::vector<Matcher<int> > mv;
4861 for (
int i = 0; i < 100; ++i) {
4871 s, &listener)) << listener.
str();
4879 v, &listener)) << listener.
str();
4887 v, &listener)) << listener.
str();
4897 v, &listener)) << listener.
str();
4900 Eq(
"where the following matchers don't match any elements:\n"
4901 "matcher #1: is equal to 2"));
4910 v, &listener)) << listener.
str();
4913 Eq(
"where the following elements don't match any matchers:\n"
4923 v, &listener)) << listener.
str();
4927 " the following matchers don't match any elements:\n"
4928 "matcher #0: is equal to 1\n"
4931 " the following elements don't match any matchers:\n"
4938 ss <<
"(element #" << element <<
", matcher #" << matcher <<
")";
4945 std::vector<string> v;
4955 "where no permutation of the elements can satisfy all matchers, "
4956 "and the closest match is 2 of 3 matchers with the "
4977 Eq(
"has 1 element and that element is equal to 345"));
4980 Eq(
"has 3 elements and there exists some permutation "
4981 "of elements such that:\n"
4982 " - element #0 is equal to 111, and\n"
4983 " - element #1 is equal to 222, and\n"
4984 " - element #2 is equal to 333"));
4992 Eq(
"doesn't have 1 element, or has 1 element that isn't equal to 345"));
4995 Eq(
"doesn't have 3 elements, or there exists no permutation "
4996 "of elements such that:\n"
4997 " - element #0 is equal to 123, and\n"
4998 " - element #1 is equal to 234, and\n"
4999 " - element #2 is equal to 345"));
5008template <
typename Graph>
5009class BacktrackingMaxBPMState {
5012 explicit BacktrackingMaxBPMState(
const Graph* g) : graph_(g) { }
5015 if (graph_->LhsSize() == 0 || graph_->RhsSize() == 0) {
5016 return best_so_far_;
5018 lhs_used_.assign(graph_->LhsSize(), kUnused);
5019 rhs_used_.assign(graph_->RhsSize(), kUnused);
5020 for (
size_t irhs = 0; irhs < graph_->RhsSize(); ++irhs) {
5023 if (best_so_far_.size() == graph_->RhsSize())
5026 return best_so_far_;
5030 static const size_t kUnused =
static_cast<size_t>(-1);
5032 void PushMatch(
size_t lhs,
size_t rhs) {
5034 lhs_used_[lhs] = rhs;
5035 rhs_used_[rhs] = lhs;
5036 if (matches_.size() > best_so_far_.size()) {
5037 best_so_far_ = matches_;
5043 lhs_used_[back.first] = kUnused;
5044 rhs_used_[back.second] = kUnused;
5045 matches_.pop_back();
5048 bool RecurseInto(
size_t irhs) {
5049 if (rhs_used_[irhs] != kUnused) {
5052 for (
size_t ilhs = 0; ilhs < graph_->LhsSize(); ++ilhs) {
5053 if (lhs_used_[ilhs] != kUnused) {
5056 if (!graph_->HasEdge(ilhs, irhs)) {
5059 PushMatch(ilhs, irhs);
5060 if (best_so_far_.size() == graph_->RhsSize()) {
5063 for (
size_t mi = irhs + 1; mi < graph_->RhsSize(); ++mi) {
5064 if (!RecurseInto(mi))
return false;
5071 const Graph* graph_;
5072 std::vector<size_t> lhs_used_;
5073 std::vector<size_t> rhs_used_;
5078template <
typename Graph>
5079const size_t BacktrackingMaxBPMState<Graph>::kUnused;
5085template <
typename Graph>
5088 return BacktrackingMaxBPMState<Graph>(&g).Compute();
5099 int nodes = GetParam();
5105 <<
"graph: " <<
graph.DebugString();
5108 std::vector<bool> seen_element(
graph.LhsSize());
5109 std::vector<bool> seen_matcher(
graph.RhsSize());
5111 for (
size_t i = 0; i < matches.size(); ++i) {
5112 size_t ilhs = matches[i].first;
5113 size_t irhs = matches[i].second;
5117 seen_element[ilhs] =
true;
5118 seen_matcher[irhs] =
true;
5120 }
while (
graph.NextGraph());
5124 ::testing::Range(0, 5));
5128 :
public ::testing::TestWithParam<std::pair<size_t, size_t> > {
5140 static const int kEdges[][2] = {{0, 2}, {1, 1}, {2, 1}, {3, 0}};
5142 g.
SetEdge(kEdges[i][0], kEdges[i][1],
true);
5152 size_t nlhs = GetParam().first;
5153 size_t nrhs = GetParam().second;
5158 <<
"graph: " <<
graph.DebugString()
5159 <<
"\nbacktracking: "
5163 }
while (
graph.NextGraph());
5168 std::make_pair(1, 2),
5169 std::make_pair(2, 1),
5170 std::make_pair(3, 2),
5171 std::make_pair(2, 3),
5172 std::make_pair(4, 1),
5173 std::make_pair(1, 4),
5174 std::make_pair(4, 3),
5175 std::make_pair(3, 4)));
5178 :
public ::testing::TestWithParam<std::pair<int, int> > {
5183 int nodes = GetParam().first;
5184 int iters = GetParam().second;
5192 for (; iters > 0; --iters, ++
seed) {
5193 srand(
static_cast<int>(
seed));
5197 <<
" graph: " <<
graph.DebugString()
5198 <<
"\nTo reproduce the failure, rerun the test with the flag"
5206 std::make_pair(5, 10000),
5207 std::make_pair(6, 5000),
5208 std::make_pair(7, 2000),
5209 std::make_pair(8, 500),
5210 std::make_pair(9, 100)));
5214TEST(IsReadableTypeNameTest, ReturnsTrueForShortNames) {
5221TEST(IsReadableTypeNameTest, ReturnsTrueForLongNonTemplateNonFunctionNames) {
5227TEST(IsReadableTypeNameTest, ReturnsFalseForLongTemplateNames) {
5233TEST(IsReadableTypeNameTest, ReturnsFalseForLongFunctionTypeNames) {
5239TEST(JoinAsTupleTest, JoinsEmptyTuple) {
5243TEST(JoinAsTupleTest, JoinsOneTuple) {
5244 const char* fields[] = {
"1"};
5248TEST(JoinAsTupleTest, JoinsTwoTuple) {
5249 const char* fields[] = {
"1",
"a"};
5253TEST(JoinAsTupleTest, JoinsTenTuple) {
5254 const char* fields[] = {
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10"};
5255 EXPECT_EQ(
"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)",
5261TEST(FormatMatcherDescriptionTest, WorksForEmptyDescription) {
5267 const char* params[] = {
"5"};
5270 Strings(params, params + 1)));
5272 const char* params2[] = {
"5",
"8"};
5275 Strings(params2, params2 + 2)));
5279TEST(PolymorphicMatcherTest, CanAccessMutableImpl) {
5289TEST(PolymorphicMatcherTest, CanAccessImpl) {
5295TEST(MatcherTupleTest, ExplainsMatchFailure) {
5298 make_tuple(
'a', 10), &ss1);
5303 make_tuple(2,
'b'), &ss2);
5305 " Actual: 2, which is 3 less than 5\n"
5306 " Expected arg #1: is equal to 'a' (97, 0x61)\n"
5307 " Actual: 'b' (98, 0x62)\n",
5312 make_tuple(2,
'a'), &ss3);
5314 " Actual: 2, which is 3 less than 5\n",
5321TEST(EachTest, ExplainsMatchResultCorrectly) {
5329 const int b[1] = {1};
5342 EXPECT_EQ(
"whose element #0 doesn't match, which is 9 less than 10",
5346TEST(EachTest, DescribesItselfCorrectly) {
5354TEST(EachTest, MatchesVectorWhenAllElementsMatch) {
5357 some_vector.push_back(3);
5360 some_vector.push_back(1);
5361 some_vector.push_back(2);
5366 another_vector.push_back(
"fee");
5368 another_vector.push_back(
"fie");
5369 another_vector.push_back(
"foe");
5370 another_vector.push_back(
"fum");
5374TEST(EachTest, MatchesMapWhenAllElementsMatch) {
5376 const char*
bar =
"a string";
5382 another_map[
"fee"] = 1;
5384 another_map[
"fie"] = 2;
5385 another_map[
"foe"] = 3;
5386 another_map[
"fum"] = 4;
5393 const int a[] = {1, 2, 3};
5398TEST(EachTest, WorksForNativeArrayAsTuple) {
5399 const int a[] = {1, 2};
5408 template <
typename T1,
typename T2>
5412 *listener <<
"where the second is " <<
get<1>(a_pair);
5415 *listener <<
"where the second/2 is " <<
get<1>(a_pair)/2;
5421 *os <<
"are a pair where the first is half of the second";
5425 *os <<
"are a pair where the first isn't half of the second";
5433TEST(PointwiseTest, DescribesSelf) {
5439 EXPECT_EQ(
"contains 3 values, where each value and its corresponding value "
5440 "in { 1, 2, 3 } are a pair where the first is half of the second",
5442 EXPECT_EQ(
"doesn't contain exactly 3 values, or contains a value x at some "
5443 "index i where x and the i-th value of { 1, 2, 3 } are a pair "
5444 "where the first isn't half of the second",
5448TEST(PointwiseTest, MakesCopyOfRhs) {
5449 list<signed char> rhs;
5462TEST(PointwiseTest, WorksForLhsNativeArray) {
5463 const int lhs[] = {1, 2, 3};
5472TEST(PointwiseTest, WorksForRhsNativeArray) {
5473 const int rhs[] = {1, 2, 3};
5482#if GTEST_HAS_STD_INITIALIZER_LIST_
5484TEST(PointwiseTest, WorksForRhsInitializerList) {
5492TEST(PointwiseTest, RejectsWrongSize) {
5493 const double lhs[2] = {1, 2};
5494 const int rhs[1] = {0};
5499 const int rhs2[3] = {0, 1, 2};
5503TEST(PointwiseTest, RejectsWrongContent) {
5504 const double lhs[3] = {1, 2, 3};
5505 const int rhs[3] = {2, 6, 4};
5507 EXPECT_EQ(
"where the value pair (2, 6) at index #1 don't match, "
5508 "where the second/2 is 3",
5512TEST(PointwiseTest, AcceptsCorrectContent) {
5513 const double lhs[3] = {1, 2, 3};
5514 const int rhs[3] = {2, 4, 6};
5519TEST(PointwiseTest, AllowsMonomorphicInnerMatcher) {
5520 const double lhs[3] = {1, 2, 3};
5521 const int rhs[3] = {2, 4, 6};
5533TEST(UnorderedPointwiseTest, DescribesSelf) {
5540 "has 3 elements and there exists some permutation of elements such "
5542 " - element #0 and 1 are a pair where the first is half of the second, "
5544 " - element #1 and 2 are a pair where the first is half of the second, "
5546 " - element #2 and 3 are a pair where the first is half of the second",
5549 "doesn't have 3 elements, or there exists no permutation of elements "
5551 " - element #0 and 1 are a pair where the first is half of the second, "
5553 " - element #1 and 2 are a pair where the first is half of the second, "
5555 " - element #2 and 3 are a pair where the first is half of the second",
5559TEST(UnorderedPointwiseTest, MakesCopyOfRhs) {
5560 list<signed char> rhs;
5573TEST(UnorderedPointwiseTest, WorksForLhsNativeArray) {
5574 const int lhs[] = {1, 2, 3};
5583TEST(UnorderedPointwiseTest, WorksForRhsNativeArray) {
5584 const int rhs[] = {1, 2, 3};
5593#if GTEST_HAS_STD_INITIALIZER_LIST_
5595TEST(UnorderedPointwiseTest, WorksForRhsInitializerList) {
5603TEST(UnorderedPointwiseTest, RejectsWrongSize) {
5604 const double lhs[2] = {1, 2};
5605 const int rhs[1] = {0};
5610 const int rhs2[3] = {0, 1, 2};
5614TEST(UnorderedPointwiseTest, RejectsWrongContent) {
5615 const double lhs[3] = {1, 2, 3};
5616 const int rhs[3] = {2, 6, 6};
5618 EXPECT_EQ(
"where the following elements don't match any matchers:\n"
5623TEST(UnorderedPointwiseTest, AcceptsCorrectContentInSameOrder) {
5624 const double lhs[3] = {1, 2, 3};
5625 const int rhs[3] = {2, 4, 6};
5629TEST(UnorderedPointwiseTest, AcceptsCorrectContentInDifferentOrder) {
5630 const double lhs[3] = {1, 2, 3};
5631 const int rhs[3] = {6, 4, 2};
5635TEST(UnorderedPointwiseTest, AllowsMonomorphicInnerMatcher) {
5636 const double lhs[3] = {1, 2, 3};
5637 const int rhs[3] = {4, 6, 2};
#define s(x, c)
Definition aesb.c:47
cryptonote::block b
Definition block.cpp:40
Definition gmock-matchers.h:80
::std::ostream * stream()
Definition gmock-matchers.h:98
Definition gmock-matchers.h:143
Definition gmock-matchers.h:319
Definition gmock-matchers.h:430
Impl & mutable_impl()
Definition gmock-matchers.h:436
const Impl & impl() const
Definition gmock-matchers.h:440
Definition gmock-matchers.h:184
internal::string str() const
Definition gmock-matchers.h:189
void Clear()
Definition gmock-matchers.h:192
Definition gmock-matchers_test.cc:3574
void set_s(const string &new_s)
Definition gmock-matchers_test.cc:3586
const string & s() const
Definition gmock-matchers_test.cc:3584
double & x() const
Definition gmock-matchers_test.cc:3589
static double x_
Definition gmock-matchers_test.cc:3594
void set_n(int new_n)
Definition gmock-matchers_test.cc:3581
int n_
Definition gmock-matchers_test.cc:3591
AClass()
Definition gmock-matchers_test.cc:3576
string s_
Definition gmock-matchers_test.cc:3592
int n() const
Definition gmock-matchers_test.cc:3579
Definition gmock-matchers_test.cc:2592
MOCK_METHOD2(Helper, int(char x, int y))
GTEST_DISALLOW_COPY_AND_ASSIGN_(AllArgsHelper)
AllArgsHelper()
Definition gmock-matchers_test.cc:2594
Definition gmock-matchers_test.cc:5091
Definition gmock-matchers_test.cc:659
GTEST_DISALLOW_COPY_AND_ASSIGN_(Base)
virtual ~Base()
Definition gmock-matchers_test.cc:661
Base()
Definition gmock-matchers_test.cc:662
Definition gmock-matchers_test.cc:5128
Definition gmock-matchers_test.cc:5178
Definition gmock-matchers_test.cc:5095
Definition gmock-matchers_test.cc:3282
ConstPropagatingPtr(T *t)
Definition gmock-matchers_test.cc:3287
T element_type
Definition gmock-matchers_test.cc:3284
T * get()
Definition gmock-matchers_test.cc:3290
T & operator*()
Definition gmock-matchers_test.cc:3291
const T & operator*() const
Definition gmock-matchers_test.cc:3294
ConstPropagatingPtr()
Definition gmock-matchers_test.cc:3286
ConstPropagatingPtr(const ConstPropagatingPtr &other)
Definition gmock-matchers_test.cc:3288
const T * get() const
Definition gmock-matchers_test.cc:3293
T * val_
Definition gmock-matchers_test.cc:3297
Definition gmock-matchers_test.cc:2472
ConvertibleToBool(int number)
Definition gmock-matchers_test.cc:2474
int number_
Definition gmock-matchers_test.cc:2478
Definition gmock-matchers_test.cc:3600
int k_
Definition gmock-matchers_test.cc:3604
int k() const
Definition gmock-matchers_test.cc:3602
Definition gmock-matchers_test.cc:667
int i
Definition gmock-matchers_test.cc:670
Derived()
Definition gmock-matchers_test.cc:669
Definition gmock-matchers_test.cc:3959
bool MatchAndExplain(const T &n, MatchResultListener *listener) const
Definition gmock-matchers_test.cc:3965
void set_divider(int a_divider)
Definition gmock-matchers_test.cc:3979
int divider_
Definition gmock-matchers_test.cc:3983
void DescribeNegationTo(ostream *os) const
Definition gmock-matchers_test.cc:3975
DivisibleByImpl(int a_divider)
Definition gmock-matchers_test.cc:3961
void DescribeTo(ostream *os) const
Definition gmock-matchers_test.cc:3971
int divider() const
Definition gmock-matchers_test.cc:3980
Definition gmock-matchers_test.cc:257
virtual bool MatchAndExplain(int x, MatchResultListener *) const
Definition gmock-matchers_test.cc:259
virtual void DescribeTo(ostream *os) const
Definition gmock-matchers_test.cc:264
Definition gmock-matchers_test.cc:2813
void TestNearMatches(testing::internal::FloatingEqMatcher< RawType >(*matcher_maker)(RawType, RawType))
Definition gmock-matchers_test.cc:2819
FloatingPointTest< RawType > ParentType
Definition gmock-matchers_test.cc:2815
Definition gmock-matchers_test.cc:2701
const float further_from_one_
Definition gmock-matchers_test.cc:2790
const float nan1_
Definition gmock-matchers_test.cc:2801
const float max_
Definition gmock-matchers_test.cc:2798
const float infinity_
Definition gmock-matchers_test.cc:2793
const size_t max_ulps_
Definition gmock-matchers_test.cc:2777
const float close_to_one_
Definition gmock-matchers_test.cc:2789
const Bits infinity_bits_
Definition gmock-matchers_test.cc:2781
const float nan2_
Definition gmock-matchers_test.cc:2802
const float further_from_infinity_
Definition gmock-matchers_test.cc:2795
const float close_to_negative_zero_
Definition gmock-matchers_test.cc:2785
void TestMatches(testing::internal::FloatingEqMatcher< RawType >(*matcher_maker)(RawType))
Definition gmock-matchers_test.cc:2731
const float close_to_infinity_
Definition gmock-matchers_test.cc:2794
const float close_to_positive_zero_
Definition gmock-matchers_test.cc:2784
const float further_from_negative_zero_
Definition gmock-matchers_test.cc:2786
void TestSize()
Definition gmock-matchers_test.cc:2725
Floating::Bits Bits
Definition gmock-matchers_test.cc:2704
testing::internal::FloatingPoint< RawType > Floating
Definition gmock-matchers_test.cc:2703
static float AsBits(T value)
Definition gmock-matchers_test.cc:2806
const Bits one_bits_
Definition gmock-matchers_test.cc:2780
FloatingPointTest()
Definition gmock-matchers_test.cc:2706
const Bits zero_bits_
Definition gmock-matchers_test.cc:2779
Definition gmock-matchers_test.cc:162
virtual void DescribeTo(ostream *os) const
Definition gmock-matchers_test.cc:166
GreaterThanMatcher(int rhs)
Definition gmock-matchers_test.cc:164
virtual bool MatchAndExplain(int lhs, MatchResultListener *listener) const
Definition gmock-matchers_test.cc:170
int rhs_
Definition gmock-matchers_test.cc:185
Definition gmock-matchers_test.cc:537
int value_
Definition gmock-matchers_test.cc:545
IntValue(int a_value)
Definition gmock-matchers_test.cc:541
int value() const
Definition gmock-matchers_test.cc:543
Definition gmock-matchers_test.cc:2437
int threshold_
Definition gmock-matchers_test.cc:2444
bool operator()(int n) const
Definition gmock-matchers_test.cc:2441
IsGreaterThan(int threshold)
Definition gmock-matchers_test.cc:2439
Definition gmock-matchers_test.cc:5406
void DescribeNegationTo(ostream *os) const
Definition gmock-matchers_test.cc:5424
bool MatchAndExplain(const tuple< T1, T2 > &a_pair, MatchResultListener *listener) const
Definition gmock-matchers_test.cc:5409
void DescribeTo(ostream *os) const
Definition gmock-matchers_test.cc:5420
Definition gmock-matchers.h:319
Definition gmock-matchers_test.cc:280
virtual bool MatchAndExplain(int x, MatchResultListener *listener) const
Definition gmock-matchers_test.cc:282
virtual void DescribeTo(ostream *os) const
Definition gmock-matchers_test.cc:294
Definition gmock-matchers_test.cc:4032
bool operator==(const NotCopyable &rhs) const
Definition gmock-matchers_test.cc:4038
bool operator>=(const NotCopyable &rhs) const
Definition gmock-matchers_test.cc:4042
NotCopyable(int a_value)
Definition gmock-matchers_test.cc:4034
int value_
Definition gmock-matchers_test.cc:4046
int value() const
Definition gmock-matchers_test.cc:4036
GTEST_DISALLOW_COPY_AND_ASSIGN_(NotCopyable)
Definition gmock-matchers_test.cc:673
Definition gmock-matchers_test.cc:480
void DescribeNegationTo(ostream *os) const
Definition gmock-matchers_test.cc:484
bool MatchAndExplain(const T &x, MatchResultListener *listener) const
Definition gmock-matchers_test.cc:489
void DescribeTo(ostream *os) const
Definition gmock-matchers_test.cc:482
Definition gmock-matchers_test.cc:440
void DescribeNegationTo(ostream *os) const
Definition gmock-matchers_test.cc:451
void DescribeTo(ostream *os) const
Definition gmock-matchers_test.cc:449
bool MatchAndExplain(const T &x, MatchResultListener *) const
Definition gmock-matchers_test.cc:443
Definition gmock-matchers_test.cc:4528
PostIncrProxy(const value_type &value)
Definition gmock-matchers_test.cc:4530
value_type operator*() const
Definition gmock-matchers_test.cc:4531
value_type value_
Definition gmock-matchers_test.cc:4533
Definition gmock-matchers_test.cc:4513
const Streamlike * s_
Definition gmock-matchers_test.cc:4549
PostIncrProxy operator++(int)
Definition gmock-matchers_test.cc:4535
ConstIter & operator++()
Definition gmock-matchers_test.cc:4521
std::list< value_type >::iterator pos_
Definition gmock-matchers_test.cc:4550
friend bool operator==(const ConstIter &a, const ConstIter &b)
Definition gmock-matchers_test.cc:4541
const value_type & operator*() const
Definition gmock-matchers_test.cc:4519
const value_type * operator->() const
Definition gmock-matchers_test.cc:4520
friend bool operator!=(const ConstIter &a, const ConstIter &b)
Definition gmock-matchers_test.cc:4544
ConstIter(const Streamlike *s, typename std::list< value_type >::iterator pos)
Definition gmock-matchers_test.cc:4515
Definition gmock-matchers_test.cc:4491
const_iterator begin() const
Definition gmock-matchers_test.cc:4501
std::list< value_type > remainder_
Definition gmock-matchers_test.cc:4565
ConstIter const_iterator
Definition gmock-matchers_test.cc:4495
const_iterator end() const
Definition gmock-matchers_test.cc:4504
T value_type
Definition gmock-matchers_test.cc:4496
friend std::ostream & operator<<(std::ostream &os, const Streamlike &s)
Definition gmock-matchers_test.cc:4553
Streamlike(InIter first, InIter last)
Definition gmock-matchers_test.cc:4499
Definition gmock-matchers_test.cc:3353
GTEST_DISALLOW_COPY_AND_ASSIGN_(Uncopyable)
int value() const
Definition gmock-matchers_test.cc:3358
Uncopyable()
Definition gmock-matchers_test.cc:3355
void set_value(int i)
Definition gmock-matchers_test.cc:3359
int value_
Definition gmock-matchers_test.cc:3362
Uncopyable(int a_value)
Definition gmock-matchers_test.cc:3356
Definition gmock-matchers_test.cc:4789
std::vector< int > IntVec
Definition gmock-matchers_test.cc:4791
Definition gmock-matchers_test.cc:866
char c_
Definition gmock-matchers_test.cc:872
bool operator==(const Unprintable &)
Definition gmock-matchers_test.cc:870
Unprintable()
Definition gmock-matchers_test.cc:868
Definition gmock-matchers.h:228
Definition gmock-matchers.h:1888
Definition gtest-internal.h:262
TypeWithSize< sizeof(RawType)>::UInt Bits
Definition gtest-internal.h:266
static RawType ReinterpretBits(const Bits bits)
Definition gtest-internal.h:317
Definition gmock-matchers.h:3257
string DebugString() const
Definition gmock-matchers.cc:382
void SetEdge(size_t ilhs, size_t irhs, bool b)
Definition gmock-matchers.h:3270
bool MatchAndExplain(T x, MatchResultListener *listener) const
Definition gmock-matchers.h:256
bool Matches(T x) const
Definition gmock-matchers.h:261
void DescribeTo(::std::ostream *os) const
Definition gmock-matchers.h:267
void DescribeNegationTo(::std::ostream *os) const
Definition gmock-matchers.h:270
Definition gtest-port.h:1156
Definition gmock-matchers.h:239
Definition gtest-linked_ptr.h:146
Definition gtest-port.h:1115
const uint8_t seed[32]
Definition code-generator.cpp:37
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition document.h:2116
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex)
Definition gtest-death-test.h:286
#define EXPECT_FATAL_FAILURE(statement, substr)
Definition gtest-spi.h:138
#define EXPECT_NONFATAL_FAILURE(statement, substr)
Definition gtest-spi.h:204
#define TEST_F(test_fixture, test_name)
Definition gtest.h:2216
#define EXPECT_EQ(val1, val2)
Definition gtest.h:1922
#define SCOPED_TRACE(message)
Definition gtest.h:2115
#define EXPECT_TRUE(condition)
Definition gtest.h:1859
#define TEST(test_case_name, test_name)
Definition gtest.h:2187
#define ADD_FAILURE()
Definition gtest.h:1808
#define EXPECT_FALSE(condition)
Definition gtest.h:1862
#define GTEST_FLAG_PREFIX_
Definition gtest-port.h:286
#define GTEST_FLAG(name)
Definition gtest-port.h:2504
#define GTEST_API_
Definition gtest-port.h:934
#define GTEST_ARRAY_SIZE_(array)
Definition gtest-port.h:1092
#define MATCHER_P(name, p0, description)
Definition gmock-generated-matchers.h:1428
#define ASSERT_THAT(value, matcher)
Definition gmock-matchers.h:4388
#define EXPECT_THAT(value, matcher)
Definition gmock-matchers.h:4390
#define EXPECT_CALL(obj, call)
Definition gmock-spec-builders.h:1845
#define ON_CALL(obj, call)
Definition gmock-spec-builders.h:1841
const internal::AnythingMatcher _
Definition gmock-matchers.h:3729
void get(std::istream &input, bool &res)
Definition io.h:61
#define L(m0, m1, m2, m3, m4, m5, m6, m7)
Definition jh.c:116
static int greater(const MDB_val *a, const MDB_val *b)
Definition mdb_load.c:283
const char * text
Definition minihttptestserver.c:269
Definition gtest_output_test_.cc:549
prefix
Definition check.py:15
Definition gtest-printers_test.cc:126
Definition gmock-matchers_test.cc:67
PolymorphicMatcher< internal::StartsWithMatcher< internal::string > > StartsWith(const internal::string &prefix)
Definition gmock-matchers.h:3991
internal::NotMatcher< InnerMatcher > Not(InnerMatcher m)
Definition gmock-matchers.h:4107
internal::PointwiseMatcher< TupleMatcher, GTEST_REMOVE_CONST_(Container)> Pointwise(const TupleMatcher &tuple_matcher, const Container &rhs)
Definition gmock-matchers.h:4187
ElementMatcherPairs FindBacktrackingMaxBPM(const Graph &g)
Definition gmock-matchers_test.cc:5087
Matcher< Lhs > TypedEq(const Rhs &rhs)
Definition gmock-matchers.h:3762
Matcher< T > An()
Definition gmock-matchers.h:3736
FloatingPointTest< float > FloatTest
Definition gmock-matchers_test.cc:2896
internal::EqMatcher< T > Eq(T x)
Definition gmock-matchers.h:3742
INSTANTIATE_TEST_CASE_P(AllGraphs, BipartiteTest, ::testing::Range(0, 5))
bool IsReadableTypeName(const string &type_name)
Definition gmock-matchers.h:688
internal::FloatingEqMatcher< float > FloatEq(float rhs)
Definition gmock-matchers.h:3843
PolymorphicMatcher< internal::NotNullMatcher > NotNull()
Definition gmock-matchers.h:3802
TEST_P(BipartiteTest, Exhaustive)
Definition gmock-matchers_test.cc:5098
string IntToStringFunction(int input)
Definition gmock-matchers_test.cc:3798
internal::WhenSortedByMatcher< Comparator, ContainerMatcher > WhenSortedBy(const Comparator &comparator, const ContainerMatcher &container_matcher)
Definition gmock-matchers.h:4162
ConvertibleToBool IsNotZero(int number)
Definition gmock-matchers_test.cc:2481
InnerMatcher AllArgs(const InnerMatcher &matcher)
Definition gmock-matchers.h:4382
PolymorphicMatcher< internal::HasSubstrMatcher< internal::string > > HasSubstr(const internal::string &substring)
Definition gmock-matchers.h:3984
PolymorphicMatcher< internal::IsNullMatcher > IsNull()
Definition gmock-matchers.h:3795
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrCaseNe(const internal::string &str)
Definition gmock-matchers.h:3976
internal::WhenSortedByMatcher< internal::LessComparator, ContainerMatcher > WhenSorted(const ContainerMatcher &container_matcher)
Definition gmock-matchers.h:4172
internal::FloatingEqMatcher< float > NanSensitiveFloatEq(float rhs)
Definition gmock-matchers.h:3849
internal::FloatingEqMatcher< float > NanSensitiveFloatNear(float rhs, float max_abs_error)
Definition gmock-matchers.h:3864
string Describe(const Matcher< T > &m)
Definition gmock-matchers_test.cc:202
internal::FloatingEqMatcher< double > DoubleNear(double rhs, double max_abs_error)
Definition gmock-matchers.h:3828
PolymorphicMatcher< internal::MatchesRegexMatcher > MatchesRegex(const internal::RE *regex)
Definition gmock-matchers.h:4005
FloatingPointNearTest< float > FloatNearTest
Definition gmock-matchers_test.cc:2952
Uncopyable & RefUncopyableFunction(Uncopyable &obj)
Definition gmock-matchers_test.cc:3843
PolymorphicMatcher< internal::TrulyMatcher< Predicate > > Truly(Predicate pred)
Definition gmock-matchers.h:4116
PolymorphicMatcher< IsHalfOfMatcher > IsHalfOf()
Definition gmock-matchers_test.cc:5429
ostream & operator<<(ostream &os, const ConvertibleFromAny &a)
Definition gmock-matchers_test.cc:626
const internal::AnythingMatcher _
Definition gmock-matchers.h:3729
const string & StringFunction(const string &input)
Definition gmock-matchers_test.cc:3867
void AllOfMatches(int num, const Matcher< int > &m)
Definition gmock-matchers_test.cc:2042
internal::FloatingEqMatcher< double > DoubleEq(double rhs)
Definition gmock-matchers.h:3815
internal::AllOfResult2< M1, M2 >::type AllOf(M1 m1, M2 m2)
Definition gmock-generated-matchers.h:1002
const int g_bar
Definition gmock-matchers_test.cc:439
GTEST_API_ string FormatMatcherDescription(bool negation, const char *matcher_name, const Strings ¶m_values)
Definition gmock-matchers.cc:127
string OfType(const string &type_name)
Definition gmock-matchers_test.cc:192
Matcher< int > GreaterThan(int n)
Definition gmock-matchers_test.cc:188
static string EMString(int element, int matcher)
Definition gmock-matchers_test.cc:4936
GTEST_API_ string JoinAsTuple(const Strings &fields)
Definition gmock-matchers.cc:105
string Explain(const MatcherType &m, const Value &x)
Definition gmock-matchers_test.cc:218
internal::ResultOfMatcher< Callable > ResultOf(Callable callable, const ResultOfMatcher &matcher)
Definition gmock-matchers.h:3939
bool IsPositiveIntValue(const IntValue &foo)
Definition gmock-matchers_test.cc:549
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrNe(const internal::string &str)
Definition gmock-matchers.h:3962
bool ExplainMatchResult(M matcher, const T &value, MatchResultListener *listener)
Definition gmock-matchers.h:4354
int IntFunction(int input)
Definition gmock-matchers_test.cc:3818
int IsPositive(double x)
Definition gmock-matchers_test.cc:2431
internal::FloatingEqMatcher< double > NanSensitiveDoubleEq(double rhs)
Definition gmock-matchers.h:3821
PolymorphicMatcher< DivisibleByImpl > DivisibleBy(int n)
Definition gmock-matchers_test.cc:3986
bool ValueIsPositive(const Uncopyable &x)
Definition gmock-matchers_test.cc:3367
PolymorphicMatcher< PolymorphicIsEvenImpl > PolymorphicIsEven()
Definition gmock-matchers_test.cc:501
internal::FloatingEqMatcher< float > FloatNear(float rhs, float max_abs_error)
Definition gmock-matchers.h:3856
::testing::tuple< long, int > Tuple2
Definition gmock-matchers_test.cc:1926
PolymorphicMatcher< internal::MatchesRegexMatcher > ContainsRegex(const internal::RE *regex)
Definition gmock-matchers.h:4016
internal::KeyMatcher< M > Key(M inner_matcher)
Definition gmock-matchers.h:4322
FloatingPointTest< double > DoubleTest
Definition gmock-matchers_test.cc:3011
internal::SizeIsMatcher< SizeMatcher > SizeIs(const SizeMatcher &size_matcher)
Definition gmock-matchers.h:4128
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrCaseEq(const internal::string &str)
Definition gmock-matchers.h:3969
void AnyOfMatches(int num, const Matcher< int > &m)
Definition gmock-matchers_test.cc:2240
internal::PairMatcher< FirstMatcher, SecondMatcher > Pair(FirstMatcher first_matcher, SecondMatcher second_matcher)
Definition gmock-matchers.h:4333
PolymorphicMatcher< Impl > MakePolymorphicMatcher(const Impl &impl)
Definition gmock-matchers.h:496
PolymorphicMatcher< internal::EndsWithMatcher< internal::string > > EndsWith(const internal::string &suffix)
Definition gmock-matchers.h:3998
bool ReferencesFooAndIsZero(const int &n)
Definition gmock-matchers_test.cc:2452
double & DoubleFunction(double &input)
Definition gmock-matchers_test.cc:3841
PolymorphicMatcher< internal::FieldMatcher< Class, FieldType > > Field(FieldType Class::*field, const FieldMatcher &matcher)
Definition gmock-matchers.h:3896
internal::FloatingEqMatcher< double > NanSensitiveDoubleNear(double rhs, double max_abs_error)
Definition gmock-matchers.h:3836
const int * ReferencingFunction(const int &n)
Definition gmock-matchers_test.cc:3940
Matcher< T > MakeMatcher(const MatcherInterface< T > *impl)
Definition gmock-matchers.h:484
internal::AnyOfResult2< M1, M2 >::type AnyOf(M1 m1, M2 m2)
Definition gmock-generated-matchers.h:1085
Matcher< T > MatcherCast(const M &matcher)
Definition gmock-matchers.h:610
PolymorphicMatcher< ReferencesBarOrIsZeroImpl > ReferencesBarOrIsZero()
Definition gmock-matchers_test.cc:458
FloatingPointNearTest< double > DoubleNearTest
Definition gmock-matchers_test.cc:3067
internal::RefMatcher< T & > Ref(T &x)
Definition gmock-matchers.h:3809
internal::UnorderedElementsAreArrayMatcher< typename internal::BoundSecondMatcher< Tuple2Matcher, typename internal::StlContainerView< GTEST_REMOVE_CONST_(RhsContainer)>::type::value_type > > UnorderedPointwise(const Tuple2Matcher &tuple2_matcher, const RhsContainer &rhs_container)
Definition gmock-matchers.h:4223
bool operator==(const ConvertibleFromAny &a, const ConvertibleFromAny &b)
Definition gmock-matchers_test.cc:622
internal::MatcherAsPredicate< M > Matches(M matcher)
Definition gmock-matchers.h:4341
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrEq(const internal::string &str)
Definition gmock-matchers.h:3955
string DescribeNegation(const Matcher< T > &m)
Definition gmock-matchers_test.cc:210
void ExplainMatchFailureTupleTo(const MatcherTuple &matchers, const ValueTuple &values, ::std::ostream *os)
Definition gmock-matchers.h:810
Definition gmock-actions.h:64
::std::vector< ElementMatcherPair > ElementMatcherPairs
Definition gmock-matchers.h:3298
::std::pair< size_t, size_t > ElementMatcherPair
Definition gmock-matchers.h:3297
bool IsReadableTypeName(const string &type_name)
Definition gmock-matchers.h:688
GTEST_API_ string FormatMatcherDescription(bool negation, const char *matcher_name, const Strings ¶m_values)
Definition gmock-matchers.cc:127
GTEST_API_ string JoinAsTuple(const Strings &fields)
Definition gmock-matchers.cc:105
std::string GetTypeName()
Definition gtest-type-util.h:64
::std::string string
Definition gtest-port.h:1097
::std::vector< string > Strings
Definition gtest-printers.h:859
GTEST_API_ ElementMatcherPairs FindMaxBipartiteMatching(const MatchMatrix &g)
Definition gmock-matchers.cc:308
TypeWithSize< 4 >::Int Int32
Definition gtest-port.h:2494
void ExplainMatchFailureTupleTo(const MatcherTuple &matchers, const ValueTuple &values, ::std::ostream *os)
Definition gmock-matchers.h:810
Definition gmock-actions.h:53
PolymorphicMatcher< internal::StartsWithMatcher< internal::string > > StartsWith(const internal::string &prefix)
Definition gmock-matchers.h:3991
internal::NotMatcher< InnerMatcher > Not(InnerMatcher m)
Definition gmock-matchers.h:4107
internal::Le2Matcher Le()
Definition gmock-matchers.h:4094
internal::PointwiseMatcher< TupleMatcher, GTEST_REMOVE_CONST_(Container)> Pointwise(const TupleMatcher &tuple_matcher, const Container &rhs)
Definition gmock-matchers.h:4187
internal::GtMatcher< Rhs > Gt(Rhs x)
Definition gmock-matchers.h:3772
Matcher< Lhs > TypedEq(const Rhs &rhs)
Definition gmock-matchers.h:3762
Matcher< T > An()
Definition gmock-matchers.h:3736
internal::Ne2Matcher Ne()
Definition gmock-matchers.h:4102
internal::LeMatcher< Rhs > Le(Rhs x)
Definition gmock-matchers.h:3778
internal::EqMatcher< T > Eq(T x)
Definition gmock-matchers.h:3742
internal::FloatingEqMatcher< float > FloatEq(float rhs)
Definition gmock-matchers.h:3843
PolymorphicMatcher< internal::NotNullMatcher > NotNull()
Definition gmock-matchers.h:3802
internal::WhenSortedByMatcher< Comparator, ContainerMatcher > WhenSortedBy(const Comparator &comparator, const ContainerMatcher &container_matcher)
Definition gmock-matchers.h:4162
InnerMatcher AllArgs(const InnerMatcher &matcher)
Definition gmock-matchers.h:4382
PolymorphicMatcher< internal::HasSubstrMatcher< internal::string > > HasSubstr(const internal::string &substring)
Definition gmock-matchers.h:3984
PolymorphicMatcher< internal::IsNullMatcher > IsNull()
Definition gmock-matchers.h:3795
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrCaseNe(const internal::string &str)
Definition gmock-matchers.h:3976
internal::WhenSortedByMatcher< internal::LessComparator, ContainerMatcher > WhenSorted(const ContainerMatcher &container_matcher)
Definition gmock-matchers.h:4172
internal::FloatingEqMatcher< float > NanSensitiveFloatEq(float rhs)
Definition gmock-matchers.h:3849
internal::FloatingEqMatcher< float > NanSensitiveFloatNear(float rhs, float max_abs_error)
Definition gmock-matchers.h:3864
internal::LtMatcher< Rhs > Lt(Rhs x)
Definition gmock-matchers.h:3784
internal::EachMatcher< M > Each(M matcher)
Definition gmock-matchers.h:4314
internal::Lt2Matcher Lt()
Definition gmock-matchers.h:4098
internal::Gt2Matcher Gt()
Definition gmock-matchers.h:4090
TYPED_TEST(CodeLocationForTYPEDTEST, Verify)
Definition gtest_unittest.cc:5370
internal::FloatingEqMatcher< double > DoubleNear(double rhs, double max_abs_error)
Definition gmock-matchers.h:3828
PolymorphicMatcher< internal::MatchesRegexMatcher > MatchesRegex(const internal::RE *regex)
Definition gmock-matchers.h:4005
PolymorphicAction< internal::ReturnVoidAction > Return()
Definition gmock-actions.h:1071
PolymorphicMatcher< internal::TrulyMatcher< Predicate > > Truly(Predicate pred)
Definition gmock-matchers.h:4116
const internal::AnythingMatcher _
Definition gmock-matchers.h:3729
PolymorphicMatcher< internal::ContainerEqMatcher< GTEST_REMOVE_CONST_(Container)> > ContainerEq(const Container &rhs)
Definition gmock-matchers.h:4150
internal::FloatingEqMatcher< double > DoubleEq(double rhs)
Definition gmock-matchers.h:3815
internal::AllOfResult2< M1, M2 >::type AllOf(M1 m1, M2 m2)
Definition gmock-generated-matchers.h:1002
Matcher< T > A()
Definition gmock-matchers.h:3732
internal::ResultOfMatcher< Callable > ResultOf(Callable callable, const ResultOfMatcher &matcher)
Definition gmock-matchers.h:3939
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrNe(const internal::string &str)
Definition gmock-matchers.h:3962
bool ExplainMatchResult(M matcher, const T &value, MatchResultListener *listener)
Definition gmock-matchers.h:4354
internal::ElementsAreArrayMatcher< typename ::std::iterator_traits< Iter >::value_type > ElementsAreArray(Iter first, Iter last)
Definition gmock-matchers.h:3646
internal::FloatingEqMatcher< double > NanSensitiveDoubleEq(double rhs)
Definition gmock-matchers.h:3821
internal::ElementsAreMatcher< ::testing::tuple<> > ElementsAre()
Definition gmock-generated-matchers.h:570
internal::FloatingEqMatcher< float > FloatNear(float rhs, float max_abs_error)
Definition gmock-matchers.h:3856
internal::UnorderedElementsAreMatcher< ::testing::tuple<> > UnorderedElementsAre()
Definition gmock-generated-matchers.h:785
internal::Ge2Matcher Ge()
Definition gmock-matchers.h:4086
PolymorphicMatcher< internal::WhenDynamicCastToMatcher< To > > WhenDynamicCastTo(const Matcher< To > &inner_matcher)
Definition gmock-matchers.h:3885
PolymorphicMatcher< internal::MatchesRegexMatcher > ContainsRegex(const internal::RE *regex)
Definition gmock-matchers.h:4016
internal::KeyMatcher< M > Key(M inner_matcher)
Definition gmock-matchers.h:4322
internal::SizeIsMatcher< SizeMatcher > SizeIs(const SizeMatcher &size_matcher)
Definition gmock-matchers.h:4128
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrCaseEq(const internal::string &str)
Definition gmock-matchers.h:3969
::std::string PrintToString(const T &value)
Definition gtest-printers.h:980
internal::ContainsMatcher< M > Contains(M matcher)
Definition gmock-matchers.h:4282
internal::Eq2Matcher Eq()
Definition gmock-matchers.h:4082
PolymorphicMatcher< internal::PropertyMatcher< Class, PropertyType > > Property(PropertyType(Class::*property)() const, const PropertyMatcher &matcher)
Definition gmock-matchers.h:3913
internal::PairMatcher< FirstMatcher, SecondMatcher > Pair(FirstMatcher first_matcher, SecondMatcher second_matcher)
Definition gmock-matchers.h:4333
PolymorphicMatcher< Impl > MakePolymorphicMatcher(const Impl &impl)
Definition gmock-matchers.h:496
PolymorphicMatcher< internal::EndsWithMatcher< internal::string > > EndsWith(const internal::string &suffix)
Definition gmock-matchers.h:3998
internal::ReferenceWrapper< T > ByRef(T &l_value)
Definition gmock-actions.h:1199
PolymorphicMatcher< internal::FieldMatcher< Class, FieldType > > Field(FieldType Class::*field, const FieldMatcher &matcher)
Definition gmock-matchers.h:3896
internal::FloatingEqMatcher< double > NanSensitiveDoubleNear(double rhs, double max_abs_error)
Definition gmock-matchers.h:3836
internal::BeginEndDistanceIsMatcher< DistanceMatcher > BeginEndDistanceIs(const DistanceMatcher &distance_matcher)
Definition gmock-matchers.h:4139
Matcher< T > MakeMatcher(const MatcherInterface< T > *impl)
Definition gmock-matchers.h:484
internal::NeMatcher< Rhs > Ne(Rhs x)
Definition gmock-matchers.h:3790
internal::UnorderedElementsAreArrayMatcher< typename ::std::iterator_traits< Iter >::value_type > UnorderedElementsAreArray(Iter first, Iter last)
Definition gmock-matchers.h:3688
internal::GeMatcher< Rhs > Ge(Rhs x)
Definition gmock-matchers.h:3766
internal::AnyOfResult2< M1, M2 >::type AnyOf(M1 m1, M2 m2)
Definition gmock-generated-matchers.h:1085
Matcher< T > MatcherCast(const M &matcher)
Definition gmock-matchers.h:610
Matcher< T > SafeMatcherCast(const M &polymorphic_matcher)
Definition gmock-matchers.h:665
bool Value(const T &value, M matcher)
Definition gmock-matchers.h:4347
internal::RefMatcher< T & > Ref(T &x)
Definition gmock-matchers.h:3809
internal::UnorderedElementsAreArrayMatcher< typename internal::BoundSecondMatcher< Tuple2Matcher, typename internal::StlContainerView< GTEST_REMOVE_CONST_(RhsContainer)>::type::value_type > > UnorderedPointwise(const Tuple2Matcher &tuple2_matcher, const RhsContainer &rhs_container)
Definition gmock-matchers.h:4223
TYPED_TEST_CASE(CodeLocationForTYPEDTEST, int)
internal::MatcherAsPredicate< M > Matches(M matcher)
Definition gmock-matchers.h:4341
internal::PointeeMatcher< InnerMatcher > Pointee(const InnerMatcher &inner_matcher)
Definition gmock-matchers.h:3872
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrEq(const internal::string &str)
Definition gmock-matchers.h:3955
const GenericPointer< typename T::ValueType > T2 value
Definition pointer.h:1225
const GenericPointer< typename T::ValueType > & pointer
Definition pointer.h:1124
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1124
const char *const str
Definition portlistingparse.c:23
Definition gmock-matchers_test.cc:3374
const double y
Definition gmock-matchers_test.cc:3380
Uncopyable z
Definition gmock-matchers_test.cc:3381
int x
Definition gmock-matchers_test.cc:3379
const char * p
Definition gmock-matchers_test.cc:3382
AStruct()
Definition gmock-matchers_test.cc:3375
AStruct(const AStruct &rhs)
Definition gmock-matchers_test.cc:3376
GTEST_DISALLOW_ASSIGN_(AStruct)
Definition gmock-matchers_test.cc:613
ConvertibleFromAny(const T &)
Definition gmock-matchers_test.cc:616
int value
Definition gmock-matchers_test.cc:619
ConvertibleFromAny(int a_value)
Definition gmock-matchers_test.cc:614
Definition gmock-matchers_test.cc:3389
GTEST_DISALLOW_ASSIGN_(DerivedStruct)
char ch
Definition gmock-matchers_test.cc:3390
Definition gmock-matchers_test.cc:3906
result_type operator()(argument_type input) const
Definition gmock-matchers_test.cc:3907
Definition gmock-matchers_test.cc:643
IntReferenceWrapper(const int &a_value)
Definition gmock-matchers_test.cc:644
const int * value
Definition gmock-matchers_test.cc:645
Definition gmock-matchers_test.cc:3922
int operator()(int n)
Definition gmock-matchers_test.cc:3924
int result_type
Definition gmock-matchers_test.cc:3923
int operator()(const char *s)
Definition gmock-matchers_test.cc:3925
Definition gmock-matchers_test.cc:3942
result_type operator()(const int &n)
Definition gmock-matchers_test.cc:3944
const int * result_type
Definition gmock-matchers_test.cc:3943
Definition gmock-matchers_test.cc:915
static void IsTypeOf(T2 v)
static bool IsTypeOf(const T &)
Definition gmock-matchers_test.cc:916
const char * str1
Definition testupnpdescgen.c:131
const char * str2
Definition testupnpdescgen.c:132