From e35fdd936d133bf8a48de140a3c666897588a053 Mon Sep 17 00:00:00 2001 From: shiqian Date: Wed, 10 Dec 2008 05:08:54 +0000 Subject: Initial drop of Google Mock. The files are incomplete and thus may not build correctly yet. --- .../internal/gmock-generated-internal-utils.h | 277 +++++++++++++++++++++ 1 file changed, 277 insertions(+) create mode 100644 include/gmock/internal/gmock-generated-internal-utils.h (limited to 'include/gmock/internal/gmock-generated-internal-utils.h') diff --git a/include/gmock/internal/gmock-generated-internal-utils.h b/include/gmock/internal/gmock-generated-internal-utils.h new file mode 100644 index 00000000..6386b05a --- /dev/null +++ b/include/gmock/internal/gmock-generated-internal-utils.h @@ -0,0 +1,277 @@ +// This file was GENERATED by a script. DO NOT EDIT BY HAND!!! + +// Copyright 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: wan@google.com (Zhanyong Wan) + +// Google Mock - a framework for writing C++ mock classes. +// +// This file contains template meta-programming utility classes needed +// for implementing Google Mock. + +#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ +#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ + +#include + +namespace testing { + +template +class Matcher; + +namespace internal { + +// An IgnoredValue object can be implicitly constructed from ANY value. +// This is used in implementing the IgnoreResult(a) action. +class IgnoredValue { + public: + // This constructor template allows any value to be implicitly + // converted to IgnoredValue. The object has no data member and + // doesn't try to remember anything about the argument. We + // deliberately omit the 'explicit' keyword in order to allow the + // conversion to be implicit. + template + IgnoredValue(const T&) {} +}; + +// MatcherTuple::type is a tuple type where each field is a Matcher +// for the corresponding field in tuple type T. +template +struct MatcherTuple; + +template <> +struct MatcherTuple< ::std::tr1::tuple<> > { + typedef ::std::tr1::tuple< > type; +}; + +template +struct MatcherTuple< ::std::tr1::tuple > { + typedef ::std::tr1::tuple > type; +}; + +template +struct MatcherTuple< ::std::tr1::tuple > { + typedef ::std::tr1::tuple, Matcher > type; +}; + +template +struct MatcherTuple< ::std::tr1::tuple > { + typedef ::std::tr1::tuple, Matcher, Matcher > type; +}; + +template +struct MatcherTuple< ::std::tr1::tuple > { + typedef ::std::tr1::tuple, Matcher, Matcher, + Matcher > type; +}; + +template +struct MatcherTuple< ::std::tr1::tuple > { + typedef ::std::tr1::tuple, Matcher, Matcher, Matcher, + Matcher > type; +}; + +template +struct MatcherTuple< ::std::tr1::tuple > { + typedef ::std::tr1::tuple, Matcher, Matcher, Matcher, + Matcher, Matcher > type; +}; + +template +struct MatcherTuple< ::std::tr1::tuple > { + typedef ::std::tr1::tuple, Matcher, Matcher, Matcher, + Matcher, Matcher, Matcher > type; +}; + +template +struct MatcherTuple< ::std::tr1::tuple > { + typedef ::std::tr1::tuple, Matcher, Matcher, Matcher, + Matcher, Matcher, Matcher, Matcher > type; +}; + +template +struct MatcherTuple< ::std::tr1::tuple > { + typedef ::std::tr1::tuple, Matcher, Matcher, Matcher, + Matcher, Matcher, Matcher, Matcher, Matcher > type; +}; + +template +struct MatcherTuple< ::std::tr1::tuple > { + typedef ::std::tr1::tuple, Matcher, Matcher, Matcher, + Matcher, Matcher, Matcher, Matcher, Matcher, + Matcher > type; +}; + +// Template struct Function, where F must be a function type, contains +// the following typedefs: +// +// Result: the function's return type. +// ArgumentN: the type of the N-th argument, where N starts with 1. +// ArgumentTuple: the tuple type consisting of all parameters of F. +// ArgumentMatcherTuple: the tuple type consisting of Matchers for all +// parameters of F. +// MakeResultVoid: the function type obtained by substituting void +// for the return type of F. +// MakeResultIgnoredValue: +// the function type obtained by substituting Something +// for the return type of F. +template +struct Function; + +template +struct Function { + typedef R Result; + typedef ::std::tr1::tuple<> ArgumentTuple; + typedef typename MatcherTuple::type ArgumentMatcherTuple; + typedef void MakeResultVoid(); + typedef IgnoredValue MakeResultIgnoredValue(); +}; + +template +struct Function + : Function { + typedef A1 Argument1; + typedef ::std::tr1::tuple ArgumentTuple; + typedef typename MatcherTuple::type ArgumentMatcherTuple; + typedef void MakeResultVoid(A1); + typedef IgnoredValue MakeResultIgnoredValue(A1); +}; + +template +struct Function + : Function { + typedef A2 Argument2; + typedef ::std::tr1::tuple ArgumentTuple; + typedef typename MatcherTuple::type ArgumentMatcherTuple; + typedef void MakeResultVoid(A1, A2); + typedef IgnoredValue MakeResultIgnoredValue(A1, A2); +}; + +template +struct Function + : Function { + typedef A3 Argument3; + typedef ::std::tr1::tuple ArgumentTuple; + typedef typename MatcherTuple::type ArgumentMatcherTuple; + typedef void MakeResultVoid(A1, A2, A3); + typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3); +}; + +template +struct Function + : Function { + typedef A4 Argument4; + typedef ::std::tr1::tuple ArgumentTuple; + typedef typename MatcherTuple::type ArgumentMatcherTuple; + typedef void MakeResultVoid(A1, A2, A3, A4); + typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4); +}; + +template +struct Function + : Function { + typedef A5 Argument5; + typedef ::std::tr1::tuple ArgumentTuple; + typedef typename MatcherTuple::type ArgumentMatcherTuple; + typedef void MakeResultVoid(A1, A2, A3, A4, A5); + typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5); +}; + +template +struct Function + : Function { + typedef A6 Argument6; + typedef ::std::tr1::tuple ArgumentTuple; + typedef typename MatcherTuple::type ArgumentMatcherTuple; + typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6); + typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6); +}; + +template +struct Function + : Function { + typedef A7 Argument7; + typedef ::std::tr1::tuple ArgumentTuple; + typedef typename MatcherTuple::type ArgumentMatcherTuple; + typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7); + typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7); +}; + +template +struct Function + : Function { + typedef A8 Argument8; + typedef ::std::tr1::tuple ArgumentTuple; + typedef typename MatcherTuple::type ArgumentMatcherTuple; + typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8); + typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8); +}; + +template +struct Function + : Function { + typedef A9 Argument9; + typedef ::std::tr1::tuple ArgumentTuple; + typedef typename MatcherTuple::type ArgumentMatcherTuple; + typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9); + typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8, + A9); +}; + +template +struct Function + : Function { + typedef A10 Argument10; + typedef ::std::tr1::tuple ArgumentTuple; + typedef typename MatcherTuple::type ArgumentMatcherTuple; + typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); + typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8, + A9, A10); +}; + +} // namespace internal + +} // namespace testing + +#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ -- cgit v1.2.3 From 53e08c44dd34857ba57581d7c5774d6c96a8d0e1 Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Tue, 14 Sep 2010 05:38:21 +0000 Subject: Include gtest and gmock headers as user headers instead of system headers. --- include/gmock/internal/gmock-generated-internal-utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/gmock/internal/gmock-generated-internal-utils.h') diff --git a/include/gmock/internal/gmock-generated-internal-utils.h b/include/gmock/internal/gmock-generated-internal-utils.h index 6386b05a..1b52dceb 100644 --- a/include/gmock/internal/gmock-generated-internal-utils.h +++ b/include/gmock/internal/gmock-generated-internal-utils.h @@ -39,7 +39,7 @@ #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ -#include +#include "gmock/internal/gmock-port.h" namespace testing { -- cgit v1.2.3 From 79a367eb217fcd47e2beaf8c0f87fe6d5926f739 Mon Sep 17 00:00:00 2001 From: jgm Date: Tue, 10 Apr 2012 16:02:11 +0000 Subject: Reduced template instantiation depth for the AllOf and AnyOf matchers. Also some formatting changes. --- include/gmock/internal/gmock-generated-internal-utils.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/gmock/internal/gmock-generated-internal-utils.h') diff --git a/include/gmock/internal/gmock-generated-internal-utils.h b/include/gmock/internal/gmock-generated-internal-utils.h index 1b52dceb..02258451 100644 --- a/include/gmock/internal/gmock-generated-internal-utils.h +++ b/include/gmock/internal/gmock-generated-internal-utils.h @@ -1,4 +1,6 @@ -// This file was GENERATED by a script. DO NOT EDIT BY HAND!!! +// This file was GENERATED by command: +// pump.py gmock-generated-internal-utils.h.pump +// DO NOT EDIT BY HAND!!! // Copyright 2007, Google Inc. // All rights reserved. @@ -58,7 +60,7 @@ class IgnoredValue { // deliberately omit the 'explicit' keyword in order to allow the // conversion to be implicit. template - IgnoredValue(const T&) {} + IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit) }; // MatcherTuple::type is a tuple type where each field is a Matcher -- cgit v1.2.3 From bd0188320de5aab1b09718e2c466387099d43cfb Mon Sep 17 00:00:00 2001 From: kosak Date: Wed, 2 Apr 2014 20:30:00 +0000 Subject: Export tuple and friends in the ::testing namespace. --- .../internal/gmock-generated-internal-utils.h | 66 +++++++++++----------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'include/gmock/internal/gmock-generated-internal-utils.h') diff --git a/include/gmock/internal/gmock-generated-internal-utils.h b/include/gmock/internal/gmock-generated-internal-utils.h index 02258451..7811e43f 100644 --- a/include/gmock/internal/gmock-generated-internal-utils.h +++ b/include/gmock/internal/gmock-generated-internal-utils.h @@ -69,70 +69,70 @@ template struct MatcherTuple; template <> -struct MatcherTuple< ::std::tr1::tuple<> > { - typedef ::std::tr1::tuple< > type; +struct MatcherTuple< ::testing::tuple<> > { + typedef ::testing::tuple< > type; }; template -struct MatcherTuple< ::std::tr1::tuple > { - typedef ::std::tr1::tuple > type; +struct MatcherTuple< ::testing::tuple > { + typedef ::testing::tuple > type; }; template -struct MatcherTuple< ::std::tr1::tuple > { - typedef ::std::tr1::tuple, Matcher > type; +struct MatcherTuple< ::testing::tuple > { + typedef ::testing::tuple, Matcher > type; }; template -struct MatcherTuple< ::std::tr1::tuple > { - typedef ::std::tr1::tuple, Matcher, Matcher > type; +struct MatcherTuple< ::testing::tuple > { + typedef ::testing::tuple, Matcher, Matcher > type; }; template -struct MatcherTuple< ::std::tr1::tuple > { - typedef ::std::tr1::tuple, Matcher, Matcher, +struct MatcherTuple< ::testing::tuple > { + typedef ::testing::tuple, Matcher, Matcher, Matcher > type; }; template -struct MatcherTuple< ::std::tr1::tuple > { - typedef ::std::tr1::tuple, Matcher, Matcher, Matcher, +struct MatcherTuple< ::testing::tuple > { + typedef ::testing::tuple, Matcher, Matcher, Matcher, Matcher > type; }; template -struct MatcherTuple< ::std::tr1::tuple > { - typedef ::std::tr1::tuple, Matcher, Matcher, Matcher, +struct MatcherTuple< ::testing::tuple > { + typedef ::testing::tuple, Matcher, Matcher, Matcher, Matcher, Matcher > type; }; template -struct MatcherTuple< ::std::tr1::tuple > { - typedef ::std::tr1::tuple, Matcher, Matcher, Matcher, +struct MatcherTuple< ::testing::tuple > { + typedef ::testing::tuple, Matcher, Matcher, Matcher, Matcher, Matcher, Matcher > type; }; template -struct MatcherTuple< ::std::tr1::tuple > { - typedef ::std::tr1::tuple, Matcher, Matcher, Matcher, +struct MatcherTuple< ::testing::tuple > { + typedef ::testing::tuple, Matcher, Matcher, Matcher, Matcher, Matcher, Matcher, Matcher > type; }; template -struct MatcherTuple< ::std::tr1::tuple > { - typedef ::std::tr1::tuple, Matcher, Matcher, Matcher, +struct MatcherTuple< ::testing::tuple > { + typedef ::testing::tuple, Matcher, Matcher, Matcher, Matcher, Matcher, Matcher, Matcher, Matcher > type; }; template -struct MatcherTuple< ::std::tr1::tuple > { - typedef ::std::tr1::tuple, Matcher, Matcher, Matcher, + typedef ::testing::tuple, Matcher, Matcher, Matcher, Matcher, Matcher, Matcher, Matcher, Matcher, Matcher > type; }; @@ -156,7 +156,7 @@ struct Function; template struct Function { typedef R Result; - typedef ::std::tr1::tuple<> ArgumentTuple; + typedef ::testing::tuple<> ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(); typedef IgnoredValue MakeResultIgnoredValue(); @@ -166,7 +166,7 @@ template struct Function : Function { typedef A1 Argument1; - typedef ::std::tr1::tuple ArgumentTuple; + typedef ::testing::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1); typedef IgnoredValue MakeResultIgnoredValue(A1); @@ -176,7 +176,7 @@ template struct Function : Function { typedef A2 Argument2; - typedef ::std::tr1::tuple ArgumentTuple; + typedef ::testing::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2); typedef IgnoredValue MakeResultIgnoredValue(A1, A2); @@ -186,7 +186,7 @@ template struct Function : Function { typedef A3 Argument3; - typedef ::std::tr1::tuple ArgumentTuple; + typedef ::testing::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3); @@ -196,7 +196,7 @@ template struct Function : Function { typedef A4 Argument4; - typedef ::std::tr1::tuple ArgumentTuple; + typedef ::testing::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3, A4); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4); @@ -207,7 +207,7 @@ template : Function { typedef A5 Argument5; - typedef ::std::tr1::tuple ArgumentTuple; + typedef ::testing::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3, A4, A5); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5); @@ -218,7 +218,7 @@ template : Function { typedef A6 Argument6; - typedef ::std::tr1::tuple ArgumentTuple; + typedef ::testing::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6); @@ -229,7 +229,7 @@ template : Function { typedef A7 Argument7; - typedef ::std::tr1::tuple ArgumentTuple; + typedef ::testing::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7); @@ -240,7 +240,7 @@ template : Function { typedef A8 Argument8; - typedef ::std::tr1::tuple ArgumentTuple; + typedef ::testing::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8); @@ -251,7 +251,7 @@ template : Function { typedef A9 Argument9; - typedef ::std::tr1::tuple ArgumentTuple; + typedef ::testing::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8, @@ -264,7 +264,7 @@ template : Function { typedef A10 Argument10; - typedef ::std::tr1::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); -- cgit v1.2.3