diff options
Diffstat (limited to 'include/gmock/gmock-generated-matchers.h')
-rw-r--r-- | include/gmock/gmock-generated-matchers.h | 397 |
1 files changed, 208 insertions, 189 deletions
diff --git a/include/gmock/gmock-generated-matchers.h b/include/gmock/gmock-generated-matchers.h index 2790e06c..2cc5746e 100644 --- a/include/gmock/gmock-generated-matchers.h +++ b/include/gmock/gmock-generated-matchers.h @@ -946,25 +946,29 @@ ElementsAreArray(const T (&array)[N]) { // Describing Parameterized Matchers // ================================= // -// When defining a parameterized matcher, you can use Python-style -// interpolations in the description string to refer to the parameter -// values. We support the following syntax currently: -// -// %% a single '%' character -// %(*)s all parameters of the matcher printed as a tuple -// %(foo)s value of the matcher parameter named 'foo' -// -// For example, -// -// MATCHER_P2(InClosedRange, low, hi, "is in range [%(low)s, %(hi)s]") { +// The last argument to MATCHER*() is a string-typed expression. The +// expression can reference all of the matcher's parameters and a +// special bool-typed variable named 'negation'. When 'negation' is +// false, the expression should evaluate to the matcher's description; +// otherwise it should evaluate to the description of the negation of +// the matcher. For example, +// +// using testing::PrintToString; +// +// MATCHER_P2(InClosedRange, low, hi, +// string(negation ? "is not" : "is") + " in range [" + +// PrintToString(low) + ", " + PrintToString(hi) + "]") { // return low <= arg && arg <= hi; // } // ... // EXPECT_THAT(3, InClosedRange(4, 6)); +// EXPECT_THAT(3, Not(InClosedRange(2, 4))); // -// would generate a failure that contains the message: +// would generate two failures that contain the text: // // Expected: is in range [4, 6] +// ... +// Expected: is not in range [2, 4] // // If you specify "" as the description, the failure message will // contain the sequence of words in the matcher name followed by the @@ -973,10 +977,13 @@ ElementsAreArray(const T (&array)[N]) { // MATCHER_P2(InClosedRange, low, hi, "") { ... } // ... // EXPECT_THAT(3, InClosedRange(4, 6)); +// EXPECT_THAT(3, Not(InClosedRange(2, 4))); // -// would generate a failure that contains the text: +// would generate two failures that contain the text: // // Expected: in closed range (4, 6) +// ... +// Expected: not (in closed range (2, 4)) // // Types of Matcher Parameters // =========================== @@ -1065,33 +1072,36 @@ ElementsAreArray(const T (&array)[N]) { template <typename arg_type>\ class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ public:\ - gmock_Impl(const ::testing::internal::Interpolations& gmock_interp)\ - : gmock_interp_(gmock_interp) {}\ + gmock_Impl()\ + {}\ virtual bool MatchAndExplain(\ arg_type arg, ::testing::MatchResultListener* result_listener) const;\ virtual void DescribeTo(::std::ostream* gmock_os) const {\ - const ::testing::internal::Strings& gmock_printed_params = \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tr1::tuple<>());\ - *gmock_os << ::testing::internal::FormatMatcherDescription(\ - #name, description, gmock_interp_, gmock_printed_params);\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ }\ - const ::testing::internal::Interpolations gmock_interp_;\ private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty())\ + return gmock_description;\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name,\ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::std::tr1::tuple<>()));\ + }\ GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ };\ template <typename arg_type>\ operator ::testing::Matcher<arg_type>() const {\ return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(gmock_interp_));\ + new gmock_Impl<arg_type>());\ }\ name##Matcher() {\ - const char* gmock_param_names[] = { NULL };\ - gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\ - gmock_param_names, ("" description ""));\ }\ private:\ - ::testing::internal::Interpolations gmock_interp_;\ GTEST_DISALLOW_ASSIGN_(name##Matcher);\ };\ inline name##Matcher name() {\ @@ -1110,36 +1120,38 @@ ElementsAreArray(const T (&array)[N]) { template <typename arg_type>\ class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ public:\ - explicit gmock_Impl(p0##_type gmock_p0, \ - const ::testing::internal::Interpolations& gmock_interp)\ - : p0(gmock_p0), gmock_interp_(gmock_interp) {}\ + explicit gmock_Impl(p0##_type gmock_p0)\ + : p0(gmock_p0) {}\ virtual bool MatchAndExplain(\ arg_type arg, ::testing::MatchResultListener* result_listener) const;\ virtual void DescribeTo(::std::ostream* gmock_os) const {\ - const ::testing::internal::Strings& gmock_printed_params = \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tr1::tuple<p0##_type>(p0));\ - *gmock_os << ::testing::internal::FormatMatcherDescription(\ - #name, description, gmock_interp_, gmock_printed_params);\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ }\ p0##_type p0;\ - const ::testing::internal::Interpolations gmock_interp_;\ private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty())\ + return gmock_description;\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name,\ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::std::tr1::tuple<p0##_type>(p0)));\ + }\ GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ };\ template <typename arg_type>\ operator ::testing::Matcher<arg_type>() const {\ return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, gmock_interp_));\ + new gmock_Impl<arg_type>(p0));\ }\ name##MatcherP(p0##_type gmock_p0) : p0(gmock_p0) {\ - const char* gmock_param_names[] = { #p0, NULL };\ - gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\ - gmock_param_names, ("" description ""));\ }\ p0##_type p0;\ private:\ - ::testing::internal::Interpolations gmock_interp_;\ GTEST_DISALLOW_ASSIGN_(name##MatcherP);\ };\ template <typename p0##_type>\ @@ -1160,39 +1172,41 @@ ElementsAreArray(const T (&array)[N]) { template <typename arg_type>\ class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \ - const ::testing::internal::Interpolations& gmock_interp)\ - : p0(gmock_p0), p1(gmock_p1), gmock_interp_(gmock_interp) {}\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\ + : p0(gmock_p0), p1(gmock_p1) {}\ virtual bool MatchAndExplain(\ arg_type arg, ::testing::MatchResultListener* result_listener) const;\ virtual void DescribeTo(::std::ostream* gmock_os) const {\ - const ::testing::internal::Strings& gmock_printed_params = \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tr1::tuple<p0##_type, p1##_type>(p0, p1));\ - *gmock_os << ::testing::internal::FormatMatcherDescription(\ - #name, description, gmock_interp_, gmock_printed_params);\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ }\ p0##_type p0;\ p1##_type p1;\ - const ::testing::internal::Interpolations gmock_interp_;\ private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty())\ + return gmock_description;\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name,\ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::std::tr1::tuple<p0##_type, p1##_type>(p0, p1)));\ + }\ GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ };\ template <typename arg_type>\ operator ::testing::Matcher<arg_type>() const {\ return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, gmock_interp_));\ + new gmock_Impl<arg_type>(p0, p1));\ }\ name##MatcherP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ p1(gmock_p1) {\ - const char* gmock_param_names[] = { #p0, #p1, NULL };\ - gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\ - gmock_param_names, ("" description ""));\ }\ p0##_type p0;\ p1##_type p1;\ private:\ - ::testing::internal::Interpolations gmock_interp_;\ GTEST_DISALLOW_ASSIGN_(name##MatcherP2);\ };\ template <typename p0##_type, typename p1##_type>\ @@ -1215,43 +1229,44 @@ ElementsAreArray(const T (&array)[N]) { template <typename arg_type>\ class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - const ::testing::internal::Interpolations& gmock_interp)\ - : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - gmock_interp_(gmock_interp) {}\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\ + : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ virtual bool MatchAndExplain(\ arg_type arg, ::testing::MatchResultListener* result_listener) const;\ virtual void DescribeTo(::std::ostream* gmock_os) const {\ - const ::testing::internal::Strings& gmock_printed_params = \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tr1::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \ - p2));\ - *gmock_os << ::testing::internal::FormatMatcherDescription(\ - #name, description, gmock_interp_, gmock_printed_params);\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ }\ p0##_type p0;\ p1##_type p1;\ p2##_type p2;\ - const ::testing::internal::Interpolations gmock_interp_;\ private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty())\ + return gmock_description;\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name,\ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::std::tr1::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \ + p2)));\ + }\ GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ };\ template <typename arg_type>\ operator ::testing::Matcher<arg_type>() const {\ return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, gmock_interp_));\ + new gmock_Impl<arg_type>(p0, p1, p2));\ }\ name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \ p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {\ - const char* gmock_param_names[] = { #p0, #p1, #p2, NULL };\ - gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\ - gmock_param_names, ("" description ""));\ }\ p0##_type p0;\ p1##_type p1;\ p2##_type p2;\ private:\ - ::testing::internal::Interpolations gmock_interp_;\ GTEST_DISALLOW_ASSIGN_(name##MatcherP3);\ };\ template <typename p0##_type, typename p1##_type, typename p2##_type>\ @@ -1276,46 +1291,47 @@ ElementsAreArray(const T (&array)[N]) { class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ public:\ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, \ - const ::testing::internal::Interpolations& gmock_interp)\ - : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ - gmock_interp_(gmock_interp) {}\ + p3##_type gmock_p3)\ + : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3) {}\ virtual bool MatchAndExplain(\ arg_type arg, ::testing::MatchResultListener* result_listener) const;\ virtual void DescribeTo(::std::ostream* gmock_os) const {\ - const ::testing::internal::Strings& gmock_printed_params = \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, \ - p3##_type>(p0, p1, p2, p3));\ - *gmock_os << ::testing::internal::FormatMatcherDescription(\ - #name, description, gmock_interp_, gmock_printed_params);\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ }\ p0##_type p0;\ p1##_type p1;\ p2##_type p2;\ p3##_type p3;\ - const ::testing::internal::Interpolations gmock_interp_;\ private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty())\ + return gmock_description;\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name,\ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, \ + p3##_type>(p0, p1, p2, p3)));\ + }\ GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ };\ template <typename arg_type>\ operator ::testing::Matcher<arg_type>() const {\ return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, p3, gmock_interp_));\ + new gmock_Impl<arg_type>(p0, p1, p2, p3));\ }\ name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \ p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \ p2(gmock_p2), p3(gmock_p3) {\ - const char* gmock_param_names[] = { #p0, #p1, #p2, #p3, NULL };\ - gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\ - gmock_param_names, ("" description ""));\ }\ p0##_type p0;\ p1##_type p1;\ p2##_type p2;\ p3##_type p3;\ private:\ - ::testing::internal::Interpolations gmock_interp_;\ GTEST_DISALLOW_ASSIGN_(name##MatcherP4);\ };\ template <typename p0##_type, typename p1##_type, typename p2##_type, \ @@ -1344,41 +1360,44 @@ ElementsAreArray(const T (&array)[N]) { class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ public:\ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, \ - const ::testing::internal::Interpolations& gmock_interp)\ + p3##_type gmock_p3, p4##_type gmock_p4)\ : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ - p4(gmock_p4), gmock_interp_(gmock_interp) {}\ + p4(gmock_p4) {}\ virtual bool MatchAndExplain(\ arg_type arg, ::testing::MatchResultListener* result_listener) const;\ virtual void DescribeTo(::std::ostream* gmock_os) const {\ - const ::testing::internal::Strings& gmock_printed_params = \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type>(p0, p1, p2, p3, p4));\ - *gmock_os << ::testing::internal::FormatMatcherDescription(\ - #name, description, gmock_interp_, gmock_printed_params);\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ }\ p0##_type p0;\ p1##_type p1;\ p2##_type p2;\ p3##_type p3;\ p4##_type p4;\ - const ::testing::internal::Interpolations gmock_interp_;\ private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty())\ + return gmock_description;\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name,\ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ + p4##_type>(p0, p1, p2, p3, p4)));\ + }\ GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ };\ template <typename arg_type>\ operator ::testing::Matcher<arg_type>() const {\ return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, gmock_interp_));\ + new gmock_Impl<arg_type>(p0, p1, p2, p3, p4));\ }\ name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \ p2##_type gmock_p2, p3##_type gmock_p3, \ p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p3(gmock_p3), p4(gmock_p4) {\ - const char* gmock_param_names[] = { #p0, #p1, #p2, #p3, #p4, NULL };\ - gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\ - gmock_param_names, ("" description ""));\ }\ p0##_type p0;\ p1##_type p1;\ @@ -1386,7 +1405,6 @@ ElementsAreArray(const T (&array)[N]) { p3##_type p3;\ p4##_type p4;\ private:\ - ::testing::internal::Interpolations gmock_interp_;\ GTEST_DISALLOW_ASSIGN_(name##MatcherP5);\ };\ template <typename p0##_type, typename p1##_type, typename p2##_type, \ @@ -1415,19 +1433,16 @@ ElementsAreArray(const T (&array)[N]) { class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ public:\ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - const ::testing::internal::Interpolations& gmock_interp)\ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5)\ : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ - p4(gmock_p4), p5(gmock_p5), gmock_interp_(gmock_interp) {}\ + p4(gmock_p4), p5(gmock_p5) {}\ virtual bool MatchAndExplain(\ arg_type arg, ::testing::MatchResultListener* result_listener) const;\ virtual void DescribeTo(::std::ostream* gmock_os) const {\ - const ::testing::internal::Strings& gmock_printed_params = \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5));\ - *gmock_os << ::testing::internal::FormatMatcherDescription(\ - #name, description, gmock_interp_, gmock_printed_params);\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ }\ p0##_type p0;\ p1##_type p1;\ @@ -1435,22 +1450,28 @@ ElementsAreArray(const T (&array)[N]) { p3##_type p3;\ p4##_type p4;\ p5##_type p5;\ - const ::testing::internal::Interpolations gmock_interp_;\ private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty())\ + return gmock_description;\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name,\ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ + p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\ + }\ GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ };\ template <typename arg_type>\ operator ::testing::Matcher<arg_type>() const {\ return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, gmock_interp_));\ + new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5));\ }\ name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {\ - const char* gmock_param_names[] = { #p0, #p1, #p2, #p3, #p4, #p5, NULL };\ - gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\ - gmock_param_names, ("" description ""));\ }\ p0##_type p0;\ p1##_type p1;\ @@ -1459,7 +1480,6 @@ ElementsAreArray(const T (&array)[N]) { p4##_type p4;\ p5##_type p5;\ private:\ - ::testing::internal::Interpolations gmock_interp_;\ GTEST_DISALLOW_ASSIGN_(name##MatcherP6);\ };\ template <typename p0##_type, typename p1##_type, typename p2##_type, \ @@ -1490,21 +1510,16 @@ ElementsAreArray(const T (&array)[N]) { public:\ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, \ - const ::testing::internal::Interpolations& gmock_interp)\ + p6##_type gmock_p6)\ : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ - p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ - gmock_interp_(gmock_interp) {}\ + p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ virtual bool MatchAndExplain(\ arg_type arg, ::testing::MatchResultListener* result_listener) const;\ virtual void DescribeTo(::std::ostream* gmock_os) const {\ - const ::testing::internal::Strings& gmock_printed_params = \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \ - p6));\ - *gmock_os << ::testing::internal::FormatMatcherDescription(\ - #name, description, gmock_interp_, gmock_printed_params);\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ }\ p0##_type p0;\ p1##_type p1;\ @@ -1513,24 +1528,30 @@ ElementsAreArray(const T (&array)[N]) { p4##_type p4;\ p5##_type p5;\ p6##_type p6;\ - const ::testing::internal::Interpolations gmock_interp_;\ private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty())\ + return gmock_description;\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name,\ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ + p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \ + p6)));\ + }\ GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ };\ template <typename arg_type>\ operator ::testing::Matcher<arg_type>() const {\ return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, gmock_interp_));\ + new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6));\ }\ name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \ p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ p6(gmock_p6) {\ - const char* gmock_param_names[] = { #p0, #p1, #p2, #p3, #p4, #p5, #p6, \ - NULL };\ - gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\ - gmock_param_names, ("" description ""));\ }\ p0##_type p0;\ p1##_type p1;\ @@ -1540,7 +1561,6 @@ ElementsAreArray(const T (&array)[N]) { p5##_type p5;\ p6##_type p6;\ private:\ - ::testing::internal::Interpolations gmock_interp_;\ GTEST_DISALLOW_ASSIGN_(name##MatcherP7);\ };\ template <typename p0##_type, typename p1##_type, typename p2##_type, \ @@ -1574,21 +1594,16 @@ ElementsAreArray(const T (&array)[N]) { public:\ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, \ - const ::testing::internal::Interpolations& gmock_interp)\ + p6##_type gmock_p6, p7##_type gmock_p7)\ : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ - p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ - gmock_interp_(gmock_interp) {}\ + p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ virtual bool MatchAndExplain(\ arg_type arg, ::testing::MatchResultListener* result_listener) const;\ virtual void DescribeTo(::std::ostream* gmock_os) const {\ - const ::testing::internal::Strings& gmock_printed_params = \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \ - p3, p4, p5, p6, p7));\ - *gmock_os << ::testing::internal::FormatMatcherDescription(\ - #name, description, gmock_interp_, gmock_printed_params);\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ }\ p0##_type p0;\ p1##_type p1;\ @@ -1598,15 +1613,24 @@ ElementsAreArray(const T (&array)[N]) { p5##_type p5;\ p6##_type p6;\ p7##_type p7;\ - const ::testing::internal::Interpolations gmock_interp_;\ private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty())\ + return gmock_description;\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name,\ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ + p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \ + p3, p4, p5, p6, p7)));\ + }\ GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ };\ template <typename arg_type>\ operator ::testing::Matcher<arg_type>() const {\ return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, \ - gmock_interp_));\ + new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7));\ }\ name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ @@ -1614,10 +1638,6 @@ ElementsAreArray(const T (&array)[N]) { p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p7(gmock_p7) {\ - const char* gmock_param_names[] = { #p0, #p1, #p2, #p3, #p4, #p5, #p6, \ - #p7, NULL };\ - gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\ - gmock_param_names, ("" description ""));\ }\ p0##_type p0;\ p1##_type p1;\ @@ -1628,7 +1648,6 @@ ElementsAreArray(const T (&array)[N]) { p6##_type p6;\ p7##_type p7;\ private:\ - ::testing::internal::Interpolations gmock_interp_;\ GTEST_DISALLOW_ASSIGN_(name##MatcherP8);\ };\ template <typename p0##_type, typename p1##_type, typename p2##_type, \ @@ -1664,21 +1683,17 @@ ElementsAreArray(const T (&array)[N]) { public:\ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ - const ::testing::internal::Interpolations& gmock_interp)\ + p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\ : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ - p8(gmock_p8), gmock_interp_(gmock_interp) {}\ + p8(gmock_p8) {}\ virtual bool MatchAndExplain(\ arg_type arg, ::testing::MatchResultListener* result_listener) const;\ virtual void DescribeTo(::std::ostream* gmock_os) const {\ - const ::testing::internal::Strings& gmock_printed_params = \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, \ - p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8));\ - *gmock_os << ::testing::internal::FormatMatcherDescription(\ - #name, description, gmock_interp_, gmock_printed_params);\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ }\ p0##_type p0;\ p1##_type p1;\ @@ -1689,15 +1704,24 @@ ElementsAreArray(const T (&array)[N]) { p6##_type p6;\ p7##_type p7;\ p8##_type p8;\ - const ::testing::internal::Interpolations gmock_interp_;\ private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty())\ + return gmock_description;\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name,\ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ + p4##_type, p5##_type, p6##_type, p7##_type, \ + p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\ + }\ GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ };\ template <typename arg_type>\ operator ::testing::Matcher<arg_type>() const {\ return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, \ - gmock_interp_));\ + new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8));\ }\ name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ @@ -1705,10 +1729,6 @@ ElementsAreArray(const T (&array)[N]) { p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p8(gmock_p8) {\ - const char* gmock_param_names[] = { #p0, #p1, #p2, #p3, #p4, #p5, #p6, \ - #p7, #p8, NULL };\ - gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\ - gmock_param_names, ("" description ""));\ }\ p0##_type p0;\ p1##_type p1;\ @@ -1720,7 +1740,6 @@ ElementsAreArray(const T (&array)[N]) { p7##_type p7;\ p8##_type p8;\ private:\ - ::testing::internal::Interpolations gmock_interp_;\ GTEST_DISALLOW_ASSIGN_(name##MatcherP9);\ };\ template <typename p0##_type, typename p1##_type, typename p2##_type, \ @@ -1759,21 +1778,17 @@ ElementsAreArray(const T (&array)[N]) { gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ - p9##_type gmock_p9, \ - const ::testing::internal::Interpolations& gmock_interp)\ + p9##_type gmock_p9)\ : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ - p8(gmock_p8), p9(gmock_p9), gmock_interp_(gmock_interp) {}\ + p8(gmock_p8), p9(gmock_p9) {}\ virtual bool MatchAndExplain(\ arg_type arg, ::testing::MatchResultListener* result_listener) const;\ virtual void DescribeTo(::std::ostream* gmock_os) const {\ - const ::testing::internal::Strings& gmock_printed_params = \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ - p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9));\ - *gmock_os << ::testing::internal::FormatMatcherDescription(\ - #name, description, gmock_interp_, gmock_printed_params);\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ }\ p0##_type p0;\ p1##_type p1;\ @@ -1785,15 +1800,24 @@ ElementsAreArray(const T (&array)[N]) { p7##_type p7;\ p8##_type p8;\ p9##_type p9;\ - const ::testing::internal::Interpolations gmock_interp_;\ private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty())\ + return gmock_description;\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name,\ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ + p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ + p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\ + }\ GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ };\ template <typename arg_type>\ operator ::testing::Matcher<arg_type>() const {\ return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, \ - gmock_interp_));\ + new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9));\ }\ name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ @@ -1801,10 +1825,6 @@ ElementsAreArray(const T (&array)[N]) { p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {\ - const char* gmock_param_names[] = { #p0, #p1, #p2, #p3, #p4, #p5, #p6, \ - #p7, #p8, #p9, NULL };\ - gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\ - gmock_param_names, ("" description ""));\ }\ p0##_type p0;\ p1##_type p1;\ @@ -1817,7 +1837,6 @@ ElementsAreArray(const T (&array)[N]) { p8##_type p8;\ p9##_type p9;\ private:\ - ::testing::internal::Interpolations gmock_interp_;\ GTEST_DISALLOW_ASSIGN_(name##MatcherP10);\ };\ template <typename p0##_type, typename p1##_type, typename p2##_type, \ |