34 #ifndef GOOGLEMOCK_TEST_GMOCK_MATCHERS_TEST_H_
35 #define GOOGLEMOCK_TEST_GMOCK_MATCHERS_TEST_H_
43 #include <forward_list>
54 #include <type_traits>
55 #include <unordered_map>
56 #include <unordered_set>
67 namespace gmock_matchers_test {
79 using std::stringstream;
81 using testing::internal::DummyMatchResultListener;
82 using testing::internal::ElementMatcherPair;
83 using testing::internal::ElementMatcherPairs;
84 using testing::internal::ElementsAreArrayMatcher;
85 using testing::internal::ExplainMatchFailureTupleTo;
86 using testing::internal::FloatingEqMatcher;
88 using testing::internal::IsReadableTypeName;
89 using testing::internal::MatchMatrix;
90 using testing::internal::PredicateFormatterFromMatcher;
91 using testing::internal::RE;
92 using testing::internal::StreamMatchResultListener;
99 MOCK_METHOD1(Call,
void(std::vector<std::unique_ptr<int>>));
103 template <
typename T>
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;
125 template <
typename T>
132 template <
typename T>
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>
170 template <
typename T>
172 return DescribeMatcher<T>(m);
176 template <
typename T>
178 return DescribeMatcher<T>(m,
true);
182 template <
typename MatcherType,
typename Value>
183 std::string
Explain(
const MatcherType& m,
const Value&
x) {
184 StringMatchResultListener listener;
185 ExplainMatchResult(m, x, &listener);
186 return listener.str();
192 #endif // GOOGLEMOCK_TEST_GMOCK_MATCHERS_TEST_H_
GreaterThanMatcher(T rhs)
std::string Explain(const MatcherType &m, const Value &x)
bool MatchAndExplain(T lhs, MatchResultListener *listener) const
const GtestGreaterThanMatcher< T > impl_
::std::vector<::std::string > Strings
void DescribeTo(ostream *os) const override
void DescribeNegationTo(ostream *os) const override
MOCK_METHOD1(Call, void(std::vector< std::unique_ptr< int >>))
std::string Describe(const Matcher< T > &m)
Matcher< T > GreaterThan(T n)
GtestGreaterThanMatcher< typename std::decay< T >::type > GtestGreaterThan(T &&rhs)
GTEST_API_ std::string FormatMatcherDescription(bool negation, const char *matcher_name, const std::vector< const char * > ¶m_names, const Strings ¶m_values)
const bool use_gtest_matcher_
std::string DescribeNegation(const Matcher< T > &m)
void DescribeNegationTo(ostream *os) const
static const ParamType & GetParam()
void DescribeTo(ostream *os) const
bool MatchAndExplain(T lhs, MatchResultListener *listener) const override