52 namespace gmock_matchers_test {
55 TEST(AddressTest, NonConst) {
57 const Matcher<int> m = Address(Eq(&n));
70 TEST(AddressTest, Const) {
72 const Matcher<int> m = Address(Eq(&n));
81 TEST(AddressTest, MatcherDoesntCopy) {
82 std::unique_ptr<int> n(
new int(1));
83 const Matcher<std::unique_ptr<int>> m = Address(Eq(&n));
89 Matcher<int> matcher = Address(
_);
91 EXPECT_EQ(
"does not have address that is anything",
101 explicit NotCopyable(
int a_value) :
value_(a_value) {}
105 bool operator==(
const NotCopyable& rhs)
const {
106 return value() == rhs.value();
109 bool operator>=(
const NotCopyable& rhs)
const {
110 return value() >= rhs.value();
116 NotCopyable(
const NotCopyable&) =
delete;
117 NotCopyable& operator=(
const NotCopyable&) =
delete;
120 TEST(ByRefTest, AllowsNotCopyableConstValueInMatchers) {
121 const NotCopyable const_value1(1);
122 const Matcher<const NotCopyable&> m = Eq(
ByRef(const_value1));
124 const NotCopyable n1(1), n2(2);
129 TEST(ByRefTest, AllowsNotCopyableValueInMatchers) {
130 NotCopyable value2(2);
131 const Matcher<NotCopyable&> m = Ge(
ByRef(value2));
133 NotCopyable n1(1), n2(2);
138 TEST(IsEmptyTest, ImplementsIsEmpty) {
141 container.push_back(0);
143 container.push_back(1);
147 TEST(IsEmptyTest, WorksWithString) {
152 text = std::string(
"\0", 1);
156 TEST(IsEmptyTest, CanDescribeSelf) {
157 Matcher<vector<int>> m =
IsEmpty();
162 TEST(IsEmptyTest, ExplainsResult) {
163 Matcher<vector<int>> m =
IsEmpty();
164 vector<int> container;
166 container.push_back(0);
170 TEST(IsEmptyTest, WorksWithMoveOnly) {
171 ContainerHelper helper;
176 TEST(IsTrueTest, IsTrueIsFalse) {
204 std::unique_ptr<int> null_unique;
205 std::unique_ptr<int> nonnull_unique(
new int(0));
212 #ifdef GTEST_HAS_TYPED_TEST
216 template <
typename T>
220 ContainerEqTestTypes;
226 static const int vals[] = {1, 1, 2, 3, 5, 8};
227 TypeParam my_set(vals, vals + 6);
228 const Matcher<TypeParam> m = ContainerEq(my_set);
235 static const int vals[] = {1, 1, 2, 3, 5, 8};
236 static const int test_vals[] = {2, 1, 8, 5};
237 TypeParam my_set(vals, vals + 6);
238 TypeParam test_set(test_vals, test_vals + 4);
239 const Matcher<TypeParam> m = ContainerEq(my_set);
241 EXPECT_EQ(
"which doesn't have these expected elements: 3",
247 static const int vals[] = {1, 1, 2, 3, 5, 8};
248 static const int test_vals[] = {1, 2, 3, 5, 8, 46};
249 TypeParam my_set(vals, vals + 6);
250 TypeParam test_set(test_vals, test_vals + 6);
251 const Matcher<const TypeParam&> m = ContainerEq(my_set);
257 TYPED_TEST(ContainerEqTest, ValueAddedAndRemoved) {
258 static const int vals[] = {1, 1, 2, 3, 5, 8};
259 static const int test_vals[] = {1, 2, 3, 8, 46};
260 TypeParam my_set(vals, vals + 6);
261 TypeParam test_set(test_vals, test_vals + 5);
262 const Matcher<TypeParam> m = ContainerEq(my_set);
265 "which has these unexpected elements: 46,\n"
266 "and doesn't have these expected elements: 5",
271 TYPED_TEST(ContainerEqTest, DuplicateDifference) {
272 static const int vals[] = {1, 1, 2, 3, 5, 8};
273 static const int test_vals[] = {1, 2, 3, 5, 8};
274 TypeParam my_set(vals, vals + 6);
275 TypeParam test_set(test_vals, test_vals + 5);
276 const Matcher<const TypeParam&> m = ContainerEq(my_set);
281 #endif // GTEST_HAS_TYPED_TEST
285 TEST(ContainerEqExtraTest, MultipleValuesMissing) {
286 static const int vals[] = {1, 1, 2, 3, 5, 8};
287 static const int test_vals[] = {2, 1, 5};
288 vector<int> my_set(vals, vals + 6);
289 vector<int> test_set(test_vals, test_vals + 3);
290 const Matcher<vector<int>> m = ContainerEq(my_set);
292 EXPECT_EQ(
"which doesn't have these expected elements: 3, 8",
298 TEST(ContainerEqExtraTest, MultipleValuesAdded) {
299 static const int vals[] = {1, 1, 2, 3, 5, 8};
300 static const int test_vals[] = {1, 2, 92, 3, 5, 8, 46};
301 list<size_t> my_set(vals, vals + 6);
302 list<size_t> test_set(test_vals, test_vals + 7);
303 const Matcher<const list<size_t>&> m = ContainerEq(my_set);
305 EXPECT_EQ(
"which has these unexpected elements: 92, 46",
310 TEST(ContainerEqExtraTest, MultipleValuesAddedAndRemoved) {
311 static const int vals[] = {1, 1, 2, 3, 5, 8};
312 static const int test_vals[] = {1, 2, 3, 92, 46};
313 list<size_t> my_set(vals, vals + 6);
314 list<size_t> test_set(test_vals, test_vals + 5);
315 const Matcher<const list<size_t>> m = ContainerEq(my_set);
318 "which has these unexpected elements: 92, 46,\n"
319 "and doesn't have these expected elements: 5, 8",
325 TEST(ContainerEqExtraTest, MultiSetOfIntDuplicateDifference) {
326 static const int vals[] = {1, 1, 2, 3, 5, 8};
327 static const int test_vals[] = {1, 2, 3, 5, 8};
328 vector<int> my_set(vals, vals + 6);
329 vector<int> test_set(test_vals, test_vals + 5);
330 const Matcher<vector<int>> m = ContainerEq(my_set);
339 TEST(ContainerEqExtraTest, WorksForMaps) {
340 map<int, std::string> my_map;
344 map<int, std::string> test_map;
348 const Matcher<const map<int, std::string>&> m = ContainerEq(my_map);
353 "which has these unexpected elements: (0, \"aa\"),\n"
354 "and doesn't have these expected elements: (0, \"a\")",
358 TEST(ContainerEqExtraTest, WorksForNativeArray) {
359 int a1[] = {1, 2, 3};
360 int a2[] = {1, 2, 3};
367 TEST(ContainerEqExtraTest, WorksForTwoDimensionalNativeArray) {
368 const char a1[][3] = {
"hi",
"lo"};
369 const char a2[][3] = {
"hi",
"lo"};
370 const char b[][3] = {
"lo",
"hi"};
377 EXPECT_THAT(a1, ElementsAre(ContainerEq(a2[0]), ContainerEq(a2[1])));
378 EXPECT_THAT(a1, ElementsAre(Not(ContainerEq(b[0])), ContainerEq(a2[1])));
381 TEST(ContainerEqExtraTest, WorksForNativeArrayAsTuple) {
382 const int a1[] = {1, 2, 3};
383 const int a2[] = {1, 2, 3};
384 const int b[] = {1, 2, 3, 4};
386 const int*
const p1 = a1;
387 EXPECT_THAT(std::make_tuple(p1, 3), ContainerEq(a2));
388 EXPECT_THAT(std::make_tuple(p1, 3), Not(ContainerEq(b)));
390 const int c[] = {1, 3, 2};
391 EXPECT_THAT(std::make_tuple(p1, 3), Not(ContainerEq(c)));
394 TEST(ContainerEqExtraTest, CopiesNativeArrayParameter) {
395 std::string a1[][3] = {{
"hi",
"hello",
"ciao"}, {
"bye",
"see you",
"ciao"}};
397 std::string a2[][3] = {{
"hi",
"hello",
"ciao"}, {
"bye",
"see you",
"ciao"}};
399 const Matcher<const std::string(&)[2][3]> m = ContainerEq(a2);
412 template <
typename Graph>
413 class BacktrackingMaxBPMState {
416 explicit BacktrackingMaxBPMState(
const Graph* g) :
graph_(g) {}
418 ElementMatcherPairs Compute() {
424 for (
size_t irhs = 0; irhs <
graph_->RhsSize(); ++irhs) {
433 static const size_t kUnused =
static_cast<size_t>(-1);
435 void PushMatch(
size_t lhs,
size_t rhs) {
436 matches_.push_back(ElementMatcherPair(lhs, rhs));
445 const ElementMatcherPair& back =
matches_.back();
451 bool RecurseInto(
size_t irhs) {
455 for (
size_t ilhs = 0; ilhs <
graph_->LhsSize(); ++ilhs) {
459 if (!
graph_->HasEdge(ilhs, irhs)) {
462 PushMatch(ilhs, irhs);
466 for (
size_t mi = irhs + 1; mi <
graph_->RhsSize(); ++mi) {
467 if (!RecurseInto(mi))
return false;
481 template <
typename Graph>
488 template <
typename Graph>
489 ElementMatcherPairs FindBacktrackingMaxBPM(
const Graph& g) {
490 return BacktrackingMaxBPMState<Graph>(&g).Compute();
500 TEST_P(BipartiteTest, Exhaustive) {
501 size_t nodes = GetParam();
502 MatchMatrix graph(nodes, nodes);
505 EXPECT_EQ(FindBacktrackingMaxBPM(graph).size(), matches.size())
506 <<
"graph: " << graph.DebugString();
509 std::vector<bool> seen_element(graph.LhsSize());
510 std::vector<bool> seen_matcher(graph.RhsSize());
512 for (
size_t i = 0;
i < matches.size(); ++
i) {
513 size_t ilhs = matches[
i].first;
514 size_t irhs = matches[
i].second;
518 seen_element[ilhs] =
true;
519 seen_matcher[irhs] =
true;
521 }
while (graph.NextGraph());
528 class BipartiteNonSquareTest
531 TEST_F(BipartiteNonSquareTest, SimpleBacktracking) {
540 constexpr std::array<std::array<size_t, 2>, 4> kEdges = {
541 {{{0, 2}}, {{1, 1}}, {{2, 1}}, {{3, 0}}}};
542 for (
size_t i = 0;
i < kEdges.size(); ++
i) {
543 g.SetEdge(kEdges[
i][0], kEdges[i][1],
true);
546 ElementsAre(Pair(3, 0), Pair(AnyOf(1, 2), 1), Pair(0, 2)))
551 TEST_P(BipartiteNonSquareTest, Exhaustive) {
552 size_t nlhs = GetParam().first;
553 size_t nrhs = GetParam().second;
554 MatchMatrix graph(nlhs, nrhs);
556 EXPECT_EQ(FindBacktrackingMaxBPM(graph).size(),
558 <<
"graph: " << graph.DebugString()
559 <<
"\nbacktracking: " <<
PrintToString(FindBacktrackingMaxBPM(graph))
562 }
while (graph.NextGraph());
566 AllGraphs, BipartiteNonSquareTest,
568 std::make_pair(3, 2), std::make_pair(2, 3),
569 std::make_pair(4, 1), std::make_pair(1, 4),
570 std::make_pair(4, 3), std::make_pair(3, 4)));
572 class BipartiteRandomTest
576 TEST_P(BipartiteRandomTest, LargerNets) {
577 int nodes = GetParam().first;
578 int iters = GetParam().second;
579 MatchMatrix graph(static_cast<size_t>(nodes), static_cast<size_t>(nodes));
583 seed =
static_cast<uint32_t
>(time(
nullptr));
586 for (; iters > 0; --iters, ++seed) {
587 srand(static_cast<unsigned int>(seed));
589 EXPECT_EQ(FindBacktrackingMaxBPM(graph).size(),
591 <<
" graph: " << graph.DebugString()
592 <<
"\nTo reproduce the failure, rerun the test with the flag"
601 std::make_pair(6, 5000),
602 std::make_pair(7, 2000),
603 std::make_pair(8, 500),
604 std::make_pair(9, 100)));
608 TEST(IsReadableTypeNameTest, ReturnsTrueForShortNames) {
610 EXPECT_TRUE(IsReadableTypeName(
"const unsigned char*"));
611 EXPECT_TRUE(IsReadableTypeName(
"MyMap<int, void*>"));
612 EXPECT_TRUE(IsReadableTypeName(
"void (*)(int, bool)"));
615 TEST(IsReadableTypeNameTest, ReturnsTrueForLongNonTemplateNonFunctionNames) {
616 EXPECT_TRUE(IsReadableTypeName(
"my_long_namespace::MyClassName"));
617 EXPECT_TRUE(IsReadableTypeName(
"int [5][6][7][8][9][10][11]"));
618 EXPECT_TRUE(IsReadableTypeName(
"my_namespace::MyOuterClass::MyInnerClass"));
621 TEST(IsReadableTypeNameTest, ReturnsFalseForLongTemplateNames) {
623 IsReadableTypeName(
"basic_string<char, std::char_traits<char> >"));
624 EXPECT_FALSE(IsReadableTypeName(
"std::vector<int, std::alloc_traits<int> >"));
627 TEST(IsReadableTypeNameTest, ReturnsFalseForLongFunctionTypeNames) {
628 EXPECT_FALSE(IsReadableTypeName(
"void (&)(int, bool, char, float)"));
633 TEST(FormatMatcherDescriptionTest, WorksForEmptyDescription) {
643 "is in range (a: 5, b: 8)",
649 TEST_P(MatcherTupleTestP, ExplainsMatchFailure) {
651 ExplainMatchFailureTupleTo(
652 std::make_tuple(Matcher<char>(Eq(
'a')), GreaterThan(5)),
653 std::make_tuple(
'a', 10), &ss1);
657 ExplainMatchFailureTupleTo(
658 std::make_tuple(GreaterThan(5), Matcher<char>(Eq(
'a'))),
659 std::make_tuple(2,
'b'), &ss2);
661 " Expected arg #0: is > 5\n"
662 " Actual: 2, which is 3 less than 5\n"
663 " Expected arg #1: is equal to 'a' (97, 0x61)\n"
664 " Actual: 'b' (98, 0x62)\n",
668 ExplainMatchFailureTupleTo(
669 std::make_tuple(GreaterThan(5), Matcher<char>(Eq(
'a'))),
670 std::make_tuple(2,
'a'), &ss3);
672 " Expected arg #0: is > 5\n"
673 " Actual: 2, which is 3 less than 5\n",
678 #if GTEST_HAS_TYPED_TEST
682 template <
typename T>
683 class SampleOptional {
685 using value_type =
T;
686 explicit SampleOptional(
T value)
687 :
value_(std::move(value)), has_value_(
true) {}
689 operator bool()
const {
return has_value_; }
700 template <
typename T>
701 class SampleOptionalWithoutBoolConversion {
703 using value_type =
T;
704 explicit SampleOptionalWithoutBoolConversion(
T value)
705 :
value_(std::move(value)), has_value_(
true) {}
706 SampleOptionalWithoutBoolConversion() :
value_(), has_value_(
false) {}
707 bool has_value()
const {
return has_value_; }
715 template <
typename T>
718 using OptionalTestTypes =
720 SampleOptionalWithoutBoolConversion<int>>;
725 const Matcher<TypeParam> m = Optional(Eq(1));
730 const Matcher<TypeParam> m = Optional(Eq(1));
735 TYPED_TEST(OptionalTest, MatchesNonEmptyOptional) {
736 const Matcher<TypeParam> m1 = Optional(1);
737 const Matcher<TypeParam> m2 = Optional(Eq(2));
738 const Matcher<TypeParam> m3 = Optional(Lt(3));
745 TYPED_TEST(OptionalTest, DoesNotMatchNullopt) {
746 const Matcher<TypeParam> m = Optional(1);
751 TYPED_TEST(OptionalTest, ComposesWithMonomorphicMatchersTakingReferences) {
752 const Matcher<const int&> eq1 = Eq(1);
753 const Matcher<const int&> eq2 = Eq(2);
760 TYPED_TEST(OptionalTest, ComposesWithMonomorphicMatchersRequiringConversion) {
761 const Matcher<int64_t> eq1 = Eq(1);
762 const Matcher<int64_t> eq2 = Eq(2);
769 template <
typename T>
772 using MoveOnlyOptionalTestTypes =
774 SampleOptionalWithoutBoolConversion<std::unique_ptr<int>>>;
778 TYPED_TEST(MoveOnlyOptionalTest, WorksWithMoveOnly) {
779 Matcher<TypeParam> m = Optional(Eq(
nullptr));
783 #endif // GTEST_HAS_TYPED_TEST
785 class SampleVariantIntString {
788 SampleVariantIntString(
const std::string& s) :
s_(s),
has_int_(
false) {}
790 template <
typename T>
791 friend bool holds_alternative(
const SampleVariantIntString&
value) {
795 template <
typename T>
796 friend const T&
get(
const SampleVariantIntString&
value) {
797 return value.get_impl(static_cast<T*>(
nullptr));
801 const int& get_impl(
int*)
const {
return i_; }
802 const std::string& get_impl(std::string*)
const {
return s_; }
809 TEST(VariantTest, DescribesSelf) {
810 const Matcher<SampleVariantIntString> m = VariantWith<int>(Eq(1));
812 "'.*' and the value is equal to 1"));
815 TEST(VariantTest, ExplainsSelf) {
816 const Matcher<SampleVariantIntString> m = VariantWith<int>(Eq(1));
818 ContainsRegex(
"whose value 1"));
820 HasSubstr(
"whose value is not of type '"));
822 "whose value 2 doesn't match");
825 TEST(VariantTest, FullMatch) {
826 Matcher<SampleVariantIntString> m = VariantWith<int>(Eq(1));
829 m = VariantWith<std::string>(Eq(
"1"));
830 EXPECT_TRUE(m.Matches(SampleVariantIntString(
"1")));
833 TEST(VariantTest, TypeDoesNotMatch) {
834 Matcher<SampleVariantIntString> m = VariantWith<int>(Eq(1));
837 m = VariantWith<std::string>(Eq(
"1"));
841 TEST(VariantTest, InnerDoesNotMatch) {
842 Matcher<SampleVariantIntString> m = VariantWith<int>(Eq(1));
845 m = VariantWith<std::string>(Eq(
"1"));
849 class SampleAnyType {
851 explicit SampleAnyType(
int i) :
index_(0),
i_(i) {}
852 explicit SampleAnyType(
const std::string& s) :
index_(1),
s_(s) {}
854 template <
typename T>
855 friend const T* any_cast(
const SampleAnyType* any) {
856 return any->get_impl(static_cast<T*>(
nullptr));
864 const int* get_impl(
int*)
const {
return index_ == 0 ? &
i_ :
nullptr; }
865 const std::string* get_impl(std::string*)
const {
870 TEST(AnyWithTest, FullMatch) {
871 Matcher<SampleAnyType> m = AnyWith<int>(Eq(1));
875 TEST(AnyWithTest, TestBadCastType) {
876 Matcher<SampleAnyType> m = AnyWith<std::string>(Eq(
"fail"));
880 TEST(AnyWithTest, TestUseInContainers) {
881 std::vector<SampleAnyType>
a;
886 a, ElementsAreArray({AnyWith<int>(1), AnyWith<int>(2), AnyWith<int>(3)}));
888 std::vector<SampleAnyType> b;
889 b.emplace_back(
"hello");
890 b.emplace_back(
"merhaba");
891 b.emplace_back(
"salut");
892 EXPECT_THAT(b, ElementsAreArray({AnyWith<std::string>(
"hello"),
893 AnyWith<std::string>(
"merhaba"),
894 AnyWith<std::string>(
"salut")}));
896 TEST(AnyWithTest, TestCompare) {
897 EXPECT_THAT(SampleAnyType(1), AnyWith<int>(Gt(0)));
900 TEST(AnyWithTest, DescribesSelf) {
901 const Matcher<const SampleAnyType&> m = AnyWith<int>(Eq(1));
903 "'.*' and the value is equal to 1"));
906 TEST(AnyWithTest, ExplainsSelf) {
907 const Matcher<const SampleAnyType&> m = AnyWith<int>(Eq(1));
911 HasSubstr(
"whose value is not of type '"));
917 TEST(ArgsTest, AcceptsZeroTemplateArg) {
918 const std::tuple<int, bool> t(5,
true);
923 TEST(ArgsTest, AcceptsOneTemplateArg) {
924 const std::tuple<int, bool> t(5,
true);
926 EXPECT_THAT(t, Args<1>(Eq(std::make_tuple(
true))));
927 EXPECT_THAT(t, Not(Args<1>(Eq(std::make_tuple(
false)))));
930 TEST(ArgsTest, AcceptsTwoTemplateArgs) {
931 const std::tuple<short, int, long> t(
short{4}, 5, 6L);
938 TEST(ArgsTest, AcceptsRepeatedTemplateArgs) {
939 const std::tuple<short, int, long> t(
short{4}, 5, 6L);
944 TEST(ArgsTest, AcceptsDecreasingTemplateArgs) {
945 const std::tuple<short, int, long> t(
short{4}, 5, 6L);
951 return std::get<0>(arg) + std::get<1>(arg) + std::get<2>(arg) == 0;
954 TEST(ArgsTest, AcceptsMoreTemplateArgsThanArityOfOriginalTuple) {
955 EXPECT_THAT(std::make_tuple(-1, 2), (Args<0, 0, 1>(SumIsZero())));
956 EXPECT_THAT(std::make_tuple(1, 2), Not(Args<0, 0, 1>(SumIsZero())));
959 TEST(ArgsTest, CanBeNested) {
960 const std::tuple<short, int, long, int> t(
short{4}, 5, 6L, 6);
965 TEST(ArgsTest, CanMatchTupleByValue) {
966 typedef std::tuple<char, int, int> Tuple3;
967 const Matcher<Tuple3> m = Args<1, 2>(Lt());
972 TEST(ArgsTest, CanMatchTupleByReference) {
973 typedef std::tuple<char, char, int> Tuple3;
974 const Matcher<const Tuple3&> m = Args<0, 1>(Lt());
982 TEST(ArgsTest, AcceptsTenTemplateArgs) {
983 EXPECT_THAT(std::make_tuple(0, 1L, 2, 3L, 4, 5, 6, 7, 8, 9),
984 (Args<9, 8, 7, 6, 5, 4, 3, 2, 1, 0>(
985 PrintsAs(
"(9, 8, 7, 6, 5, 4, 3, 2, 1, 0)"))));
986 EXPECT_THAT(std::make_tuple(0, 1L, 2, 3L, 4, 5, 6, 7, 8, 9),
987 Not(Args<9, 8, 7, 6, 5, 4, 3, 2, 1, 0>(
988 PrintsAs(
"(0, 8, 7, 6, 5, 4, 3, 2, 1, 0)"))));
991 TEST(ArgsTest, DescirbesSelfCorrectly) {
992 const Matcher<std::tuple<int, bool, char>> m = Args<2, 0>(Lt());
994 "are a tuple whose fields (#2, #0) are a pair where "
995 "the first < the second",
999 TEST(ArgsTest, DescirbesNestedArgsCorrectly) {
1000 const Matcher<const std::tuple<int, bool, char, int>&> m =
1001 Args<0, 2, 3>(Args<2, 0>(Lt()));
1003 "are a tuple whose fields (#0, #2, #3) are a tuple "
1004 "whose fields (#2, #0) are a pair where the first < the second",
1008 TEST(ArgsTest, DescribesNegationCorrectly) {
1009 const Matcher<std::tuple<int, char>> m = Args<1, 0>(Gt());
1011 "are a tuple whose fields (#1, #0) aren't a pair "
1012 "where the first > the second",
1016 TEST(ArgsTest, ExplainsMatchResultWithoutInnerExplanation) {
1017 const Matcher<std::tuple<bool, int, int>> m = Args<1, 2>(Eq());
1018 EXPECT_EQ(
"whose fields (#1, #2) are (42, 42)",
1019 Explain(m, std::make_tuple(
false, 42, 42)));
1020 EXPECT_EQ(
"whose fields (#1, #2) are (42, 43)",
1021 Explain(m, std::make_tuple(
false, 42, 43)));
1025 class LessThanMatcher :
public MatcherInterface<std::tuple<char, int>> {
1027 void DescribeTo(::std::ostream* )
const override {}
1029 bool MatchAndExplain(std::tuple<char, int>
value,
1030 MatchResultListener* listener)
const override {
1031 const int diff = std::get<0>(
value) - std::get<1>(value);
1033 *listener <<
"where the first value is " << diff
1034 <<
" more than the second";
1040 Matcher<std::tuple<char, int>> LessThan() {
1041 return MakeMatcher(
new LessThanMatcher);
1044 TEST(ArgsTest, ExplainsMatchResultWithInnerExplanation) {
1045 const Matcher<std::tuple<char, int, int>> m = Args<0, 2>(LessThan());
1047 "whose fields (#0, #2) are ('a' (97, 0x61), 42), "
1048 "where the first value is 55 more than the second",
1049 Explain(m, std::make_tuple(
'a', 42, 42)));
1050 EXPECT_EQ(
"whose fields (#0, #2) are ('\\0', 43)",
1051 Explain(m, std::make_tuple(
'\0', 42, 43)));
1058 MATCHER(IsEven,
"") {
return (arg % 2) == 0; }
1060 TEST(MatcherMacroTest, Works) {
1061 const Matcher<int> m = IsEven();
1072 MATCHER(IsEven2, negation ?
"is odd" :
"is even") {
1073 if ((arg % 2) == 0) {
1076 *result_listener <<
"OK";
1079 *result_listener <<
"% 2 == " << (arg % 2);
1087 std::string(negation ?
"doesn't equal" :
"equals") +
" the sum of " +
1089 if (arg == (
x +
y)) {
1090 *result_listener <<
"OK";
1095 if (result_listener->stream() !=
nullptr) {
1096 *result_listener->stream() <<
"diff == " << (
x +
y - arg);
1104 TEST(MatcherMacroTest, DescriptionCanReferenceNegationAndParameters) {
1105 const Matcher<int> m1 = IsEven2();
1109 const Matcher<int> m2 = EqSumOf(5, 9);
1115 TEST(MatcherMacroTest, CanExplainMatchResult) {
1116 const Matcher<int> m1 = IsEven2();
1120 const Matcher<int> m2 = EqSumOf(1, 2);
1129 StaticAssertTypeEq<::std::string, arg_type>();
1133 MATCHER(IsEmptyStringByRef,
"") {
1134 StaticAssertTypeEq<const ::std::string&, arg_type>();
1138 TEST(MatcherMacroTest, CanReferenceArgType) {
1139 const Matcher<::std::string> m1 = IsEmptyString();
1142 const Matcher<const ::std::string&> m2 = IsEmptyStringByRef();
1148 namespace matcher_test {
1149 MATCHER(IsOdd,
"") {
return (arg % 2) != 0; }
1152 TEST(MatcherMacroTest, WorksInNamespace) {
1160 return Value(arg, matcher_test::IsOdd()) && arg > 0;
1163 TEST(MatcherMacroTest, CanBeComposedUsingValue) {
1171 MATCHER_P(IsGreaterThan32And, n,
"") {
return arg > 32 && arg > n; }
1173 TEST(MatcherPMacroTest, Works) {
1174 const Matcher<int> m = IsGreaterThan32And(5);
1185 MATCHER_P(_is_Greater_Than32and_, n,
"") {
return arg > 32 && arg > n; }
1187 TEST(MatcherPMacroTest, GeneratesCorrectDescription) {
1188 const Matcher<int> m = _is_Greater_Than32and_(5);
1199 class UncopyableFoo {
1203 UncopyableFoo(
const UncopyableFoo&) =
delete;
1204 void operator=(
const UncopyableFoo&) =
delete;
1210 MATCHER_P(ReferencesUncopyable, variable,
"") {
return &arg == &variable; }
1212 TEST(MatcherPMacroTest, WorksWhenExplicitlyInstantiatedWithReference) {
1213 UncopyableFoo foo1(
'1'), foo2(
'2');
1214 const Matcher<const UncopyableFoo&> m =
1215 ReferencesUncopyable<const UncopyableFoo&>(foo1);
1224 EXPECT_EQ(
"references uncopyable (variable: 1-byte object <31>)",
1232 StaticAssertTypeEq<int, foo_type>();
1233 StaticAssertTypeEq<long, bar_type>();
1234 StaticAssertTypeEq<char, baz_type>();
1238 TEST(MatcherPnMacroTest, CanReferenceParamTypes) {
1239 EXPECT_THAT(0, ParamTypesAreIntLongAndChar(10, 20L,
'a'));
1245 MATCHER_P2(ReferencesAnyOf, variable1, variable2,
"") {
1246 return &arg == &variable1 || &arg == &variable2;
1249 TEST(MatcherPnMacroTest, WorksWhenExplicitlyInstantiatedWithReferences) {
1250 UncopyableFoo foo1(
'1'), foo2(
'2'), foo3(
'3');
1251 const Matcher<const UncopyableFoo&> const_m =
1252 ReferencesAnyOf<const UncopyableFoo&, const UncopyableFoo&>(foo1, foo2);
1258 const Matcher<UncopyableFoo&> m =
1259 ReferencesAnyOf<UncopyableFoo&, UncopyableFoo&>(foo1, foo2);
1266 TEST(MatcherPnMacroTest,
1267 GeneratesCorretDescriptionWhenExplicitlyInstantiatedWithReferences) {
1268 UncopyableFoo foo1(
'1'), foo2(
'2');
1269 const Matcher<const UncopyableFoo&> m =
1270 ReferencesAnyOf<const UncopyableFoo&, const UncopyableFoo&>(foo1, foo2);
1277 "references any of (variable1: 1-byte object <31>, variable2: 1-byte "
1284 MATCHER_P2(IsNotInClosedRange, low, hi,
"") {
return arg < low || arg > hi; }
1286 TEST(MatcherPnMacroTest, Works) {
1287 const Matcher<const long&> m = IsNotInClosedRange(10, 20);
1292 EXPECT_EQ(
"not (is not in closed range (low: 10, hi: 20))",
1301 MATCHER(EqualsSumOf,
"") {
return arg == 0; }
1302 MATCHER_P(EqualsSumOf, a,
"") {
return arg ==
a; }
1303 MATCHER_P2(EqualsSumOf, a, b,
"") {
return arg == a + b; }
1304 MATCHER_P3(EqualsSumOf, a, b, c,
"") {
return arg == a + b +
c; }
1305 MATCHER_P4(EqualsSumOf, a, b, c, d,
"") {
return arg == a + b + c + d; }
1306 MATCHER_P5(EqualsSumOf, a, b, c, d, e,
"") {
return arg == a + b + c + d + e; }
1307 MATCHER_P6(EqualsSumOf, a, b, c, d, e, f,
"") {
1308 return arg == a + b + c + d + e +
f;
1310 MATCHER_P7(EqualsSumOf, a, b, c, d, e, f, g,
"") {
1311 return arg == a + b + c + d + e +
f +
g;
1313 MATCHER_P8(EqualsSumOf, a, b, c, d, e, f, g, h,
"") {
1314 return arg == a + b + c + d + e +
f +
g + h;
1316 MATCHER_P9(EqualsSumOf, a, b, c, d, e, f, g, h,
i,
"") {
1317 return arg == a + b + c + d + e +
f +
g + h +
i;
1319 MATCHER_P10(EqualsSumOf, a, b, c, d, e, f, g, h,
i, j,
"") {
1320 return arg == a + b + c + d + e +
f +
g + h +
i + j;
1323 TEST(MatcherPnMacroTest, CanBeOverloadedOnNumberOfParameters) {
1329 EXPECT_THAT(12345, EqualsSumOf(10000, 2000, 300, 40, 5));
1331 EqualsSumOf(::std::string(
"a"),
'b',
'c',
"d",
"e",
'f'));
1333 EqualsSumOf(::std::string(
"a"),
'b',
'c',
"d",
"e",
'f',
'g'));
1334 EXPECT_THAT(
"abcdefgh", EqualsSumOf(::std::string(
"a"),
'b',
'c',
"d",
"e",
1336 EXPECT_THAT(
"abcdefghi", EqualsSumOf(::std::string(
"a"),
'b',
'c',
"d",
"e",
1337 'f',
'g',
"h",
'i'));
1339 EqualsSumOf(::std::string(
"a"),
'b',
'c',
"d",
"e",
'f',
'g',
"h",
1340 'i', ::std::string(
"j")));
1346 EXPECT_THAT(-1234, Not(EqualsSumOf(1000, 200, 30, 4)));
1347 EXPECT_THAT(-12345, Not(EqualsSumOf(10000, 2000, 300, 40, 5)));
1349 Not(EqualsSumOf(::std::string(
"a"),
'b',
'c',
"d",
"e",
'f')));
1350 EXPECT_THAT(
"abcdefg ", Not(EqualsSumOf(::std::string(
"a"),
'b',
'c',
"d",
1352 EXPECT_THAT(
"abcdefgh ", Not(EqualsSumOf(::std::string(
"a"),
'b',
'c',
"d",
1353 "e",
'f',
'g',
"h")));
1354 EXPECT_THAT(
"abcdefghi ", Not(EqualsSumOf(::std::string(
"a"),
'b',
'c',
"d",
1355 "e",
'f',
'g',
"h",
'i')));
1357 Not(EqualsSumOf(::std::string(
"a"),
'b',
'c',
"d",
"e",
'f',
'g',
1358 "h",
'i', ::std::string(
"j"))));
1363 TEST(MatcherPnMacroTest, WorksForDifferentParameterTypes) {
1364 EXPECT_THAT(123, EqualsSumOf(100L, 20, static_cast<char>(3)));
1365 EXPECT_THAT(
"abcd", EqualsSumOf(::std::string(
"a"),
"b",
'c',
"d"));
1367 EXPECT_THAT(124, Not(EqualsSumOf(100L, 20, static_cast<char>(3))));
1368 EXPECT_THAT(
"abcde", Not(EqualsSumOf(::std::string(
"a"),
"b",
'c',
"d")));
1375 std::string prefix_str(prefix);
1376 char suffix_char =
static_cast<char>(suffix);
1377 return arg == prefix_str + suffix_char;
1380 TEST(MatcherPnMacroTest, SimpleTypePromotion) {
1381 Matcher<std::string> no_promo = EqConcat(std::string(
"foo"),
't');
1382 Matcher<const std::string&> promo = EqConcat(
"foo", static_cast<int>(
't'));
1391 TEST(MatcherPnMacroTest, TypesAreCorrect) {
1393 EqualsSumOfMatcher a0 = EqualsSumOf();
1396 EqualsSumOfMatcherP<int> a1 = EqualsSumOf(1);
1400 EqualsSumOfMatcherP2<int, char> a2 = EqualsSumOf(1,
'2');
1401 EqualsSumOfMatcherP3<int, int, char> a3 = EqualsSumOf(1, 2,
'3');
1402 EqualsSumOfMatcherP4<int, int, int, char> a4 = EqualsSumOf(1, 2, 3,
'4');
1403 EqualsSumOfMatcherP5<int, int, int, int, char> a5 =
1404 EqualsSumOf(1, 2, 3, 4,
'5');
1405 EqualsSumOfMatcherP6<int, int, int, int, int, char> a6 =
1406 EqualsSumOf(1, 2, 3, 4, 5,
'6');
1407 EqualsSumOfMatcherP7<int, int, int, int, int, int, char> a7 =
1408 EqualsSumOf(1, 2, 3, 4, 5, 6,
'7');
1409 EqualsSumOfMatcherP8<int, int, int, int, int, int, int, char> a8 =
1410 EqualsSumOf(1, 2, 3, 4, 5, 6, 7,
'8');
1411 EqualsSumOfMatcherP9<int, int, int, int, int, int, int, int, char> a9 =
1412 EqualsSumOf(1, 2, 3, 4, 5, 6, 7, 8,
'9');
1413 EqualsSumOfMatcherP10<int, int, int, int, int, int, int, int, int, char> a10 =
1414 EqualsSumOf(1, 2, 3, 4, 5, 6, 7, 8, 9,
'0');
1435 const int count =
static_cast<int>(Value(arg, m1)) +
1436 static_cast<int>(Value(arg, m2)) +
1437 static_cast<int>(Value(arg, m3));
1441 TEST(MatcherPnMacroTest, CanUseMatcherTypedParameterInValue) {
1450 TEST(ContainsTimes, ListMatchesWhenElementQuantityMatches) {
1451 list<int> some_list;
1452 some_list.push_back(3);
1453 some_list.push_back(1);
1454 some_list.push_back(2);
1455 some_list.push_back(3);
1459 EXPECT_THAT(some_list, Contains(Ge(2)).Times(Gt(2)));
1462 EXPECT_THAT(some_list, Not(Contains(5).Times(1)));
1464 EXPECT_THAT(some_list, Not(Contains(3).Times(1)));
1465 EXPECT_THAT(some_list, Contains(3).Times(Not(1)));
1469 TEST_P(ContainsTimesP, ExplainsMatchResultCorrectly) {
1470 const int a[2] = {1, 2};
1471 Matcher<const int(&)[2]> m = Contains(2).Times(3);
1473 "whose element #1 matches but whose match quantity of 1 does not match",
1476 m = Contains(3).Times(0);
1477 EXPECT_EQ(
"has no element that matches and whose match quantity of 0 matches",
1480 m = Contains(3).Times(4);
1482 "has no element that matches and whose match quantity of 0 does not "
1486 m = Contains(2).Times(4);
1488 "whose element #1 matches but whose match quantity of 1 does not "
1492 m = Contains(GreaterThan(0)).Times(2);
1493 EXPECT_EQ(
"whose elements (0, 1) match and whose match quantity of 2 matches",
1496 m = Contains(GreaterThan(10)).Times(Gt(1));
1498 "has no element that matches and whose match quantity of 0 does not "
1502 m = Contains(GreaterThan(0)).Times(GreaterThan<size_t>(5));
1504 "whose elements (0, 1) match but whose match quantity of 2 does not "
1505 "match, which is 3 less than 5",
1509 TEST(ContainsTimes, DescribesItselfCorrectly) {
1510 Matcher<vector<int>> m = Contains(1).Times(2);
1511 EXPECT_EQ(
"quantity of elements that match is equal to 1 is equal to 2",
1514 Matcher<vector<int>> m2 = Not(m);
1515 EXPECT_EQ(
"quantity of elements that match is equal to 1 isn't equal to 2",
1521 TEST(AllOfArrayTest, BasicForms) {
1523 std::vector<int> v0{};
1524 std::vector<int> v1{1};
1525 std::vector<int> v2{2, 3};
1526 std::vector<int> v3{4, 4, 4};
1529 EXPECT_THAT(2, Not(AllOfArray(v1.begin(), v1.end())));
1530 EXPECT_THAT(3, Not(AllOfArray(v2.begin(), v2.end())));
1533 int ar[6] = {1, 2, 3, 4, 4, 4};
1542 int ar2[2] = {2, 3};
1543 int ar3[3] = {4, 4, 4};
1563 TEST(AllOfArrayTest, Matchers) {
1565 std::vector<Matcher<int>> matchers{Ge(1), Lt(2)};
1576 TEST(AnyOfArrayTest, BasicForms) {
1578 std::vector<int> v0{};
1579 std::vector<int> v1{1};
1580 std::vector<int> v2{2, 3};
1581 EXPECT_THAT(0, Not(AnyOfArray(v0.begin(), v0.end())));
1583 EXPECT_THAT(2, Not(AnyOfArray(v1.begin(), v1.end())));
1585 EXPECT_THAT(4, Not(AnyOfArray(v2.begin(), v2.end())));
1587 int ar[3] = {1, 2, 3};
1596 int ar2[2] = {2, 3};
1616 TEST(AnyOfArrayTest, Matchers) {
1619 std::vector<Matcher<int>> matchers{Lt(1), Ge(2)};
1628 TEST_P(AnyOfArrayTestP, ExplainsMatchResultCorrectly) {
1631 const std::vector<int> v0{};
1632 const std::vector<int> v1{1};
1633 const std::vector<int> v2{2, 3};
1634 const Matcher<int> m0 = AnyOfArray(v0);
1635 const Matcher<int> m1 = AnyOfArray(v1);
1636 const Matcher<int> m2 = AnyOfArray(v2);
1649 const Matcher<int> g1 = AnyOfArray({GreaterThan(1)});
1650 const Matcher<int> g2 = AnyOfArray({GreaterThan(1), GreaterThan(2)});
1655 EXPECT_EQ(
"which is 1 less than 1, and which is 2 less than 2",
1657 EXPECT_EQ(
"which is the same as 1, and which is 1 less than 2",
1663 MATCHER(IsNotNull,
"") {
return arg !=
nullptr; }
1667 TEST(MatcherMacroTest, WorksOnMoveOnlyType) {
1668 std::unique_ptr<int>
p(
new int(3));
1670 EXPECT_THAT(std::unique_ptr<int>(), Not(IsNotNull()));
1673 MATCHER_P(UniquePointee, pointee,
"") {
return *arg == pointee; }
1677 TEST(MatcherPMacroTest, WorksOnMoveOnlyType) {
1678 std::unique_ptr<int>
p(
new int(3));
1683 MATCHER(EnsureNoUnusedButMarkedUnusedWarning,
"") {
return (arg % 2) == 0; }
1685 TEST(MockMethodMockFunctionTest, EnsureNoUnusedButMarkedUnusedWarning) {
1687 #pragma clang diagnostic push
1688 #pragma clang diagnostic error "-Wused-but-marked-unused"
1691 EXPECT_THAT(0, EnsureNoUnusedButMarkedUnusedWarning());
1693 #pragma clang diagnostic pop
1697 #if GTEST_HAS_EXCEPTIONS
1703 TEST(ThrowsTest, Examples) {
1705 std::function<
void()>([]() {
throw std::runtime_error(
"message"); }),
1706 Throws<std::runtime_error>());
1709 std::function<
void()>([]() {
throw std::runtime_error(
"message"); }),
1710 ThrowsMessage<std::runtime_error>(HasSubstr(
"message")));
1713 TEST(ThrowsTest, PrintsExceptionWhat) {
1715 std::function<
void()>([]() {
throw std::runtime_error(
"ABC123XYZ"); }),
1716 ThrowsMessage<std::runtime_error>(HasSubstr(
"ABC123XYZ")));
1719 TEST(ThrowsTest, DoesNotGenerateDuplicateCatchClauseWarning) {
1720 EXPECT_THAT(std::function<
void()>([]() {
throw std::exception(); }),
1721 Throws<std::exception>());
1724 TEST(ThrowsTest, CallableExecutedExactlyOnce) {
1736 throw std::runtime_error(
"message");
1738 Throws<std::runtime_error>());
1743 throw std::runtime_error(
"message");
1745 ThrowsMessage<std::runtime_error>(HasSubstr(
"message")));
1750 throw std::runtime_error(
"message");
1752 Throws<std::runtime_error>(
1753 Property(&std::runtime_error::what, HasSubstr(
"message"))));
1758 Matcher<std::function<void()>> matcher = Throws<std::runtime_error>();
1759 std::stringstream ss;
1760 matcher.DescribeTo(&ss);
1761 auto explanation = ss.str();
1762 EXPECT_THAT(explanation, HasSubstr(
"std::runtime_error"));
1765 TEST(ThrowsTest, Success) {
1766 Matcher<std::function<void()>> matcher = Throws<std::runtime_error>();
1767 StringMatchResultListener listener;
1769 []() {
throw std::runtime_error(
"error message"); }, &listener));
1770 EXPECT_THAT(listener.str(), HasSubstr(
"std::runtime_error"));
1773 TEST(ThrowsTest, FailWrongType) {
1774 Matcher<std::function<void()>> matcher = Throws<std::runtime_error>();
1775 StringMatchResultListener listener;
1777 []() {
throw std::logic_error(
"error message"); }, &listener));
1778 EXPECT_THAT(listener.str(), HasSubstr(
"std::logic_error"));
1779 EXPECT_THAT(listener.str(), HasSubstr(
"\"error message\""));
1782 TEST(ThrowsTest, FailWrongTypeNonStd) {
1783 Matcher<std::function<void()>> matcher = Throws<std::runtime_error>();
1784 StringMatchResultListener listener;
1785 EXPECT_FALSE(matcher.MatchAndExplain([]() {
throw 10; }, &listener));
1787 HasSubstr(
"throws an exception of an unknown type"));
1790 TEST(ThrowsTest, FailNoThrow) {
1791 Matcher<std::function<void()>> matcher = Throws<std::runtime_error>();
1792 StringMatchResultListener listener;
1793 EXPECT_FALSE(matcher.MatchAndExplain([]() { (
void)0; }, &listener));
1794 EXPECT_THAT(listener.str(), HasSubstr(
"does not throw any exception"));
1797 class ThrowsPredicateTest
1798 :
public TestWithParam<Matcher<std::function<void()>>> {};
1801 Matcher<std::function<void()>> matcher = GetParam();
1802 std::stringstream ss;
1803 matcher.DescribeTo(&ss);
1804 auto explanation = ss.str();
1805 EXPECT_THAT(explanation, HasSubstr(
"std::runtime_error"));
1806 EXPECT_THAT(explanation, HasSubstr(
"error message"));
1809 TEST_P(ThrowsPredicateTest, Success) {
1810 Matcher<std::function<void()>> matcher = GetParam();
1811 StringMatchResultListener listener;
1813 []() {
throw std::runtime_error(
"error message"); }, &listener));
1814 EXPECT_THAT(listener.str(), HasSubstr(
"std::runtime_error"));
1817 TEST_P(ThrowsPredicateTest, FailWrongType) {
1818 Matcher<std::function<void()>> matcher = GetParam();
1819 StringMatchResultListener listener;
1821 []() {
throw std::logic_error(
"error message"); }, &listener));
1822 EXPECT_THAT(listener.str(), HasSubstr(
"std::logic_error"));
1823 EXPECT_THAT(listener.str(), HasSubstr(
"\"error message\""));
1826 TEST_P(ThrowsPredicateTest, FailWrongTypeNonStd) {
1827 Matcher<std::function<void()>> matcher = GetParam();
1828 StringMatchResultListener listener;
1829 EXPECT_FALSE(matcher.MatchAndExplain([]() {
throw 10; }, &listener));
1831 HasSubstr(
"throws an exception of an unknown type"));
1834 TEST_P(ThrowsPredicateTest, FailNoThrow) {
1835 Matcher<std::function<void()>> matcher = GetParam();
1836 StringMatchResultListener listener;
1837 EXPECT_FALSE(matcher.MatchAndExplain([]() {}, &listener));
1838 EXPECT_THAT(listener.str(), HasSubstr(
"does not throw any exception"));
1842 AllMessagePredicates, ThrowsPredicateTest,
1843 Values(Matcher<std::function<
void()>>(
1844 ThrowsMessage<std::runtime_error>(HasSubstr(
"error message")))));
1847 TEST(ThrowsPredicateCompilesTest, ExceptionMatcherAcceptsBroadType) {
1849 Matcher<std::function<void()>> matcher =
1850 ThrowsMessage<std::runtime_error>(HasSubstr(
"error message"));
1852 matcher.Matches([]() {
throw std::runtime_error(
"error message"); }));
1854 matcher.Matches([]() {
throw std::runtime_error(
"wrong message"); }));
1858 Matcher<uint64_t> inner = Eq(10);
1859 Matcher<std::function<void()>> matcher = Throws<uint32_t>(inner);
1860 EXPECT_TRUE(matcher.Matches([]() { throw (uint32_t)10; }));
1861 EXPECT_FALSE(matcher.Matches([]() { throw (uint32_t)11; }));
1867 TEST(ThrowsPredicateCompilesTest, MessageMatcherAcceptsNonMatcher) {
1868 Matcher<std::function<void()>> matcher =
1869 ThrowsMessage<std::runtime_error>(
"error message");
1871 matcher.Matches([]() {
throw std::runtime_error(
"error message"); }));
1873 []() {
throw std::runtime_error(
"wrong error message"); }));
1876 #endif // GTEST_HAS_EXCEPTIONS
GTEST_API_ bool IsTrue(bool condition)
internal::ValueArray< T...> Values(T...v)
GTEST_DISABLE_MSC_WARNINGS_POP_() TEST(LinkTest
ElementMatcherPairs best_so_far_
std::string Explain(const MatcherType &m, const Value &x)
#define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, description)
::std::string PrintToString(const T &value)
static const size_t kUnused
#define TEST_F(test_fixture, test_name)
#define TEST(test_suite_name, test_name)
::std::vector<::std::string > Strings
MATCHER_P2(IsPair, first, second,"")
#define INSTANTIATE_GTEST_MATCHER_TEST_P(TestSuite)
ElementMatcherPairs matches_
#define MATCHER_P5(name, p0, p1, p2, p3, p4, description)
internal::ParamGenerator< T > Range(T start, T end, IncrementT step)
#define MATCHER_P3(name, p0, p1, p2, description)
BigUInt< n > operator*(BigUInt< n > const &a, BigUInt< n > const &b)
#define MATCHER(name, description)
std::string Describe(const Matcher< T > &m)
inline::std::reference_wrapper< T > ByRef(T &l_value)
#define TYPED_TEST_SUITE(CaseName, Types,...)
CacheTaylor< T > diff(const CacheTaylor< T > &x, int n=1)
Compute Taylor series of n-th derivative of x.
expr expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c *expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 c
#define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)
#define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
bool operator>=(BigUInt< n > const &a, BigUInt< n > const &b)
ADVar foo(double d, ADVar x, ADVar y)
PolymorphicMatcher< internal::IsEmptyMatcher > IsEmpty()
#define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description)
#define GTEST_FLAG_GET(name)
#define SCOPED_TRACE(message)
#define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description)
GTEST_API_ std::string FormatMatcherDescription(bool negation, const char *matcher_name, const std::vector< const char * > ¶m_names, const Strings ¶m_values)
#define EXPECT_THAT(value, matcher)
#define MATCHER_P(name, p0, description)
#define EXPECT_CALL(obj, call)
bool operator==(const Handle< T > &h1, const Handle< T > &h2)
Compare two handles.
std::string DescribeNegation(const Matcher< T > &m)
#define EXPECT_EQ(val1, val2)
GTEST_API_ ElementMatcherPairs FindMaxBipartiteMatching(const MatchMatrix &g)
#define TEST_P(test_suite_name, test_name)
#define TYPED_TEST(CaseName, TestName)
#define MATCHER_P4(name, p0, p1, p2, p3, description)
#define EXPECT_TRUE(condition)
#define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description)
std::vector< size_t > lhs_used_
#define EXPECT_FALSE(condition)
#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name,...)
#define GTEST_FLAG_PREFIX_
std::vector< size_t > rhs_used_