PageRenderTime 63ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 1ms

/testlibs/gmock/include/gmock/gmock-generated-matchers.h

https://github.com/deltaforge/nebu-app-hadoop
C Header | 2054 lines | 1602 code | 160 blank | 292 comment | 15 complexity | e8fb88ad9132634af60059773166abb2 MD5 | raw file
Possible License(s): LGPL-3.0, BSD-3-Clause
  1. // This file was GENERATED by command:
  2. // pump.py gmock-generated-matchers.h.pump
  3. // DO NOT EDIT BY HAND!!!
  4. // Copyright 2008, Google Inc.
  5. // All rights reserved.
  6. //
  7. // Redistribution and use in source and binary forms, with or without
  8. // modification, are permitted provided that the following conditions are
  9. // met:
  10. //
  11. // * Redistributions of source code must retain the above copyright
  12. // notice, this list of conditions and the following disclaimer.
  13. // * Redistributions in binary form must reproduce the above
  14. // copyright notice, this list of conditions and the following disclaimer
  15. // in the documentation and/or other materials provided with the
  16. // distribution.
  17. // * Neither the name of Google Inc. nor the names of its
  18. // contributors may be used to endorse or promote products derived from
  19. // this software without specific prior written permission.
  20. //
  21. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. // Google Mock - a framework for writing C++ mock classes.
  33. //
  34. // This file implements some commonly used variadic matchers.
  35. #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
  36. #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
  37. #include <sstream>
  38. #include <string>
  39. #include <vector>
  40. #include "gmock/gmock-matchers.h"
  41. namespace testing {
  42. namespace internal {
  43. // The type of the i-th (0-based) field of Tuple.
  44. #define GMOCK_FIELD_TYPE_(Tuple, i) \
  45. typename ::std::tr1::tuple_element<i, Tuple>::type
  46. // TupleFields<Tuple, k0, ..., kn> is for selecting fields from a
  47. // tuple of type Tuple. It has two members:
  48. //
  49. // type: a tuple type whose i-th field is the ki-th field of Tuple.
  50. // GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple.
  51. //
  52. // For example, in class TupleFields<tuple<bool, char, int>, 2, 0>, we have:
  53. //
  54. // type is tuple<int, bool>, and
  55. // GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true).
  56. template <class Tuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1,
  57. int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
  58. int k9 = -1>
  59. class TupleFields;
  60. // This generic version is used when there are 10 selectors.
  61. template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
  62. int k7, int k8, int k9>
  63. class TupleFields {
  64. public:
  65. typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
  66. GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
  67. GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
  68. GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
  69. GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8),
  70. GMOCK_FIELD_TYPE_(Tuple, k9)> type;
  71. static type GetSelectedFields(const Tuple& t) {
  72. using ::std::tr1::get;
  73. return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
  74. get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t), get<k9>(t));
  75. }
  76. };
  77. // The following specialization is used for 0 ~ 9 selectors.
  78. template <class Tuple>
  79. class TupleFields<Tuple, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
  80. public:
  81. typedef ::std::tr1::tuple<> type;
  82. static type GetSelectedFields(const Tuple& /* t */) {
  83. using ::std::tr1::get;
  84. return type();
  85. }
  86. };
  87. template <class Tuple, int k0>
  88. class TupleFields<Tuple, k0, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
  89. public:
  90. typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0)> type;
  91. static type GetSelectedFields(const Tuple& t) {
  92. using ::std::tr1::get;
  93. return type(get<k0>(t));
  94. }
  95. };
  96. template <class Tuple, int k0, int k1>
  97. class TupleFields<Tuple, k0, k1, -1, -1, -1, -1, -1, -1, -1, -1> {
  98. public:
  99. typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
  100. GMOCK_FIELD_TYPE_(Tuple, k1)> type;
  101. static type GetSelectedFields(const Tuple& t) {
  102. using ::std::tr1::get;
  103. return type(get<k0>(t), get<k1>(t));
  104. }
  105. };
  106. template <class Tuple, int k0, int k1, int k2>
  107. class TupleFields<Tuple, k0, k1, k2, -1, -1, -1, -1, -1, -1, -1> {
  108. public:
  109. typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
  110. GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2)> type;
  111. static type GetSelectedFields(const Tuple& t) {
  112. using ::std::tr1::get;
  113. return type(get<k0>(t), get<k1>(t), get<k2>(t));
  114. }
  115. };
  116. template <class Tuple, int k0, int k1, int k2, int k3>
  117. class TupleFields<Tuple, k0, k1, k2, k3, -1, -1, -1, -1, -1, -1> {
  118. public:
  119. typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
  120. GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
  121. GMOCK_FIELD_TYPE_(Tuple, k3)> type;
  122. static type GetSelectedFields(const Tuple& t) {
  123. using ::std::tr1::get;
  124. return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t));
  125. }
  126. };
  127. template <class Tuple, int k0, int k1, int k2, int k3, int k4>
  128. class TupleFields<Tuple, k0, k1, k2, k3, k4, -1, -1, -1, -1, -1> {
  129. public:
  130. typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
  131. GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
  132. GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4)> type;
  133. static type GetSelectedFields(const Tuple& t) {
  134. using ::std::tr1::get;
  135. return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t));
  136. }
  137. };
  138. template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5>
  139. class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, -1, -1, -1, -1> {
  140. public:
  141. typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
  142. GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
  143. GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
  144. GMOCK_FIELD_TYPE_(Tuple, k5)> type;
  145. static type GetSelectedFields(const Tuple& t) {
  146. using ::std::tr1::get;
  147. return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
  148. get<k5>(t));
  149. }
  150. };
  151. template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6>
  152. class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, -1, -1, -1> {
  153. public:
  154. typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
  155. GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
  156. GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
  157. GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6)> type;
  158. static type GetSelectedFields(const Tuple& t) {
  159. using ::std::tr1::get;
  160. return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
  161. get<k5>(t), get<k6>(t));
  162. }
  163. };
  164. template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
  165. int k7>
  166. class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, -1, -1> {
  167. public:
  168. typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
  169. GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
  170. GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
  171. GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
  172. GMOCK_FIELD_TYPE_(Tuple, k7)> type;
  173. static type GetSelectedFields(const Tuple& t) {
  174. using ::std::tr1::get;
  175. return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
  176. get<k5>(t), get<k6>(t), get<k7>(t));
  177. }
  178. };
  179. template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
  180. int k7, int k8>
  181. class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, k8, -1> {
  182. public:
  183. typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
  184. GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
  185. GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
  186. GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
  187. GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8)> type;
  188. static type GetSelectedFields(const Tuple& t) {
  189. using ::std::tr1::get;
  190. return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
  191. get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t));
  192. }
  193. };
  194. #undef GMOCK_FIELD_TYPE_
  195. // Implements the Args() matcher.
  196. template <class ArgsTuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1,
  197. int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
  198. int k9 = -1>
  199. class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> {
  200. public:
  201. // ArgsTuple may have top-level const or reference modifiers.
  202. typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple;
  203. typedef typename internal::TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5,
  204. k6, k7, k8, k9>::type SelectedArgs;
  205. typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher;
  206. template <typename InnerMatcher>
  207. explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher)
  208. : inner_matcher_(SafeMatcherCast<const SelectedArgs&>(inner_matcher)) {}
  209. virtual bool MatchAndExplain(ArgsTuple args,
  210. MatchResultListener* listener) const {
  211. const SelectedArgs& selected_args = GetSelectedArgs(args);
  212. if (!listener->IsInterested())
  213. return inner_matcher_.Matches(selected_args);
  214. PrintIndices(listener->stream());
  215. *listener << "are " << PrintToString(selected_args);
  216. StringMatchResultListener inner_listener;
  217. const bool match = inner_matcher_.MatchAndExplain(selected_args,
  218. &inner_listener);
  219. PrintIfNotEmpty(inner_listener.str(), listener->stream());
  220. return match;
  221. }
  222. virtual void DescribeTo(::std::ostream* os) const {
  223. *os << "are a tuple ";
  224. PrintIndices(os);
  225. inner_matcher_.DescribeTo(os);
  226. }
  227. virtual void DescribeNegationTo(::std::ostream* os) const {
  228. *os << "are a tuple ";
  229. PrintIndices(os);
  230. inner_matcher_.DescribeNegationTo(os);
  231. }
  232. private:
  233. static SelectedArgs GetSelectedArgs(ArgsTuple args) {
  234. return TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5, k6, k7, k8,
  235. k9>::GetSelectedFields(args);
  236. }
  237. // Prints the indices of the selected fields.
  238. static void PrintIndices(::std::ostream* os) {
  239. *os << "whose fields (";
  240. const int indices[10] = { k0, k1, k2, k3, k4, k5, k6, k7, k8, k9 };
  241. for (int i = 0; i < 10; i++) {
  242. if (indices[i] < 0)
  243. break;
  244. if (i >= 1)
  245. *os << ", ";
  246. *os << "#" << indices[i];
  247. }
  248. *os << ") ";
  249. }
  250. const MonomorphicInnerMatcher inner_matcher_;
  251. GTEST_DISALLOW_ASSIGN_(ArgsMatcherImpl);
  252. };
  253. template <class InnerMatcher, int k0 = -1, int k1 = -1, int k2 = -1,
  254. int k3 = -1, int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1,
  255. int k8 = -1, int k9 = -1>
  256. class ArgsMatcher {
  257. public:
  258. explicit ArgsMatcher(const InnerMatcher& inner_matcher)
  259. : inner_matcher_(inner_matcher) {}
  260. template <typename ArgsTuple>
  261. operator Matcher<ArgsTuple>() const {
  262. return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, k0, k1, k2, k3, k4, k5,
  263. k6, k7, k8, k9>(inner_matcher_));
  264. }
  265. private:
  266. const InnerMatcher inner_matcher_;
  267. GTEST_DISALLOW_ASSIGN_(ArgsMatcher);
  268. };
  269. // Implements ElementsAre() of 1-10 arguments.
  270. template <typename T1>
  271. class ElementsAreMatcher1 {
  272. public:
  273. explicit ElementsAreMatcher1(const T1& e1) : e1_(e1) {}
  274. template <typename Container>
  275. operator Matcher<Container>() const {
  276. typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
  277. typedef typename internal::StlContainerView<RawContainer>::type::value_type
  278. Element;
  279. // Nokia's Symbian Compiler has a nasty bug where the object put
  280. // in a one-element local array is not destructed when the array
  281. // goes out of scope. This leads to obvious badness as we've
  282. // added the linked_ptr in it to our other linked_ptrs list.
  283. // Hence we implement ElementsAreMatcher1 specially to avoid using
  284. // a local array.
  285. const Matcher<const Element&> matcher =
  286. MatcherCast<const Element&>(e1_);
  287. return MakeMatcher(new ElementsAreMatcherImpl<Container>(&matcher, 1));
  288. }
  289. private:
  290. const T1& e1_;
  291. GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher1);
  292. };
  293. template <typename T1, typename T2>
  294. class ElementsAreMatcher2 {
  295. public:
  296. ElementsAreMatcher2(const T1& e1, const T2& e2) : e1_(e1), e2_(e2) {}
  297. template <typename Container>
  298. operator Matcher<Container>() const {
  299. typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
  300. typedef typename internal::StlContainerView<RawContainer>::type::value_type
  301. Element;
  302. const Matcher<const Element&> matchers[] = {
  303. MatcherCast<const Element&>(e1_),
  304. MatcherCast<const Element&>(e2_),
  305. };
  306. return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 2));
  307. }
  308. private:
  309. const T1& e1_;
  310. const T2& e2_;
  311. GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher2);
  312. };
  313. template <typename T1, typename T2, typename T3>
  314. class ElementsAreMatcher3 {
  315. public:
  316. ElementsAreMatcher3(const T1& e1, const T2& e2, const T3& e3) : e1_(e1),
  317. e2_(e2), e3_(e3) {}
  318. template <typename Container>
  319. operator Matcher<Container>() const {
  320. typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
  321. typedef typename internal::StlContainerView<RawContainer>::type::value_type
  322. Element;
  323. const Matcher<const Element&> matchers[] = {
  324. MatcherCast<const Element&>(e1_),
  325. MatcherCast<const Element&>(e2_),
  326. MatcherCast<const Element&>(e3_),
  327. };
  328. return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 3));
  329. }
  330. private:
  331. const T1& e1_;
  332. const T2& e2_;
  333. const T3& e3_;
  334. GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher3);
  335. };
  336. template <typename T1, typename T2, typename T3, typename T4>
  337. class ElementsAreMatcher4 {
  338. public:
  339. ElementsAreMatcher4(const T1& e1, const T2& e2, const T3& e3,
  340. const T4& e4) : e1_(e1), e2_(e2), e3_(e3), e4_(e4) {}
  341. template <typename Container>
  342. operator Matcher<Container>() const {
  343. typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
  344. typedef typename internal::StlContainerView<RawContainer>::type::value_type
  345. Element;
  346. const Matcher<const Element&> matchers[] = {
  347. MatcherCast<const Element&>(e1_),
  348. MatcherCast<const Element&>(e2_),
  349. MatcherCast<const Element&>(e3_),
  350. MatcherCast<const Element&>(e4_),
  351. };
  352. return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 4));
  353. }
  354. private:
  355. const T1& e1_;
  356. const T2& e2_;
  357. const T3& e3_;
  358. const T4& e4_;
  359. GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher4);
  360. };
  361. template <typename T1, typename T2, typename T3, typename T4, typename T5>
  362. class ElementsAreMatcher5 {
  363. public:
  364. ElementsAreMatcher5(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
  365. const T5& e5) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5) {}
  366. template <typename Container>
  367. operator Matcher<Container>() const {
  368. typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
  369. typedef typename internal::StlContainerView<RawContainer>::type::value_type
  370. Element;
  371. const Matcher<const Element&> matchers[] = {
  372. MatcherCast<const Element&>(e1_),
  373. MatcherCast<const Element&>(e2_),
  374. MatcherCast<const Element&>(e3_),
  375. MatcherCast<const Element&>(e4_),
  376. MatcherCast<const Element&>(e5_),
  377. };
  378. return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 5));
  379. }
  380. private:
  381. const T1& e1_;
  382. const T2& e2_;
  383. const T3& e3_;
  384. const T4& e4_;
  385. const T5& e5_;
  386. GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher5);
  387. };
  388. template <typename T1, typename T2, typename T3, typename T4, typename T5,
  389. typename T6>
  390. class ElementsAreMatcher6 {
  391. public:
  392. ElementsAreMatcher6(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
  393. const T5& e5, const T6& e6) : e1_(e1), e2_(e2), e3_(e3), e4_(e4),
  394. e5_(e5), e6_(e6) {}
  395. template <typename Container>
  396. operator Matcher<Container>() const {
  397. typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
  398. typedef typename internal::StlContainerView<RawContainer>::type::value_type
  399. Element;
  400. const Matcher<const Element&> matchers[] = {
  401. MatcherCast<const Element&>(e1_),
  402. MatcherCast<const Element&>(e2_),
  403. MatcherCast<const Element&>(e3_),
  404. MatcherCast<const Element&>(e4_),
  405. MatcherCast<const Element&>(e5_),
  406. MatcherCast<const Element&>(e6_),
  407. };
  408. return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 6));
  409. }
  410. private:
  411. const T1& e1_;
  412. const T2& e2_;
  413. const T3& e3_;
  414. const T4& e4_;
  415. const T5& e5_;
  416. const T6& e6_;
  417. GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher6);
  418. };
  419. template <typename T1, typename T2, typename T3, typename T4, typename T5,
  420. typename T6, typename T7>
  421. class ElementsAreMatcher7 {
  422. public:
  423. ElementsAreMatcher7(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
  424. const T5& e5, const T6& e6, const T7& e7) : e1_(e1), e2_(e2), e3_(e3),
  425. e4_(e4), e5_(e5), e6_(e6), e7_(e7) {}
  426. template <typename Container>
  427. operator Matcher<Container>() const {
  428. typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
  429. typedef typename internal::StlContainerView<RawContainer>::type::value_type
  430. Element;
  431. const Matcher<const Element&> matchers[] = {
  432. MatcherCast<const Element&>(e1_),
  433. MatcherCast<const Element&>(e2_),
  434. MatcherCast<const Element&>(e3_),
  435. MatcherCast<const Element&>(e4_),
  436. MatcherCast<const Element&>(e5_),
  437. MatcherCast<const Element&>(e6_),
  438. MatcherCast<const Element&>(e7_),
  439. };
  440. return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 7));
  441. }
  442. private:
  443. const T1& e1_;
  444. const T2& e2_;
  445. const T3& e3_;
  446. const T4& e4_;
  447. const T5& e5_;
  448. const T6& e6_;
  449. const T7& e7_;
  450. GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher7);
  451. };
  452. template <typename T1, typename T2, typename T3, typename T4, typename T5,
  453. typename T6, typename T7, typename T8>
  454. class ElementsAreMatcher8 {
  455. public:
  456. ElementsAreMatcher8(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
  457. const T5& e5, const T6& e6, const T7& e7, const T8& e8) : e1_(e1),
  458. e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6), e7_(e7), e8_(e8) {}
  459. template <typename Container>
  460. operator Matcher<Container>() const {
  461. typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
  462. typedef typename internal::StlContainerView<RawContainer>::type::value_type
  463. Element;
  464. const Matcher<const Element&> matchers[] = {
  465. MatcherCast<const Element&>(e1_),
  466. MatcherCast<const Element&>(e2_),
  467. MatcherCast<const Element&>(e3_),
  468. MatcherCast<const Element&>(e4_),
  469. MatcherCast<const Element&>(e5_),
  470. MatcherCast<const Element&>(e6_),
  471. MatcherCast<const Element&>(e7_),
  472. MatcherCast<const Element&>(e8_),
  473. };
  474. return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 8));
  475. }
  476. private:
  477. const T1& e1_;
  478. const T2& e2_;
  479. const T3& e3_;
  480. const T4& e4_;
  481. const T5& e5_;
  482. const T6& e6_;
  483. const T7& e7_;
  484. const T8& e8_;
  485. GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher8);
  486. };
  487. template <typename T1, typename T2, typename T3, typename T4, typename T5,
  488. typename T6, typename T7, typename T8, typename T9>
  489. class ElementsAreMatcher9 {
  490. public:
  491. ElementsAreMatcher9(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
  492. const T5& e5, const T6& e6, const T7& e7, const T8& e8,
  493. const T9& e9) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6),
  494. e7_(e7), e8_(e8), e9_(e9) {}
  495. template <typename Container>
  496. operator Matcher<Container>() const {
  497. typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
  498. typedef typename internal::StlContainerView<RawContainer>::type::value_type
  499. Element;
  500. const Matcher<const Element&> matchers[] = {
  501. MatcherCast<const Element&>(e1_),
  502. MatcherCast<const Element&>(e2_),
  503. MatcherCast<const Element&>(e3_),
  504. MatcherCast<const Element&>(e4_),
  505. MatcherCast<const Element&>(e5_),
  506. MatcherCast<const Element&>(e6_),
  507. MatcherCast<const Element&>(e7_),
  508. MatcherCast<const Element&>(e8_),
  509. MatcherCast<const Element&>(e9_),
  510. };
  511. return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 9));
  512. }
  513. private:
  514. const T1& e1_;
  515. const T2& e2_;
  516. const T3& e3_;
  517. const T4& e4_;
  518. const T5& e5_;
  519. const T6& e6_;
  520. const T7& e7_;
  521. const T8& e8_;
  522. const T9& e9_;
  523. GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher9);
  524. };
  525. template <typename T1, typename T2, typename T3, typename T4, typename T5,
  526. typename T6, typename T7, typename T8, typename T9, typename T10>
  527. class ElementsAreMatcher10 {
  528. public:
  529. ElementsAreMatcher10(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
  530. const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9,
  531. const T10& e10) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6),
  532. e7_(e7), e8_(e8), e9_(e9), e10_(e10) {}
  533. template <typename Container>
  534. operator Matcher<Container>() const {
  535. typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
  536. typedef typename internal::StlContainerView<RawContainer>::type::value_type
  537. Element;
  538. const Matcher<const Element&> matchers[] = {
  539. MatcherCast<const Element&>(e1_),
  540. MatcherCast<const Element&>(e2_),
  541. MatcherCast<const Element&>(e3_),
  542. MatcherCast<const Element&>(e4_),
  543. MatcherCast<const Element&>(e5_),
  544. MatcherCast<const Element&>(e6_),
  545. MatcherCast<const Element&>(e7_),
  546. MatcherCast<const Element&>(e8_),
  547. MatcherCast<const Element&>(e9_),
  548. MatcherCast<const Element&>(e10_),
  549. };
  550. return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 10));
  551. }
  552. private:
  553. const T1& e1_;
  554. const T2& e2_;
  555. const T3& e3_;
  556. const T4& e4_;
  557. const T5& e5_;
  558. const T6& e6_;
  559. const T7& e7_;
  560. const T8& e8_;
  561. const T9& e9_;
  562. const T10& e10_;
  563. GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher10);
  564. };
  565. } // namespace internal
  566. // Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected
  567. // fields of it matches a_matcher. C++ doesn't support default
  568. // arguments for function templates, so we have to overload it.
  569. template <typename InnerMatcher>
  570. inline internal::ArgsMatcher<InnerMatcher>
  571. Args(const InnerMatcher& matcher) {
  572. return internal::ArgsMatcher<InnerMatcher>(matcher);
  573. }
  574. template <int k1, typename InnerMatcher>
  575. inline internal::ArgsMatcher<InnerMatcher, k1>
  576. Args(const InnerMatcher& matcher) {
  577. return internal::ArgsMatcher<InnerMatcher, k1>(matcher);
  578. }
  579. template <int k1, int k2, typename InnerMatcher>
  580. inline internal::ArgsMatcher<InnerMatcher, k1, k2>
  581. Args(const InnerMatcher& matcher) {
  582. return internal::ArgsMatcher<InnerMatcher, k1, k2>(matcher);
  583. }
  584. template <int k1, int k2, int k3, typename InnerMatcher>
  585. inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3>
  586. Args(const InnerMatcher& matcher) {
  587. return internal::ArgsMatcher<InnerMatcher, k1, k2, k3>(matcher);
  588. }
  589. template <int k1, int k2, int k3, int k4, typename InnerMatcher>
  590. inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4>
  591. Args(const InnerMatcher& matcher) {
  592. return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4>(matcher);
  593. }
  594. template <int k1, int k2, int k3, int k4, int k5, typename InnerMatcher>
  595. inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5>
  596. Args(const InnerMatcher& matcher) {
  597. return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5>(matcher);
  598. }
  599. template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerMatcher>
  600. inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6>
  601. Args(const InnerMatcher& matcher) {
  602. return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6>(matcher);
  603. }
  604. template <int k1, int k2, int k3, int k4, int k5, int k6, int k7,
  605. typename InnerMatcher>
  606. inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7>
  607. Args(const InnerMatcher& matcher) {
  608. return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6,
  609. k7>(matcher);
  610. }
  611. template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
  612. typename InnerMatcher>
  613. inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8>
  614. Args(const InnerMatcher& matcher) {
  615. return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7,
  616. k8>(matcher);
  617. }
  618. template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
  619. int k9, typename InnerMatcher>
  620. inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9>
  621. Args(const InnerMatcher& matcher) {
  622. return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8,
  623. k9>(matcher);
  624. }
  625. template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
  626. int k9, int k10, typename InnerMatcher>
  627. inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9,
  628. k10>
  629. Args(const InnerMatcher& matcher) {
  630. return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8,
  631. k9, k10>(matcher);
  632. }
  633. // ElementsAre(e0, e1, ..., e_n) matches an STL-style container with
  634. // (n + 1) elements, where the i-th element in the container must
  635. // match the i-th argument in the list. Each argument of
  636. // ElementsAre() can be either a value or a matcher. We support up to
  637. // 10 arguments.
  638. //
  639. // NOTE: Since ElementsAre() cares about the order of the elements, it
  640. // must not be used with containers whose elements's order is
  641. // undefined (e.g. hash_map).
  642. inline internal::ElementsAreMatcher0 ElementsAre() {
  643. return internal::ElementsAreMatcher0();
  644. }
  645. template <typename T1>
  646. inline internal::ElementsAreMatcher1<T1> ElementsAre(const T1& e1) {
  647. return internal::ElementsAreMatcher1<T1>(e1);
  648. }
  649. template <typename T1, typename T2>
  650. inline internal::ElementsAreMatcher2<T1, T2> ElementsAre(const T1& e1,
  651. const T2& e2) {
  652. return internal::ElementsAreMatcher2<T1, T2>(e1, e2);
  653. }
  654. template <typename T1, typename T2, typename T3>
  655. inline internal::ElementsAreMatcher3<T1, T2, T3> ElementsAre(const T1& e1,
  656. const T2& e2, const T3& e3) {
  657. return internal::ElementsAreMatcher3<T1, T2, T3>(e1, e2, e3);
  658. }
  659. template <typename T1, typename T2, typename T3, typename T4>
  660. inline internal::ElementsAreMatcher4<T1, T2, T3, T4> ElementsAre(const T1& e1,
  661. const T2& e2, const T3& e3, const T4& e4) {
  662. return internal::ElementsAreMatcher4<T1, T2, T3, T4>(e1, e2, e3, e4);
  663. }
  664. template <typename T1, typename T2, typename T3, typename T4, typename T5>
  665. inline internal::ElementsAreMatcher5<T1, T2, T3, T4,
  666. T5> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
  667. const T5& e5) {
  668. return internal::ElementsAreMatcher5<T1, T2, T3, T4, T5>(e1, e2, e3, e4, e5);
  669. }
  670. template <typename T1, typename T2, typename T3, typename T4, typename T5,
  671. typename T6>
  672. inline internal::ElementsAreMatcher6<T1, T2, T3, T4, T5,
  673. T6> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
  674. const T5& e5, const T6& e6) {
  675. return internal::ElementsAreMatcher6<T1, T2, T3, T4, T5, T6>(e1, e2, e3, e4,
  676. e5, e6);
  677. }
  678. template <typename T1, typename T2, typename T3, typename T4, typename T5,
  679. typename T6, typename T7>
  680. inline internal::ElementsAreMatcher7<T1, T2, T3, T4, T5, T6,
  681. T7> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
  682. const T5& e5, const T6& e6, const T7& e7) {
  683. return internal::ElementsAreMatcher7<T1, T2, T3, T4, T5, T6, T7>(e1, e2, e3,
  684. e4, e5, e6, e7);
  685. }
  686. template <typename T1, typename T2, typename T3, typename T4, typename T5,
  687. typename T6, typename T7, typename T8>
  688. inline internal::ElementsAreMatcher8<T1, T2, T3, T4, T5, T6, T7,
  689. T8> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
  690. const T5& e5, const T6& e6, const T7& e7, const T8& e8) {
  691. return internal::ElementsAreMatcher8<T1, T2, T3, T4, T5, T6, T7, T8>(e1, e2,
  692. e3, e4, e5, e6, e7, e8);
  693. }
  694. template <typename T1, typename T2, typename T3, typename T4, typename T5,
  695. typename T6, typename T7, typename T8, typename T9>
  696. inline internal::ElementsAreMatcher9<T1, T2, T3, T4, T5, T6, T7, T8,
  697. T9> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
  698. const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) {
  699. return internal::ElementsAreMatcher9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(e1,
  700. e2, e3, e4, e5, e6, e7, e8, e9);
  701. }
  702. template <typename T1, typename T2, typename T3, typename T4, typename T5,
  703. typename T6, typename T7, typename T8, typename T9, typename T10>
  704. inline internal::ElementsAreMatcher10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
  705. T10> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
  706. const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9,
  707. const T10& e10) {
  708. return internal::ElementsAreMatcher10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
  709. T10>(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10);
  710. }
  711. // ElementsAreArray(array) and ElementAreArray(array, count) are like
  712. // ElementsAre(), except that they take an array of values or
  713. // matchers. The former form infers the size of 'array', which must
  714. // be a static C-style array. In the latter form, 'array' can either
  715. // be a static array or a pointer to a dynamically created array.
  716. template <typename T>
  717. inline internal::ElementsAreArrayMatcher<T> ElementsAreArray(
  718. const T* first, size_t count) {
  719. return internal::ElementsAreArrayMatcher<T>(first, count);
  720. }
  721. template <typename T, size_t N>
  722. inline internal::ElementsAreArrayMatcher<T>
  723. ElementsAreArray(const T (&array)[N]) {
  724. return internal::ElementsAreArrayMatcher<T>(array, N);
  725. }
  726. // AllOf(m1, m2, ..., mk) matches any value that matches all of the given
  727. // sub-matchers. AllOf is called fully qualified to prevent ADL from firing.
  728. template <typename Matcher1, typename Matcher2>
  729. inline internal::BothOfMatcher<Matcher1, Matcher2>
  730. AllOf(Matcher1 m1, Matcher2 m2) {
  731. return internal::BothOfMatcher<Matcher1, Matcher2>(m1, m2);
  732. }
  733. template <typename Matcher1, typename Matcher2, typename Matcher3>
  734. inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2,
  735. Matcher3> >
  736. AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3) {
  737. return ::testing::AllOf(m1, ::testing::AllOf(m2, m3));
  738. }
  739. template <typename Matcher1, typename Matcher2, typename Matcher3,
  740. typename Matcher4>
  741. inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2,
  742. internal::BothOfMatcher<Matcher3, Matcher4> > >
  743. AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4) {
  744. return ::testing::AllOf(m1, ::testing::AllOf(m2, m3, m4));
  745. }
  746. template <typename Matcher1, typename Matcher2, typename Matcher3,
  747. typename Matcher4, typename Matcher5>
  748. inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2,
  749. internal::BothOfMatcher<Matcher3, internal::BothOfMatcher<Matcher4,
  750. Matcher5> > > >
  751. AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5) {
  752. return ::testing::AllOf(m1, ::testing::AllOf(m2, m3, m4, m5));
  753. }
  754. template <typename Matcher1, typename Matcher2, typename Matcher3,
  755. typename Matcher4, typename Matcher5, typename Matcher6>
  756. inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2,
  757. internal::BothOfMatcher<Matcher3, internal::BothOfMatcher<Matcher4,
  758. internal::BothOfMatcher<Matcher5, Matcher6> > > > >
  759. AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5,
  760. Matcher6 m6) {
  761. return ::testing::AllOf(m1, ::testing::AllOf(m2, m3, m4, m5, m6));
  762. }
  763. template <typename Matcher1, typename Matcher2, typename Matcher3,
  764. typename Matcher4, typename Matcher5, typename Matcher6, typename Matcher7>
  765. inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2,
  766. internal::BothOfMatcher<Matcher3, internal::BothOfMatcher<Matcher4,
  767. internal::BothOfMatcher<Matcher5, internal::BothOfMatcher<Matcher6,
  768. Matcher7> > > > > >
  769. AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5,
  770. Matcher6 m6, Matcher7 m7) {
  771. return ::testing::AllOf(m1, ::testing::AllOf(m2, m3, m4, m5, m6, m7));
  772. }
  773. template <typename Matcher1, typename Matcher2, typename Matcher3,
  774. typename Matcher4, typename Matcher5, typename Matcher6, typename Matcher7,
  775. typename Matcher8>
  776. inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2,
  777. internal::BothOfMatcher<Matcher3, internal::BothOfMatcher<Matcher4,
  778. internal::BothOfMatcher<Matcher5, internal::BothOfMatcher<Matcher6,
  779. internal::BothOfMatcher<Matcher7, Matcher8> > > > > > >
  780. AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5,
  781. Matcher6 m6, Matcher7 m7, Matcher8 m8) {
  782. return ::testing::AllOf(m1, ::testing::AllOf(m2, m3, m4, m5, m6, m7, m8));
  783. }
  784. template <typename Matcher1, typename Matcher2, typename Matcher3,
  785. typename Matcher4, typename Matcher5, typename Matcher6, typename Matcher7,
  786. typename Matcher8, typename Matcher9>
  787. inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2,
  788. internal::BothOfMatcher<Matcher3, internal::BothOfMatcher<Matcher4,
  789. internal::BothOfMatcher<Matcher5, internal::BothOfMatcher<Matcher6,
  790. internal::BothOfMatcher<Matcher7, internal::BothOfMatcher<Matcher8,
  791. Matcher9> > > > > > > >
  792. AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5,
  793. Matcher6 m6, Matcher7 m7, Matcher8 m8, Matcher9 m9) {
  794. return ::testing::AllOf(m1, ::testing::AllOf(m2, m3, m4, m5, m6, m7, m8, m9));
  795. }
  796. template <typename Matcher1, typename Matcher2, typename Matcher3,
  797. typename Matcher4, typename Matcher5, typename Matcher6, typename Matcher7,
  798. typename Matcher8, typename Matcher9, typename Matcher10>
  799. inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2,
  800. internal::BothOfMatcher<Matcher3, internal::BothOfMatcher<Matcher4,
  801. internal::BothOfMatcher<Matcher5, internal::BothOfMatcher<Matcher6,
  802. internal::BothOfMatcher<Matcher7, internal::BothOfMatcher<Matcher8,
  803. internal::BothOfMatcher<Matcher9, Matcher10> > > > > > > > >
  804. AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5,
  805. Matcher6 m6, Matcher7 m7, Matcher8 m8, Matcher9 m9, Matcher10 m10) {
  806. return ::testing::AllOf(m1, ::testing::AllOf(m2, m3, m4, m5, m6, m7, m8, m9,
  807. m10));
  808. }
  809. // AnyOf(m1, m2, ..., mk) matches any value that matches any of the given
  810. // sub-matchers. AnyOf is called fully qualified to prevent ADL from firing.
  811. template <typename Matcher1, typename Matcher2>
  812. inline internal::EitherOfMatcher<Matcher1, Matcher2>
  813. AnyOf(Matcher1 m1, Matcher2 m2) {
  814. return internal::EitherOfMatcher<Matcher1, Matcher2>(m1, m2);
  815. }
  816. template <typename Matcher1, typename Matcher2, typename Matcher3>
  817. inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matcher2,
  818. Matcher3> >
  819. AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3) {
  820. return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3));
  821. }
  822. template <typename Matcher1, typename Matcher2, typename Matcher3,
  823. typename Matcher4>
  824. inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matcher2,
  825. internal::EitherOfMatcher<Matcher3, Matcher4> > >
  826. AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4) {
  827. return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3, m4));
  828. }
  829. template <typename Matcher1, typename Matcher2, typename Matcher3,
  830. typename Matcher4, typename Matcher5>
  831. inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matcher2,
  832. internal::EitherOfMatcher<Matcher3, internal::EitherOfMatcher<Matcher4,
  833. Matcher5> > > >
  834. AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5) {
  835. return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3, m4, m5));
  836. }
  837. template <typename Matcher1, typename Matcher2, typename Matcher3,
  838. typename Matcher4, typename Matcher5, typename Matcher6>
  839. inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matcher2,
  840. internal::EitherOfMatcher<Matcher3, internal::EitherOfMatcher<Matcher4,
  841. internal::EitherOfMatcher<Matcher5, Matcher6> > > > >
  842. AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5,
  843. Matcher6 m6) {
  844. return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3, m4, m5, m6));
  845. }
  846. template <typename Matcher1, typename Matcher2, typename Matcher3,
  847. typename Matcher4, typename Matcher5, typename Matcher6, typename Matcher7>
  848. inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matcher2,
  849. internal::EitherOfMatcher<Matcher3, internal::EitherOfMatcher<Matcher4,
  850. internal::EitherOfMatcher<Matcher5, internal::EitherOfMatcher<Matcher6,
  851. Matcher7> > > > > >
  852. AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5,
  853. Matcher6 m6, Matcher7 m7) {
  854. return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3, m4, m5, m6, m7));
  855. }
  856. template <typename Matcher1, typename Matcher2, typename Matcher3,
  857. typename Matcher4, typename Matcher5, typename Matcher6, typename Matcher7,
  858. typename Matcher8>
  859. inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matcher2,
  860. internal::EitherOfMatcher<Matcher3, internal::EitherOfMatcher<Matcher4,
  861. internal::EitherOfMatcher<Matcher5, internal::EitherOfMatcher<Matcher6,
  862. internal::EitherOfMatcher<Matcher7, Matcher8> > > > > > >
  863. AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5,
  864. Matcher6 m6, Matcher7 m7, Matcher8 m8) {
  865. return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3, m4, m5, m6, m7, m8));
  866. }
  867. template <typename Matcher1, typename Matcher2, typename Matcher3,
  868. typename Matcher4, typename Matcher5, typename Matcher6, typename Matcher7,
  869. typename Matcher8, typename Matcher9>
  870. inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matcher2,
  871. internal::EitherOfMatcher<Matcher3, internal::EitherOfMatcher<Matcher4,
  872. internal::EitherOfMatcher<Matcher5, internal::EitherOfMatcher<Matcher6,
  873. internal::EitherOfMatcher<Matcher7, internal::EitherOfMatcher<Matcher8,
  874. Matcher9> > > > > > > >
  875. AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5,
  876. Matcher6 m6, Matcher7 m7, Matcher8 m8, Matcher9 m9) {
  877. return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3, m4, m5, m6, m7, m8, m9));
  878. }
  879. template <typename Matcher1, typename Matcher2, typename Matcher3,
  880. typename Matcher4, typename Matcher5, typename Matcher6, typename Matcher7,
  881. typename Matcher8, typename Matcher9, typename Matcher10>
  882. inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matcher2,
  883. internal::EitherOfMatcher<Matcher3, internal::EitherOfMatcher<Matcher4,
  884. internal::EitherOfMatcher<Matcher5, internal::EitherOfMatcher<Matcher6,
  885. internal::EitherOfMatcher<Matcher7, internal::EitherOfMatcher<Matcher8,
  886. internal::EitherOfMatcher<Matcher9, Matcher10> > > > > > > > >
  887. AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5,
  888. Matcher6 m6, Matcher7 m7, Matcher8 m8, Matcher9 m9, Matcher10 m10) {
  889. return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3, m4, m5, m6, m7, m8, m9,
  890. m10));
  891. }
  892. } // namespace testing
  893. // The MATCHER* family of macros can be used in a namespace scope to
  894. // define custom matchers easily.
  895. //
  896. // Basic Usage
  897. // ===========
  898. //
  899. // The syntax
  900. //
  901. // MATCHER(name, description_string) { statements; }
  902. //
  903. // defines a matcher with the given name that executes the statements,
  904. // which must return a bool to indicate if the match succeeds. Inside
  905. // the statements, you can refer to the value being matched by 'arg',
  906. // and refer to its type by 'arg_type'.
  907. //
  908. // The description string documents what the matcher does, and is used
  909. // to generate the failure message when the match fails. Since a
  910. // MATCHER() is usually defined in a header file shared by multiple
  911. // C++ source files, we require the description to be a C-string
  912. // literal to avoid possible side effects. It can be empty, in which
  913. // case we'll use the sequence of words in the matcher name as the
  914. // description.
  915. //
  916. // For example:
  917. //
  918. // MATCHER(IsEven, "") { return (arg % 2) == 0; }
  919. //
  920. // allows you to write
  921. //
  922. // // Expects mock_foo.Bar(n) to be called where n is even.
  923. // EXPECT_CALL(mock_foo, Bar(IsEven()));
  924. //
  925. // or,
  926. //
  927. // // Verifies that the value of some_expression is even.
  928. // EXPECT_THAT(some_expression, IsEven());
  929. //
  930. // If the above assertion fails, it will print something like:
  931. //
  932. // Value of: some_expression
  933. // Expected: is even
  934. // Actual: 7
  935. //
  936. // where the description "is even" is automatically calculated from the
  937. // matcher name IsEven.
  938. //
  939. // Argument Type
  940. // =============
  941. //
  942. // Note that the type of the value being matched (arg_type) is
  943. // determined by the context in which you use the matcher and is
  944. // supplied to you by the compiler, so you don't need to worry about
  945. // declaring it (nor can you). This allows the matcher to be
  946. // polymorphic. For example, IsEven() can be used to match any type
  947. // where the value of "(arg % 2) == 0" can be implicitly converted to
  948. // a bool. In the "Bar(IsEven())" example above, if method Bar()
  949. // takes an int, 'arg_type' will be int; if it takes an unsigned long,
  950. // 'arg_type' will be unsigned long; and so on.
  951. //
  952. // Parameterizing Matchers
  953. // =======================
  954. //
  955. // Sometimes you'll want to parameterize the matcher. For that you
  956. // can use another macro:
  957. //
  958. // MATCHER_P(name, param_name, description_string) { statements; }
  959. //
  960. // For example:
  961. //
  962. // MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; }
  963. //
  964. // will allow you to write:
  965. //
  966. // EXPECT_THAT(Blah("a"), HasAbsoluteValue(n));
  967. //
  968. // which may lead to this message (assuming n is 10):
  969. //
  970. // Value of: Blah("a")
  971. // Expected: has absolute value 10
  972. // Actual: -9
  973. //
  974. // Note that both the matcher description and its parameter are
  975. // printed, making the message human-friendly.
  976. //
  977. // In the matcher definition body, you can write 'foo_type' to
  978. // reference the type of a parameter named 'foo'. For example, in the
  979. // body of MATCHER_P(HasAbsoluteValue, value) above, you can write
  980. // 'value_type' to refer to the type of 'value'.
  981. //
  982. // We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P10 to
  983. // support multi-parameter matchers.
  984. //
  985. // Describing Parameterized Matchers
  986. // =================================
  987. //
  988. // The last argument to MATCHER*() is a string-typed expression. The
  989. // expression can reference all of the matcher's parameters and a
  990. // special bool-typed variable named 'negation'. When 'negation' is
  991. // false, the expression should evaluate to the matcher's description;
  992. // otherwise it should evaluate to the description of the negation of
  993. // the matcher. For example,
  994. //
  995. // using testing::PrintToString;
  996. //
  997. // MATCHER_P2(InClosedRange, low, hi,
  998. // string(negation ? "is not" : "is") + " in range [" +
  999. // PrintToString(low) + ", " + PrintToString(hi) + "]") {
  1000. // return low <= arg && arg <= hi;
  1001. // }
  1002. // ...
  1003. // EXPECT_THAT(3, InClosedRange(4, 6));
  1004. // EXPECT_THAT(3, Not(InClosedRange(2, 4)));
  1005. //
  1006. // would generate two failures that contain the text:
  1007. //
  1008. // Expected: is in range [4, 6]
  1009. // ...
  1010. // Expected: is not in range [2, 4]
  1011. //
  1012. // If you specify "" as the description, the failure message will
  1013. // contain the sequence of words in the matcher name followed by the
  1014. // parameter values printed as a tuple. For example,
  1015. //
  1016. // MATCHER_P2(InClosedRange, low, hi, "") { ... }
  1017. // ...
  1018. // EXPECT_THAT(3, InClosedRange(4, 6));
  1019. // EXPECT_THAT(3, Not(InClosedRange(2, 4)));
  1020. //
  1021. // would generate two failures that contain the text:
  1022. //
  1023. // Expected: in closed range (4, 6)
  1024. // ...
  1025. // Expected: not (in closed range (2, 4))
  1026. //
  1027. // Types of Matcher Parameters
  1028. // ===========================
  1029. //
  1030. // For the purpose of typing, you can view
  1031. //
  1032. // MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... }
  1033. //
  1034. // as shorthand for
  1035. //
  1036. // template <typename p1_type, ..., typename pk_type>
  1037. // FooMatcherPk<p1_type, ..., pk_type>
  1038. // Foo(p1_type p1, ..., pk_type pk) { ... }
  1039. //
  1040. // When you write Foo(v1, ..., vk), the compiler infers the types of
  1041. // the parameters v1, ..., and vk for you. If you are not happy with
  1042. // the result of the type inference, you can specify the types by
  1043. // explicitly instantiating the template, as in Foo<long, bool>(5,
  1044. // false). As said earlier, you don't get to (or need to) specify
  1045. // 'arg_type' as that's determined by the context in which the matcher
  1046. // is used. You can assign the result of expression Foo(p1, ..., pk)
  1047. // to a variable of type FooMatcherPk<p1_type, ..., pk_type>. This
  1048. // can be useful when composing matchers.
  1049. //
  1050. // While you can instantiate a matcher template with reference types,
  1051. // passing the parameters by pointer usually makes your code more
  1052. // readable. If, however, you still want to pass a parameter by
  1053. // reference, be aware that in the failure message generated by the
  1054. // matcher you will see the value of the referenced object but not its
  1055. // address.
  1056. //
  1057. // Explaining Match Results
  1058. // ========================
  1059. //
  1060. // Sometimes the matcher description alone isn't enough to explain why
  1061. // the match has failed or succeeded. For example, when expecting a
  1062. // long string, it can be very helpful to also print the diff between
  1063. // the expected string and the actual one. To achieve that, you can
  1064. // optionally stream additional information to a special variable
  1065. // named result_listener, whose type is a pointer to class
  1066. // MatchResultListener:
  1067. //
  1068. // MATCHER_P(EqualsLongString, str, "") {
  1069. // if (arg == str) return true;
  1070. //
  1071. // *result_listener << "the difference: "
  1072. /// << DiffStrings(str, arg);
  1073. // return false;
  1074. // }
  1075. //
  1076. // Overloading Matchers
  1077. // ====================
  1078. //
  1079. // You can overload matchers with different numbers of parameters:
  1080. //
  1081. // MATCHER_P(Blah, a, description_string1) { ... }
  1082. // MATCHER_P2(Blah, a, b, description_string2) { ... }
  1083. //
  1084. // Caveats
  1085. // =======
  1086. //
  1087. // When defining a new matcher, you should also consider implementing
  1088. // MatcherInterface or using MakePolymorphicMatcher(). These
  1089. // approaches require more work than the MATCHER* macros, but also
  1090. // give you more control on the types of the value being matched and
  1091. // the matcher parameters, which may leads to better compiler error
  1092. // messages when the matcher is used wrong. They also allow
  1093. // overloading matchers based on parameter types (as opposed to just
  1094. // based on the number of parameters).
  1095. //
  1096. // MATCHER*() can only be used in a namespace scope. The reason is
  1097. // that C++ doesn't yet allow function-local types to be used to
  1098. // instantiate templates. The up-coming C++0x standard will fix this.
  1099. // Once that's done, we'll consider supporting using MATCHER*() inside
  1100. // a function.
  1101. //
  1102. // More Information
  1103. // ================
  1104. //
  1105. // To learn more about using these macros, please search for 'MATCHER'
  1106. // on http://code.google.com/p/googlemock/wiki/CookBook.
  1107. #define MATCHER(name, description)\
  1108. class name##Matcher {\
  1109. public:\
  1110. template <typename arg_type>\
  1111. class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
  1112. public:\
  1113. gmock_Impl()\
  1114. {}\
  1115. virtual bool MatchAndExplain(\
  1116. arg_type arg, ::testing::MatchResultListener* result_listener) const;\
  1117. virtual void DescribeTo(::std::ostream* gmock_os) const {\
  1118. *gmock_os << FormatDescription(false);\
  1119. }\
  1120. virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
  1121. *gmock_os << FormatDescription(true);\
  1122. }\
  1123. private:\
  1124. ::testing::internal::string FormatDescription(bool negation) const {\
  1125. const ::testing::internal::string gmock_description = (description);\
  1126. if (!gmock_description.empty())\
  1127. return gmock_description;\
  1128. return ::testing::internal::FormatMatcherDescription(\
  1129. negation, #name,\
  1130. ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
  1131. ::std::tr1::tuple<>()));\
  1132. }\
  1133. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1134. };\
  1135. template <typename arg_type>\
  1136. operator ::testing::Matcher<arg_type>() const {\
  1137. return ::testing::Matcher<arg_type>(\
  1138. new gmock_Impl<arg_type>());\
  1139. }\
  1140. name##Matcher() {\
  1141. }\
  1142. private:\
  1143. GTEST_DISALLOW_ASSIGN_(name##Matcher);\
  1144. };\
  1145. inline name##Matcher name() {\
  1146. return name##Matcher();\
  1147. }\
  1148. template <typename arg_type>\
  1149. bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain(\
  1150. arg_type arg,\
  1151. ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
  1152. const
  1153. #define MATCHER_P(name, p0, description)\
  1154. template <typename p0##_type>\
  1155. class name##MatcherP {\
  1156. public:\
  1157. template <typename arg_type>\
  1158. class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
  1159. public:\
  1160. explicit gmock_Impl(p0##_type gmock_p0)\
  1161. : p0(gmock_p0) {}\
  1162. virtual bool MatchAndExplain(\
  1163. arg_type arg, ::testing::MatchResultListener* result_listener) const;\
  1164. virtual void DescribeTo(::std::ostream* gmock_os) const {\
  1165. *gmock_os << FormatDescription(false);\
  1166. }\
  1167. virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
  1168. *gmock_os << FormatDescription(true);\
  1169. }\
  1170. p0##_type p0;\
  1171. private:\
  1172. ::testing::internal::string FormatDescription(bool negation) const {\
  1173. const ::testing::internal::string gmock_description = (description);\
  1174. if (!gmock_description.empty())\
  1175. return gmock_description;\
  1176. return ::testing::internal::FormatMatcherDescription(\
  1177. negation, #name,\
  1178. ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
  1179. ::std::tr1::tuple<p0##_type>(p0)));\
  1180. }\
  1181. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1182. };\
  1183. template <typename arg_type>\
  1184. operator ::testing::Matcher<arg_type>() const {\
  1185. return ::testing::Matcher<arg_type>(\
  1186. new gmock_Impl<arg_type>(p0));\
  1187. }\
  1188. name##MatcherP(p0##_type gmock_p0) : p0(gmock_p0) {\
  1189. }\
  1190. p0##_type p0;\
  1191. private:\
  1192. GTEST_DISALLOW_ASSIGN_(name##MatcherP);\
  1193. };\
  1194. template <typename p0##_type>\
  1195. inline name##MatcherP<p0##_type> name(p0##_type p0) {\
  1196. return name##MatcherP<p0##_type>(p0);\
  1197. }\
  1198. template <typename p0##_type>\
  1199. template <typename arg_type>\
  1200. bool name##MatcherP<p0##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
  1201. arg_type arg,\
  1202. ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
  1203. const
  1204. #define MATCHER_P2(name, p0, p1, description)\
  1205. template <typename p0##_type, typename p1##_type>\
  1206. class name##MatcherP2 {\
  1207. public:\
  1208. template <typename arg_type>\
  1209. class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
  1210. public:\
  1211. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\
  1212. : p0(gmock_p0), p1(gmock_p1) {}\
  1213. virtual bool MatchAndExplain(\
  1214. arg_type arg, ::testing::MatchResultListener* result_listener) const;\
  1215. virtual void DescribeTo(::std::ostream* gmock_os) const {\
  1216. *gmock_os << FormatDescription(false);\
  1217. }\
  1218. virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
  1219. *gmock_os << FormatDescription(true);\
  1220. }\
  1221. p0##_type p0;\
  1222. p1##_type p1;\
  1223. private:\
  1224. ::testing::internal::string FormatDescription(bool negation) const {\
  1225. const ::testing::internal::string gmock_description = (description);\
  1226. if (!gmock_description.empty())\
  1227. return gmock_description;\
  1228. return ::testing::internal::FormatMatcherDescription(\
  1229. negation, #name,\
  1230. ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
  1231. ::std::tr1::tuple<p0##_type, p1##_type>(p0, p1)));\
  1232. }\
  1233. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1234. };\
  1235. template <typename arg_type>\
  1236. operator ::testing::Matcher<arg_type>() const {\
  1237. return ::testing::Matcher<arg_type>(\
  1238. new gmock_Impl<arg_type>(p0, p1));\
  1239. }\
  1240. name##MatcherP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
  1241. p1(gmock_p1) {\
  1242. }\
  1243. p0##_type p0;\
  1244. p1##_type p1;\
  1245. private:\
  1246. GTEST_DISALLOW_ASSIGN_(name##MatcherP2);\
  1247. };\
  1248. template <typename p0##_type, typename p1##_type>\
  1249. inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \
  1250. p1##_type p1) {\
  1251. return name##MatcherP2<p0##_type, p1##_type>(p0, p1);\
  1252. }\
  1253. template <typename p0##_type, typename p1##_type>\
  1254. template <typename arg_type>\
  1255. bool name##MatcherP2<p0##_type, \
  1256. p1##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
  1257. arg_type arg,\
  1258. ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
  1259. const
  1260. #define MATCHER_P3(name, p0, p1, p2, description)\
  1261. template <typename p0##_type, typename p1##_type, typename p2##_type>\
  1262. class name##MatcherP3 {\
  1263. public:\
  1264. template <typename arg_type>\
  1265. class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
  1266. public:\
  1267. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\
  1268. : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\
  1269. virtual bool MatchAndExplain(\
  1270. arg_type arg, ::testing::MatchResultListener* result_listener) const;\
  1271. virtual void DescribeTo(::std::ostream* gmock_os) const {\
  1272. *gmock_os << FormatDescription(false);\
  1273. }\
  1274. virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
  1275. *gmock_os << FormatDescription(true);\
  1276. }\
  1277. p0##_type p0;\
  1278. p1##_type p1;\
  1279. p2##_type p2;\
  1280. private:\
  1281. ::testing::internal::string FormatDescription(bool negation) const {\
  1282. const ::testing::internal::string gmock_description = (description);\
  1283. if (!gmock_description.empty())\
  1284. return gmock_description;\
  1285. return ::testing::internal::FormatMatcherDescription(\
  1286. negation, #name,\
  1287. ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
  1288. ::std::tr1::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \
  1289. p2)));\
  1290. }\
  1291. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1292. };\
  1293. template <typename arg_type>\
  1294. operator ::testing::Matcher<arg_type>() const {\
  1295. return ::testing::Matcher<arg_type>(\
  1296. new gmock_Impl<arg_type>(p0, p1, p2));\
  1297. }\
  1298. name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \
  1299. p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {\
  1300. }\
  1301. p0##_type p0;\
  1302. p1##_type p1;\
  1303. p2##_type p2;\
  1304. private:\
  1305. GTEST_DISALLOW_ASSIGN_(name##MatcherP3);\
  1306. };\
  1307. template <typename p0##_type, typename p1##_type, typename p2##_type>\
  1308. inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
  1309. p1##_type p1, p2##_type p2) {\
  1310. return name##MatcherP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
  1311. }\
  1312. template <typename p0##_type, typename p1##_type, typename p2##_type>\
  1313. template <typename arg_type>\
  1314. bool name##MatcherP3<p0##_type, p1##_type, \
  1315. p2##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
  1316. arg_type arg,\
  1317. ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
  1318. const
  1319. #define MATCHER_P4(name, p0, p1, p2, p3, description)\
  1320. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1321. typename p3##_type>\
  1322. class name##MatcherP4 {\
  1323. public:\
  1324. template <typename arg_type>\
  1325. class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
  1326. public:\
  1327. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1328. p3##_type gmock_p3)\
  1329. : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3) {}\
  1330. virtual bool MatchAndExplain(\
  1331. arg_type arg, ::testing::MatchResultListener* result_listener) const;\
  1332. virtual void DescribeTo(::std::ostream* gmock_os) const {\
  1333. *gmock_os << FormatDescription(false);\
  1334. }\
  1335. virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
  1336. *gmock_os << FormatDescription(true);\
  1337. }\
  1338. p0##_type p0;\
  1339. p1##_type p1;\
  1340. p2##_type p2;\
  1341. p3##_type p3;\
  1342. private:\
  1343. ::testing::internal::string FormatDescription(bool negation) const {\
  1344. const ::testing::internal::string gmock_description = (description);\
  1345. if (!gmock_description.empty())\
  1346. return gmock_description;\
  1347. return ::testing::internal::FormatMatcherDescription(\
  1348. negation, #name,\
  1349. ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
  1350. ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, \
  1351. p3##_type>(p0, p1, p2, p3)));\
  1352. }\
  1353. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1354. };\
  1355. template <typename arg_type>\
  1356. operator ::testing::Matcher<arg_type>() const {\
  1357. return ::testing::Matcher<arg_type>(\
  1358. new gmock_Impl<arg_type>(p0, p1, p2, p3));\
  1359. }\
  1360. name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \
  1361. p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \
  1362. p2(gmock_p2), p3(gmock_p3) {\
  1363. }\
  1364. p0##_type p0;\
  1365. p1##_type p1;\
  1366. p2##_type p2;\
  1367. p3##_type p3;\
  1368. private:\
  1369. GTEST_DISALLOW_ASSIGN_(name##MatcherP4);\
  1370. };\
  1371. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1372. typename p3##_type>\
  1373. inline name##MatcherP4<p0##_type, p1##_type, p2##_type, \
  1374. p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
  1375. p3##_type p3) {\
  1376. return name##MatcherP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, \
  1377. p1, p2, p3);\
  1378. }\
  1379. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1380. typename p3##_type>\
  1381. template <typename arg_type>\
  1382. bool name##MatcherP4<p0##_type, p1##_type, p2##_type, \
  1383. p3##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
  1384. arg_type arg,\
  1385. ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
  1386. const
  1387. #define MATCHER_P5(name, p0, p1, p2, p3, p4, description)\
  1388. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1389. typename p3##_type, typename p4##_type>\
  1390. class name##MatcherP5 {\
  1391. public:\
  1392. template <typename arg_type>\
  1393. class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
  1394. public:\
  1395. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1396. p3##_type gmock_p3, p4##_type gmock_p4)\
  1397. : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
  1398. p4(gmock_p4) {}\
  1399. virtual bool MatchAndExplain(\
  1400. arg_type arg, ::testing::MatchResultListener* result_listener) const;\
  1401. virtual void DescribeTo(::std::ostream* gmock_os) const {\
  1402. *gmock_os << FormatDescription(false);\
  1403. }\
  1404. virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
  1405. *gmock_os << FormatDescription(true);\
  1406. }\
  1407. p0##_type p0;\
  1408. p1##_type p1;\
  1409. p2##_type p2;\
  1410. p3##_type p3;\
  1411. p4##_type p4;\
  1412. private:\
  1413. ::testing::internal::string FormatDescription(bool negation) const {\
  1414. const ::testing::internal::string gmock_description = (description);\
  1415. if (!gmock_description.empty())\
  1416. return gmock_description;\
  1417. return ::testing::internal::FormatMatcherDescription(\
  1418. negation, #name,\
  1419. ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
  1420. ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
  1421. p4##_type>(p0, p1, p2, p3, p4)));\
  1422. }\
  1423. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1424. };\
  1425. template <typename arg_type>\
  1426. operator ::testing::Matcher<arg_type>() const {\
  1427. return ::testing::Matcher<arg_type>(\
  1428. new gmock_Impl<arg_type>(p0, p1, p2, p3, p4));\
  1429. }\
  1430. name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \
  1431. p2##_type gmock_p2, p3##_type gmock_p3, \
  1432. p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
  1433. p3(gmock_p3), p4(gmock_p4) {\
  1434. }\
  1435. p0##_type p0;\
  1436. p1##_type p1;\
  1437. p2##_type p2;\
  1438. p3##_type p3;\
  1439. p4##_type p4;\
  1440. private:\
  1441. GTEST_DISALLOW_ASSIGN_(name##MatcherP5);\
  1442. };\
  1443. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1444. typename p3##_type, typename p4##_type>\
  1445. inline name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
  1446. p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
  1447. p4##_type p4) {\
  1448. return name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
  1449. p4##_type>(p0, p1, p2, p3, p4);\
  1450. }\
  1451. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1452. typename p3##_type, typename p4##_type>\
  1453. template <typename arg_type>\
  1454. bool name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
  1455. p4##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
  1456. arg_type arg,\
  1457. ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
  1458. const
  1459. #define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)\
  1460. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1461. typename p3##_type, typename p4##_type, typename p5##_type>\
  1462. class name##MatcherP6 {\
  1463. public:\
  1464. template <typename arg_type>\
  1465. class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
  1466. public:\
  1467. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1468. p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5)\
  1469. : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
  1470. p4(gmock_p4), p5(gmock_p5) {}\
  1471. virtual bool MatchAndExplain(\
  1472. arg_type arg, ::testing::MatchResultListener* result_listener) const;\
  1473. virtual void DescribeTo(::std::ostream* gmock_os) const {\
  1474. *gmock_os << FormatDescription(false);\
  1475. }\
  1476. virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
  1477. *gmock_os << FormatDescription(true);\
  1478. }\
  1479. p0##_type p0;\
  1480. p1##_type p1;\
  1481. p2##_type p2;\
  1482. p3##_type p3;\
  1483. p4##_type p4;\
  1484. p5##_type p5;\
  1485. private:\
  1486. ::testing::internal::string FormatDescription(bool negation) const {\
  1487. const ::testing::internal::string gmock_description = (description);\
  1488. if (!gmock_description.empty())\
  1489. return gmock_description;\
  1490. return ::testing::internal::FormatMatcherDescription(\
  1491. negation, #name,\
  1492. ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
  1493. ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
  1494. p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\
  1495. }\
  1496. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1497. };\
  1498. template <typename arg_type>\
  1499. operator ::testing::Matcher<arg_type>() const {\
  1500. return ::testing::Matcher<arg_type>(\
  1501. new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5));\
  1502. }\
  1503. name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \
  1504. p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
  1505. p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
  1506. p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {\
  1507. }\
  1508. p0##_type p0;\
  1509. p1##_type p1;\
  1510. p2##_type p2;\
  1511. p3##_type p3;\
  1512. p4##_type p4;\
  1513. p5##_type p5;\
  1514. private:\
  1515. GTEST_DISALLOW_ASSIGN_(name##MatcherP6);\
  1516. };\
  1517. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1518. typename p3##_type, typename p4##_type, typename p5##_type>\
  1519. inline name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \
  1520. p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
  1521. p3##_type p3, p4##_type p4, p5##_type p5) {\
  1522. return name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \
  1523. p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
  1524. }\
  1525. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1526. typename p3##_type, typename p4##_type, typename p5##_type>\
  1527. template <typename arg_type>\
  1528. bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
  1529. p5##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
  1530. arg_type arg,\
  1531. ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
  1532. const
  1533. #define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description)\
  1534. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1535. typename p3##_type, typename p4##_type, typename p5##_type, \
  1536. typename p6##_type>\
  1537. class name##MatcherP7 {\
  1538. public:\
  1539. template <typename arg_type>\
  1540. class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
  1541. public:\
  1542. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1543. p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
  1544. p6##_type gmock_p6)\
  1545. : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
  1546. p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\
  1547. virtual bool MatchAndExplain(\
  1548. arg_type arg, ::testing::MatchResultListener* result_listener) const;\
  1549. virtual void DescribeTo(::std::ostream* gmock_os) const {\
  1550. *gmock_os << FormatDescription(false);\
  1551. }\
  1552. virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
  1553. *gmock_os << FormatDescription(true);\
  1554. }\
  1555. p0##_type p0;\
  1556. p1##_type p1;\
  1557. p2##_type p2;\
  1558. p3##_type p3;\
  1559. p4##_type p4;\
  1560. p5##_type p5;\
  1561. p6##_type p6;\
  1562. private:\
  1563. ::testing::internal::string FormatDescription(bool negation) const {\
  1564. const ::testing::internal::string gmock_description = (description);\
  1565. if (!gmock_description.empty())\
  1566. return gmock_description;\
  1567. return ::testing::internal::FormatMatcherDescription(\
  1568. negation, #name,\
  1569. ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
  1570. ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
  1571. p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \
  1572. p6)));\
  1573. }\
  1574. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1575. };\
  1576. template <typename arg_type>\
  1577. operator ::testing::Matcher<arg_type>() const {\
  1578. return ::testing::Matcher<arg_type>(\
  1579. new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6));\
  1580. }\
  1581. name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \
  1582. p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
  1583. p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \
  1584. p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \
  1585. p6(gmock_p6) {\
  1586. }\
  1587. p0##_type p0;\
  1588. p1##_type p1;\
  1589. p2##_type p2;\
  1590. p3##_type p3;\
  1591. p4##_type p4;\
  1592. p5##_type p5;\
  1593. p6##_type p6;\
  1594. private:\
  1595. GTEST_DISALLOW_ASSIGN_(name##MatcherP7);\
  1596. };\
  1597. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1598. typename p3##_type, typename p4##_type, typename p5##_type, \
  1599. typename p6##_type>\
  1600. inline name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \
  1601. p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \
  1602. p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
  1603. p6##_type p6) {\
  1604. return name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \
  1605. p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
  1606. }\
  1607. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1608. typename p3##_type, typename p4##_type, typename p5##_type, \
  1609. typename p6##_type>\
  1610. template <typename arg_type>\
  1611. bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
  1612. p5##_type, p6##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
  1613. arg_type arg,\
  1614. ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
  1615. const
  1616. #define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description)\
  1617. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1618. typename p3##_type, typename p4##_type, typename p5##_type, \
  1619. typename p6##_type, typename p7##_type>\
  1620. class name##MatcherP8 {\
  1621. public:\
  1622. template <typename arg_type>\
  1623. class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
  1624. public:\
  1625. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1626. p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
  1627. p6##_type gmock_p6, p7##_type gmock_p7)\
  1628. : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
  1629. p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\
  1630. virtual bool MatchAndExplain(\
  1631. arg_type arg, ::testing::MatchResultListener* result_listener) const;\
  1632. virtual void DescribeTo(::std::ostream* gmock_os) const {\
  1633. *gmock_os << FormatDescription(false);\
  1634. }\
  1635. virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
  1636. *gmock_os << FormatDescription(true);\
  1637. }\
  1638. p0##_type p0;\
  1639. p1##_type p1;\
  1640. p2##_type p2;\
  1641. p3##_type p3;\
  1642. p4##_type p4;\
  1643. p5##_type p5;\
  1644. p6##_type p6;\
  1645. p7##_type p7;\
  1646. private:\
  1647. ::testing::internal::string FormatDescription(bool negation) const {\
  1648. const ::testing::internal::string gmock_description = (description);\
  1649. if (!gmock_description.empty())\
  1650. return gmock_description;\
  1651. return ::testing::internal::FormatMatcherDescription(\
  1652. negation, #name,\
  1653. ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
  1654. ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
  1655. p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \
  1656. p3, p4, p5, p6, p7)));\
  1657. }\
  1658. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1659. };\
  1660. template <typename arg_type>\
  1661. operator ::testing::Matcher<arg_type>() const {\
  1662. return ::testing::Matcher<arg_type>(\
  1663. new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7));\
  1664. }\
  1665. name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \
  1666. p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
  1667. p5##_type gmock_p5, p6##_type gmock_p6, \
  1668. p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
  1669. p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
  1670. p7(gmock_p7) {\
  1671. }\
  1672. p0##_type p0;\
  1673. p1##_type p1;\
  1674. p2##_type p2;\
  1675. p3##_type p3;\
  1676. p4##_type p4;\
  1677. p5##_type p5;\
  1678. p6##_type p6;\
  1679. p7##_type p7;\
  1680. private:\
  1681. GTEST_DISALLOW_ASSIGN_(name##MatcherP8);\
  1682. };\
  1683. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1684. typename p3##_type, typename p4##_type, typename p5##_type, \
  1685. typename p6##_type, typename p7##_type>\
  1686. inline name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \
  1687. p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \
  1688. p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
  1689. p6##_type p6, p7##_type p7) {\
  1690. return name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \
  1691. p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
  1692. p6, p7);\
  1693. }\
  1694. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1695. typename p3##_type, typename p4##_type, typename p5##_type, \
  1696. typename p6##_type, typename p7##_type>\
  1697. template <typename arg_type>\
  1698. bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
  1699. p5##_type, p6##_type, \
  1700. p7##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
  1701. arg_type arg,\
  1702. ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
  1703. const
  1704. #define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description)\
  1705. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1706. typename p3##_type, typename p4##_type, typename p5##_type, \
  1707. typename p6##_type, typename p7##_type, typename p8##_type>\
  1708. class name##MatcherP9 {\
  1709. public:\
  1710. template <typename arg_type>\
  1711. class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
  1712. public:\
  1713. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1714. p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
  1715. p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\
  1716. : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
  1717. p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
  1718. p8(gmock_p8) {}\
  1719. virtual bool MatchAndExplain(\
  1720. arg_type arg, ::testing::MatchResultListener* result_listener) const;\
  1721. virtual void DescribeTo(::std::ostream* gmock_os) const {\
  1722. *gmock_os << FormatDescription(false);\
  1723. }\
  1724. virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
  1725. *gmock_os << FormatDescription(true);\
  1726. }\
  1727. p0##_type p0;\
  1728. p1##_type p1;\
  1729. p2##_type p2;\
  1730. p3##_type p3;\
  1731. p4##_type p4;\
  1732. p5##_type p5;\
  1733. p6##_type p6;\
  1734. p7##_type p7;\
  1735. p8##_type p8;\
  1736. private:\
  1737. ::testing::internal::string FormatDescription(bool negation) const {\
  1738. const ::testing::internal::string gmock_description = (description);\
  1739. if (!gmock_description.empty())\
  1740. return gmock_description;\
  1741. return ::testing::internal::FormatMatcherDescription(\
  1742. negation, #name,\
  1743. ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
  1744. ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
  1745. p4##_type, p5##_type, p6##_type, p7##_type, \
  1746. p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\
  1747. }\
  1748. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1749. };\
  1750. template <typename arg_type>\
  1751. operator ::testing::Matcher<arg_type>() const {\
  1752. return ::testing::Matcher<arg_type>(\
  1753. new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8));\
  1754. }\
  1755. name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \
  1756. p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
  1757. p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
  1758. p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
  1759. p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
  1760. p8(gmock_p8) {\
  1761. }\
  1762. p0##_type p0;\
  1763. p1##_type p1;\
  1764. p2##_type p2;\
  1765. p3##_type p3;\
  1766. p4##_type p4;\
  1767. p5##_type p5;\
  1768. p6##_type p6;\
  1769. p7##_type p7;\
  1770. p8##_type p8;\
  1771. private:\
  1772. GTEST_DISALLOW_ASSIGN_(name##MatcherP9);\
  1773. };\
  1774. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1775. typename p3##_type, typename p4##_type, typename p5##_type, \
  1776. typename p6##_type, typename p7##_type, typename p8##_type>\
  1777. inline name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \
  1778. p4##_type, p5##_type, p6##_type, p7##_type, \
  1779. p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
  1780. p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \
  1781. p8##_type p8) {\
  1782. return name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \
  1783. p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
  1784. p3, p4, p5, p6, p7, p8);\
  1785. }\
  1786. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1787. typename p3##_type, typename p4##_type, typename p5##_type, \
  1788. typename p6##_type, typename p7##_type, typename p8##_type>\
  1789. template <typename arg_type>\
  1790. bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
  1791. p5##_type, p6##_type, p7##_type, \
  1792. p8##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
  1793. arg_type arg,\
  1794. ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
  1795. const
  1796. #define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, description)\
  1797. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1798. typename p3##_type, typename p4##_type, typename p5##_type, \
  1799. typename p6##_type, typename p7##_type, typename p8##_type, \
  1800. typename p9##_type>\
  1801. class name##MatcherP10 {\
  1802. public:\
  1803. template <typename arg_type>\
  1804. class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
  1805. public:\
  1806. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1807. p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
  1808. p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
  1809. p9##_type gmock_p9)\
  1810. : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
  1811. p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
  1812. p8(gmock_p8), p9(gmock_p9) {}\
  1813. virtual bool MatchAndExplain(\
  1814. arg_type arg, ::testing::MatchResultListener* result_listener) const;\
  1815. virtual void DescribeTo(::std::ostream* gmock_os) const {\
  1816. *gmock_os << FormatDescription(false);\
  1817. }\
  1818. virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
  1819. *gmock_os << FormatDescription(true);\
  1820. }\
  1821. p0##_type p0;\
  1822. p1##_type p1;\
  1823. p2##_type p2;\
  1824. p3##_type p3;\
  1825. p4##_type p4;\
  1826. p5##_type p5;\
  1827. p6##_type p6;\
  1828. p7##_type p7;\
  1829. p8##_type p8;\
  1830. p9##_type p9;\
  1831. private:\
  1832. ::testing::internal::string FormatDescription(bool negation) const {\
  1833. const ::testing::internal::string gmock_description = (description);\
  1834. if (!gmock_description.empty())\
  1835. return gmock_description;\
  1836. return ::testing::internal::FormatMatcherDescription(\
  1837. negation, #name,\
  1838. ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
  1839. ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
  1840. p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
  1841. p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\
  1842. }\
  1843. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1844. };\
  1845. template <typename arg_type>\
  1846. operator ::testing::Matcher<arg_type>() const {\
  1847. return ::testing::Matcher<arg_type>(\
  1848. new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9));\
  1849. }\
  1850. name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \
  1851. p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
  1852. p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
  1853. p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \
  1854. p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
  1855. p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {\
  1856. }\
  1857. p0##_type p0;\
  1858. p1##_type p1;\
  1859. p2##_type p2;\
  1860. p3##_type p3;\
  1861. p4##_type p4;\
  1862. p5##_type p5;\
  1863. p6##_type p6;\
  1864. p7##_type p7;\
  1865. p8##_type p8;\
  1866. p9##_type p9;\
  1867. private:\
  1868. GTEST_DISALLOW_ASSIGN_(name##MatcherP10);\
  1869. };\
  1870. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1871. typename p3##_type, typename p4##_type, typename p5##_type, \
  1872. typename p6##_type, typename p7##_type, typename p8##_type, \
  1873. typename p9##_type>\
  1874. inline name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
  1875. p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
  1876. p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
  1877. p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
  1878. p9##_type p9) {\
  1879. return name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
  1880. p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
  1881. p1, p2, p3, p4, p5, p6, p7, p8, p9);\
  1882. }\
  1883. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1884. typename p3##_type, typename p4##_type, typename p5##_type, \
  1885. typename p6##_type, typename p7##_type, typename p8##_type, \
  1886. typename p9##_type>\
  1887. template <typename arg_type>\
  1888. bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
  1889. p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
  1890. p9##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
  1891. arg_type arg,\
  1892. ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
  1893. const
  1894. #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_