34#ifndef GOOGLEMOCK_TEST_GMOCK_MATCHERS_TEST_H_
35#define GOOGLEMOCK_TEST_GMOCK_MATCHERS_TEST_H_
43#include <forward_list>
55#include <unordered_map>
56#include <unordered_set>
67namespace gmock_matchers_test {
79using std::stringstream;
81using testing::internal::DummyMatchResultListener;
82using testing::internal::ElementMatcherPair;
83using testing::internal::ElementMatcherPairs;
84using testing::internal::ElementsAreArrayMatcher;
85using testing::internal::ExplainMatchFailureTupleTo;
86using testing::internal::FloatingEqMatcher;
88using testing::internal::IsReadableTypeName;
89using testing::internal::MatchMatrix;
90using testing::internal::PredicateFormatterFromMatcher;
91using testing::internal::RE;
92using testing::internal::StreamMatchResultListener;
112 *listener <<
"which is " << (lhs -
rhs) <<
" more than " <<
rhs;
113 }
else if (lhs ==
rhs) {
114 *listener <<
"which is the same as " <<
rhs;
116 *listener <<
"which is " << (
rhs - lhs) <<
" less than " <<
rhs;
137 void DescribeTo(ostream* os)
const override { impl_.DescribeTo(os); }
139 impl_.DescribeNegationTo(os);
143 return impl_.MatchAndExplain(lhs, listener);
151#define INSTANTIATE_GTEST_MATCHER_TEST_P(TestSuite) \
152 using TestSuite##P = GTestMatcherTestP; \
153 INSTANTIATE_TEST_SUITE_P(MatcherInterface, TestSuite##P, Values(false)); \
154 INSTANTIATE_TEST_SUITE_P(GtestMatcher, TestSuite##P, Values(true))
158 template <
typename T>
172 return DescribeMatcher<T>(m);
178 return DescribeMatcher<T>(m,
true);
182template <
typename MatcherType,
typename Value>
183std::string
Explain(
const MatcherType& m,
const Value&
x) {
184 StringMatchResultListener listener;
185 ExplainMatchResult(m,
x, &listener);
186 return listener.str();
Definition gmock-internal-utils.h:55
static const ParamType & GetParam()
Definition gtest.h:1681
Definition gmock-matchers_test.h:156
const bool use_gtest_matcher_
Definition gmock-matchers_test.h:166
Matcher< T > GreaterThan(T n)
Definition gmock-matchers_test.h:159
Definition gmock-matchers_test.h:133
void DescribeTo(ostream *os) const override
Definition gmock-matchers_test.h:137
bool MatchAndExplain(T lhs, MatchResultListener *listener) const override
Definition gmock-matchers_test.h:142
void DescribeNegationTo(ostream *os) const override
Definition gmock-matchers_test.h:138
GreaterThanMatcher(T rhs)
Definition gmock-matchers_test.h:135
int x
Definition gmock-matchers-containers_test.cc:376
GtestGreaterThanMatcher< typename std::decay< T >::type > GtestGreaterThan(T &&rhs)
Definition gmock-matchers_test.h:126
std::string Explain(const MatcherType &m, const Value &x)
Definition gmock-matchers_test.h:183
std::string Describe(const Matcher< T > &m)
Definition gmock-matchers_test.h:171
std::string DescribeNegation(const Matcher< T > &m)
Definition gmock-matchers_test.h:177
GTEST_API_ std::string FormatMatcherDescription(bool negation, const char *matcher_name, const std::vector< const char * > ¶m_names, const Strings ¶m_values)
Definition gmock-matchers.cc:52
::std::vector<::std::string > Strings
Definition gtest-printers.h:1115
Definition gmock-actions.h:151
Definition gmock-matchers_test.h:98
MOCK_METHOD1(Call, void(std::vector< std::unique_ptr< int > >))
Definition gmock-matchers_test.h:104
void DescribeTo(ostream *os) const
Definition gmock-matchers_test.h:107
T rhs
Definition gmock-matchers_test.h:122
void is_gtest_matcher
Definition gmock-matchers_test.h:105
bool MatchAndExplain(T lhs, MatchResultListener *listener) const
Definition gmock-matchers_test.h:110
void DescribeNegationTo(ostream *os) const
Definition gmock-matchers_test.h:108