34 #include "gmock/gmock-generated-matchers.h" 44 #include "gmock/gmock.h" 45 #include "gtest/gtest.h" 46 #include "gtest/gtest-spi.h" 54 using std::stringstream;
96 m.DescribeNegationTo(&ss);
101 template <
typename MatcherType,
typename Value>
104 m.ExplainMatchResultTo(x, &ss);
110 TEST(ArgsTest, AcceptsZeroTemplateArg) {
111 const tuple<int, bool>
t(5,
true);
116 TEST(ArgsTest, AcceptsOneTemplateArg) {
117 const tuple<int, bool>
t(5,
true);
123 TEST(ArgsTest, AcceptsTwoTemplateArgs) {
124 const tuple<short, int, long>
t(4, 5, 6L);
131 TEST(ArgsTest, AcceptsRepeatedTemplateArgs) {
132 const tuple<short, int, long>
t(4, 5, 6L);
137 TEST(ArgsTest, AcceptsDecreasingTemplateArgs) {
138 const tuple<short, int, long>
t(4, 5, 6L);
149 # pragma warning(push) 150 # pragma warning(disable:4100) 154 return get<0>(arg) + get<1>(arg) + get<2>(arg) == 0;
157 TEST(ArgsTest, AcceptsMoreTemplateArgsThanArityOfOriginalTuple) {
162 TEST(ArgsTest, CanBeNested) {
163 const tuple<short, int, long, int>
t(4, 5, 6L, 6);
168 TEST(ArgsTest, CanMatchTupleByValue) {
169 typedef tuple<char, int, int> Tuple3;
170 const Matcher<Tuple3> m = Args<1, 2>(
Lt());
175 TEST(ArgsTest, CanMatchTupleByReference) {
176 typedef tuple<char, char, int> Tuple3;
177 const Matcher<const Tuple3&> m = Args<0, 1>(
Lt());
187 TEST(ArgsTest, AcceptsTenTemplateArgs) {
188 EXPECT_THAT(
make_tuple(0, 1L, 2, 3L, 4, 5, 6, 7, 8, 9),
189 (Args<9, 8, 7, 6, 5, 4, 3, 2, 1, 0>(
190 PrintsAs(
"(9, 8, 7, 6, 5, 4, 3, 2, 1, 0)"))));
191 EXPECT_THAT(
make_tuple(0, 1L, 2, 3L, 4, 5, 6, 7, 8, 9),
192 Not(Args<9, 8, 7, 6, 5, 4, 3, 2, 1, 0>(
193 PrintsAs(
"(0, 8, 7, 6, 5, 4, 3, 2, 1, 0)"))));
196 TEST(ArgsTest, DescirbesSelfCorrectly) {
197 const Matcher<tuple<int, bool, char> > m = Args<2, 0>(
Lt());
198 EXPECT_EQ(
"are a tuple whose fields (#2, #0) are a pair where " 199 "the first < the second",
203 TEST(ArgsTest, DescirbesNestedArgsCorrectly) {
204 const Matcher<const tuple<int, bool, char, int>&> m =
205 Args<0, 2, 3>(Args<2, 0>(
Lt()));
206 EXPECT_EQ(
"are a tuple whose fields (#0, #2, #3) are a tuple " 207 "whose fields (#2, #0) are a pair where the first < the second",
211 TEST(ArgsTest, DescribesNegationCorrectly) {
212 const Matcher<tuple<int, char> > m = Args<1, 0>(
Gt());
213 EXPECT_EQ(
"are a tuple whose fields (#1, #0) aren't a pair " 214 "where the first > the second",
218 TEST(ArgsTest, ExplainsMatchResultWithoutInnerExplanation) {
219 const Matcher<tuple<bool, int, int> > m = Args<1, 2>(
Eq());
220 EXPECT_EQ(
"whose fields (#1, #2) are (42, 42)",
222 EXPECT_EQ(
"whose fields (#1, #2) are (42, 43)",
227 class LessThanMatcher :
public MatcherInterface<tuple<char, int> > {
229 virtual void DescribeTo(::std::ostream* os)
const {}
231 virtual bool MatchAndExplain(tuple<char, int>
value,
232 MatchResultListener* listener)
const {
233 const int diff = get<0>(
value) - get<1>(value);
235 *listener <<
"where the first value is " << diff
236 <<
" more than the second";
242 Matcher<tuple<char, int> > LessThan() {
246 TEST(ArgsTest, ExplainsMatchResultWithInnerExplanation) {
247 const Matcher<tuple<char, int, int> > m = Args<0, 2>(LessThan());
248 EXPECT_EQ(
"whose fields (#0, #2) are ('a' (97, 0x61), 42), " 249 "where the first value is 55 more than the second",
251 EXPECT_EQ(
"whose fields (#0, #2) are ('\\0', 43)",
256 class GreaterThanMatcher :
public MatcherInterface<int> {
258 explicit GreaterThanMatcher(
int rhs) : rhs_(rhs) {}
260 virtual void DescribeTo(::std::ostream* os)
const {
261 *os <<
"is greater than " << rhs_;
264 virtual bool MatchAndExplain(
int lhs,
265 MatchResultListener* listener)
const {
266 const int diff = lhs - rhs_;
268 *listener <<
"which is " << diff <<
" more than " << rhs_;
269 }
else if (diff == 0) {
270 *listener <<
"which is the same as " << rhs_;
272 *listener <<
"which is " << -diff <<
" less than " << rhs_;
288 TEST(ElementsAreTest, CanDescribeExpectingNoElement) {
293 TEST(ElementsAreTest, CanDescribeExpectingOneElement) {
298 TEST(ElementsAreTest, CanDescribeExpectingManyElements) {
301 "element #0 is equal to \"one\",\n" 302 "element #1 is equal to \"two\"",
Describe(m));
305 TEST(ElementsAreTest, CanDescribeNegationOfExpectingNoElement) {
310 TEST(ElementsAreTest, CanDescribeNegationOfExpectingOneElment) {
316 TEST(ElementsAreTest, CanDescribeNegationOfExpectingManyElements) {
317 Matcher<const list<string>& > m =
ElementsAre(
"one",
"two");
318 EXPECT_EQ(
"doesn't have 2 elements, or\n" 319 "element #0 isn't equal to \"one\", or\n" 323 TEST(ElementsAreTest, DoesNotExplainTrivialMatch) {
327 test_list.push_back(1);
328 test_list.push_back(3);
332 TEST(ElementsAreTest, ExplainsNonTrivialMatch) {
333 Matcher<const vector<int>& > m =
336 const int a[] = { 10, 0, 100 };
338 EXPECT_EQ(
"whose element #0 matches, which is 9 more than 1,\n" 339 "and whose element #2 matches, which is 98 more than 2",
343 TEST(ElementsAreTest, CanExplainMismatchWrongSize) {
350 test_list.push_back(1);
354 TEST(ElementsAreTest, CanExplainMismatchRightSize) {
363 EXPECT_EQ(
"whose element #1 doesn't match, which is 4 less than 5",
367 TEST(ElementsAreTest, MatchesOneElementVector) {
369 test_vector.push_back(
"test string");
374 TEST(ElementsAreTest, MatchesOneElementList) {
376 test_list.push_back(
"test string");
381 TEST(ElementsAreTest, MatchesThreeElementVector) {
383 test_vector.push_back(
"one");
384 test_vector.push_back(
"two");
385 test_vector.push_back(
"three");
390 TEST(ElementsAreTest, MatchesOneElementEqMatcher) {
392 test_vector.push_back(4);
397 TEST(ElementsAreTest, MatchesOneElementAnyMatcher) {
399 test_vector.push_back(4);
404 TEST(ElementsAreTest, MatchesOneElementValue) {
406 test_vector.push_back(4);
411 TEST(ElementsAreTest, MatchesThreeElementsMixedMatchers) {
413 test_vector.push_back(1);
414 test_vector.push_back(2);
415 test_vector.push_back(3);
420 TEST(ElementsAreTest, MatchesTenElementVector) {
421 const int a[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
430 TEST(ElementsAreTest, DoesNotMatchWrongSize) {
432 test_vector.push_back(
"test string");
433 test_vector.push_back(
"test string");
439 TEST(ElementsAreTest, DoesNotMatchWrongValue) {
441 test_vector.push_back(
"other string");
447 TEST(ElementsAreTest, DoesNotMatchWrongOrder) {
449 test_vector.push_back(
"one");
450 test_vector.push_back(
"three");
451 test_vector.push_back(
"two");
458 TEST(ElementsAreTest, WorksForNestedContainer) {
466 nested.push_back(list<char>(strings[
i], strings[i] + strlen(strings[i])));
475 TEST(ElementsAreTest, WorksWithByRefElementMatchers) {
476 int a[] = { 0, 1, 2 };
483 TEST(ElementsAreTest, WorksWithContainerPointerUsingPointee) {
484 int a[] = { 0, 1, 2 };
491 TEST(ElementsAreTest, WorksWithNativeArrayPassedByReference) {
492 int array[] = { 0, 1, 2 };
498 class NativeArrayPassedAsPointerAndSize {
500 NativeArrayPassedAsPointerAndSize() {}
508 TEST(ElementsAreTest, WorksWithNativeArrayPassedAsPointerAndSize) {
509 int array[] = { 0, 1 };
510 ::testing::tuple<int*, size_t> array_as_tuple(array, 2);
514 NativeArrayPassedAsPointerAndSize helper;
517 helper.Helper(array, 2);
520 TEST(ElementsAreTest, WorksWithTwoDimensionalNativeArray) {
521 const char a2[][3] = {
"hi",
"lo" };
529 TEST(ElementsAreTest, AcceptsStringLiteral) {
530 string array[] = {
"hi",
"one",
"two" };
543 extern const char kHi[];
545 TEST(ElementsAreTest, AcceptsArrayWithUnknownSize) {
549 string array1[] = {
"hi" };
552 string array2[] = {
"ho" };
556 const char kHi[] =
"hi";
560 TEST(ElementsAreTest, MakesCopyOfArguments) {
568 const int array1[] = { 1, 2 };
570 const int array2[] = { 0, 0 };
579 TEST(ElementsAreArrayTest, CanBeCreatedWithValueArray) {
580 const int a[] = { 1, 2, 3 };
589 TEST(ElementsAreArrayTest, CanBeCreatedWithArraySize) {
590 const char* a[] = {
"one",
"two",
"three" };
596 test_vector[0] =
"1";
600 TEST(ElementsAreArrayTest, CanBeCreatedWithoutArraySize) {
601 const char* a[] = {
"one",
"two",
"three" };
606 test_vector[0] =
"1";
610 TEST(ElementsAreArrayTest, CanBeCreatedWithMatcherArray) {
611 const Matcher<string> kMatcherArray[] =
615 test_vector.push_back(
"one");
616 test_vector.push_back(
"two");
617 test_vector.push_back(
"three");
620 test_vector.push_back(
"three");
624 TEST(ElementsAreArrayTest, CanBeCreatedWithVector) {
625 const int a[] = { 1, 2, 3 };
629 test_vector.push_back(4);
633 #if GTEST_HAS_STD_INITIALIZER_LIST_ 635 TEST(ElementsAreArrayTest, TakesInitializerList) {
636 const int a[5] = { 1, 2, 3, 4, 5 };
642 TEST(ElementsAreArrayTest, TakesInitializerListOfCStrings) {
643 const string a[5] = {
"a",
"b",
"c",
"d",
"e" };
649 TEST(ElementsAreArrayTest, TakesInitializerListOfSameTypedMatchers) {
650 const int a[5] = { 1, 2, 3, 4, 5 };
657 TEST(ElementsAreArrayTest,
658 TakesInitializerListOfDifferentTypedMatchers) {
659 const int a[5] = { 1, 2, 3, 4, 5 };
669 #endif // GTEST_HAS_STD_INITIALIZER_LIST_ 671 TEST(ElementsAreArrayTest, CanBeCreatedWithMatcherVector) {
672 const int a[] = { 1, 2, 3 };
673 const Matcher<int> kMatchers[] = {
Eq(1),
Eq(2),
Eq(3) };
678 test_vector.push_back(4);
682 TEST(ElementsAreArrayTest, CanBeCreatedWithIteratorRange) {
683 const int a[] = { 1, 2, 3 };
690 int*
const null_int = NULL;
697 TEST(ElementsAreArrayTest, WorksWithNativeArray) {
706 TEST(ElementsAreArrayTest, SourceLifeSpan) {
707 const int a[] = { 1, 2, 3 };
710 ElementsAreArrayMatcher<int> matcher_maker =
716 for (Iter it =
expect.begin(); it !=
expect.end(); ++it) { *it += 10; }
718 test_vector.push_back(3);
726 MATCHER(IsEven,
"") {
return (arg % 2) == 0; }
728 TEST(MatcherMacroTest, Works) {
729 const Matcher<int> m = IsEven();
740 MATCHER(IsEven2, negation ?
"is odd" :
"is even") {
741 if ((arg % 2) == 0) {
744 *result_listener <<
"OK";
747 *result_listener <<
"% 2 == " << (arg % 2);
755 string(negation ?
"doesn't equal" :
"equals") +
" the sum of " +
757 if (arg == (x + y)) {
758 *result_listener <<
"OK";
763 if (result_listener->stream() != NULL) {
764 *result_listener->stream() <<
"diff == " << (x + y - arg);
772 TEST(MatcherMacroTest, DescriptionCanReferenceNegationAndParameters) {
773 const Matcher<int> m1 = IsEven2();
777 const Matcher<int> m2 = EqSumOf(5, 9);
783 TEST(MatcherMacroTest, CanExplainMatchResult) {
784 const Matcher<int> m1 = IsEven2();
788 const Matcher<int> m2 = EqSumOf(1, 2);
797 StaticAssertTypeEq< ::std::string, arg_type>();
801 MATCHER(IsEmptyStringByRef,
"") {
802 StaticAssertTypeEq<const ::std::string&, arg_type>();
806 TEST(MatcherMacroTest, CanReferenceArgType) {
807 const Matcher< ::std::string> m1 = IsEmptyString();
810 const Matcher<const ::std::string&> m2 = IsEmptyStringByRef();
817 MATCHER(IsOdd,
"") {
return (arg % 2) != 0; }
820 TEST(MatcherMacroTest, WorksInNamespace) {
821 Matcher<int> m = matcher_test::IsOdd();
828 return Value(arg, matcher_test::IsOdd()) && arg > 0;
831 TEST(MatcherMacroTest, CanBeComposedUsingValue) {
839 MATCHER_P(IsGreaterThan32And, n,
"") {
return arg > 32 && arg > n; }
841 TEST(MatcherPMacroTest, Works) {
842 const Matcher<int> m = IsGreaterThan32And(5);
853 MATCHER_P(_is_Greater_Than32and_, n,
"") {
return arg > 32 && arg > n; }
855 TEST(MatcherPMacroTest, GeneratesCorrectDescription) {
856 const Matcher<int> m = _is_Greater_Than32and_(5);
867 class UncopyableFoo {
869 explicit UncopyableFoo(
char value) : value_(value) {}
871 UncopyableFoo(
const UncopyableFoo&);
872 void operator=(
const UncopyableFoo&);
877 MATCHER_P(ReferencesUncopyable, variable,
"") {
return &arg == &variable; }
879 TEST(MatcherPMacroTest, WorksWhenExplicitlyInstantiatedWithReference) {
881 const Matcher<const UncopyableFoo&> m =
882 ReferencesUncopyable<const UncopyableFoo&>(
foo1);
899 StaticAssertTypeEq<int, foo_type>();
900 StaticAssertTypeEq<long, bar_type>();
901 StaticAssertTypeEq<char, baz_type>();
905 TEST(MatcherPnMacroTest, CanReferenceParamTypes) {
906 EXPECT_THAT(0, ParamTypesAreIntLongAndChar(10, 20L,
'a'));
912 MATCHER_P2(ReferencesAnyOf, variable1, variable2,
"") {
913 return &arg == &variable1 || &arg == &variable2;
916 TEST(MatcherPnMacroTest, WorksWhenExplicitlyInstantiatedWithReferences) {
917 UncopyableFoo
foo1(
'1'),
foo2(
'2'), foo3(
'3');
918 const Matcher<const UncopyableFoo&> m =
919 ReferencesAnyOf<const UncopyableFoo&, const UncopyableFoo&>(
foo1,
foo2);
926 TEST(MatcherPnMacroTest,
927 GeneratesCorretDescriptionWhenExplicitlyInstantiatedWithReferences) {
929 const Matcher<const UncopyableFoo&> m =
930 ReferencesAnyOf<const UncopyableFoo&, const UncopyableFoo&>(
foo1,
foo2);
936 EXPECT_EQ(
"references any of (1-byte object <31>, 1-byte object <32>)",
942 MATCHER_P2(IsNotInClosedRange, low, hi,
"") {
return arg < low || arg > hi; }
944 TEST(MatcherPnMacroTest, Works) {
945 const Matcher<const long&> m = IsNotInClosedRange(10, 20);
958 MATCHER(EqualsSumOf,
"") {
return arg == 0; }
959 MATCHER_P(EqualsSumOf, a,
"") {
return arg ==
a; }
960 MATCHER_P2(EqualsSumOf, a, b,
"") {
return arg == a +
b; }
961 MATCHER_P3(EqualsSumOf, a, b,
c,
"") {
return arg == a + b +
c; }
962 MATCHER_P4(EqualsSumOf, a, b,
c, d,
"") {
return arg == a + b +
c + d; }
963 MATCHER_P5(EqualsSumOf, a, b,
c, d, e,
"") {
return arg == a + b +
c + d + e; }
965 return arg == a + b +
c + d + e +
f;
968 return arg == a + b +
c + d + e +
f +
g;
971 return arg == a + b +
c + d + e +
f +
g +
h;
973 MATCHER_P9(EqualsSumOf, a, b,
c, d, e,
f,
g,
h, i,
"") {
974 return arg == a + b +
c + d + e +
f +
g +
h +
i;
976 MATCHER_P10(EqualsSumOf, a, b,
c, d, e,
f,
g,
h, i, j,
"") {
977 return arg == a + b +
c + d + e +
f +
g +
h + i + j;
980 TEST(MatcherPnMacroTest, CanBeOverloadedOnNumberOfParameters) {
986 EXPECT_THAT(12345, EqualsSumOf(10000, 2000, 300, 40, 5));
988 EqualsSumOf(::
std::string(
"a"),
'b',
'c',
"d",
"e",
'f'));
990 EqualsSumOf(::
std::string(
"a"),
'b',
'c',
"d",
"e",
'f',
'g'));
992 EqualsSumOf(::
std::string(
"a"),
'b',
'c',
"d",
"e",
'f',
'g',
995 EqualsSumOf(::
std::string(
"a"),
'b',
'c',
"d",
"e",
'f',
'g',
998 EqualsSumOf(::
std::string(
"a"),
'b',
'c',
"d",
"e",
'f',
'g',
1013 Not(EqualsSumOf(::
std::string(
"a"),
'b',
'c',
"d",
"e",
'f',
'g',
1016 Not(EqualsSumOf(::
std::string(
"a"),
'b',
'c',
"d",
"e",
'f',
'g',
1019 Not(EqualsSumOf(::
std::string(
"a"),
'b',
'c',
"d",
"e",
'f',
'g',
1025 TEST(MatcherPnMacroTest, WorksForDifferentParameterTypes) {
1026 EXPECT_THAT(123, EqualsSumOf(100L, 20, static_cast<char>(3)));
1029 EXPECT_THAT(124,
Not(EqualsSumOf(100L, 20, static_cast<char>(3))));
1038 char suffix_char =
static_cast<char>(
suffix);
1039 return arg == prefix_str + suffix_char;
1042 TEST(MatcherPnMacroTest, SimpleTypePromotion) {
1043 Matcher<std::string> no_promo =
1045 Matcher<const std::string&> promo =
1046 EqConcat(
"foo", static_cast<int>(
't'));
1055 TEST(MatcherPnMacroTest, TypesAreCorrect) {
1057 EqualsSumOfMatcher a0 = EqualsSumOf();
1060 EqualsSumOfMatcherP<int> a1 = EqualsSumOf(1);
1064 EqualsSumOfMatcherP2<int, char> a2 = EqualsSumOf(1,
'2');
1065 EqualsSumOfMatcherP3<int, int, char> a3 = EqualsSumOf(1, 2,
'3');
1066 EqualsSumOfMatcherP4<int, int, int, char> a4 = EqualsSumOf(1, 2, 3,
'4');
1067 EqualsSumOfMatcherP5<int, int, int, int, char> a5 =
1068 EqualsSumOf(1, 2, 3, 4,
'5');
1069 EqualsSumOfMatcherP6<int, int, int, int, int, char> a6 =
1070 EqualsSumOf(1, 2, 3, 4, 5,
'6');
1071 EqualsSumOfMatcherP7<int, int, int, int, int, int, char> a7 =
1072 EqualsSumOf(1, 2, 3, 4, 5, 6,
'7');
1073 EqualsSumOfMatcherP8<int, int, int, int, int, int, int, char> a8 =
1074 EqualsSumOf(1, 2, 3, 4, 5, 6, 7,
'8');
1075 EqualsSumOfMatcherP9<int, int, int, int, int, int, int, int, char> a9 =
1076 EqualsSumOf(1, 2, 3, 4, 5, 6, 7, 8,
'9');
1077 EqualsSumOfMatcherP10<int, int, int, int, int, int, int, int, int, char> a10 =
1078 EqualsSumOf(1, 2, 3, 4, 5, 6, 7, 8, 9,
'0');
1099 const int count =
static_cast<int>(
Value(arg, m1))
1100 + static_cast<int>(
Value(arg, m2)) + static_cast<int>(
Value(arg, m3));
1104 TEST(MatcherPnMacroTest, CanUseMatcherTypedParameterInValue) {
1111 TEST(ContainsTest, ListMatchesWhenElementIsInContainer) {
1112 list<int> some_list;
1113 some_list.push_back(3);
1114 some_list.push_back(1);
1115 some_list.push_back(2);
1120 list<string> another_list;
1121 another_list.push_back(
"fee");
1122 another_list.push_back(
"fie");
1123 another_list.push_back(
"foe");
1124 another_list.push_back(
"fum");
1128 TEST(ContainsTest, ListDoesNotMatchWhenElementIsNotInContainer) {
1129 list<int> some_list;
1130 some_list.push_back(3);
1131 some_list.push_back(1);
1135 TEST(ContainsTest, SetMatchesWhenElementIsInContainer) {
1145 another_set.insert(
"fee");
1146 another_set.insert(
"fie");
1147 another_set.insert(
"foe");
1148 another_set.insert(
"fum");
1152 TEST(ContainsTest, SetDoesNotMatchWhenElementIsNotInContainer) {
1159 c_string_set.insert(
"hello");
1163 TEST(ContainsTest, ExplainsMatchResultCorrectly) {
1164 const int a[2] = { 1, 2 };
1165 Matcher<const int (&)[2]> m =
Contains(2);
1172 EXPECT_EQ(
"whose element #0 matches, which is 1 more than 0",
Explain(m, a));
1178 TEST(ContainsTest, DescribesItselfCorrectly) {
1179 Matcher<vector<int> > m =
Contains(1);
1182 Matcher<vector<int> > m2 =
Not(m);
1186 TEST(ContainsTest, MapMatchesWhenElementIsInContainer) {
1188 const char*
bar =
"a string";
1193 another_map[
"fee"] = 1;
1194 another_map[
"fie"] = 2;
1195 another_map[
"foe"] = 3;
1196 another_map[
"fum"] = 4;
1201 TEST(ContainsTest, MapDoesNotMatchWhenElementIsNotInContainer) {
1208 TEST(ContainsTest, ArrayMatchesWhenElementIsInContainer) {
1209 const char* string_array[] = {
"fee",
"fie",
"foe",
"fum" };
1213 TEST(ContainsTest, ArrayDoesNotMatchWhenElementIsNotInContainer) {
1214 int int_array[] = { 1, 2, 3, 4 };
1218 TEST(ContainsTest, AcceptsMatcher) {
1219 const int a[] = { 1, 2, 3 };
1224 TEST(ContainsTest, WorksForNativeArrayAsTuple) {
1225 const int a[] = { 1, 2 };
1226 const int*
const pointer =
a;
1231 TEST(ContainsTest, WorksForTwoDimensionalNativeArray) {
1232 int a[][3] = { { 1, 2, 3 }, { 4, 5, 6 } };
1239 TEST(AllOfTest, HugeMatcher) {
1242 EXPECT_THAT(0,
testing::AllOf(
_,
_,
_,
_,
_,
_,
_,
_,
_,
1246 TEST(AnyOfTest, HugeMatcher) {
1249 EXPECT_THAT(0,
testing::AnyOf(
_,
_,
_,
_,
_,
_,
_,
_,
_,
1264 template <
typename T1,
typename T2>
1265 bool AllOf(
const T1& t1,
const T2& t2) {
return true; }
1267 TEST(AllOfTest, DoesNotCallAllOfUnqualified) {
1269 M(),
M(),
M(),
M(),
M(),
M(),
M(),
M(),
M(),
M()));
1272 template <
typename T1,
typename T2>
bool 1273 AnyOf(
const T1& t1,
const T2& t2) {
return true; }
1275 TEST(AnyOfTest, DoesNotCallAnyOfUnqualified) {
1277 M(),
M(),
M(),
M(),
M(),
M(),
M(),
M(),
M(),
M()));
1283 # pragma warning(pop) string Describe(const Matcher< T > &m)
Matcher< int > GreaterThan(int n)
internal::GtMatcher< Rhs > Gt(Rhs x)
#define MATCHER_P2(name, p0, p1, description)
#define TEST(test_case_name, test_name)
internal::NeMatcher< Rhs > Ne(Rhs x)
#define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description)
#define MATCHER_P4(name, p0, p1, p2, p3, description)
internal::EqMatcher< T > Eq(T x)
::std::string PrintToString(const T &value)
#define GTEST_ARRAY_SIZE_(array)
#define EXPECT_EQ(val1, val2)
#define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)
FOLLY_NOINLINE void foo2()
#define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description)
string Explain(const MatcherType &m, const Value &x)
internal::ArgsMatcher< InnerMatcher > Args(const InnerMatcher &matcher)
bool prefix(Cursor &c, uint32_t expected)
string DescribeNegation(const Matcher< T > &m)
internal::AllOfResult2< M1, M2 >::type AllOf(M1 m1, M2 m2)
internal::RefMatcher< T & > Ref(T &x)
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrEq(const internal::string &str)
FOLLY_PUSH_WARNING RHS rhs
internal::LtMatcher< Rhs > Lt(Rhs x)
constexpr auto size(C const &c) -> decltype(c.size())
internal::LeMatcher< Rhs > Le(Rhs x)
FOLLY_NOINLINE void foo1()
def Iter(n, format, sep='')
internal::ElementsAreArrayMatcher< typename::std::iterator_traits< Iter >::value_type > ElementsAreArray(Iter first, Iter last)
bool Value(const T &value, M matcher)
internal::NotMatcher< InnerMatcher > Not(InnerMatcher m)
internal::AnyOfResult2< M1, M2 >::type AnyOf(M1 m1, M2 m2)
Matcher< T > MakeMatcher(const MatcherInterface< T > *impl)
#define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description)
#define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, description)
Encoder::MutableCompressedList list
static map< string, int > m
internal::PointeeMatcher< InnerMatcher > Pointee(const InnerMatcher &inner_matcher)
void expect(LineReader &lr, const char *expected)
static const char *const value
folly::Singleton< int > bar
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
#define MATCHER_P(name, p0, description)
StrictConjunction< T< As >... > AllOf
#define EXPECT_TRUE(condition)
#define EXPECT_THAT(value, matcher)
uint64_t diff(uint64_t a, uint64_t b)
#define MATCHER_P3(name, p0, p1, p2, description)
bool StaticAssertTypeEq()
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
MATCHER(IsFlowException,"")
#define EXPECT_FALSE(condition)
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
internal::GeMatcher< Rhs > Ge(Rhs x)
internal::ContainsMatcher< M > Contains(M matcher)
#define MATCHER_P5(name, p0, p1, p2, p3, p4, description)
static vector< fbstring > strings
#define MOCK_METHOD2(m,...)
PUSHMI_INLINE_VAR constexpr detail::get_fn< T > get
internal::ElementsAreMatcher< ::testing::tuple<> > ElementsAre()