Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-07 08:19:51

0001 // This file was GENERATED by command:
0002 //     pump.py gmock-generated-matchers.h.pump
0003 // DO NOT EDIT BY HAND!!!
0004 
0005 // Copyright 2008, Google Inc.
0006 // All rights reserved.
0007 //
0008 // Redistribution and use in source and binary forms, with or without
0009 // modification, are permitted provided that the following conditions are
0010 // met:
0011 //
0012 //     * Redistributions of source code must retain the above copyright
0013 // notice, this list of conditions and the following disclaimer.
0014 //     * Redistributions in binary form must reproduce the above
0015 // copyright notice, this list of conditions and the following disclaimer
0016 // in the documentation and/or other materials provided with the
0017 // distribution.
0018 //     * Neither the name of Google Inc. nor the names of its
0019 // contributors may be used to endorse or promote products derived from
0020 // this software without specific prior written permission.
0021 //
0022 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0023 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0024 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0025 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0026 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0027 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0028 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0029 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0030 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0031 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0032 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0033 
0034 // Google Mock - a framework for writing C++ mock classes.
0035 //
0036 // This file implements some commonly used variadic matchers.
0037 
0038 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
0039 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
0040 
0041 #include <iterator>
0042 #include <sstream>
0043 #include <string>
0044 #include <vector>
0045 #include "gmock/gmock-matchers.h"
0046 
0047 namespace testing {
0048 namespace internal {
0049 
0050 // The type of the i-th (0-based) field of Tuple.
0051 #define GMOCK_FIELD_TYPE_(Tuple, i) \
0052     typename ::testing::tuple_element<i, Tuple>::type
0053 
0054 // TupleFields<Tuple, k0, ..., kn> is for selecting fields from a
0055 // tuple of type Tuple.  It has two members:
0056 //
0057 //   type: a tuple type whose i-th field is the ki-th field of Tuple.
0058 //   GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple.
0059 //
0060 // For example, in class TupleFields<tuple<bool, char, int>, 2, 0>, we have:
0061 //
0062 //   type is tuple<int, bool>, and
0063 //   GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true).
0064 
0065 template <class Tuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1,
0066     int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
0067     int k9 = -1>
0068 class TupleFields;
0069 
0070 // This generic version is used when there are 10 selectors.
0071 template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
0072     int k7, int k8, int k9>
0073 class TupleFields {
0074  public:
0075   typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
0076       GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
0077       GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
0078       GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
0079       GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8),
0080       GMOCK_FIELD_TYPE_(Tuple, k9)> type;
0081   static type GetSelectedFields(const Tuple& t) {
0082     return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
0083         get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t), get<k9>(t));
0084   }
0085 };
0086 
0087 // The following specialization is used for 0 ~ 9 selectors.
0088 
0089 template <class Tuple>
0090 class TupleFields<Tuple, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
0091  public:
0092   typedef ::testing::tuple<> type;
0093   static type GetSelectedFields(const Tuple& /* t */) {
0094     return type();
0095   }
0096 };
0097 
0098 template <class Tuple, int k0>
0099 class TupleFields<Tuple, k0, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
0100  public:
0101   typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0)> type;
0102   static type GetSelectedFields(const Tuple& t) {
0103     return type(get<k0>(t));
0104   }
0105 };
0106 
0107 template <class Tuple, int k0, int k1>
0108 class TupleFields<Tuple, k0, k1, -1, -1, -1, -1, -1, -1, -1, -1> {
0109  public:
0110   typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
0111       GMOCK_FIELD_TYPE_(Tuple, k1)> type;
0112   static type GetSelectedFields(const Tuple& t) {
0113     return type(get<k0>(t), get<k1>(t));
0114   }
0115 };
0116 
0117 template <class Tuple, int k0, int k1, int k2>
0118 class TupleFields<Tuple, k0, k1, k2, -1, -1, -1, -1, -1, -1, -1> {
0119  public:
0120   typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
0121       GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2)> type;
0122   static type GetSelectedFields(const Tuple& t) {
0123     return type(get<k0>(t), get<k1>(t), get<k2>(t));
0124   }
0125 };
0126 
0127 template <class Tuple, int k0, int k1, int k2, int k3>
0128 class TupleFields<Tuple, k0, k1, k2, k3, -1, -1, -1, -1, -1, -1> {
0129  public:
0130   typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
0131       GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
0132       GMOCK_FIELD_TYPE_(Tuple, k3)> type;
0133   static type GetSelectedFields(const Tuple& t) {
0134     return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t));
0135   }
0136 };
0137 
0138 template <class Tuple, int k0, int k1, int k2, int k3, int k4>
0139 class TupleFields<Tuple, k0, k1, k2, k3, k4, -1, -1, -1, -1, -1> {
0140  public:
0141   typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
0142       GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
0143       GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4)> type;
0144   static type GetSelectedFields(const Tuple& t) {
0145     return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t));
0146   }
0147 };
0148 
0149 template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5>
0150 class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, -1, -1, -1, -1> {
0151  public:
0152   typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
0153       GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
0154       GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
0155       GMOCK_FIELD_TYPE_(Tuple, k5)> type;
0156   static type GetSelectedFields(const Tuple& t) {
0157     return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
0158         get<k5>(t));
0159   }
0160 };
0161 
0162 template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6>
0163 class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, -1, -1, -1> {
0164  public:
0165   typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
0166       GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
0167       GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
0168       GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6)> type;
0169   static type GetSelectedFields(const Tuple& t) {
0170     return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
0171         get<k5>(t), get<k6>(t));
0172   }
0173 };
0174 
0175 template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
0176     int k7>
0177 class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, -1, -1> {
0178  public:
0179   typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
0180       GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
0181       GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
0182       GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
0183       GMOCK_FIELD_TYPE_(Tuple, k7)> type;
0184   static type GetSelectedFields(const Tuple& t) {
0185     return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
0186         get<k5>(t), get<k6>(t), get<k7>(t));
0187   }
0188 };
0189 
0190 template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
0191     int k7, int k8>
0192 class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, k8, -1> {
0193  public:
0194   typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
0195       GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
0196       GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
0197       GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
0198       GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8)> type;
0199   static type GetSelectedFields(const Tuple& t) {
0200     return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
0201         get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t));
0202   }
0203 };
0204 
0205 #undef GMOCK_FIELD_TYPE_
0206 
0207 // Implements the Args() matcher.
0208 template <class ArgsTuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1,
0209     int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
0210     int k9 = -1>
0211 class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> {
0212  public:
0213   // ArgsTuple may have top-level const or reference modifiers.
0214   typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple;
0215   typedef typename internal::TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5,
0216       k6, k7, k8, k9>::type SelectedArgs;
0217   typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher;
0218 
0219   template <typename InnerMatcher>
0220   explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher)
0221       : inner_matcher_(SafeMatcherCast<const SelectedArgs&>(inner_matcher)) {}
0222 
0223   virtual bool MatchAndExplain(ArgsTuple args,
0224                                MatchResultListener* listener) const {
0225     const SelectedArgs& selected_args = GetSelectedArgs(args);
0226     if (!listener->IsInterested())
0227       return inner_matcher_.Matches(selected_args);
0228 
0229     PrintIndices(listener->stream());
0230     *listener << "are " << PrintToString(selected_args);
0231 
0232     StringMatchResultListener inner_listener;
0233     const bool match = inner_matcher_.MatchAndExplain(selected_args,
0234                                                       &inner_listener);
0235     PrintIfNotEmpty(inner_listener.str(), listener->stream());
0236     return match;
0237   }
0238 
0239   virtual void DescribeTo(::std::ostream* os) const {
0240     *os << "are a tuple ";
0241     PrintIndices(os);
0242     inner_matcher_.DescribeTo(os);
0243   }
0244 
0245   virtual void DescribeNegationTo(::std::ostream* os) const {
0246     *os << "are a tuple ";
0247     PrintIndices(os);
0248     inner_matcher_.DescribeNegationTo(os);
0249   }
0250 
0251  private:
0252   static SelectedArgs GetSelectedArgs(ArgsTuple args) {
0253     return TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5, k6, k7, k8,
0254         k9>::GetSelectedFields(args);
0255   }
0256 
0257   // Prints the indices of the selected fields.
0258   static void PrintIndices(::std::ostream* os) {
0259     *os << "whose fields (";
0260     const int indices[10] = { k0, k1, k2, k3, k4, k5, k6, k7, k8, k9 };
0261     for (int i = 0; i < 10; i++) {
0262       if (indices[i] < 0)
0263         break;
0264 
0265       if (i >= 1)
0266         *os << ", ";
0267 
0268       *os << "#" << indices[i];
0269     }
0270     *os << ") ";
0271   }
0272 
0273   const MonomorphicInnerMatcher inner_matcher_;
0274 
0275   GTEST_DISALLOW_ASSIGN_(ArgsMatcherImpl);
0276 };
0277 
0278 template <class InnerMatcher, int k0 = -1, int k1 = -1, int k2 = -1,
0279     int k3 = -1, int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1,
0280     int k8 = -1, int k9 = -1>
0281 class ArgsMatcher {
0282  public:
0283   explicit ArgsMatcher(const InnerMatcher& inner_matcher)
0284       : inner_matcher_(inner_matcher) {}
0285 
0286   template <typename ArgsTuple>
0287   operator Matcher<ArgsTuple>() const {
0288     return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, k0, k1, k2, k3, k4, k5,
0289         k6, k7, k8, k9>(inner_matcher_));
0290   }
0291 
0292  private:
0293   const InnerMatcher inner_matcher_;
0294 
0295   GTEST_DISALLOW_ASSIGN_(ArgsMatcher);
0296 };
0297 
0298 // A set of metafunctions for computing the result type of AllOf.
0299 // AllOf(m1, ..., mN) returns
0300 // AllOfResultN<decltype(m1), ..., decltype(mN)>::type.
0301 
0302 // Although AllOf isn't defined for one argument, AllOfResult1 is defined
0303 // to simplify the implementation.
0304 template <typename M1>
0305 struct AllOfResult1 {
0306   typedef M1 type;
0307 };
0308 
0309 template <typename M1, typename M2>
0310 struct AllOfResult2 {
0311   typedef BothOfMatcher<
0312       typename AllOfResult1<M1>::type,
0313       typename AllOfResult1<M2>::type
0314   > type;
0315 };
0316 
0317 template <typename M1, typename M2, typename M3>
0318 struct AllOfResult3 {
0319   typedef BothOfMatcher<
0320       typename AllOfResult1<M1>::type,
0321       typename AllOfResult2<M2, M3>::type
0322   > type;
0323 };
0324 
0325 template <typename M1, typename M2, typename M3, typename M4>
0326 struct AllOfResult4 {
0327   typedef BothOfMatcher<
0328       typename AllOfResult2<M1, M2>::type,
0329       typename AllOfResult2<M3, M4>::type
0330   > type;
0331 };
0332 
0333 template <typename M1, typename M2, typename M3, typename M4, typename M5>
0334 struct AllOfResult5 {
0335   typedef BothOfMatcher<
0336       typename AllOfResult2<M1, M2>::type,
0337       typename AllOfResult3<M3, M4, M5>::type
0338   > type;
0339 };
0340 
0341 template <typename M1, typename M2, typename M3, typename M4, typename M5,
0342     typename M6>
0343 struct AllOfResult6 {
0344   typedef BothOfMatcher<
0345       typename AllOfResult3<M1, M2, M3>::type,
0346       typename AllOfResult3<M4, M5, M6>::type
0347   > type;
0348 };
0349 
0350 template <typename M1, typename M2, typename M3, typename M4, typename M5,
0351     typename M6, typename M7>
0352 struct AllOfResult7 {
0353   typedef BothOfMatcher<
0354       typename AllOfResult3<M1, M2, M3>::type,
0355       typename AllOfResult4<M4, M5, M6, M7>::type
0356   > type;
0357 };
0358 
0359 template <typename M1, typename M2, typename M3, typename M4, typename M5,
0360     typename M6, typename M7, typename M8>
0361 struct AllOfResult8 {
0362   typedef BothOfMatcher<
0363       typename AllOfResult4<M1, M2, M3, M4>::type,
0364       typename AllOfResult4<M5, M6, M7, M8>::type
0365   > type;
0366 };
0367 
0368 template <typename M1, typename M2, typename M3, typename M4, typename M5,
0369     typename M6, typename M7, typename M8, typename M9>
0370 struct AllOfResult9 {
0371   typedef BothOfMatcher<
0372       typename AllOfResult4<M1, M2, M3, M4>::type,
0373       typename AllOfResult5<M5, M6, M7, M8, M9>::type
0374   > type;
0375 };
0376 
0377 template <typename M1, typename M2, typename M3, typename M4, typename M5,
0378     typename M6, typename M7, typename M8, typename M9, typename M10>
0379 struct AllOfResult10 {
0380   typedef BothOfMatcher<
0381       typename AllOfResult5<M1, M2, M3, M4, M5>::type,
0382       typename AllOfResult5<M6, M7, M8, M9, M10>::type
0383   > type;
0384 };
0385 
0386 // A set of metafunctions for computing the result type of AnyOf.
0387 // AnyOf(m1, ..., mN) returns
0388 // AnyOfResultN<decltype(m1), ..., decltype(mN)>::type.
0389 
0390 // Although AnyOf isn't defined for one argument, AnyOfResult1 is defined
0391 // to simplify the implementation.
0392 template <typename M1>
0393 struct AnyOfResult1 {
0394   typedef M1 type;
0395 };
0396 
0397 template <typename M1, typename M2>
0398 struct AnyOfResult2 {
0399   typedef EitherOfMatcher<
0400       typename AnyOfResult1<M1>::type,
0401       typename AnyOfResult1<M2>::type
0402   > type;
0403 };
0404 
0405 template <typename M1, typename M2, typename M3>
0406 struct AnyOfResult3 {
0407   typedef EitherOfMatcher<
0408       typename AnyOfResult1<M1>::type,
0409       typename AnyOfResult2<M2, M3>::type
0410   > type;
0411 };
0412 
0413 template <typename M1, typename M2, typename M3, typename M4>
0414 struct AnyOfResult4 {
0415   typedef EitherOfMatcher<
0416       typename AnyOfResult2<M1, M2>::type,
0417       typename AnyOfResult2<M3, M4>::type
0418   > type;
0419 };
0420 
0421 template <typename M1, typename M2, typename M3, typename M4, typename M5>
0422 struct AnyOfResult5 {
0423   typedef EitherOfMatcher<
0424       typename AnyOfResult2<M1, M2>::type,
0425       typename AnyOfResult3<M3, M4, M5>::type
0426   > type;
0427 };
0428 
0429 template <typename M1, typename M2, typename M3, typename M4, typename M5,
0430     typename M6>
0431 struct AnyOfResult6 {
0432   typedef EitherOfMatcher<
0433       typename AnyOfResult3<M1, M2, M3>::type,
0434       typename AnyOfResult3<M4, M5, M6>::type
0435   > type;
0436 };
0437 
0438 template <typename M1, typename M2, typename M3, typename M4, typename M5,
0439     typename M6, typename M7>
0440 struct AnyOfResult7 {
0441   typedef EitherOfMatcher<
0442       typename AnyOfResult3<M1, M2, M3>::type,
0443       typename AnyOfResult4<M4, M5, M6, M7>::type
0444   > type;
0445 };
0446 
0447 template <typename M1, typename M2, typename M3, typename M4, typename M5,
0448     typename M6, typename M7, typename M8>
0449 struct AnyOfResult8 {
0450   typedef EitherOfMatcher<
0451       typename AnyOfResult4<M1, M2, M3, M4>::type,
0452       typename AnyOfResult4<M5, M6, M7, M8>::type
0453   > type;
0454 };
0455 
0456 template <typename M1, typename M2, typename M3, typename M4, typename M5,
0457     typename M6, typename M7, typename M8, typename M9>
0458 struct AnyOfResult9 {
0459   typedef EitherOfMatcher<
0460       typename AnyOfResult4<M1, M2, M3, M4>::type,
0461       typename AnyOfResult5<M5, M6, M7, M8, M9>::type
0462   > type;
0463 };
0464 
0465 template <typename M1, typename M2, typename M3, typename M4, typename M5,
0466     typename M6, typename M7, typename M8, typename M9, typename M10>
0467 struct AnyOfResult10 {
0468   typedef EitherOfMatcher<
0469       typename AnyOfResult5<M1, M2, M3, M4, M5>::type,
0470       typename AnyOfResult5<M6, M7, M8, M9, M10>::type
0471   > type;
0472 };
0473 
0474 }  // namespace internal
0475 
0476 // Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected
0477 // fields of it matches a_matcher.  C++ doesn't support default
0478 // arguments for function templates, so we have to overload it.
0479 template <typename InnerMatcher>
0480 inline internal::ArgsMatcher<InnerMatcher>
0481 Args(const InnerMatcher& matcher) {
0482   return internal::ArgsMatcher<InnerMatcher>(matcher);
0483 }
0484 
0485 template <int k1, typename InnerMatcher>
0486 inline internal::ArgsMatcher<InnerMatcher, k1>
0487 Args(const InnerMatcher& matcher) {
0488   return internal::ArgsMatcher<InnerMatcher, k1>(matcher);
0489 }
0490 
0491 template <int k1, int k2, typename InnerMatcher>
0492 inline internal::ArgsMatcher<InnerMatcher, k1, k2>
0493 Args(const InnerMatcher& matcher) {
0494   return internal::ArgsMatcher<InnerMatcher, k1, k2>(matcher);
0495 }
0496 
0497 template <int k1, int k2, int k3, typename InnerMatcher>
0498 inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3>
0499 Args(const InnerMatcher& matcher) {
0500   return internal::ArgsMatcher<InnerMatcher, k1, k2, k3>(matcher);
0501 }
0502 
0503 template <int k1, int k2, int k3, int k4, typename InnerMatcher>
0504 inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4>
0505 Args(const InnerMatcher& matcher) {
0506   return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4>(matcher);
0507 }
0508 
0509 template <int k1, int k2, int k3, int k4, int k5, typename InnerMatcher>
0510 inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5>
0511 Args(const InnerMatcher& matcher) {
0512   return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5>(matcher);
0513 }
0514 
0515 template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerMatcher>
0516 inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6>
0517 Args(const InnerMatcher& matcher) {
0518   return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6>(matcher);
0519 }
0520 
0521 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7,
0522     typename InnerMatcher>
0523 inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7>
0524 Args(const InnerMatcher& matcher) {
0525   return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6,
0526       k7>(matcher);
0527 }
0528 
0529 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
0530     typename InnerMatcher>
0531 inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8>
0532 Args(const InnerMatcher& matcher) {
0533   return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7,
0534       k8>(matcher);
0535 }
0536 
0537 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
0538     int k9, typename InnerMatcher>
0539 inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9>
0540 Args(const InnerMatcher& matcher) {
0541   return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8,
0542       k9>(matcher);
0543 }
0544 
0545 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
0546     int k9, int k10, typename InnerMatcher>
0547 inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9,
0548     k10>
0549 Args(const InnerMatcher& matcher) {
0550   return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8,
0551       k9, k10>(matcher);
0552 }
0553 
0554 // ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with
0555 // n elements, where the i-th element in the container must
0556 // match the i-th argument in the list.  Each argument of
0557 // ElementsAre() can be either a value or a matcher.  We support up to
0558 // 10 arguments.
0559 //
0560 // The use of DecayArray in the implementation allows ElementsAre()
0561 // to accept string literals, whose type is const char[N], but we
0562 // want to treat them as const char*.
0563 //
0564 // NOTE: Since ElementsAre() cares about the order of the elements, it
0565 // must not be used with containers whose elements's order is
0566 // undefined (e.g. hash_map).
0567 
0568 inline internal::ElementsAreMatcher<
0569     ::testing::tuple<> >
0570 ElementsAre() {
0571   typedef ::testing::tuple<> Args;
0572   return internal::ElementsAreMatcher<Args>(Args());
0573 }
0574 
0575 template <typename T1>
0576 inline internal::ElementsAreMatcher<
0577     ::testing::tuple<
0578         typename internal::DecayArray<T1>::type> >
0579 ElementsAre(const T1& e1) {
0580   typedef ::testing::tuple<
0581       typename internal::DecayArray<T1>::type> Args;
0582   return internal::ElementsAreMatcher<Args>(Args(e1));
0583 }
0584 
0585 template <typename T1, typename T2>
0586 inline internal::ElementsAreMatcher<
0587     ::testing::tuple<
0588         typename internal::DecayArray<T1>::type,
0589         typename internal::DecayArray<T2>::type> >
0590 ElementsAre(const T1& e1, const T2& e2) {
0591   typedef ::testing::tuple<
0592       typename internal::DecayArray<T1>::type,
0593       typename internal::DecayArray<T2>::type> Args;
0594   return internal::ElementsAreMatcher<Args>(Args(e1, e2));
0595 }
0596 
0597 template <typename T1, typename T2, typename T3>
0598 inline internal::ElementsAreMatcher<
0599     ::testing::tuple<
0600         typename internal::DecayArray<T1>::type,
0601         typename internal::DecayArray<T2>::type,
0602         typename internal::DecayArray<T3>::type> >
0603 ElementsAre(const T1& e1, const T2& e2, const T3& e3) {
0604   typedef ::testing::tuple<
0605       typename internal::DecayArray<T1>::type,
0606       typename internal::DecayArray<T2>::type,
0607       typename internal::DecayArray<T3>::type> Args;
0608   return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3));
0609 }
0610 
0611 template <typename T1, typename T2, typename T3, typename T4>
0612 inline internal::ElementsAreMatcher<
0613     ::testing::tuple<
0614         typename internal::DecayArray<T1>::type,
0615         typename internal::DecayArray<T2>::type,
0616         typename internal::DecayArray<T3>::type,
0617         typename internal::DecayArray<T4>::type> >
0618 ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) {
0619   typedef ::testing::tuple<
0620       typename internal::DecayArray<T1>::type,
0621       typename internal::DecayArray<T2>::type,
0622       typename internal::DecayArray<T3>::type,
0623       typename internal::DecayArray<T4>::type> Args;
0624   return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4));
0625 }
0626 
0627 template <typename T1, typename T2, typename T3, typename T4, typename T5>
0628 inline internal::ElementsAreMatcher<
0629     ::testing::tuple<
0630         typename internal::DecayArray<T1>::type,
0631         typename internal::DecayArray<T2>::type,
0632         typename internal::DecayArray<T3>::type,
0633         typename internal::DecayArray<T4>::type,
0634         typename internal::DecayArray<T5>::type> >
0635 ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
0636     const T5& e5) {
0637   typedef ::testing::tuple<
0638       typename internal::DecayArray<T1>::type,
0639       typename internal::DecayArray<T2>::type,
0640       typename internal::DecayArray<T3>::type,
0641       typename internal::DecayArray<T4>::type,
0642       typename internal::DecayArray<T5>::type> Args;
0643   return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5));
0644 }
0645 
0646 template <typename T1, typename T2, typename T3, typename T4, typename T5,
0647     typename T6>
0648 inline internal::ElementsAreMatcher<
0649     ::testing::tuple<
0650         typename internal::DecayArray<T1>::type,
0651         typename internal::DecayArray<T2>::type,
0652         typename internal::DecayArray<T3>::type,
0653         typename internal::DecayArray<T4>::type,
0654         typename internal::DecayArray<T5>::type,
0655         typename internal::DecayArray<T6>::type> >
0656 ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
0657     const T5& e5, const T6& e6) {
0658   typedef ::testing::tuple<
0659       typename internal::DecayArray<T1>::type,
0660       typename internal::DecayArray<T2>::type,
0661       typename internal::DecayArray<T3>::type,
0662       typename internal::DecayArray<T4>::type,
0663       typename internal::DecayArray<T5>::type,
0664       typename internal::DecayArray<T6>::type> Args;
0665   return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6));
0666 }
0667 
0668 template <typename T1, typename T2, typename T3, typename T4, typename T5,
0669     typename T6, typename T7>
0670 inline internal::ElementsAreMatcher<
0671     ::testing::tuple<
0672         typename internal::DecayArray<T1>::type,
0673         typename internal::DecayArray<T2>::type,
0674         typename internal::DecayArray<T3>::type,
0675         typename internal::DecayArray<T4>::type,
0676         typename internal::DecayArray<T5>::type,
0677         typename internal::DecayArray<T6>::type,
0678         typename internal::DecayArray<T7>::type> >
0679 ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
0680     const T5& e5, const T6& e6, const T7& e7) {
0681   typedef ::testing::tuple<
0682       typename internal::DecayArray<T1>::type,
0683       typename internal::DecayArray<T2>::type,
0684       typename internal::DecayArray<T3>::type,
0685       typename internal::DecayArray<T4>::type,
0686       typename internal::DecayArray<T5>::type,
0687       typename internal::DecayArray<T6>::type,
0688       typename internal::DecayArray<T7>::type> Args;
0689   return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7));
0690 }
0691 
0692 template <typename T1, typename T2, typename T3, typename T4, typename T5,
0693     typename T6, typename T7, typename T8>
0694 inline internal::ElementsAreMatcher<
0695     ::testing::tuple<
0696         typename internal::DecayArray<T1>::type,
0697         typename internal::DecayArray<T2>::type,
0698         typename internal::DecayArray<T3>::type,
0699         typename internal::DecayArray<T4>::type,
0700         typename internal::DecayArray<T5>::type,
0701         typename internal::DecayArray<T6>::type,
0702         typename internal::DecayArray<T7>::type,
0703         typename internal::DecayArray<T8>::type> >
0704 ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
0705     const T5& e5, const T6& e6, const T7& e7, const T8& e8) {
0706   typedef ::testing::tuple<
0707       typename internal::DecayArray<T1>::type,
0708       typename internal::DecayArray<T2>::type,
0709       typename internal::DecayArray<T3>::type,
0710       typename internal::DecayArray<T4>::type,
0711       typename internal::DecayArray<T5>::type,
0712       typename internal::DecayArray<T6>::type,
0713       typename internal::DecayArray<T7>::type,
0714       typename internal::DecayArray<T8>::type> Args;
0715   return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7,
0716       e8));
0717 }
0718 
0719 template <typename T1, typename T2, typename T3, typename T4, typename T5,
0720     typename T6, typename T7, typename T8, typename T9>
0721 inline internal::ElementsAreMatcher<
0722     ::testing::tuple<
0723         typename internal::DecayArray<T1>::type,
0724         typename internal::DecayArray<T2>::type,
0725         typename internal::DecayArray<T3>::type,
0726         typename internal::DecayArray<T4>::type,
0727         typename internal::DecayArray<T5>::type,
0728         typename internal::DecayArray<T6>::type,
0729         typename internal::DecayArray<T7>::type,
0730         typename internal::DecayArray<T8>::type,
0731         typename internal::DecayArray<T9>::type> >
0732 ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
0733     const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) {
0734   typedef ::testing::tuple<
0735       typename internal::DecayArray<T1>::type,
0736       typename internal::DecayArray<T2>::type,
0737       typename internal::DecayArray<T3>::type,
0738       typename internal::DecayArray<T4>::type,
0739       typename internal::DecayArray<T5>::type,
0740       typename internal::DecayArray<T6>::type,
0741       typename internal::DecayArray<T7>::type,
0742       typename internal::DecayArray<T8>::type,
0743       typename internal::DecayArray<T9>::type> Args;
0744   return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7,
0745       e8, e9));
0746 }
0747 
0748 template <typename T1, typename T2, typename T3, typename T4, typename T5,
0749     typename T6, typename T7, typename T8, typename T9, typename T10>
0750 inline internal::ElementsAreMatcher<
0751     ::testing::tuple<
0752         typename internal::DecayArray<T1>::type,
0753         typename internal::DecayArray<T2>::type,
0754         typename internal::DecayArray<T3>::type,
0755         typename internal::DecayArray<T4>::type,
0756         typename internal::DecayArray<T5>::type,
0757         typename internal::DecayArray<T6>::type,
0758         typename internal::DecayArray<T7>::type,
0759         typename internal::DecayArray<T8>::type,
0760         typename internal::DecayArray<T9>::type,
0761         typename internal::DecayArray<T10>::type> >
0762 ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
0763     const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9,
0764     const T10& e10) {
0765   typedef ::testing::tuple<
0766       typename internal::DecayArray<T1>::type,
0767       typename internal::DecayArray<T2>::type,
0768       typename internal::DecayArray<T3>::type,
0769       typename internal::DecayArray<T4>::type,
0770       typename internal::DecayArray<T5>::type,
0771       typename internal::DecayArray<T6>::type,
0772       typename internal::DecayArray<T7>::type,
0773       typename internal::DecayArray<T8>::type,
0774       typename internal::DecayArray<T9>::type,
0775       typename internal::DecayArray<T10>::type> Args;
0776   return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7,
0777       e8, e9, e10));
0778 }
0779 
0780 // UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension
0781 // that matches n elements in any order.  We support up to n=10 arguments.
0782 
0783 inline internal::UnorderedElementsAreMatcher<
0784     ::testing::tuple<> >
0785 UnorderedElementsAre() {
0786   typedef ::testing::tuple<> Args;
0787   return internal::UnorderedElementsAreMatcher<Args>(Args());
0788 }
0789 
0790 template <typename T1>
0791 inline internal::UnorderedElementsAreMatcher<
0792     ::testing::tuple<
0793         typename internal::DecayArray<T1>::type> >
0794 UnorderedElementsAre(const T1& e1) {
0795   typedef ::testing::tuple<
0796       typename internal::DecayArray<T1>::type> Args;
0797   return internal::UnorderedElementsAreMatcher<Args>(Args(e1));
0798 }
0799 
0800 template <typename T1, typename T2>
0801 inline internal::UnorderedElementsAreMatcher<
0802     ::testing::tuple<
0803         typename internal::DecayArray<T1>::type,
0804         typename internal::DecayArray<T2>::type> >
0805 UnorderedElementsAre(const T1& e1, const T2& e2) {
0806   typedef ::testing::tuple<
0807       typename internal::DecayArray<T1>::type,
0808       typename internal::DecayArray<T2>::type> Args;
0809   return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2));
0810 }
0811 
0812 template <typename T1, typename T2, typename T3>
0813 inline internal::UnorderedElementsAreMatcher<
0814     ::testing::tuple<
0815         typename internal::DecayArray<T1>::type,
0816         typename internal::DecayArray<T2>::type,
0817         typename internal::DecayArray<T3>::type> >
0818 UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3) {
0819   typedef ::testing::tuple<
0820       typename internal::DecayArray<T1>::type,
0821       typename internal::DecayArray<T2>::type,
0822       typename internal::DecayArray<T3>::type> Args;
0823   return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3));
0824 }
0825 
0826 template <typename T1, typename T2, typename T3, typename T4>
0827 inline internal::UnorderedElementsAreMatcher<
0828     ::testing::tuple<
0829         typename internal::DecayArray<T1>::type,
0830         typename internal::DecayArray<T2>::type,
0831         typename internal::DecayArray<T3>::type,
0832         typename internal::DecayArray<T4>::type> >
0833 UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) {
0834   typedef ::testing::tuple<
0835       typename internal::DecayArray<T1>::type,
0836       typename internal::DecayArray<T2>::type,
0837       typename internal::DecayArray<T3>::type,
0838       typename internal::DecayArray<T4>::type> Args;
0839   return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4));
0840 }
0841 
0842 template <typename T1, typename T2, typename T3, typename T4, typename T5>
0843 inline internal::UnorderedElementsAreMatcher<
0844     ::testing::tuple<
0845         typename internal::DecayArray<T1>::type,
0846         typename internal::DecayArray<T2>::type,
0847         typename internal::DecayArray<T3>::type,
0848         typename internal::DecayArray<T4>::type,
0849         typename internal::DecayArray<T5>::type> >
0850 UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
0851     const T5& e5) {
0852   typedef ::testing::tuple<
0853       typename internal::DecayArray<T1>::type,
0854       typename internal::DecayArray<T2>::type,
0855       typename internal::DecayArray<T3>::type,
0856       typename internal::DecayArray<T4>::type,
0857       typename internal::DecayArray<T5>::type> Args;
0858   return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5));
0859 }
0860 
0861 template <typename T1, typename T2, typename T3, typename T4, typename T5,
0862     typename T6>
0863 inline internal::UnorderedElementsAreMatcher<
0864     ::testing::tuple<
0865         typename internal::DecayArray<T1>::type,
0866         typename internal::DecayArray<T2>::type,
0867         typename internal::DecayArray<T3>::type,
0868         typename internal::DecayArray<T4>::type,
0869         typename internal::DecayArray<T5>::type,
0870         typename internal::DecayArray<T6>::type> >
0871 UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
0872     const T5& e5, const T6& e6) {
0873   typedef ::testing::tuple<
0874       typename internal::DecayArray<T1>::type,
0875       typename internal::DecayArray<T2>::type,
0876       typename internal::DecayArray<T3>::type,
0877       typename internal::DecayArray<T4>::type,
0878       typename internal::DecayArray<T5>::type,
0879       typename internal::DecayArray<T6>::type> Args;
0880   return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5,
0881       e6));
0882 }
0883 
0884 template <typename T1, typename T2, typename T3, typename T4, typename T5,
0885     typename T6, typename T7>
0886 inline internal::UnorderedElementsAreMatcher<
0887     ::testing::tuple<
0888         typename internal::DecayArray<T1>::type,
0889         typename internal::DecayArray<T2>::type,
0890         typename internal::DecayArray<T3>::type,
0891         typename internal::DecayArray<T4>::type,
0892         typename internal::DecayArray<T5>::type,
0893         typename internal::DecayArray<T6>::type,
0894         typename internal::DecayArray<T7>::type> >
0895 UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
0896     const T5& e5, const T6& e6, const T7& e7) {
0897   typedef ::testing::tuple<
0898       typename internal::DecayArray<T1>::type,
0899       typename internal::DecayArray<T2>::type,
0900       typename internal::DecayArray<T3>::type,
0901       typename internal::DecayArray<T4>::type,
0902       typename internal::DecayArray<T5>::type,
0903       typename internal::DecayArray<T6>::type,
0904       typename internal::DecayArray<T7>::type> Args;
0905   return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5,
0906       e6, e7));
0907 }
0908 
0909 template <typename T1, typename T2, typename T3, typename T4, typename T5,
0910     typename T6, typename T7, typename T8>
0911 inline internal::UnorderedElementsAreMatcher<
0912     ::testing::tuple<
0913         typename internal::DecayArray<T1>::type,
0914         typename internal::DecayArray<T2>::type,
0915         typename internal::DecayArray<T3>::type,
0916         typename internal::DecayArray<T4>::type,
0917         typename internal::DecayArray<T5>::type,
0918         typename internal::DecayArray<T6>::type,
0919         typename internal::DecayArray<T7>::type,
0920         typename internal::DecayArray<T8>::type> >
0921 UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
0922     const T5& e5, const T6& e6, const T7& e7, const T8& e8) {
0923   typedef ::testing::tuple<
0924       typename internal::DecayArray<T1>::type,
0925       typename internal::DecayArray<T2>::type,
0926       typename internal::DecayArray<T3>::type,
0927       typename internal::DecayArray<T4>::type,
0928       typename internal::DecayArray<T5>::type,
0929       typename internal::DecayArray<T6>::type,
0930       typename internal::DecayArray<T7>::type,
0931       typename internal::DecayArray<T8>::type> Args;
0932   return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5,
0933       e6, e7, e8));
0934 }
0935 
0936 template <typename T1, typename T2, typename T3, typename T4, typename T5,
0937     typename T6, typename T7, typename T8, typename T9>
0938 inline internal::UnorderedElementsAreMatcher<
0939     ::testing::tuple<
0940         typename internal::DecayArray<T1>::type,
0941         typename internal::DecayArray<T2>::type,
0942         typename internal::DecayArray<T3>::type,
0943         typename internal::DecayArray<T4>::type,
0944         typename internal::DecayArray<T5>::type,
0945         typename internal::DecayArray<T6>::type,
0946         typename internal::DecayArray<T7>::type,
0947         typename internal::DecayArray<T8>::type,
0948         typename internal::DecayArray<T9>::type> >
0949 UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
0950     const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) {
0951   typedef ::testing::tuple<
0952       typename internal::DecayArray<T1>::type,
0953       typename internal::DecayArray<T2>::type,
0954       typename internal::DecayArray<T3>::type,
0955       typename internal::DecayArray<T4>::type,
0956       typename internal::DecayArray<T5>::type,
0957       typename internal::DecayArray<T6>::type,
0958       typename internal::DecayArray<T7>::type,
0959       typename internal::DecayArray<T8>::type,
0960       typename internal::DecayArray<T9>::type> Args;
0961   return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5,
0962       e6, e7, e8, e9));
0963 }
0964 
0965 template <typename T1, typename T2, typename T3, typename T4, typename T5,
0966     typename T6, typename T7, typename T8, typename T9, typename T10>
0967 inline internal::UnorderedElementsAreMatcher<
0968     ::testing::tuple<
0969         typename internal::DecayArray<T1>::type,
0970         typename internal::DecayArray<T2>::type,
0971         typename internal::DecayArray<T3>::type,
0972         typename internal::DecayArray<T4>::type,
0973         typename internal::DecayArray<T5>::type,
0974         typename internal::DecayArray<T6>::type,
0975         typename internal::DecayArray<T7>::type,
0976         typename internal::DecayArray<T8>::type,
0977         typename internal::DecayArray<T9>::type,
0978         typename internal::DecayArray<T10>::type> >
0979 UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
0980     const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9,
0981     const T10& e10) {
0982   typedef ::testing::tuple<
0983       typename internal::DecayArray<T1>::type,
0984       typename internal::DecayArray<T2>::type,
0985       typename internal::DecayArray<T3>::type,
0986       typename internal::DecayArray<T4>::type,
0987       typename internal::DecayArray<T5>::type,
0988       typename internal::DecayArray<T6>::type,
0989       typename internal::DecayArray<T7>::type,
0990       typename internal::DecayArray<T8>::type,
0991       typename internal::DecayArray<T9>::type,
0992       typename internal::DecayArray<T10>::type> Args;
0993   return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5,
0994       e6, e7, e8, e9, e10));
0995 }
0996 
0997 // AllOf(m1, m2, ..., mk) matches any value that matches all of the given
0998 // sub-matchers.  AllOf is called fully qualified to prevent ADL from firing.
0999 
1000 template <typename M1, typename M2>
1001 inline typename internal::AllOfResult2<M1, M2>::type
1002 AllOf(M1 m1, M2 m2) {
1003   return typename internal::AllOfResult2<M1, M2>::type(
1004       m1,
1005       m2);
1006 }
1007 
1008 template <typename M1, typename M2, typename M3>
1009 inline typename internal::AllOfResult3<M1, M2, M3>::type
1010 AllOf(M1 m1, M2 m2, M3 m3) {
1011   return typename internal::AllOfResult3<M1, M2, M3>::type(
1012       m1,
1013       ::testing::AllOf(m2, m3));
1014 }
1015 
1016 template <typename M1, typename M2, typename M3, typename M4>
1017 inline typename internal::AllOfResult4<M1, M2, M3, M4>::type
1018 AllOf(M1 m1, M2 m2, M3 m3, M4 m4) {
1019   return typename internal::AllOfResult4<M1, M2, M3, M4>::type(
1020       ::testing::AllOf(m1, m2),
1021       ::testing::AllOf(m3, m4));
1022 }
1023 
1024 template <typename M1, typename M2, typename M3, typename M4, typename M5>
1025 inline typename internal::AllOfResult5<M1, M2, M3, M4, M5>::type
1026 AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) {
1027   return typename internal::AllOfResult5<M1, M2, M3, M4, M5>::type(
1028       ::testing::AllOf(m1, m2),
1029       ::testing::AllOf(m3, m4, m5));
1030 }
1031 
1032 template <typename M1, typename M2, typename M3, typename M4, typename M5,
1033     typename M6>
1034 inline typename internal::AllOfResult6<M1, M2, M3, M4, M5, M6>::type
1035 AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) {
1036   return typename internal::AllOfResult6<M1, M2, M3, M4, M5, M6>::type(
1037       ::testing::AllOf(m1, m2, m3),
1038       ::testing::AllOf(m4, m5, m6));
1039 }
1040 
1041 template <typename M1, typename M2, typename M3, typename M4, typename M5,
1042     typename M6, typename M7>
1043 inline typename internal::AllOfResult7<M1, M2, M3, M4, M5, M6, M7>::type
1044 AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) {
1045   return typename internal::AllOfResult7<M1, M2, M3, M4, M5, M6, M7>::type(
1046       ::testing::AllOf(m1, m2, m3),
1047       ::testing::AllOf(m4, m5, m6, m7));
1048 }
1049 
1050 template <typename M1, typename M2, typename M3, typename M4, typename M5,
1051     typename M6, typename M7, typename M8>
1052 inline typename internal::AllOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type
1053 AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) {
1054   return typename internal::AllOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type(
1055       ::testing::AllOf(m1, m2, m3, m4),
1056       ::testing::AllOf(m5, m6, m7, m8));
1057 }
1058 
1059 template <typename M1, typename M2, typename M3, typename M4, typename M5,
1060     typename M6, typename M7, typename M8, typename M9>
1061 inline typename internal::AllOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, M9>::type
1062 AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) {
1063   return typename internal::AllOfResult9<M1, M2, M3, M4, M5, M6, M7, M8,
1064       M9>::type(
1065       ::testing::AllOf(m1, m2, m3, m4),
1066       ::testing::AllOf(m5, m6, m7, m8, m9));
1067 }
1068 
1069 template <typename M1, typename M2, typename M3, typename M4, typename M5,
1070     typename M6, typename M7, typename M8, typename M9, typename M10>
1071 inline typename internal::AllOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9,
1072     M10>::type
1073 AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
1074   return typename internal::AllOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9,
1075       M10>::type(
1076       ::testing::AllOf(m1, m2, m3, m4, m5),
1077       ::testing::AllOf(m6, m7, m8, m9, m10));
1078 }
1079 
1080 // AnyOf(m1, m2, ..., mk) matches any value that matches any of the given
1081 // sub-matchers.  AnyOf is called fully qualified to prevent ADL from firing.
1082 
1083 template <typename M1, typename M2>
1084 inline typename internal::AnyOfResult2<M1, M2>::type
1085 AnyOf(M1 m1, M2 m2) {
1086   return typename internal::AnyOfResult2<M1, M2>::type(
1087       m1,
1088       m2);
1089 }
1090 
1091 template <typename M1, typename M2, typename M3>
1092 inline typename internal::AnyOfResult3<M1, M2, M3>::type
1093 AnyOf(M1 m1, M2 m2, M3 m3) {
1094   return typename internal::AnyOfResult3<M1, M2, M3>::type(
1095       m1,
1096       ::testing::AnyOf(m2, m3));
1097 }
1098 
1099 template <typename M1, typename M2, typename M3, typename M4>
1100 inline typename internal::AnyOfResult4<M1, M2, M3, M4>::type
1101 AnyOf(M1 m1, M2 m2, M3 m3, M4 m4) {
1102   return typename internal::AnyOfResult4<M1, M2, M3, M4>::type(
1103       ::testing::AnyOf(m1, m2),
1104       ::testing::AnyOf(m3, m4));
1105 }
1106 
1107 template <typename M1, typename M2, typename M3, typename M4, typename M5>
1108 inline typename internal::AnyOfResult5<M1, M2, M3, M4, M5>::type
1109 AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) {
1110   return typename internal::AnyOfResult5<M1, M2, M3, M4, M5>::type(
1111       ::testing::AnyOf(m1, m2),
1112       ::testing::AnyOf(m3, m4, m5));
1113 }
1114 
1115 template <typename M1, typename M2, typename M3, typename M4, typename M5,
1116     typename M6>
1117 inline typename internal::AnyOfResult6<M1, M2, M3, M4, M5, M6>::type
1118 AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) {
1119   return typename internal::AnyOfResult6<M1, M2, M3, M4, M5, M6>::type(
1120       ::testing::AnyOf(m1, m2, m3),
1121       ::testing::AnyOf(m4, m5, m6));
1122 }
1123 
1124 template <typename M1, typename M2, typename M3, typename M4, typename M5,
1125     typename M6, typename M7>
1126 inline typename internal::AnyOfResult7<M1, M2, M3, M4, M5, M6, M7>::type
1127 AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) {
1128   return typename internal::AnyOfResult7<M1, M2, M3, M4, M5, M6, M7>::type(
1129       ::testing::AnyOf(m1, m2, m3),
1130       ::testing::AnyOf(m4, m5, m6, m7));
1131 }
1132 
1133 template <typename M1, typename M2, typename M3, typename M4, typename M5,
1134     typename M6, typename M7, typename M8>
1135 inline typename internal::AnyOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type
1136 AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) {
1137   return typename internal::AnyOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type(
1138       ::testing::AnyOf(m1, m2, m3, m4),
1139       ::testing::AnyOf(m5, m6, m7, m8));
1140 }
1141 
1142 template <typename M1, typename M2, typename M3, typename M4, typename M5,
1143     typename M6, typename M7, typename M8, typename M9>
1144 inline typename internal::AnyOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, M9>::type
1145 AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) {
1146   return typename internal::AnyOfResult9<M1, M2, M3, M4, M5, M6, M7, M8,
1147       M9>::type(
1148       ::testing::AnyOf(m1, m2, m3, m4),
1149       ::testing::AnyOf(m5, m6, m7, m8, m9));
1150 }
1151 
1152 template <typename M1, typename M2, typename M3, typename M4, typename M5,
1153     typename M6, typename M7, typename M8, typename M9, typename M10>
1154 inline typename internal::AnyOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9,
1155     M10>::type
1156 AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
1157   return typename internal::AnyOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9,
1158       M10>::type(
1159       ::testing::AnyOf(m1, m2, m3, m4, m5),
1160       ::testing::AnyOf(m6, m7, m8, m9, m10));
1161 }
1162 
1163 }  // namespace testing
1164 
1165 
1166 // The MATCHER* family of macros can be used in a namespace scope to
1167 // define custom matchers easily.
1168 //
1169 // Basic Usage
1170 // ===========
1171 //
1172 // The syntax
1173 //
1174 //   MATCHER(name, description_string) { statements; }
1175 //
1176 // defines a matcher with the given name that executes the statements,
1177 // which must return a bool to indicate if the match succeeds.  Inside
1178 // the statements, you can refer to the value being matched by 'arg',
1179 // and refer to its type by 'arg_type'.
1180 //
1181 // The description string documents what the matcher does, and is used
1182 // to generate the failure message when the match fails.  Since a
1183 // MATCHER() is usually defined in a header file shared by multiple
1184 // C++ source files, we require the description to be a C-string
1185 // literal to avoid possible side effects.  It can be empty, in which
1186 // case we'll use the sequence of words in the matcher name as the
1187 // description.
1188 //
1189 // For example:
1190 //
1191 //   MATCHER(IsEven, "") { return (arg % 2) == 0; }
1192 //
1193 // allows you to write
1194 //
1195 //   // Expects mock_foo.Bar(n) to be called where n is even.
1196 //   EXPECT_CALL(mock_foo, Bar(IsEven()));
1197 //
1198 // or,
1199 //
1200 //   // Verifies that the value of some_expression is even.
1201 //   EXPECT_THAT(some_expression, IsEven());
1202 //
1203 // If the above assertion fails, it will print something like:
1204 //
1205 //   Value of: some_expression
1206 //   Expected: is even
1207 //     Actual: 7
1208 //
1209 // where the description "is even" is automatically calculated from the
1210 // matcher name IsEven.
1211 //
1212 // Argument Type
1213 // =============
1214 //
1215 // Note that the type of the value being matched (arg_type) is
1216 // determined by the context in which you use the matcher and is
1217 // supplied to you by the compiler, so you don't need to worry about
1218 // declaring it (nor can you).  This allows the matcher to be
1219 // polymorphic.  For example, IsEven() can be used to match any type
1220 // where the value of "(arg % 2) == 0" can be implicitly converted to
1221 // a bool.  In the "Bar(IsEven())" example above, if method Bar()
1222 // takes an int, 'arg_type' will be int; if it takes an unsigned long,
1223 // 'arg_type' will be unsigned long; and so on.
1224 //
1225 // Parameterizing Matchers
1226 // =======================
1227 //
1228 // Sometimes you'll want to parameterize the matcher.  For that you
1229 // can use another macro:
1230 //
1231 //   MATCHER_P(name, param_name, description_string) { statements; }
1232 //
1233 // For example:
1234 //
1235 //   MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; }
1236 //
1237 // will allow you to write:
1238 //
1239 //   EXPECT_THAT(Blah("a"), HasAbsoluteValue(n));
1240 //
1241 // which may lead to this message (assuming n is 10):
1242 //
1243 //   Value of: Blah("a")
1244 //   Expected: has absolute value 10
1245 //     Actual: -9
1246 //
1247 // Note that both the matcher description and its parameter are
1248 // printed, making the message human-friendly.
1249 //
1250 // In the matcher definition body, you can write 'foo_type' to
1251 // reference the type of a parameter named 'foo'.  For example, in the
1252 // body of MATCHER_P(HasAbsoluteValue, value) above, you can write
1253 // 'value_type' to refer to the type of 'value'.
1254 //
1255 // We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P10 to
1256 // support multi-parameter matchers.
1257 //
1258 // Describing Parameterized Matchers
1259 // =================================
1260 //
1261 // The last argument to MATCHER*() is a string-typed expression.  The
1262 // expression can reference all of the matcher's parameters and a
1263 // special bool-typed variable named 'negation'.  When 'negation' is
1264 // false, the expression should evaluate to the matcher's description;
1265 // otherwise it should evaluate to the description of the negation of
1266 // the matcher.  For example,
1267 //
1268 //   using testing::PrintToString;
1269 //
1270 //   MATCHER_P2(InClosedRange, low, hi,
1271 //       string(negation ? "is not" : "is") + " in range [" +
1272 //       PrintToString(low) + ", " + PrintToString(hi) + "]") {
1273 //     return low <= arg && arg <= hi;
1274 //   }
1275 //   ...
1276 //   EXPECT_THAT(3, InClosedRange(4, 6));
1277 //   EXPECT_THAT(3, Not(InClosedRange(2, 4)));
1278 //
1279 // would generate two failures that contain the text:
1280 //
1281 //   Expected: is in range [4, 6]
1282 //   ...
1283 //   Expected: is not in range [2, 4]
1284 //
1285 // If you specify "" as the description, the failure message will
1286 // contain the sequence of words in the matcher name followed by the
1287 // parameter values printed as a tuple.  For example,
1288 //
1289 //   MATCHER_P2(InClosedRange, low, hi, "") { ... }
1290 //   ...
1291 //   EXPECT_THAT(3, InClosedRange(4, 6));
1292 //   EXPECT_THAT(3, Not(InClosedRange(2, 4)));
1293 //
1294 // would generate two failures that contain the text:
1295 //
1296 //   Expected: in closed range (4, 6)
1297 //   ...
1298 //   Expected: not (in closed range (2, 4))
1299 //
1300 // Types of Matcher Parameters
1301 // ===========================
1302 //
1303 // For the purpose of typing, you can view
1304 //
1305 //   MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... }
1306 //
1307 // as shorthand for
1308 //
1309 //   template <typename p1_type, ..., typename pk_type>
1310 //   FooMatcherPk<p1_type, ..., pk_type>
1311 //   Foo(p1_type p1, ..., pk_type pk) { ... }
1312 //
1313 // When you write Foo(v1, ..., vk), the compiler infers the types of
1314 // the parameters v1, ..., and vk for you.  If you are not happy with
1315 // the result of the type inference, you can specify the types by
1316 // explicitly instantiating the template, as in Foo<long, bool>(5,
1317 // false).  As said earlier, you don't get to (or need to) specify
1318 // 'arg_type' as that's determined by the context in which the matcher
1319 // is used.  You can assign the result of expression Foo(p1, ..., pk)
1320 // to a variable of type FooMatcherPk<p1_type, ..., pk_type>.  This
1321 // can be useful when composing matchers.
1322 //
1323 // While you can instantiate a matcher template with reference types,
1324 // passing the parameters by pointer usually makes your code more
1325 // readable.  If, however, you still want to pass a parameter by
1326 // reference, be aware that in the failure message generated by the
1327 // matcher you will see the value of the referenced object but not its
1328 // address.
1329 //
1330 // Explaining Match Results
1331 // ========================
1332 //
1333 // Sometimes the matcher description alone isn't enough to explain why
1334 // the match has failed or succeeded.  For example, when expecting a
1335 // long string, it can be very helpful to also print the diff between
1336 // the expected string and the actual one.  To achieve that, you can
1337 // optionally stream additional information to a special variable
1338 // named result_listener, whose type is a pointer to class
1339 // MatchResultListener:
1340 //
1341 //   MATCHER_P(EqualsLongString, str, "") {
1342 //     if (arg == str) return true;
1343 //
1344 //     *result_listener << "the difference: "
1345 ///                     << DiffStrings(str, arg);
1346 //     return false;
1347 //   }
1348 //
1349 // Overloading Matchers
1350 // ====================
1351 //
1352 // You can overload matchers with different numbers of parameters:
1353 //
1354 //   MATCHER_P(Blah, a, description_string1) { ... }
1355 //   MATCHER_P2(Blah, a, b, description_string2) { ... }
1356 //
1357 // Caveats
1358 // =======
1359 //
1360 // When defining a new matcher, you should also consider implementing
1361 // MatcherInterface or using MakePolymorphicMatcher().  These
1362 // approaches require more work than the MATCHER* macros, but also
1363 // give you more control on the types of the value being matched and
1364 // the matcher parameters, which may leads to better compiler error
1365 // messages when the matcher is used wrong.  They also allow
1366 // overloading matchers based on parameter types (as opposed to just
1367 // based on the number of parameters).
1368 //
1369 // MATCHER*() can only be used in a namespace scope.  The reason is
1370 // that C++ doesn't yet allow function-local types to be used to
1371 // instantiate templates.  The up-coming C++0x standard will fix this.
1372 // Once that's done, we'll consider supporting using MATCHER*() inside
1373 // a function.
1374 //
1375 // More Information
1376 // ================
1377 //
1378 // To learn more about using these macros, please search for 'MATCHER'
1379 // on http://code.google.com/p/googlemock/wiki/CookBook.
1380 
1381 #define MATCHER(name, description)\
1382   class name##Matcher {\
1383    public:\
1384     template <typename arg_type>\
1385     class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
1386      public:\
1387       gmock_Impl()\
1388            {}\
1389       virtual bool MatchAndExplain(\
1390           arg_type arg, ::testing::MatchResultListener* result_listener) const;\
1391       virtual void DescribeTo(::std::ostream* gmock_os) const {\
1392         *gmock_os << FormatDescription(false);\
1393       }\
1394       virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
1395         *gmock_os << FormatDescription(true);\
1396       }\
1397      private:\
1398       ::testing::internal::string FormatDescription(bool negation) const {\
1399         const ::testing::internal::string gmock_description = (description);\
1400         if (!gmock_description.empty())\
1401           return gmock_description;\
1402         return ::testing::internal::FormatMatcherDescription(\
1403             negation, #name, \
1404             ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
1405                 ::testing::tuple<>()));\
1406       }\
1407       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1408     };\
1409     template <typename arg_type>\
1410     operator ::testing::Matcher<arg_type>() const {\
1411       return ::testing::Matcher<arg_type>(\
1412           new gmock_Impl<arg_type>());\
1413     }\
1414     name##Matcher() {\
1415     }\
1416    private:\
1417     GTEST_DISALLOW_ASSIGN_(name##Matcher);\
1418   };\
1419   inline name##Matcher name() {\
1420     return name##Matcher();\
1421   }\
1422   template <typename arg_type>\
1423   bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain(\
1424       arg_type arg, \
1425       ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
1426           const
1427 
1428 #define MATCHER_P(name, p0, description)\
1429   template <typename p0##_type>\
1430   class name##MatcherP {\
1431    public:\
1432     template <typename arg_type>\
1433     class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
1434      public:\
1435       explicit gmock_Impl(p0##_type gmock_p0)\
1436            : p0(gmock_p0) {}\
1437       virtual bool MatchAndExplain(\
1438           arg_type arg, ::testing::MatchResultListener* result_listener) const;\
1439       virtual void DescribeTo(::std::ostream* gmock_os) const {\
1440         *gmock_os << FormatDescription(false);\
1441       }\
1442       virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
1443         *gmock_os << FormatDescription(true);\
1444       }\
1445       p0##_type p0;\
1446      private:\
1447       ::testing::internal::string FormatDescription(bool negation) const {\
1448         const ::testing::internal::string gmock_description = (description);\
1449         if (!gmock_description.empty())\
1450           return gmock_description;\
1451         return ::testing::internal::FormatMatcherDescription(\
1452             negation, #name, \
1453             ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
1454                 ::testing::tuple<p0##_type>(p0)));\
1455       }\
1456       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1457     };\
1458     template <typename arg_type>\
1459     operator ::testing::Matcher<arg_type>() const {\
1460       return ::testing::Matcher<arg_type>(\
1461           new gmock_Impl<arg_type>(p0));\
1462     }\
1463     explicit name##MatcherP(p0##_type gmock_p0) : p0(gmock_p0) {\
1464     }\
1465     p0##_type p0;\
1466    private:\
1467     GTEST_DISALLOW_ASSIGN_(name##MatcherP);\
1468   };\
1469   template <typename p0##_type>\
1470   inline name##MatcherP<p0##_type> name(p0##_type p0) {\
1471     return name##MatcherP<p0##_type>(p0);\
1472   }\
1473   template <typename p0##_type>\
1474   template <typename arg_type>\
1475   bool name##MatcherP<p0##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
1476       arg_type arg, \
1477       ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
1478           const
1479 
1480 #define MATCHER_P2(name, p0, p1, description)\
1481   template <typename p0##_type, typename p1##_type>\
1482   class name##MatcherP2 {\
1483    public:\
1484     template <typename arg_type>\
1485     class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
1486      public:\
1487       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\
1488            : p0(gmock_p0), p1(gmock_p1) {}\
1489       virtual bool MatchAndExplain(\
1490           arg_type arg, ::testing::MatchResultListener* result_listener) const;\
1491       virtual void DescribeTo(::std::ostream* gmock_os) const {\
1492         *gmock_os << FormatDescription(false);\
1493       }\
1494       virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
1495         *gmock_os << FormatDescription(true);\
1496       }\
1497       p0##_type p0;\
1498       p1##_type p1;\
1499      private:\
1500       ::testing::internal::string FormatDescription(bool negation) const {\
1501         const ::testing::internal::string gmock_description = (description);\
1502         if (!gmock_description.empty())\
1503           return gmock_description;\
1504         return ::testing::internal::FormatMatcherDescription(\
1505             negation, #name, \
1506             ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
1507                 ::testing::tuple<p0##_type, p1##_type>(p0, p1)));\
1508       }\
1509       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1510     };\
1511     template <typename arg_type>\
1512     operator ::testing::Matcher<arg_type>() const {\
1513       return ::testing::Matcher<arg_type>(\
1514           new gmock_Impl<arg_type>(p0, p1));\
1515     }\
1516     name##MatcherP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
1517         p1(gmock_p1) {\
1518     }\
1519     p0##_type p0;\
1520     p1##_type p1;\
1521    private:\
1522     GTEST_DISALLOW_ASSIGN_(name##MatcherP2);\
1523   };\
1524   template <typename p0##_type, typename p1##_type>\
1525   inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \
1526       p1##_type p1) {\
1527     return name##MatcherP2<p0##_type, p1##_type>(p0, p1);\
1528   }\
1529   template <typename p0##_type, typename p1##_type>\
1530   template <typename arg_type>\
1531   bool name##MatcherP2<p0##_type, \
1532       p1##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
1533       arg_type arg, \
1534       ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
1535           const
1536 
1537 #define MATCHER_P3(name, p0, p1, p2, description)\
1538   template <typename p0##_type, typename p1##_type, typename p2##_type>\
1539   class name##MatcherP3 {\
1540    public:\
1541     template <typename arg_type>\
1542     class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
1543      public:\
1544       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\
1545            : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\
1546       virtual bool MatchAndExplain(\
1547           arg_type arg, ::testing::MatchResultListener* result_listener) const;\
1548       virtual void DescribeTo(::std::ostream* gmock_os) const {\
1549         *gmock_os << FormatDescription(false);\
1550       }\
1551       virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
1552         *gmock_os << FormatDescription(true);\
1553       }\
1554       p0##_type p0;\
1555       p1##_type p1;\
1556       p2##_type p2;\
1557      private:\
1558       ::testing::internal::string FormatDescription(bool negation) const {\
1559         const ::testing::internal::string gmock_description = (description);\
1560         if (!gmock_description.empty())\
1561           return gmock_description;\
1562         return ::testing::internal::FormatMatcherDescription(\
1563             negation, #name, \
1564             ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
1565                 ::testing::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \
1566                     p2)));\
1567       }\
1568       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1569     };\
1570     template <typename arg_type>\
1571     operator ::testing::Matcher<arg_type>() const {\
1572       return ::testing::Matcher<arg_type>(\
1573           new gmock_Impl<arg_type>(p0, p1, p2));\
1574     }\
1575     name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \
1576         p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {\
1577     }\
1578     p0##_type p0;\
1579     p1##_type p1;\
1580     p2##_type p2;\
1581    private:\
1582     GTEST_DISALLOW_ASSIGN_(name##MatcherP3);\
1583   };\
1584   template <typename p0##_type, typename p1##_type, typename p2##_type>\
1585   inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
1586       p1##_type p1, p2##_type p2) {\
1587     return name##MatcherP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
1588   }\
1589   template <typename p0##_type, typename p1##_type, typename p2##_type>\
1590   template <typename arg_type>\
1591   bool name##MatcherP3<p0##_type, p1##_type, \
1592       p2##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
1593       arg_type arg, \
1594       ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
1595           const
1596 
1597 #define MATCHER_P4(name, p0, p1, p2, p3, description)\
1598   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1599       typename p3##_type>\
1600   class name##MatcherP4 {\
1601    public:\
1602     template <typename arg_type>\
1603     class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
1604      public:\
1605       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1606           p3##_type gmock_p3)\
1607            : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3) {}\
1608       virtual bool MatchAndExplain(\
1609           arg_type arg, ::testing::MatchResultListener* result_listener) const;\
1610       virtual void DescribeTo(::std::ostream* gmock_os) const {\
1611         *gmock_os << FormatDescription(false);\
1612       }\
1613       virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
1614         *gmock_os << FormatDescription(true);\
1615       }\
1616       p0##_type p0;\
1617       p1##_type p1;\
1618       p2##_type p2;\
1619       p3##_type p3;\
1620      private:\
1621       ::testing::internal::string FormatDescription(bool negation) const {\
1622         const ::testing::internal::string gmock_description = (description);\
1623         if (!gmock_description.empty())\
1624           return gmock_description;\
1625         return ::testing::internal::FormatMatcherDescription(\
1626             negation, #name, \
1627             ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
1628                 ::testing::tuple<p0##_type, p1##_type, p2##_type, \
1629                     p3##_type>(p0, p1, p2, p3)));\
1630       }\
1631       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1632     };\
1633     template <typename arg_type>\
1634     operator ::testing::Matcher<arg_type>() const {\
1635       return ::testing::Matcher<arg_type>(\
1636           new gmock_Impl<arg_type>(p0, p1, p2, p3));\
1637     }\
1638     name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \
1639         p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \
1640         p2(gmock_p2), p3(gmock_p3) {\
1641     }\
1642     p0##_type p0;\
1643     p1##_type p1;\
1644     p2##_type p2;\
1645     p3##_type p3;\
1646    private:\
1647     GTEST_DISALLOW_ASSIGN_(name##MatcherP4);\
1648   };\
1649   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1650       typename p3##_type>\
1651   inline name##MatcherP4<p0##_type, p1##_type, p2##_type, \
1652       p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
1653       p3##_type p3) {\
1654     return name##MatcherP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, \
1655         p1, p2, p3);\
1656   }\
1657   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1658       typename p3##_type>\
1659   template <typename arg_type>\
1660   bool name##MatcherP4<p0##_type, p1##_type, p2##_type, \
1661       p3##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
1662       arg_type arg, \
1663       ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
1664           const
1665 
1666 #define MATCHER_P5(name, p0, p1, p2, p3, p4, description)\
1667   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1668       typename p3##_type, typename p4##_type>\
1669   class name##MatcherP5 {\
1670    public:\
1671     template <typename arg_type>\
1672     class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
1673      public:\
1674       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1675           p3##_type gmock_p3, p4##_type gmock_p4)\
1676            : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
1677                p4(gmock_p4) {}\
1678       virtual bool MatchAndExplain(\
1679           arg_type arg, ::testing::MatchResultListener* result_listener) const;\
1680       virtual void DescribeTo(::std::ostream* gmock_os) const {\
1681         *gmock_os << FormatDescription(false);\
1682       }\
1683       virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
1684         *gmock_os << FormatDescription(true);\
1685       }\
1686       p0##_type p0;\
1687       p1##_type p1;\
1688       p2##_type p2;\
1689       p3##_type p3;\
1690       p4##_type p4;\
1691      private:\
1692       ::testing::internal::string FormatDescription(bool negation) const {\
1693         const ::testing::internal::string gmock_description = (description);\
1694         if (!gmock_description.empty())\
1695           return gmock_description;\
1696         return ::testing::internal::FormatMatcherDescription(\
1697             negation, #name, \
1698             ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
1699                 ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
1700                     p4##_type>(p0, p1, p2, p3, p4)));\
1701       }\
1702       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1703     };\
1704     template <typename arg_type>\
1705     operator ::testing::Matcher<arg_type>() const {\
1706       return ::testing::Matcher<arg_type>(\
1707           new gmock_Impl<arg_type>(p0, p1, p2, p3, p4));\
1708     }\
1709     name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \
1710         p2##_type gmock_p2, p3##_type gmock_p3, \
1711         p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1712         p3(gmock_p3), p4(gmock_p4) {\
1713     }\
1714     p0##_type p0;\
1715     p1##_type p1;\
1716     p2##_type p2;\
1717     p3##_type p3;\
1718     p4##_type p4;\
1719    private:\
1720     GTEST_DISALLOW_ASSIGN_(name##MatcherP5);\
1721   };\
1722   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1723       typename p3##_type, typename p4##_type>\
1724   inline name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1725       p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
1726       p4##_type p4) {\
1727     return name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1728         p4##_type>(p0, p1, p2, p3, p4);\
1729   }\
1730   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1731       typename p3##_type, typename p4##_type>\
1732   template <typename arg_type>\
1733   bool name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1734       p4##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
1735       arg_type arg, \
1736       ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
1737           const
1738 
1739 #define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)\
1740   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1741       typename p3##_type, typename p4##_type, typename p5##_type>\
1742   class name##MatcherP6 {\
1743    public:\
1744     template <typename arg_type>\
1745     class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
1746      public:\
1747       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1748           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5)\
1749            : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
1750                p4(gmock_p4), p5(gmock_p5) {}\
1751       virtual bool MatchAndExplain(\
1752           arg_type arg, ::testing::MatchResultListener* result_listener) const;\
1753       virtual void DescribeTo(::std::ostream* gmock_os) const {\
1754         *gmock_os << FormatDescription(false);\
1755       }\
1756       virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
1757         *gmock_os << FormatDescription(true);\
1758       }\
1759       p0##_type p0;\
1760       p1##_type p1;\
1761       p2##_type p2;\
1762       p3##_type p3;\
1763       p4##_type p4;\
1764       p5##_type p5;\
1765      private:\
1766       ::testing::internal::string FormatDescription(bool negation) const {\
1767         const ::testing::internal::string gmock_description = (description);\
1768         if (!gmock_description.empty())\
1769           return gmock_description;\
1770         return ::testing::internal::FormatMatcherDescription(\
1771             negation, #name, \
1772             ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
1773                 ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
1774                     p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\
1775       }\
1776       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1777     };\
1778     template <typename arg_type>\
1779     operator ::testing::Matcher<arg_type>() const {\
1780       return ::testing::Matcher<arg_type>(\
1781           new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5));\
1782     }\
1783     name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \
1784         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1785         p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1786         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {\
1787     }\
1788     p0##_type p0;\
1789     p1##_type p1;\
1790     p2##_type p2;\
1791     p3##_type p3;\
1792     p4##_type p4;\
1793     p5##_type p5;\
1794    private:\
1795     GTEST_DISALLOW_ASSIGN_(name##MatcherP6);\
1796   };\
1797   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1798       typename p3##_type, typename p4##_type, typename p5##_type>\
1799   inline name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \
1800       p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
1801       p3##_type p3, p4##_type p4, p5##_type p5) {\
1802     return name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \
1803         p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
1804   }\
1805   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1806       typename p3##_type, typename p4##_type, typename p5##_type>\
1807   template <typename arg_type>\
1808   bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1809       p5##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
1810       arg_type arg, \
1811       ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
1812           const
1813 
1814 #define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description)\
1815   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1816       typename p3##_type, typename p4##_type, typename p5##_type, \
1817       typename p6##_type>\
1818   class name##MatcherP7 {\
1819    public:\
1820     template <typename arg_type>\
1821     class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
1822      public:\
1823       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1824           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1825           p6##_type gmock_p6)\
1826            : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
1827                p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\
1828       virtual bool MatchAndExplain(\
1829           arg_type arg, ::testing::MatchResultListener* result_listener) const;\
1830       virtual void DescribeTo(::std::ostream* gmock_os) const {\
1831         *gmock_os << FormatDescription(false);\
1832       }\
1833       virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
1834         *gmock_os << FormatDescription(true);\
1835       }\
1836       p0##_type p0;\
1837       p1##_type p1;\
1838       p2##_type p2;\
1839       p3##_type p3;\
1840       p4##_type p4;\
1841       p5##_type p5;\
1842       p6##_type p6;\
1843      private:\
1844       ::testing::internal::string FormatDescription(bool negation) const {\
1845         const ::testing::internal::string gmock_description = (description);\
1846         if (!gmock_description.empty())\
1847           return gmock_description;\
1848         return ::testing::internal::FormatMatcherDescription(\
1849             negation, #name, \
1850             ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
1851                 ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
1852                     p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \
1853                     p6)));\
1854       }\
1855       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1856     };\
1857     template <typename arg_type>\
1858     operator ::testing::Matcher<arg_type>() const {\
1859       return ::testing::Matcher<arg_type>(\
1860           new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6));\
1861     }\
1862     name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \
1863         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1864         p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \
1865         p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \
1866         p6(gmock_p6) {\
1867     }\
1868     p0##_type p0;\
1869     p1##_type p1;\
1870     p2##_type p2;\
1871     p3##_type p3;\
1872     p4##_type p4;\
1873     p5##_type p5;\
1874     p6##_type p6;\
1875    private:\
1876     GTEST_DISALLOW_ASSIGN_(name##MatcherP7);\
1877   };\
1878   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1879       typename p3##_type, typename p4##_type, typename p5##_type, \
1880       typename p6##_type>\
1881   inline name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \
1882       p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \
1883       p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
1884       p6##_type p6) {\
1885     return name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \
1886         p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
1887   }\
1888   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1889       typename p3##_type, typename p4##_type, typename p5##_type, \
1890       typename p6##_type>\
1891   template <typename arg_type>\
1892   bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1893       p5##_type, p6##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
1894       arg_type arg, \
1895       ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
1896           const
1897 
1898 #define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description)\
1899   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1900       typename p3##_type, typename p4##_type, typename p5##_type, \
1901       typename p6##_type, typename p7##_type>\
1902   class name##MatcherP8 {\
1903    public:\
1904     template <typename arg_type>\
1905     class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
1906      public:\
1907       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1908           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1909           p6##_type gmock_p6, p7##_type gmock_p7)\
1910            : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
1911                p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\
1912       virtual bool MatchAndExplain(\
1913           arg_type arg, ::testing::MatchResultListener* result_listener) const;\
1914       virtual void DescribeTo(::std::ostream* gmock_os) const {\
1915         *gmock_os << FormatDescription(false);\
1916       }\
1917       virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
1918         *gmock_os << FormatDescription(true);\
1919       }\
1920       p0##_type p0;\
1921       p1##_type p1;\
1922       p2##_type p2;\
1923       p3##_type p3;\
1924       p4##_type p4;\
1925       p5##_type p5;\
1926       p6##_type p6;\
1927       p7##_type p7;\
1928      private:\
1929       ::testing::internal::string FormatDescription(bool negation) const {\
1930         const ::testing::internal::string gmock_description = (description);\
1931         if (!gmock_description.empty())\
1932           return gmock_description;\
1933         return ::testing::internal::FormatMatcherDescription(\
1934             negation, #name, \
1935             ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
1936                 ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
1937                     p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \
1938                     p3, p4, p5, p6, p7)));\
1939       }\
1940       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1941     };\
1942     template <typename arg_type>\
1943     operator ::testing::Matcher<arg_type>() const {\
1944       return ::testing::Matcher<arg_type>(\
1945           new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7));\
1946     }\
1947     name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \
1948         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1949         p5##_type gmock_p5, p6##_type gmock_p6, \
1950         p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1951         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
1952         p7(gmock_p7) {\
1953     }\
1954     p0##_type p0;\
1955     p1##_type p1;\
1956     p2##_type p2;\
1957     p3##_type p3;\
1958     p4##_type p4;\
1959     p5##_type p5;\
1960     p6##_type p6;\
1961     p7##_type p7;\
1962    private:\
1963     GTEST_DISALLOW_ASSIGN_(name##MatcherP8);\
1964   };\
1965   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1966       typename p3##_type, typename p4##_type, typename p5##_type, \
1967       typename p6##_type, typename p7##_type>\
1968   inline name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \
1969       p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \
1970       p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
1971       p6##_type p6, p7##_type p7) {\
1972     return name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \
1973         p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
1974         p6, p7);\
1975   }\
1976   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1977       typename p3##_type, typename p4##_type, typename p5##_type, \
1978       typename p6##_type, typename p7##_type>\
1979   template <typename arg_type>\
1980   bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1981       p5##_type, p6##_type, \
1982       p7##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
1983       arg_type arg, \
1984       ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
1985           const
1986 
1987 #define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description)\
1988   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1989       typename p3##_type, typename p4##_type, typename p5##_type, \
1990       typename p6##_type, typename p7##_type, typename p8##_type>\
1991   class name##MatcherP9 {\
1992    public:\
1993     template <typename arg_type>\
1994     class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
1995      public:\
1996       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1997           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1998           p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\
1999            : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
2000                p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
2001                p8(gmock_p8) {}\
2002       virtual bool MatchAndExplain(\
2003           arg_type arg, ::testing::MatchResultListener* result_listener) const;\
2004       virtual void DescribeTo(::std::ostream* gmock_os) const {\
2005         *gmock_os << FormatDescription(false);\
2006       }\
2007       virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
2008         *gmock_os << FormatDescription(true);\
2009       }\
2010       p0##_type p0;\
2011       p1##_type p1;\
2012       p2##_type p2;\
2013       p3##_type p3;\
2014       p4##_type p4;\
2015       p5##_type p5;\
2016       p6##_type p6;\
2017       p7##_type p7;\
2018       p8##_type p8;\
2019      private:\
2020       ::testing::internal::string FormatDescription(bool negation) const {\
2021         const ::testing::internal::string gmock_description = (description);\
2022         if (!gmock_description.empty())\
2023           return gmock_description;\
2024         return ::testing::internal::FormatMatcherDescription(\
2025             negation, #name, \
2026             ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
2027                 ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
2028                     p4##_type, p5##_type, p6##_type, p7##_type, \
2029                     p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\
2030       }\
2031       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
2032     };\
2033     template <typename arg_type>\
2034     operator ::testing::Matcher<arg_type>() const {\
2035       return ::testing::Matcher<arg_type>(\
2036           new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8));\
2037     }\
2038     name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \
2039         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
2040         p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
2041         p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
2042         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
2043         p8(gmock_p8) {\
2044     }\
2045     p0##_type p0;\
2046     p1##_type p1;\
2047     p2##_type p2;\
2048     p3##_type p3;\
2049     p4##_type p4;\
2050     p5##_type p5;\
2051     p6##_type p6;\
2052     p7##_type p7;\
2053     p8##_type p8;\
2054    private:\
2055     GTEST_DISALLOW_ASSIGN_(name##MatcherP9);\
2056   };\
2057   template <typename p0##_type, typename p1##_type, typename p2##_type, \
2058       typename p3##_type, typename p4##_type, typename p5##_type, \
2059       typename p6##_type, typename p7##_type, typename p8##_type>\
2060   inline name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \
2061       p4##_type, p5##_type, p6##_type, p7##_type, \
2062       p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
2063       p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \
2064       p8##_type p8) {\
2065     return name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \
2066         p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
2067         p3, p4, p5, p6, p7, p8);\
2068   }\
2069   template <typename p0##_type, typename p1##_type, typename p2##_type, \
2070       typename p3##_type, typename p4##_type, typename p5##_type, \
2071       typename p6##_type, typename p7##_type, typename p8##_type>\
2072   template <typename arg_type>\
2073   bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
2074       p5##_type, p6##_type, p7##_type, \
2075       p8##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
2076       arg_type arg, \
2077       ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
2078           const
2079 
2080 #define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, description)\
2081   template <typename p0##_type, typename p1##_type, typename p2##_type, \
2082       typename p3##_type, typename p4##_type, typename p5##_type, \
2083       typename p6##_type, typename p7##_type, typename p8##_type, \
2084       typename p9##_type>\
2085   class name##MatcherP10 {\
2086    public:\
2087     template <typename arg_type>\
2088     class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
2089      public:\
2090       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
2091           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
2092           p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
2093           p9##_type gmock_p9)\
2094            : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
2095                p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
2096                p8(gmock_p8), p9(gmock_p9) {}\
2097       virtual bool MatchAndExplain(\
2098           arg_type arg, ::testing::MatchResultListener* result_listener) const;\
2099       virtual void DescribeTo(::std::ostream* gmock_os) const {\
2100         *gmock_os << FormatDescription(false);\
2101       }\
2102       virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
2103         *gmock_os << FormatDescription(true);\
2104       }\
2105       p0##_type p0;\
2106       p1##_type p1;\
2107       p2##_type p2;\
2108       p3##_type p3;\
2109       p4##_type p4;\
2110       p5##_type p5;\
2111       p6##_type p6;\
2112       p7##_type p7;\
2113       p8##_type p8;\
2114       p9##_type p9;\
2115      private:\
2116       ::testing::internal::string FormatDescription(bool negation) const {\
2117         const ::testing::internal::string gmock_description = (description);\
2118         if (!gmock_description.empty())\
2119           return gmock_description;\
2120         return ::testing::internal::FormatMatcherDescription(\
2121             negation, #name, \
2122             ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
2123                 ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
2124                     p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
2125                     p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\
2126       }\
2127       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
2128     };\
2129     template <typename arg_type>\
2130     operator ::testing::Matcher<arg_type>() const {\
2131       return ::testing::Matcher<arg_type>(\
2132           new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9));\
2133     }\
2134     name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \
2135         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
2136         p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
2137         p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \
2138         p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
2139         p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {\
2140     }\
2141     p0##_type p0;\
2142     p1##_type p1;\
2143     p2##_type p2;\
2144     p3##_type p3;\
2145     p4##_type p4;\
2146     p5##_type p5;\
2147     p6##_type p6;\
2148     p7##_type p7;\
2149     p8##_type p8;\
2150     p9##_type p9;\
2151    private:\
2152     GTEST_DISALLOW_ASSIGN_(name##MatcherP10);\
2153   };\
2154   template <typename p0##_type, typename p1##_type, typename p2##_type, \
2155       typename p3##_type, typename p4##_type, typename p5##_type, \
2156       typename p6##_type, typename p7##_type, typename p8##_type, \
2157       typename p9##_type>\
2158   inline name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
2159       p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
2160       p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
2161       p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
2162       p9##_type p9) {\
2163     return name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
2164         p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
2165         p1, p2, p3, p4, p5, p6, p7, p8, p9);\
2166   }\
2167   template <typename p0##_type, typename p1##_type, typename p2##_type, \
2168       typename p3##_type, typename p4##_type, typename p5##_type, \
2169       typename p6##_type, typename p7##_type, typename p8##_type, \
2170       typename p9##_type>\
2171   template <typename arg_type>\
2172   bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
2173       p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
2174       p9##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
2175       arg_type arg, \
2176       ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
2177           const
2178 
2179 #endif  // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_