?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

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