update google lin on linux

This commit is contained in:
Bassem Girgis
2019-08-10 17:56:39 -05:00
parent fd3d04d3c9
commit dc31c290a0
66 changed files with 5364 additions and 2382 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,27 +0,0 @@
// Copyright 2015 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef BENCHMARK_BENCHMARK_API_H_
#define BENCHMARK_BENCHMARK_API_H_
#ifdef __DEPRECATED
# ifndef BENCHMARK_WARNING_MSG
# warning the benchmark_api.h header has been deprecated and will be removed, please include benchmark.h instead
# else
BENCHMARK_WARNING_MSG("the benchmark_api.h header has been deprecated and will be removed, please include benchmark.h instead")
# endif
#endif
#include "benchmark.h" // For forward declaration of BenchmarkReporter
#endif // BENCHMARK_BENCHMARK_API_H_

View File

@@ -1,27 +0,0 @@
// Copyright 2015 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef BENCHMARK_REPORTER_H_
#define BENCHMARK_REPORTER_H_
#ifdef __DEPRECATED
# ifndef BENCHMARK_WARNING_MSG
# warning the reporter.h header has been deprecated and will be removed, please include benchmark.h instead
# else
BENCHMARK_WARNING_MSG("the reporter.h header has been deprecated and will be removed, please include benchmark.h instead")
# endif
#endif
#include "benchmark.h" // For forward declaration of BenchmarkReporter
#endif // BENCHMARK_REPORTER_H_

View File

@@ -1,184 +0,0 @@
/* define if glog doesn't use RTTI */
/* #undef DISABLE_RTTI */
/* Namespace for Google classes */
#define GOOGLE_NAMESPACE google
/* Define if you have the `dladdr' function */
/* #undef HAVE_DLADDR */
/* Define if you have the `snprintf' function */
#define HAVE_SNPRINTF
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H
/* Define to 1 if you have the <execinfo.h> header file. */
#define HAVE_EXECINFO_H
/* Define if you have the `fcntl' function */
#define HAVE_FCNTL
/* Define to 1 if you have the <glob.h> header file. */
#define HAVE_GLOB_H
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `pthread' library (-lpthread). */
/* #undef HAVE_LIBPTHREAD */
/* Define to 1 if you have the <libunwind.h> header file. */
/* #undef HAVE_LIBUNWIND_H */
/* define if you have google gflags library */
/* #undef HAVE_LIB_GFLAGS */
/* define if you have google gmock library */
/* #undef HAVE_LIB_GMOCK */
/* define if you have google gtest library */
/* #undef HAVE_LIB_GTEST */
/* define if you have libunwind */
/* #undef HAVE_LIB_UNWIND */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H
/* define to disable multithreading support. */
/* #undef NO_THREADS */
/* define if the compiler implements namespaces */
#define HAVE_NAMESPACES
/* Define if you have the 'pread' function */
#define HAVE_PREAD
/* Define if you have POSIX threads libraries and header files. */
#define HAVE_PTHREAD
/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H
/* Define if you have the 'pwrite' function */
#define HAVE_PWRITE
/* define if the compiler implements pthread_rwlock_* */
/* #undef HAVE_RWLOCK */
/* Define if you have the 'sigaction' function */
#define HAVE_SIGACTION
/* Define if you have the `sigaltstack' function */
/* #undef HAVE_SIGALTSTACK */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H
/* Define to 1 if you have the <syscall.h> header file. */
#define HAVE_SYSCALL_H
/* Define to 1 if you have the <syslog.h> header file. */
#define HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/syscall.h> header file. */
#define HAVE_SYS_SYSCALL_H
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/ucontext.h> header file. */
/* #undef HAVE_SYS_UCONTEXT_H */
/* Define to 1 if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H
/* Define to 1 if you have the <ucontext.h> header file. */
#define HAVE_UCONTEXT_H
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <unwind.h> header file. */
#define HAVE_UNWIND_H 1
/* define if the compiler supports using expression for operator */
#define HAVE_USING_OPERATOR
/* define if your compiler has __attribute__ */
#define HAVE___ATTRIBUTE__
/* define if your compiler has __builtin_expect */
#define HAVE___BUILTIN_EXPECT 1
/* define if your compiler has __sync_val_compare_and_swap */
#define HAVE___SYNC_VAL_COMPARE_AND_SWAP
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
/* #undef LT_OBJDIR */
/* Name of package */
/* #undef PACKAGE */
/* Define to the address where bug reports for this package should be sent. */
/* #undef PACKAGE_BUGREPORT */
/* Define to the full name of this package. */
/* #undef PACKAGE_NAME */
/* Define to the full name and version of this package. */
/* #undef PACKAGE_STRING */
/* Define to the one symbol short name of this package. */
/* #undef PACKAGE_TARNAME */
/* Define to the home page for this package. */
/* #undef PACKAGE_URL */
/* Define to the version of this package. */
/* #undef PACKAGE_VERSION */
/* How to access the PC from a struct ucontext */
/* #undef PC_FROM_UCONTEXT */
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
/* #undef PTHREAD_CREATE_JOINABLE */
/* The size of `void *', as computed by sizeof. */
#define SIZEOF_VOID_P 8
/* Define to 1 if you have the ANSI C header files. */
/* #undef STDC_HEADERS */
/* the namespace where STL code like vector<> is defined */
#define STL_NAMESPACE std
/* location of source code */
#define TEST_SRC_DIR "/home/brgirgis/Documents/code/thirdparty/google/glog/glog"
/* Version number of package */
/* #undef VERSION */
/* Stops putting the code inside the Google namespace */
#define _END_GOOGLE_NAMESPACE_ }
/* Puts following code inside the Google namespace */
#define _START_GOOGLE_NAMESPACE_ namespace google {

View File

@@ -568,8 +568,10 @@ class LogSink; // defined below
LOG_TO_STRING_##severity(static_cast<std::vector<std::string>*>(outvec)).stream() LOG_TO_STRING_##severity(static_cast<std::vector<std::string>*>(outvec)).stream()
#define LOG_IF(severity, condition) \ #define LOG_IF(severity, condition) \
static_cast<void>(0), \
!(condition) ? (void) 0 : google::LogMessageVoidify() & LOG(severity) !(condition) ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
#define SYSLOG_IF(severity, condition) \ #define SYSLOG_IF(severity, condition) \
static_cast<void>(0), \
!(condition) ? (void) 0 : google::LogMessageVoidify() & SYSLOG(severity) !(condition) ? (void) 0 : google::LogMessageVoidify() & SYSLOG(severity)
#define LOG_ASSERT(condition) \ #define LOG_ASSERT(condition) \
@@ -859,6 +861,7 @@ DECLARE_CHECK_STROP_IMPL(strcasecmp, false)
&google::LogMessage::SendToLog) &google::LogMessage::SendToLog)
#define PLOG_IF(severity, condition) \ #define PLOG_IF(severity, condition) \
static_cast<void>(0), \
!(condition) ? (void) 0 : google::LogMessageVoidify() & PLOG(severity) !(condition) ? (void) 0 : google::LogMessageVoidify() & PLOG(severity)
// A CHECK() macro that postpends errno if the condition is false. E.g. // A CHECK() macro that postpends errno if the condition is false. E.g.
@@ -931,16 +934,11 @@ struct CompileAssert {
struct CrashReason; struct CrashReason;
// Returns true if FailureSignalHandler is installed. // Returns true if FailureSignalHandler is installed.
bool IsFailureSignalHandlerInstalled(); // Needs to be exported since it's used by the signalhandler_unittest.
GOOGLE_GLOG_DLL_DECL bool IsFailureSignalHandlerInstalled();
} // namespace glog_internal_namespace_ } // namespace glog_internal_namespace_
#define GOOGLE_GLOG_COMPILE_ASSERT(expr, msg) \
typedef google::glog_internal_namespace_::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
#define LOG_EVERY_N(severity, n) \ #define LOG_EVERY_N(severity, n) \
GOOGLE_GLOG_COMPILE_ASSERT(google::GLOG_ ## severity < \
google::NUM_SEVERITIES, \
INVALID_REQUESTED_LOG_SEVERITY); \
SOME_KIND_OF_LOG_EVERY_N(severity, (n), google::LogMessage::SendToLog) SOME_KIND_OF_LOG_EVERY_N(severity, (n), google::LogMessage::SendToLog)
#define SYSLOG_EVERY_N(severity, n) \ #define SYSLOG_EVERY_N(severity, n) \
@@ -1009,22 +1007,28 @@ const LogSeverity GLOG_0 = GLOG_ERROR;
#else // !DCHECK_IS_ON() #else // !DCHECK_IS_ON()
#define DLOG(severity) \ #define DLOG(severity) \
static_cast<void>(0), \
true ? (void) 0 : google::LogMessageVoidify() & LOG(severity) true ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
#define DVLOG(verboselevel) \ #define DVLOG(verboselevel) \
static_cast<void>(0), \
(true || !VLOG_IS_ON(verboselevel)) ? \ (true || !VLOG_IS_ON(verboselevel)) ? \
(void) 0 : google::LogMessageVoidify() & LOG(INFO) (void) 0 : google::LogMessageVoidify() & LOG(INFO)
#define DLOG_IF(severity, condition) \ #define DLOG_IF(severity, condition) \
static_cast<void>(0), \
(true || !(condition)) ? (void) 0 : google::LogMessageVoidify() & LOG(severity) (true || !(condition)) ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
#define DLOG_EVERY_N(severity, n) \ #define DLOG_EVERY_N(severity, n) \
static_cast<void>(0), \
true ? (void) 0 : google::LogMessageVoidify() & LOG(severity) true ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
#define DLOG_IF_EVERY_N(severity, condition, n) \ #define DLOG_IF_EVERY_N(severity, condition, n) \
static_cast<void>(0), \
(true || !(condition))? (void) 0 : google::LogMessageVoidify() & LOG(severity) (true || !(condition))? (void) 0 : google::LogMessageVoidify() & LOG(severity)
#define DLOG_ASSERT(condition) \ #define DLOG_ASSERT(condition) \
static_cast<void>(0), \
true ? (void) 0 : LOG_ASSERT(condition) true ? (void) 0 : LOG_ASSERT(condition)
// MSVC warning C4127: conditional expression is constant // MSVC warning C4127: conditional expression is constant
@@ -1109,10 +1113,11 @@ namespace base_logging {
// buffer to allow for a '\n' and '\0'. // buffer to allow for a '\n' and '\0'.
class GOOGLE_GLOG_DLL_DECL LogStreamBuf : public std::streambuf { class GOOGLE_GLOG_DLL_DECL LogStreamBuf : public std::streambuf {
public: public:
// REQUIREMENTS: "len" must be >= 2 to account for the '\n' and '\n'. // REQUIREMENTS: "len" must be >= 2 to account for the '\n' and '\0'.
LogStreamBuf(char *buf, int len) { LogStreamBuf(char *buf, int len) {
setp(buf, buf + len - 2); setp(buf, buf + len - 2);
} }
// This effectively ignores overflow. // This effectively ignores overflow.
virtual int_type overflow(int_type ch) { virtual int_type overflow(int_type ch) {
return ch; return ch;
@@ -1151,13 +1156,9 @@ public:
// 2005 if you are deriving from a type in the Standard C++ Library" // 2005 if you are deriving from a type in the Standard C++ Library"
// http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx // http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx
// Let's just ignore the warning. // Let's just ignore the warning.
#ifdef _MSC_VER GLOG_MSVC_PUSH_DISABLE_WARNING(4275)
# pragma warning(disable: 4275)
#endif
class GOOGLE_GLOG_DLL_DECL LogStream : public std::ostream { class GOOGLE_GLOG_DLL_DECL LogStream : public std::ostream {
#ifdef _MSC_VER GLOG_MSVC_POP_WARNING()
# pragma warning(default: 4275)
#endif
public: public:
LogStream(char *buf, int len, int ctr) LogStream(char *buf, int len, int ctr)
: std::ostream(NULL), : std::ostream(NULL),

View File

@@ -175,11 +175,6 @@ GOOGLE_GLOG_DLL_DECL void RawLog__(LogSeverity severity,
const char* format, ...) const char* format, ...)
; ;
// Hack to propagate time information into this module so that
// this module does not have to directly call localtime_r(),
// which could allocate memory.
GOOGLE_GLOG_DLL_DECL void RawLog__SetLastTime(const struct tm& t, int usecs);
} }
#endif // BASE_RAW_LOGGING_H_ #endif // BASE_RAW_LOGGING_H_

View File

@@ -26,13 +26,14 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // 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. // Google Mock - a framework for writing C++ mock classes.
// //
// This file implements some commonly used actions. // This file implements some commonly used actions.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
@@ -46,9 +47,10 @@
#include "gmock/internal/gmock-internal-utils.h" #include "gmock/internal/gmock-internal-utils.h"
#include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-port.h"
#if GTEST_HAS_STD_TYPE_TRAITS_ // Defined by gtest-port.h via gmock-port.h. #if GTEST_LANG_CXX11 // Defined by gtest-port.h via gmock-port.h.
#include <functional>
#include <type_traits> #include <type_traits>
#endif #endif // GTEST_LANG_CXX11
namespace testing { namespace testing {
@@ -96,7 +98,7 @@ struct BuiltInDefaultValueGetter<T, false> {
template <typename T> template <typename T>
class BuiltInDefaultValue { class BuiltInDefaultValue {
public: public:
#if GTEST_HAS_STD_TYPE_TRAITS_ #if GTEST_LANG_CXX11
// This function returns true iff type T has a built-in default value. // This function returns true iff type T has a built-in default value.
static bool Exists() { static bool Exists() {
return ::std::is_default_constructible<T>::value; return ::std::is_default_constructible<T>::value;
@@ -107,7 +109,7 @@ class BuiltInDefaultValue {
T, ::std::is_default_constructible<T>::value>::Get(); T, ::std::is_default_constructible<T>::value>::Get();
} }
#else // GTEST_HAS_STD_TYPE_TRAITS_ #else // GTEST_LANG_CXX11
// This function returns true iff type T has a built-in default value. // This function returns true iff type T has a built-in default value.
static bool Exists() { static bool Exists() {
return false; return false;
@@ -117,7 +119,7 @@ class BuiltInDefaultValue {
return BuiltInDefaultValueGetter<T, false>::Get(); return BuiltInDefaultValueGetter<T, false>::Get();
} }
#endif // GTEST_HAS_STD_TYPE_TRAITS_ #endif // GTEST_LANG_CXX11
}; };
// This partial specialization says that we use the same built-in // This partial specialization says that we use the same built-in
@@ -359,15 +361,21 @@ class Action {
// Constructs a null Action. Needed for storing Action objects in // Constructs a null Action. Needed for storing Action objects in
// STL containers. // STL containers.
Action() : impl_(NULL) {} Action() {}
// Constructs an Action from its implementation. A NULL impl is #if GTEST_LANG_CXX11
// used to represent the "do-default" action. // Construct an Action from a specified callable.
// This cannot take std::function directly, because then Action would not be
// directly constructible from lambda (it would require two conversions).
template <typename G,
typename = typename ::std::enable_if<
::std::is_constructible<::std::function<F>, G>::value>::type>
Action(G&& fun) : fun_(::std::forward<G>(fun)) {} // NOLINT
#endif
// Constructs an Action from its implementation.
explicit Action(ActionInterface<F>* impl) : impl_(impl) {} explicit Action(ActionInterface<F>* impl) : impl_(impl) {}
// Copy constructor.
Action(const Action& action) : impl_(action.impl_) {}
// This constructor allows us to turn an Action<Func> object into an // This constructor allows us to turn an Action<Func> object into an
// Action<F>, as long as F's arguments can be implicitly converted // Action<F>, as long as F's arguments can be implicitly converted
// to Func's and Func's return type can be implicitly converted to // to Func's and Func's return type can be implicitly converted to
@@ -376,7 +384,13 @@ class Action {
explicit Action(const Action<Func>& action); explicit Action(const Action<Func>& action);
// Returns true iff this is the DoDefault() action. // Returns true iff this is the DoDefault() action.
bool IsDoDefault() const { return impl_.get() == NULL; } bool IsDoDefault() const {
#if GTEST_LANG_CXX11
return impl_ == nullptr && fun_ == nullptr;
#else
return impl_ == NULL;
#endif
}
// Performs the action. Note that this method is const even though // Performs the action. Note that this method is const even though
// the corresponding method in ActionInterface is not. The reason // the corresponding method in ActionInterface is not. The reason
@@ -384,14 +398,15 @@ class Action {
// another concrete action, not that the concrete action it binds to // another concrete action, not that the concrete action it binds to
// cannot change state. (Think of the difference between a const // cannot change state. (Think of the difference between a const
// pointer and a pointer to const.) // pointer and a pointer to const.)
Result Perform(const ArgumentTuple& args) const { Result Perform(ArgumentTuple args) const {
internal::Assert( if (IsDoDefault()) {
!IsDoDefault(), __FILE__, __LINE__, internal::IllegalDoDefault(__FILE__, __LINE__);
"You are using DoDefault() inside a composite action like " }
"DoAll() or WithArgs(). This is not supported for technical " #if GTEST_LANG_CXX11
"reasons. Please instead spell out the default action, or " if (fun_ != nullptr) {
"assign the default action to an Action variable and use " return internal::Apply(fun_, ::std::move(args));
"the variable in various places."); }
#endif
return impl_->Perform(args); return impl_->Perform(args);
} }
@@ -399,6 +414,18 @@ class Action {
template <typename F1, typename F2> template <typename F1, typename F2>
friend class internal::ActionAdaptor; friend class internal::ActionAdaptor;
template <typename G>
friend class Action;
// In C++11, Action can be implemented either as a generic functor (through
// std::function), or legacy ActionInterface. In C++98, only ActionInterface
// is available. The invariants are as follows:
// * in C++98, impl_ is null iff this is the default action
// * in C++11, at most one of fun_ & impl_ may be nonnull; both are null iff
// this is the default action
#if GTEST_LANG_CXX11
::std::function<F> fun_;
#endif
internal::linked_ptr<ActionInterface<F> > impl_; internal::linked_ptr<ActionInterface<F> > impl_;
}; };
@@ -530,6 +557,9 @@ struct ByMoveWrapper {
// statement, and conversion of the result of Return to Action<T(U)> is a // statement, and conversion of the result of Return to Action<T(U)> is a
// good place for that. // good place for that.
// //
// The real life example of the above scenario happens when an invocation
// of gtl::Container() is passed into Return.
//
template <typename R> template <typename R>
class ReturnAction { class ReturnAction {
public: public:
@@ -749,7 +779,7 @@ class DoDefaultAction {
// This template type conversion operator allows DoDefault() to be // This template type conversion operator allows DoDefault() to be
// used in any function. // used in any function.
template <typename F> template <typename F>
operator Action<F>() const { return Action<F>(NULL); } operator Action<F>() const { return Action<F>(); } // NOLINT
}; };
// Implements the Assign action to set a given pointer referent to a // Implements the Assign action to set a given pointer referent to a
@@ -885,6 +915,28 @@ class InvokeMethodWithoutArgsAction {
GTEST_DISALLOW_ASSIGN_(InvokeMethodWithoutArgsAction); GTEST_DISALLOW_ASSIGN_(InvokeMethodWithoutArgsAction);
}; };
// Implements the InvokeWithoutArgs(callback) action.
template <typename CallbackType>
class InvokeCallbackWithoutArgsAction {
public:
// The c'tor takes ownership of the callback.
explicit InvokeCallbackWithoutArgsAction(CallbackType* callback)
: callback_(callback) {
callback->CheckIsRepeatable(); // Makes sure the callback is permanent.
}
// This type conversion operator template allows Invoke(callback) to
// be used wherever the callback's return type can be implicitly
// converted to that of the mock function.
template <typename Result, typename ArgumentTuple>
Result Perform(const ArgumentTuple&) const { return callback_->Run(); }
private:
const internal::linked_ptr<CallbackType> callback_;
GTEST_DISALLOW_ASSIGN_(InvokeCallbackWithoutArgsAction);
};
// Implements the IgnoreResult(action) action. // Implements the IgnoreResult(action) action.
template <typename A> template <typename A>
class IgnoreResultAction { class IgnoreResultAction {
@@ -1029,9 +1081,9 @@ class DoBothAction {
// return sqrt(x*x + y*y); // return sqrt(x*x + y*y);
// } // }
// ... // ...
// EXEPCT_CALL(mock, Foo("abc", _, _)) // EXPECT_CALL(mock, Foo("abc", _, _))
// .WillOnce(Invoke(DistanceToOriginWithLabel)); // .WillOnce(Invoke(DistanceToOriginWithLabel));
// EXEPCT_CALL(mock, Bar(5, _, _)) // EXPECT_CALL(mock, Bar(5, _, _))
// .WillOnce(Invoke(DistanceToOriginWithIndex)); // .WillOnce(Invoke(DistanceToOriginWithIndex));
// //
// you could write // you could write
@@ -1041,8 +1093,8 @@ class DoBothAction {
// return sqrt(x*x + y*y); // return sqrt(x*x + y*y);
// } // }
// ... // ...
// EXEPCT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin)); // EXPECT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin));
// EXEPCT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin)); // EXPECT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin));
typedef internal::IgnoredValue Unused; typedef internal::IgnoredValue Unused;
// This constructor allows us to turn an Action<From> object into an // This constructor allows us to turn an Action<From> object into an
@@ -1052,7 +1104,13 @@ typedef internal::IgnoredValue Unused;
template <typename To> template <typename To>
template <typename From> template <typename From>
Action<To>::Action(const Action<From>& from) Action<To>::Action(const Action<From>& from)
: impl_(new internal::ActionAdaptor<To, From>(from)) {} :
#if GTEST_LANG_CXX11
fun_(from.fun_),
#endif
impl_(from.impl_ == NULL ? NULL
: new internal::ActionAdaptor<To, From>(from)) {
}
// Creates an action that returns 'value'. 'value' is passed by value // Creates an action that returns 'value'. 'value' is passed by value
// instead of const reference - otherwise Return("string literal") // instead of const reference - otherwise Return("string literal")

View File

@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // 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. // Google Mock - a framework for writing C++ mock classes.
// //
@@ -35,6 +34,8 @@
// cardinalities can be defined by the user implementing the // cardinalities can be defined by the user implementing the
// CardinalityInterface interface if necessary. // CardinalityInterface interface if necessary.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
@@ -43,6 +44,9 @@
#include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
/* class A needs to have dll-interface to be used by clients of class B */)
namespace testing { namespace testing {
// To implement a cardinality Foo, define: // To implement a cardinality Foo, define:
@@ -144,4 +148,6 @@ inline Cardinality MakeCardinality(const CardinalityInterface* c) {
} // namespace testing } // namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ #endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_

View File

@@ -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-actions.h.pump
// DO NOT EDIT BY HAND!!!
// Copyright 2007, Google Inc. // Copyright 2007, Google Inc.
// All rights reserved. // All rights reserved.
@@ -28,13 +30,14 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // 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. // Google Mock - a framework for writing C++ mock classes.
// //
// This file implements some commonly used variadic actions. // This file implements some commonly used variadic actions.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
@@ -45,8 +48,8 @@ namespace testing {
namespace internal { namespace internal {
// InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary // InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
// function or method with the unpacked values, where F is a function // function, method, or callback with the unpacked values, where F is
// type that takes N arguments. // a function type that takes N arguments.
template <typename Result, typename ArgumentTuple> template <typename Result, typename ArgumentTuple>
class InvokeHelper; class InvokeHelper;
@@ -64,6 +67,12 @@ class InvokeHelper<R, ::testing::tuple<> > {
const ::testing::tuple<>&) { const ::testing::tuple<>&) {
return (obj_ptr->*method_ptr)(); return (obj_ptr->*method_ptr)();
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<>&) {
return callback->Run();
}
}; };
template <typename R, typename A1> template <typename R, typename A1>
@@ -80,6 +89,12 @@ class InvokeHelper<R, ::testing::tuple<A1> > {
const ::testing::tuple<A1>& args) { const ::testing::tuple<A1>& args) {
return (obj_ptr->*method_ptr)(get<0>(args)); return (obj_ptr->*method_ptr)(get<0>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1>& args) {
return callback->Run(get<0>(args));
}
}; };
template <typename R, typename A1, typename A2> template <typename R, typename A1, typename A2>
@@ -96,6 +111,12 @@ class InvokeHelper<R, ::testing::tuple<A1, A2> > {
const ::testing::tuple<A1, A2>& args) { const ::testing::tuple<A1, A2>& args) {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args)); return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1, A2>& args) {
return callback->Run(get<0>(args), get<1>(args));
}
}; };
template <typename R, typename A1, typename A2, typename A3> template <typename R, typename A1, typename A2, typename A3>
@@ -113,6 +134,12 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3> > {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
get<2>(args)); get<2>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1, A2, A3>& args) {
return callback->Run(get<0>(args), get<1>(args), get<2>(args));
}
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4> template <typename R, typename A1, typename A2, typename A3, typename A4>
@@ -132,6 +159,13 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4> > {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
get<2>(args), get<3>(args)); get<2>(args), get<3>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1, A2, A3, A4>& args) {
return callback->Run(get<0>(args), get<1>(args), get<2>(args),
get<3>(args));
}
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@@ -152,6 +186,13 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5> > {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
get<2>(args), get<3>(args), get<4>(args)); get<2>(args), get<3>(args), get<4>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1, A2, A3, A4, A5>& args) {
return callback->Run(get<0>(args), get<1>(args), get<2>(args),
get<3>(args), get<4>(args));
}
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@@ -172,6 +213,8 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
get<2>(args), get<3>(args), get<4>(args), get<5>(args)); get<2>(args), get<3>(args), get<4>(args), get<5>(args));
} }
// There is no InvokeCallback() for 6-tuples
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@@ -194,6 +237,8 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
get<2>(args), get<3>(args), get<4>(args), get<5>(args), get<2>(args), get<3>(args), get<4>(args), get<5>(args),
get<6>(args)); get<6>(args));
} }
// There is no InvokeCallback() for 7-tuples
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@@ -217,6 +262,8 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
get<2>(args), get<3>(args), get<4>(args), get<5>(args), get<2>(args), get<3>(args), get<4>(args), get<5>(args),
get<6>(args), get<7>(args)); get<6>(args), get<7>(args));
} }
// There is no InvokeCallback() for 8-tuples
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@@ -240,6 +287,8 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
get<2>(args), get<3>(args), get<4>(args), get<5>(args), get<2>(args), get<3>(args), get<4>(args), get<5>(args),
get<6>(args), get<7>(args), get<8>(args)); get<6>(args), get<7>(args), get<8>(args));
} }
// There is no InvokeCallback() for 9-tuples
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@@ -265,6 +314,33 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
get<2>(args), get<3>(args), get<4>(args), get<5>(args), get<2>(args), get<3>(args), get<4>(args), get<5>(args),
get<6>(args), get<7>(args), get<8>(args), get<9>(args)); get<6>(args), get<7>(args), get<8>(args), get<9>(args));
} }
// There is no InvokeCallback() for 10-tuples
};
// Implements the Invoke(callback) action.
template <typename CallbackType>
class InvokeCallbackAction {
public:
// The c'tor takes ownership of the callback.
explicit InvokeCallbackAction(CallbackType* callback)
: callback_(callback) {
callback->CheckIsRepeatable(); // Makes sure the callback is permanent.
}
// This type conversion operator template allows Invoke(callback) to
// be used wherever the callback's type is compatible with that of
// the mock function, i.e. if the mock function's arguments can be
// implicitly converted to the callback's arguments and the
// callback's result can be implicitly converted to the mock
// function's result.
template <typename Result, typename ArgumentTuple>
Result Perform(const ArgumentTuple& args) const {
return InvokeHelper<Result, ArgumentTuple>::InvokeCallback(
callback_.get(), args);
}
private:
const linked_ptr<CallbackType> callback_;
}; };
// An INTERNAL macro for extracting the type of a tuple field. It's // An INTERNAL macro for extracting the type of a tuple field. It's
@@ -875,7 +951,7 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
// MORE INFORMATION: // MORE INFORMATION:
// //
// To learn more about using these macros, please search for 'ACTION' // To learn more about using these macros, please search for 'ACTION'
// on http://code.google.com/p/googlemock/wiki/CookBook. // on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md
// An internal macro needed for implementing ACTION*(). // An internal macro needed for implementing ACTION*().
#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\
@@ -1073,52 +1149,90 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
#define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\ #define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\
() ()
#define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\ #define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\
(p0##_type gmock_p0) : p0(gmock_p0) (p0##_type gmock_p0) : p0(::testing::internal::move(gmock_p0))
#define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\ #define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\
(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), p1(gmock_p1) (p0##_type gmock_p0, \
p1##_type gmock_p1) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1))
#define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\ #define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\
(p0##_type gmock_p0, p1##_type gmock_p1, \ (p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) p2##_type gmock_p2) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2))
#define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\ #define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (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##_type gmock_p3) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3) p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3))
#define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\ #define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (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), \ p3##_type gmock_p3, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) p4##_type gmock_p4) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4))
#define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\ #define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, \ p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p5##_type gmock_p5) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5))
#define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\ #define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ 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), \ p6##_type gmock_p6) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6))
#define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\ #define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), \ p6##_type gmock_p6, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p7##_type gmock_p7) : p0(::testing::internal::move(gmock_p0)), \
p7(gmock_p7) p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7))
#define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ #define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
p7, p8)\ p7, p8)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, \ p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p8##_type gmock_p8) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::move(gmock_p1)), \
p8(gmock_p8) p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8))
#define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ #define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
p7, p8, p9)\ p7, p8, p9)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p9##_type gmock_p9) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::move(gmock_p1)), \
p8(gmock_p8), p9(gmock_p9) p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)), \
p9(::testing::internal::move(gmock_p9))
// Declares the fields for storing the value parameters. // Declares the fields for storing the value parameters.
#define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS() #define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS()
@@ -1354,7 +1468,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
template <typename p0##_type>\ template <typename p0##_type>\
class name##ActionP {\ class name##ActionP {\
public:\ public:\
explicit name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\ explicit name##ActionP(p0##_type gmock_p0) : \
p0(::testing::internal::forward<p0##_type>(gmock_p0)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1362,7 +1477,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::Result return_type;\ typedef typename ::testing::internal::Function<F>::Result return_type;\
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
explicit gmock_Impl(p0##_type gmock_p0) : p0(gmock_p0) {}\ explicit gmock_Impl(p0##_type gmock_p0) : \
p0(::testing::internal::forward<p0##_type>(gmock_p0)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1404,8 +1520,9 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
template <typename p0##_type, typename p1##_type>\ template <typename p0##_type, typename p1##_type>\
class name##ActionP2 {\ class name##ActionP2 {\
public:\ public:\
name##ActionP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ name##ActionP2(p0##_type gmock_p0, \
p1(gmock_p1) {}\ p1##_type gmock_p1) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1413,8 +1530,9 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::Result return_type;\ typedef typename ::testing::internal::Function<F>::Result return_type;\
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ gmock_Impl(p0##_type gmock_p0, \
p1(gmock_p1) {}\ p1##_type gmock_p1) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1460,7 +1578,9 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
class name##ActionP3 {\ class name##ActionP3 {\
public:\ public:\
name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ p2##_type gmock_p2) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1469,7 +1589,9 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ p2##_type gmock_p2) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1519,8 +1641,11 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
class name##ActionP4 {\ class name##ActionP4 {\
public:\ public:\
name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \ p2##_type gmock_p2, \
p2(gmock_p2), p3(gmock_p3) {}\ p3##_type gmock_p3) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1529,8 +1654,10 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(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##_type gmock_p3) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1587,8 +1714,11 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
public:\ public:\
name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, \ p2##_type gmock_p2, p3##_type gmock_p3, \
p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p4##_type gmock_p4) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1597,8 +1727,12 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), \ p3##_type gmock_p3, \
p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) {}\ p4##_type gmock_p4) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1657,8 +1791,12 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
public:\ public:\
name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ 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), \ p5##_type gmock_p5) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1668,8 +1806,12 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, \ p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p5##_type gmock_p5) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1731,9 +1873,14 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
public:\ public:\
name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ 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), \ p5##_type gmock_p5, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ p6##_type gmock_p6) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p6(gmock_p6) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1743,8 +1890,13 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ 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, \ 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), \ p6##_type gmock_p6) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1813,9 +1965,14 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, \ p5##_type gmock_p5, p6##_type gmock_p6, \
p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p7##_type gmock_p7) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p7(gmock_p7) {}\ p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1825,9 +1982,15 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ 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, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), \ p6##_type gmock_p6, \
p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), \ p7##_type gmock_p7) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1900,9 +2063,15 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p8##_type gmock_p8) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p8(gmock_p8) {}\ p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
p8(::testing::internal::forward<p8##_type>(gmock_p8)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1913,9 +2082,15 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ 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, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, \ p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p8##_type gmock_p8) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p7(gmock_p7), p8(gmock_p8) {}\ p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
p8(::testing::internal::forward<p8##_type>(gmock_p8)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1992,9 +2167,17 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ p8##_type gmock_p8, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p9##_type gmock_p9) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
p8(::testing::internal::forward<p8##_type>(gmock_p8)), \
p9(::testing::internal::forward<p9##_type>(gmock_p9)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -2005,9 +2188,16 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ 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, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p9##_type gmock_p9) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
p8(::testing::internal::forward<p8##_type>(gmock_p8)), \
p9(::testing::internal::forward<p9##_type>(gmock_p9)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -2369,7 +2559,7 @@ ACTION_TEMPLATE(ReturnNew,
} // namespace testing } // namespace testing
// Include any custom actions added by the local installation. // Include any custom callback actions added by the local installation.
// We must include this header at the end to make sure it can use the // We must include this header at the end to make sure it can use the
// declarations from this file. // declarations from this file.
#include "gmock/internal/custom/gmock-generated-actions.h" #include "gmock/internal/custom/gmock-generated-actions.h"

View File

@@ -32,13 +32,14 @@ $$}} This meta comment fixes auto-indentation in editors.
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // 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. // Google Mock - a framework for writing C++ mock classes.
// //
// This file implements some commonly used variadic actions. // This file implements some commonly used variadic actions.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
@@ -49,12 +50,13 @@ namespace testing {
namespace internal { namespace internal {
// InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary // InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
// function or method with the unpacked values, where F is a function // function, method, or callback with the unpacked values, where F is
// type that takes N arguments. // a function type that takes N arguments.
template <typename Result, typename ArgumentTuple> template <typename Result, typename ArgumentTuple>
class InvokeHelper; class InvokeHelper;
$var max_callback_arity = 5
$range i 0..n $range i 0..n
$for i [[ $for i [[
$range j 1..i $range j 1..i
@@ -76,10 +78,47 @@ class InvokeHelper<R, ::testing::tuple<$as> > {
const ::testing::tuple<$as>&$args) { const ::testing::tuple<$as>&$args) {
return (obj_ptr->*method_ptr)($gets); return (obj_ptr->*method_ptr)($gets);
} }
$if i <= max_callback_arity [[
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<$as>&$args) {
return callback->Run($gets);
}
]] $else [[
// There is no InvokeCallback() for $i-tuples
]]
}; };
]] ]]
// Implements the Invoke(callback) action.
template <typename CallbackType>
class InvokeCallbackAction {
public:
// The c'tor takes ownership of the callback.
explicit InvokeCallbackAction(CallbackType* callback)
: callback_(callback) {
callback->CheckIsRepeatable(); // Makes sure the callback is permanent.
}
// This type conversion operator template allows Invoke(callback) to
// be used wherever the callback's type is compatible with that of
// the mock function, i.e. if the mock function's arguments can be
// implicitly converted to the callback's arguments and the
// callback's result can be implicitly converted to the mock
// function's result.
template <typename Result, typename ArgumentTuple>
Result Perform(const ArgumentTuple& args) const {
return InvokeHelper<Result, ArgumentTuple>::InvokeCallback(
callback_.get(), args);
}
private:
const linked_ptr<CallbackType> callback_;
};
// An INTERNAL macro for extracting the type of a tuple field. It's // An INTERNAL macro for extracting the type of a tuple field. It's
// subject to change without notice - DO NOT USE IN USER CODE! // subject to change without notice - DO NOT USE IN USER CODE!
#define GMOCK_FIELD_(Tuple, N) \ #define GMOCK_FIELD_(Tuple, N) \
@@ -357,7 +396,7 @@ $range j2 2..i
// MORE INFORMATION: // MORE INFORMATION:
// //
// To learn more about using these macros, please search for 'ACTION' // To learn more about using these macros, please search for 'ACTION'
// on http://code.google.com/p/googlemock/wiki/CookBook. // on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md
$range i 0..n $range i 0..n
$range k 0..n-1 $range k 0..n-1
@@ -486,7 +525,7 @@ _VALUE_PARAMS($for j, [[p$j]]) $for j [[, typename p$j##_type]]
$for i [[ $for i [[
$range j 0..i-1 $range j 0..i-1
#define GMOCK_INTERNAL_INIT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])\ #define GMOCK_INTERNAL_INIT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])\
($for j, [[p$j##_type gmock_p$j]])$if i>0 [[ : ]]$for j, [[p$j(gmock_p$j)]] ($for j, [[p$j##_type gmock_p$j]])$if i>0 [[ : ]]$for j, [[p$j(::testing::internal::move(gmock_p$j))]]
]] ]]
@@ -619,7 +658,7 @@ $var class_name = [[name##Action[[$if i==0 [[]] $elif i==1 [[P]]
$range j 0..i-1 $range j 0..i-1
$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] $var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]]
$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] $var param_types_and_names = [[$for j, [[p$j##_type p$j]]]]
$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] $var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::testing::internal::forward<p$j##_type>(gmock_p$j))]]]]]]
$var param_field_decls = [[$for j $var param_field_decls = [[$for j
[[ [[

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
$$ -*- mode: c++; -*- $$ -*- mode: c++; -*-
$$ This is a Pump source file. Please use Pump to convert it to $$ This is a Pump source file. Please use Pump to convert
$$ gmock-generated-function-mockers.h. $$ it to gmock-generated-function-mockers.h.
$$ $$
$var n = 10 $$ The maximum arity we support. $var n = 10 $$ The maximum arity we support.
// Copyright 2007, Google Inc. // Copyright 2007, Google Inc.
@@ -31,13 +31,14 @@ $var n = 10 $$ The maximum arity we support.
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // 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. // Google Mock - a framework for writing C++ mock classes.
// //
// This file implements function mockers of various arities. // This file implements function mockers of various arities.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
@@ -68,7 +69,7 @@ $for i [[
$range j 1..i $range j 1..i
$var typename_As = [[$for j [[, typename A$j]]]] $var typename_As = [[$for j [[, typename A$j]]]]
$var As = [[$for j, [[A$j]]]] $var As = [[$for j, [[A$j]]]]
$var as = [[$for j, [[a$j]]]] $var as = [[$for j, [[internal::forward<A$j>(a$j)]]]]
$var Aas = [[$for j, [[A$j a$j]]]] $var Aas = [[$for j, [[A$j a$j]]]]
$var ms = [[$for j, [[m$j]]]] $var ms = [[$for j, [[m$j]]]]
$var matchers = [[$for j, [[const Matcher<A$j>& m$j]]]] $var matchers = [[$for j, [[const Matcher<A$j>& m$j]]]]
@@ -79,13 +80,8 @@ class FunctionMocker<R($As)> : public
typedef R F($As); typedef R F($As);
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
MockSpec<F>& With($matchers) { MockSpec<F> With($matchers) {
return MockSpec<F>(this, ::testing::make_tuple($ms));
$if i >= 1 [[
this->current_spec().SetMatchers(::testing::make_tuple($ms));
]]
return this->current_spec();
} }
R Invoke($Aas) { R Invoke($Aas) {
@@ -99,6 +95,58 @@ $if i >= 1 [[
]] ]]
// Removes the given pointer; this is a helper for the expectation setter method
// for parameterless matchers.
//
// We want to make sure that the user cannot set a parameterless expectation on
// overloaded methods, including methods which are overloaded on const. Example:
//
// class MockClass {
// MOCK_METHOD0(GetName, string&());
// MOCK_CONST_METHOD0(GetName, const string&());
// };
//
// TEST() {
// // This should be an error, as it's not clear which overload is expected.
// EXPECT_CALL(mock, GetName).WillOnce(ReturnRef(value));
// }
//
// Here are the generated expectation-setter methods:
//
// class MockClass {
// // Overload 1
// MockSpec<string&()> gmock_GetName() { ... }
// // Overload 2. Declared const so that the compiler will generate an
// // error when trying to resolve between this and overload 4 in
// // 'gmock_GetName(WithoutMatchers(), nullptr)'.
// MockSpec<string&()> gmock_GetName(
// const WithoutMatchers&, const Function<string&()>*) const {
// // Removes const from this, calls overload 1
// return AdjustConstness_(this)->gmock_GetName();
// }
//
// // Overload 3
// const string& gmock_GetName() const { ... }
// // Overload 4
// MockSpec<const string&()> gmock_GetName(
// const WithoutMatchers&, const Function<const string&()>*) const {
// // Does not remove const, calls overload 3
// return AdjustConstness_const(this)->gmock_GetName();
// }
// }
//
template <typename MockType>
const MockType* AdjustConstness_const(const MockType* mock) {
return mock;
}
// Removes const from and returns the given pointer; this is a helper for the
// expectation setter method for parameterless matchers.
template <typename MockType>
MockType* AdjustConstness_(const MockType* mock) {
return const_cast<MockType*>(mock);
}
} // namespace internal } // namespace internal
// The style guide prohibits "using" statements in a namespace scope // The style guide prohibits "using" statements in a namespace scope
@@ -134,11 +182,14 @@ using internal::FunctionMocker;
$for i [[ $for i [[
$range j 1..i $range j 1..i
$var arg_as = [[$for j, \ $var arg_as = [[$for j, [[GMOCK_ARG_(tn, $j, __VA_ARGS__) gmock_a$j]]]]
[[GMOCK_ARG_(tn, $j, __VA_ARGS__) gmock_a$j]]]] $var as = [[$for j, \
$var as = [[$for j, [[gmock_a$j]]]] [[::testing::internal::forward<GMOCK_ARG_(tn, $j, __VA_ARGS__)>(gmock_a$j)]]]]
$var matcher_as = [[$for j, \ $var matcher_arg_as = [[$for j, \
[[GMOCK_MATCHER_(tn, $j, __VA_ARGS__) gmock_a$j]]]] [[GMOCK_MATCHER_(tn, $j, __VA_ARGS__) gmock_a$j]]]]
$var matcher_as = [[$for j, [[gmock_a$j]]]]
$var anything_matchers = [[$for j, \
[[::testing::A<GMOCK_ARG_(tn, $j, __VA_ARGS__)>()]]]]
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, ...) \ #define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
@@ -149,10 +200,16 @@ $var matcher_as = [[$for j, \
GMOCK_MOCKER_($i, constness, Method).SetOwnerAndName(this, #Method); \ GMOCK_MOCKER_($i, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_($i, constness, Method).Invoke($as); \ return GMOCK_MOCKER_($i, constness, Method).Invoke($as); \
} \ } \
::testing::MockSpec<__VA_ARGS__>& \ ::testing::MockSpec<__VA_ARGS__> \
gmock_##Method($matcher_as) constness { \ gmock_##Method($matcher_arg_as) constness { \
GMOCK_MOCKER_($i, constness, Method).RegisterOwner(this); \ GMOCK_MOCKER_($i, constness, Method).RegisterOwner(this); \
return GMOCK_MOCKER_($i, constness, Method).With($as); \ return GMOCK_MOCKER_($i, constness, Method).With($matcher_as); \
} \
::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
const ::testing::internal::WithoutMatchers&, \
constness ::testing::internal::Function<__VA_ARGS__>* ) const { \
return ::testing::internal::AdjustConstness_##constness(this)-> \
gmock_##Method($anything_matchers); \
} \ } \
mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_($i, constness, Method) mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_($i, constness, Method)
@@ -263,7 +320,7 @@ class MockFunction;
$for i [[ $for i [[
$range j 0..i-1 $range j 0..i-1
$var ArgTypes = [[$for j, [[A$j]]]] $var ArgTypes = [[$for j, [[A$j]]]]
$var ArgNames = [[$for j, [[a$j]]]] $var ArgValues = [[$for j, [[::std::move(a$j)]]]]
$var ArgDecls = [[$for j, [[A$j a$j]]]] $var ArgDecls = [[$for j, [[A$j a$j]]]]
template <typename R$for j [[, typename A$j]]> template <typename R$for j [[, typename A$j]]>
class MockFunction<R($ArgTypes)> { class MockFunction<R($ArgTypes)> {
@@ -273,9 +330,9 @@ class MockFunction<R($ArgTypes)> {
MOCK_METHOD$i[[]]_T(Call, R($ArgTypes)); MOCK_METHOD$i[[]]_T(Call, R($ArgTypes));
#if GTEST_HAS_STD_FUNCTION_ #if GTEST_HAS_STD_FUNCTION_
std::function<R($ArgTypes)> AsStdFunction() { ::std::function<R($ArgTypes)> AsStdFunction() {
return [this]($ArgDecls) -> R { return [this]($ArgDecls) -> R {
return this->Call($ArgNames); return this->Call($ArgValues);
}; };
} }
#endif // GTEST_HAS_STD_FUNCTION_ #endif // GTEST_HAS_STD_FUNCTION_

View File

@@ -35,6 +35,8 @@
// //
// This file implements some commonly used variadic matchers. // This file implements some commonly used variadic matchers.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
@@ -779,6 +781,9 @@ ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
// UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension // UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension
// that matches n elements in any order. We support up to n=10 arguments. // that matches n elements in any order. We support up to n=10 arguments.
//
// If you have >10 elements, consider UnorderedElementsAreArray() or
// UnorderedPointwise() instead.
inline internal::UnorderedElementsAreMatcher< inline internal::UnorderedElementsAreMatcher<
::testing::tuple<> > ::testing::tuple<> >
@@ -1268,7 +1273,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
// using testing::PrintToString; // using testing::PrintToString;
// //
// MATCHER_P2(InClosedRange, low, hi, // MATCHER_P2(InClosedRange, low, hi,
// string(negation ? "is not" : "is") + " in range [" + // std::string(negation ? "is not" : "is") + " in range [" +
// PrintToString(low) + ", " + PrintToString(hi) + "]") { // PrintToString(low) + ", " + PrintToString(hi) + "]") {
// return low <= arg && arg <= hi; // return low <= arg && arg <= hi;
// } // }
@@ -1376,18 +1381,21 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
// ================ // ================
// //
// To learn more about using these macros, please search for 'MATCHER' // To learn more about using these macros, please search for 'MATCHER'
// on http://code.google.com/p/googlemock/wiki/CookBook. // on
// https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md
#define MATCHER(name, description)\ #define MATCHER(name, description)\
class name##Matcher {\ class name##Matcher {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl()\ gmock_Impl()\
{}\ {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
@@ -1395,8 +1403,8 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1404,7 +1412,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<>()));\ ::testing::tuple<>()));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -1414,14 +1421,13 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
name##Matcher() {\ name##Matcher() {\
}\ }\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##Matcher);\
};\ };\
inline name##Matcher name() {\ inline name##Matcher name() {\
return name##Matcher();\ return name##Matcher();\
}\ }\
template <typename arg_type>\ template <typename arg_type>\
bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain(\ bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1430,22 +1436,24 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP {\ class name##MatcherP {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
explicit gmock_Impl(p0##_type gmock_p0)\ explicit gmock_Impl(p0##_type gmock_p0)\
: p0(gmock_p0) {}\ : p0(::testing::internal::move(gmock_p0)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1453,18 +1461,17 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<p0##_type>(p0)));\ ::testing::tuple<p0##_type>(p0)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
return ::testing::Matcher<arg_type>(\ return ::testing::Matcher<arg_type>(\
new gmock_Impl<arg_type>(p0));\ new gmock_Impl<arg_type>(p0));\
}\ }\
explicit name##MatcherP(p0##_type gmock_p0) : p0(gmock_p0) {\ explicit name##MatcherP(p0##_type gmock_p0) : \
p0(::testing::internal::move(gmock_p0)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP);\
};\ };\
template <typename p0##_type>\ template <typename p0##_type>\
inline name##MatcherP<p0##_type> name(p0##_type p0) {\ inline name##MatcherP<p0##_type> name(p0##_type p0) {\
@@ -1473,7 +1480,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
template <typename p0##_type>\ template <typename p0##_type>\
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP<p0##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ bool name##MatcherP<p0##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1482,23 +1489,26 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP2 {\ class name##MatcherP2 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\
: p0(gmock_p0), p1(gmock_p1) {}\ : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1506,20 +1516,19 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<p0##_type, p1##_type>(p0, p1)));\ ::testing::tuple<p0##_type, p1##_type>(p0, p1)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
return ::testing::Matcher<arg_type>(\ return ::testing::Matcher<arg_type>(\
new gmock_Impl<arg_type>(p0, p1));\ new gmock_Impl<arg_type>(p0, p1));\
}\ }\
name##MatcherP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ name##MatcherP2(p0##_type gmock_p0, \
p1(gmock_p1) {\ p1##_type gmock_p1) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP2);\
};\ };\
template <typename p0##_type, typename p1##_type>\ template <typename p0##_type, typename p1##_type>\
inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \ inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \
@@ -1530,7 +1539,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP2<p0##_type, \ bool name##MatcherP2<p0##_type, \
p1##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p1##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1539,24 +1548,28 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP3 {\ class name##MatcherP3 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1565,7 +1578,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
::testing::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \ ::testing::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \
p2)));\ p2)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -1573,13 +1585,14 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
new gmock_Impl<arg_type>(p0, p1, p2));\ new gmock_Impl<arg_type>(p0, p1, p2));\
}\ }\
name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {\ p2##_type gmock_p2) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP3);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type>\ template <typename p0##_type, typename p1##_type, typename p2##_type>\
inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \ inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
@@ -1590,7 +1603,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP3<p0##_type, p1##_type, \ bool name##MatcherP3<p0##_type, p1##_type, \
p2##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p2##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1600,26 +1613,31 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP4 {\ class name##MatcherP4 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3)\ p3##_type gmock_p3)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3) {}\ : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1628,7 +1646,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
::testing::tuple<p0##_type, p1##_type, p2##_type, \ ::testing::tuple<p0##_type, p1##_type, p2##_type, \
p3##_type>(p0, p1, p2, p3)));\ p3##_type>(p0, p1, p2, p3)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -1636,15 +1653,17 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
new gmock_Impl<arg_type>(p0, p1, p2, p3));\ new gmock_Impl<arg_type>(p0, p1, p2, p3));\
}\ }\
name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \ 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##_type gmock_p2, \
p2(gmock_p2), p3(gmock_p3) {\ p3##_type gmock_p3) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP4);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type, \ template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type>\ typename p3##_type>\
@@ -1659,7 +1678,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP4<p0##_type, p1##_type, p2##_type, \ bool name##MatcherP4<p0##_type, p1##_type, p2##_type, \
p3##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p3##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1669,28 +1688,33 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP5 {\ class name##MatcherP5 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4)\ p3##_type gmock_p3, p4##_type gmock_p4)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ : p0(::testing::internal::move(gmock_p0)), \
p4(gmock_p4) {}\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1699,7 +1723,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type>(p0, p1, p2, p3, p4)));\ p4##_type>(p0, p1, p2, p3, p4)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -1708,16 +1731,18 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
}\ }\
name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, \ p2##_type gmock_p2, p3##_type gmock_p3, \
p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p4##_type gmock_p4) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4) {\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP5);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type, \ template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type>\ typename p3##_type, typename p4##_type>\
@@ -1732,7 +1757,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \ bool name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p4##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1742,29 +1767,35 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP6 {\ class name##MatcherP6 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ 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)\ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ : p0(::testing::internal::move(gmock_p0)), \
p4(gmock_p4), p5(gmock_p5) {}\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1773,7 +1804,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\ p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -1782,17 +1812,20 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
}\ }\
name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ 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), \ p5##_type gmock_p5) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP6);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type, \ template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type>\ typename p3##_type, typename p4##_type, typename p5##_type>\
@@ -1807,7 +1840,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
p5##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p5##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1818,31 +1851,38 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP7 {\ class name##MatcherP7 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ 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, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6)\ p6##_type gmock_p6)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ : p0(::testing::internal::move(gmock_p0)), \
p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1852,7 +1892,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \ p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \
p6)));\ p6)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -1861,19 +1900,23 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
}\ }\
name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ 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), \ p5##_type gmock_p5, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ p6##_type gmock_p6) : p0(::testing::internal::move(gmock_p0)), \
p6(gmock_p6) {\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP7);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type, \ template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \ typename p3##_type, typename p4##_type, typename p5##_type, \
@@ -1891,7 +1934,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
p5##_type, p6##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p5##_type, p6##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1902,32 +1945,40 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP8 {\ class name##MatcherP8 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ 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, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7)\ p6##_type gmock_p6, p7##_type gmock_p7)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ : p0(::testing::internal::move(gmock_p0)), \
p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
p7##_type p7;\ p7##_type const p7;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1937,7 +1988,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \ p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \
p3, p4, p5, p6, p7)));\ p3, p4, p5, p6, p7)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -1947,20 +1997,24 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, \ p5##_type gmock_p5, p6##_type gmock_p6, \
p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p7##_type gmock_p7) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p1(::testing::internal::move(gmock_p1)), \
p7(gmock_p7) {\ p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
p7##_type p7;\ p7##_type const p7;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP8);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type, \ template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \ typename p3##_type, typename p4##_type, typename p5##_type, \
@@ -1980,7 +2034,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
p5##_type, p6##_type, \ p5##_type, p6##_type, \
p7##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p7##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1991,34 +2045,42 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP9 {\ class name##MatcherP9 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ 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, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\ p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ : p0(::testing::internal::move(gmock_p0)), \
p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::move(gmock_p1)), \
p8(gmock_p8) {}\ p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
p7##_type p7;\ p7##_type const p7;\
p8##_type p8;\ p8##_type const p8;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -2028,7 +2090,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
p4##_type, p5##_type, p6##_type, p7##_type, \ p4##_type, p5##_type, p6##_type, p7##_type, \
p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\ p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -2038,21 +2099,26 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p8##_type gmock_p8) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::move(gmock_p1)), \
p8(gmock_p8) {\ p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
p7##_type p7;\ p7##_type const p7;\
p8##_type p8;\ p8##_type const p8;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP9);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type, \ template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \ typename p3##_type, typename p4##_type, typename p5##_type, \
@@ -2073,7 +2139,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
p5##_type, p6##_type, p7##_type, \ p5##_type, p6##_type, p7##_type, \
p8##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p8##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -2085,36 +2151,45 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP10 {\ class name##MatcherP10 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ 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, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
p9##_type gmock_p9)\ p9##_type gmock_p9)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ : p0(::testing::internal::move(gmock_p0)), \
p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::move(gmock_p1)), \
p8(gmock_p8), p9(gmock_p9) {}\ p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)), \
p9(::testing::internal::move(gmock_p9)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
p7##_type p7;\ p7##_type const p7;\
p8##_type p8;\ p8##_type const p8;\
p9##_type p9;\ p9##_type const p9;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -2124,7 +2199,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\ p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -2134,22 +2208,29 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ p8##_type gmock_p8, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p9##_type gmock_p9) : p0(::testing::internal::move(gmock_p0)), \
p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)), \
p9(::testing::internal::move(gmock_p9)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
p7##_type p7;\ p7##_type const p7;\
p8##_type p8;\ p8##_type const p8;\
p9##_type p9;\ p9##_type const p9;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP10);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type, \ template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \ typename p3##_type, typename p4##_type, typename p5##_type, \
@@ -2172,7 +2253,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \ bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
p9##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p9##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const

View File

@@ -1,6 +1,6 @@
$$ -*- mode: c++; -*- $$ -*- mode: c++; -*-
$$ This is a Pump source file. Please use Pump to convert it to $$ This is a Pump source file. Please use Pump to convert
$$ gmock-generated-actions.h. $$ it to gmock-generated-matchers.h.
$$ $$
$var n = 10 $$ The maximum arity we support. $var n = 10 $$ The maximum arity we support.
$$ }} This line fixes auto-indentation of the following code in Emacs. $$ }} This line fixes auto-indentation of the following code in Emacs.
@@ -37,6 +37,8 @@ $$ }} This line fixes auto-indentation of the following code in Emacs.
// //
// This file implements some commonly used variadic matchers. // This file implements some commonly used variadic matchers.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
@@ -303,6 +305,9 @@ $for j, [[
// UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension // UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension
// that matches n elements in any order. We support up to n=$n arguments. // that matches n elements in any order. We support up to n=$n arguments.
//
// If you have >$n elements, consider UnorderedElementsAreArray() or
// UnorderedPointwise() instead.
$range i 0..n $range i 0..n
$for i [[ $for i [[
@@ -479,7 +484,7 @@ $$ // show up in the generated code.
// using testing::PrintToString; // using testing::PrintToString;
// //
// MATCHER_P2(InClosedRange, low, hi, // MATCHER_P2(InClosedRange, low, hi,
// string(negation ? "is not" : "is") + " in range [" + // std::string(negation ? "is not" : "is") + " in range [" +
// PrintToString(low) + ", " + PrintToString(hi) + "]") { // PrintToString(low) + ", " + PrintToString(hi) + "]") {
// return low <= arg && arg <= hi; // return low <= arg && arg <= hi;
// } // }
@@ -587,7 +592,8 @@ $$ // show up in the generated code.
// ================ // ================
// //
// To learn more about using these macros, please search for 'MATCHER' // To learn more about using these macros, please search for 'MATCHER'
// on http://code.google.com/p/googlemock/wiki/CookBook. // on
// https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md
$range i 0..n $range i 0..n
$for i $for i
@@ -604,32 +610,34 @@ $var template = [[$if i==0 [[]] $else [[
]]]] ]]]]
$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] $var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]]
$var impl_ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] $var impl_ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]]
$var impl_inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] $var impl_inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::testing::internal::move(gmock_p$j))]]]]]]
$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] $var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::testing::internal::move(gmock_p$j))]]]]]]
$var params = [[$for j, [[p$j]]]] $var params = [[$for j, [[p$j]]]]
$var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]] $var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]]
$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] $var param_types_and_names = [[$for j, [[p$j##_type p$j]]]]
$var param_field_decls = [[$for j $var param_field_decls = [[$for j
[[ [[
p$j##_type p$j;\ p$j##_type const p$j;\
]]]] ]]]]
$var param_field_decls2 = [[$for j $var param_field_decls2 = [[$for j
[[ [[
p$j##_type p$j;\ p$j##_type const p$j;\
]]]] ]]]]
#define $macro_name(name$for j [[, p$j]], description)\$template #define $macro_name(name$for j [[, p$j]], description)\$template
class $class_name {\ class $class_name {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
[[$if i==1 [[explicit ]]]]gmock_Impl($impl_ctor_param_list)\ [[$if i==1 [[explicit ]]]]gmock_Impl($impl_ctor_param_list)\
$impl_inits {}\ $impl_inits {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
@@ -637,8 +645,8 @@ $var param_field_decls2 = [[$for j
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\$param_field_decls }\$param_field_decls
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -646,7 +654,6 @@ $var param_field_decls2 = [[$for j
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\ ::testing::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -656,14 +663,13 @@ $var param_field_decls2 = [[$for j
[[$if i==1 [[explicit ]]]]$class_name($ctor_param_list)$inits {\ [[$if i==1 [[explicit ]]]]$class_name($ctor_param_list)$inits {\
}\$param_field_decls2 }\$param_field_decls2
private:\ private:\
GTEST_DISALLOW_ASSIGN_($class_name);\
};\$template };\$template
inline $class_name$param_types name($param_types_and_names) {\ inline $class_name$param_types name($param_types_and_names) {\
return $class_name$param_types($params);\ return $class_name$param_types($params);\
}\$template }\$template
template <typename arg_type>\ template <typename arg_type>\
bool $class_name$param_types::gmock_Impl<arg_type>::MatchAndExplain(\ bool $class_name$param_types::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
]] ]]

View File

@@ -30,8 +30,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Implements class templates NiceMock, NaggyMock, and StrictMock. // Implements class templates NiceMock, NaggyMock, and StrictMock.
// //
@@ -51,10 +50,9 @@
// NiceMock<MockFoo>. // NiceMock<MockFoo>.
// //
// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of // NiceMock, NaggyMock, and StrictMock "inherit" the constructors of
// their respective base class, with up-to 10 arguments. Therefore // their respective base class. Therefore you can write
// you can write NiceMock<MockFoo>(5, "a") to construct a nice mock // NiceMock<MockFoo>(5, "a") to construct a nice mock where MockFoo
// where MockFoo has a constructor that accepts (int, const char*), // has a constructor that accepts (int, const char*), for example.
// for example.
// //
// A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>, // A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>,
// and StrictMock<MockFoo> only works for mock methods defined using // and StrictMock<MockFoo> only works for mock methods defined using
@@ -63,10 +61,8 @@
// or "strict" modifier may not affect it, depending on the compiler. // or "strict" modifier may not affect it, depending on the compiler.
// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT // In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT
// supported. // supported.
//
// Another known limitation is that the constructors of the base mock // GOOGLETEST_CM0002 DO NOT DELETE
// cannot have arguments passed by non-const reference, which are
// banned by the Google C++ style guide anyway.
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
@@ -79,15 +75,35 @@ namespace testing {
template <class MockClass> template <class MockClass>
class NiceMock : public MockClass { class NiceMock : public MockClass {
public: public:
// We don't factor out the constructor body to a common method, as NiceMock() : MockClass() {
// we have to avoid a possible clash with members of MockClass.
NiceMock() {
::testing::Mock::AllowUninterestingCalls( ::testing::Mock::AllowUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
// C++ doesn't (yet) allow inheritance of constructors, so we have #if GTEST_LANG_CXX11
// to define it for each arity. // Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// constructors as public. These tests would need to be cleaned up first.
// Single argument constructor is special-cased so that it can be
// made explicit.
template <typename A>
explicit NiceMock(A&& arg) : MockClass(std::forward<A>(arg)) {
::testing::Mock::AllowUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename... An>
NiceMock(A1&& arg1, A2&& arg2, An&&... args)
: MockClass(std::forward<A1>(arg1), std::forward<A2>(arg2),
std::forward<An>(args)...) {
::testing::Mock::AllowUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
#else
// C++98 doesn't have variadic templates, so we have to define one
// for each arity.
template <typename A1> template <typename A1>
explicit NiceMock(const A1& a1) : MockClass(a1) { explicit NiceMock(const A1& a1) : MockClass(a1) {
::testing::Mock::AllowUninterestingCalls( ::testing::Mock::AllowUninterestingCalls(
@@ -163,7 +179,9 @@ class NiceMock : public MockClass {
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
virtual ~NiceMock() { #endif // GTEST_LANG_CXX11
~NiceMock() {
::testing::Mock::UnregisterCallReaction( ::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
@@ -175,15 +193,35 @@ class NiceMock : public MockClass {
template <class MockClass> template <class MockClass>
class NaggyMock : public MockClass { class NaggyMock : public MockClass {
public: public:
// We don't factor out the constructor body to a common method, as NaggyMock() : MockClass() {
// we have to avoid a possible clash with members of MockClass.
NaggyMock() {
::testing::Mock::WarnUninterestingCalls( ::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
// C++ doesn't (yet) allow inheritance of constructors, so we have #if GTEST_LANG_CXX11
// to define it for each arity. // Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// constructors as public. These tests would need to be cleaned up first.
// Single argument constructor is special-cased so that it can be
// made explicit.
template <typename A>
explicit NaggyMock(A&& arg) : MockClass(std::forward<A>(arg)) {
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename... An>
NaggyMock(A1&& arg1, A2&& arg2, An&&... args)
: MockClass(std::forward<A1>(arg1), std::forward<A2>(arg2),
std::forward<An>(args)...) {
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
#else
// C++98 doesn't have variadic templates, so we have to define one
// for each arity.
template <typename A1> template <typename A1>
explicit NaggyMock(const A1& a1) : MockClass(a1) { explicit NaggyMock(const A1& a1) : MockClass(a1) {
::testing::Mock::WarnUninterestingCalls( ::testing::Mock::WarnUninterestingCalls(
@@ -259,7 +297,9 @@ class NaggyMock : public MockClass {
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
virtual ~NaggyMock() { #endif // GTEST_LANG_CXX11
~NaggyMock() {
::testing::Mock::UnregisterCallReaction( ::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
@@ -271,15 +311,35 @@ class NaggyMock : public MockClass {
template <class MockClass> template <class MockClass>
class StrictMock : public MockClass { class StrictMock : public MockClass {
public: public:
// We don't factor out the constructor body to a common method, as StrictMock() : MockClass() {
// we have to avoid a possible clash with members of MockClass.
StrictMock() {
::testing::Mock::FailUninterestingCalls( ::testing::Mock::FailUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
// C++ doesn't (yet) allow inheritance of constructors, so we have #if GTEST_LANG_CXX11
// to define it for each arity. // Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// constructors as public. These tests would need to be cleaned up first.
// Single argument constructor is special-cased so that it can be
// made explicit.
template <typename A>
explicit StrictMock(A&& arg) : MockClass(std::forward<A>(arg)) {
::testing::Mock::FailUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename... An>
StrictMock(A1&& arg1, A2&& arg2, An&&... args)
: MockClass(std::forward<A1>(arg1), std::forward<A2>(arg2),
std::forward<An>(args)...) {
::testing::Mock::FailUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
#else
// C++98 doesn't have variadic templates, so we have to define one
// for each arity.
template <typename A1> template <typename A1>
explicit StrictMock(const A1& a1) : MockClass(a1) { explicit StrictMock(const A1& a1) : MockClass(a1) {
::testing::Mock::FailUninterestingCalls( ::testing::Mock::FailUninterestingCalls(
@@ -355,7 +415,9 @@ class StrictMock : public MockClass {
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
virtual ~StrictMock() { #endif // GTEST_LANG_CXX11
~StrictMock() {
::testing::Mock::UnregisterCallReaction( ::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }

View File

@@ -1,6 +1,6 @@
$$ -*- mode: c++; -*- $$ -*- mode: c++; -*-
$$ This is a Pump source file. Please use Pump to convert it to $$ This is a Pump source file. Please use Pump to convert
$$ gmock-generated-nice-strict.h. $$ it to gmock-generated-nice-strict.h.
$$ $$
$var n = 10 $$ The maximum arity we support. $var n = 10 $$ The maximum arity we support.
// Copyright 2008, Google Inc. // Copyright 2008, Google Inc.
@@ -31,8 +31,7 @@ $var n = 10 $$ The maximum arity we support.
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Implements class templates NiceMock, NaggyMock, and StrictMock. // Implements class templates NiceMock, NaggyMock, and StrictMock.
// //
@@ -52,10 +51,9 @@ $var n = 10 $$ The maximum arity we support.
// NiceMock<MockFoo>. // NiceMock<MockFoo>.
// //
// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of // NiceMock, NaggyMock, and StrictMock "inherit" the constructors of
// their respective base class, with up-to $n arguments. Therefore // their respective base class. Therefore you can write
// you can write NiceMock<MockFoo>(5, "a") to construct a nice mock // NiceMock<MockFoo>(5, "a") to construct a nice mock where MockFoo
// where MockFoo has a constructor that accepts (int, const char*), // has a constructor that accepts (int, const char*), for example.
// for example.
// //
// A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>, // A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>,
// and StrictMock<MockFoo> only works for mock methods defined using // and StrictMock<MockFoo> only works for mock methods defined using
@@ -64,10 +62,8 @@ $var n = 10 $$ The maximum arity we support.
// or "strict" modifier may not affect it, depending on the compiler. // or "strict" modifier may not affect it, depending on the compiler.
// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT // In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT
// supported. // supported.
//
// Another known limitation is that the constructors of the base mock // GOOGLETEST_CM0002 DO NOT DELETE
// cannot have arguments passed by non-const reference, which are
// banned by the Google C++ style guide anyway.
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
@@ -91,15 +87,35 @@ $var method=[[$if kind==0 [[AllowUninterestingCalls]]
template <class MockClass> template <class MockClass>
class $clazz : public MockClass { class $clazz : public MockClass {
public: public:
// We don't factor out the constructor body to a common method, as $clazz() : MockClass() {
// we have to avoid a possible clash with members of MockClass.
$clazz() {
::testing::Mock::$method( ::testing::Mock::$method(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
// C++ doesn't (yet) allow inheritance of constructors, so we have #if GTEST_LANG_CXX11
// to define it for each arity. // Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// constructors as public. These tests would need to be cleaned up first.
// Single argument constructor is special-cased so that it can be
// made explicit.
template <typename A>
explicit $clazz(A&& arg) : MockClass(std::forward<A>(arg)) {
::testing::Mock::$method(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename... An>
$clazz(A1&& arg1, A2&& arg2, An&&... args)
: MockClass(std::forward<A1>(arg1), std::forward<A2>(arg2),
std::forward<An>(args)...) {
::testing::Mock::$method(
internal::ImplicitCast_<MockClass*>(this));
}
#else
// C++98 doesn't have variadic templates, so we have to define one
// for each arity.
template <typename A1> template <typename A1>
explicit $clazz(const A1& a1) : MockClass(a1) { explicit $clazz(const A1& a1) : MockClass(a1) {
::testing::Mock::$method( ::testing::Mock::$method(
@@ -117,7 +133,9 @@ $range j 1..i
]] ]]
virtual ~$clazz() { #endif // GTEST_LANG_CXX11
~$clazz() {
::testing::Mock::UnregisterCallReaction( ::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }

File diff suppressed because it is too large Load Diff

View File

@@ -26,13 +26,14 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // 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. // Google Mock - a framework for writing C++ mock classes.
// //
// This file implements some actions that depend on gmock-generated-actions.h. // This file implements some actions that depend on gmock-generated-actions.h.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_

View File

@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: marcus.boerger@google.com (Marcus Boerger)
// Google Mock - a framework for writing C++ mock classes. // Google Mock - a framework for writing C++ mock classes.
// //
@@ -36,13 +35,27 @@
// Note that tests are implemented in gmock-matchers_test.cc rather than // Note that tests are implemented in gmock-matchers_test.cc rather than
// gmock-more-matchers-test.cc. // gmock-more-matchers-test.cc.
#ifndef GMOCK_GMOCK_MORE_MATCHERS_H_ // GOOGLETEST_CM0002 DO NOT DELETE
#define GMOCK_GMOCK_MORE_MATCHERS_H_
#ifndef GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_
#include "gmock/gmock-generated-matchers.h" #include "gmock/gmock-generated-matchers.h"
namespace testing { namespace testing {
// Silence C4100 (unreferenced formal
// parameter) for MSVC
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable:4100)
#if (_MSC_VER == 1900)
// and silence C4800 (C4800: 'int *const ': forcing value
// to bool 'true' or 'false') for MSVC 14
# pragma warning(disable:4800)
#endif
#endif
// Defines a matcher that matches an empty container. The container must // Defines a matcher that matches an empty container. The container must
// support both size() and empty(), which all STL-like containers provide. // support both size() and empty(), which all STL-like containers provide.
MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") { MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") {
@@ -53,6 +66,27 @@ MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") {
return false; return false;
} }
// Define a matcher that matches a value that evaluates in boolean
// context to true. Useful for types that define "explicit operator
// bool" operators and so can't be compared for equality with true
// and false.
MATCHER(IsTrue, negation ? "is false" : "is true") {
return static_cast<bool>(arg);
}
// Define a matcher that matches a value that evaluates in boolean
// context to false. Useful for types that define "explicit operator
// bool" operators and so can't be compared for equality with true
// and false.
MATCHER(IsFalse, negation ? "is true" : "is false") {
return !static_cast<bool>(arg);
}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace testing } // namespace testing
#endif // GMOCK_GMOCK_MORE_MATCHERS_H_ #endif // GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_

View File

@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // 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. // Google Mock - a framework for writing C++ mock classes.
// //
@@ -57,6 +56,8 @@
// where all clauses are optional, and .InSequence()/.After()/ // where all clauses are optional, and .InSequence()/.After()/
// .WillOnce() can appear any number of times. // .WillOnce() can appear any number of times.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
@@ -65,11 +66,6 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <vector> #include <vector>
#if GTEST_HAS_EXCEPTIONS
# include <stdexcept> // NOLINT
#endif
#include "gmock/gmock-actions.h" #include "gmock/gmock-actions.h"
#include "gmock/gmock-cardinalities.h" #include "gmock/gmock-cardinalities.h"
#include "gmock/gmock-matchers.h" #include "gmock/gmock-matchers.h"
@@ -77,6 +73,13 @@
#include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#if GTEST_HAS_EXCEPTIONS
# include <stdexcept> // NOLINT
#endif
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
/* class A needs to have dll-interface to be used by clients of class B */)
namespace testing { namespace testing {
// An abstract handle of an expectation. // An abstract handle of an expectation.
@@ -148,15 +151,13 @@ class GTEST_API_ UntypedFunctionMockerBase {
// action fails. // action fails.
// L = * // L = *
virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction( virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
const void* untyped_args, void* untyped_args, const std::string& call_description) const = 0;
const string& call_description) const = 0;
// Performs the given action with the given arguments and returns // Performs the given action with the given arguments and returns
// the action's result. // the action's result.
// L = * // L = *
virtual UntypedActionResultHolderBase* UntypedPerformAction( virtual UntypedActionResultHolderBase* UntypedPerformAction(
const void* untyped_action, const void* untyped_action, void* untyped_args) const = 0;
const void* untyped_args) const = 0;
// Writes a message that the call is uninteresting (i.e. neither // Writes a message that the call is uninteresting (i.e. neither
// explicitly expected nor explicitly unexpected) to the given // explicitly expected nor explicitly unexpected) to the given
@@ -186,7 +187,7 @@ class GTEST_API_ UntypedFunctionMockerBase {
// this information in the global mock registry. Will be called // this information in the global mock registry. Will be called
// whenever an EXPECT_CALL() or ON_CALL() is executed on this mock // whenever an EXPECT_CALL() or ON_CALL() is executed on this mock
// method. // method.
// TODO(wan@google.com): rename to SetAndRegisterOwner(). // FIXME: rename to SetAndRegisterOwner().
void RegisterOwner(const void* mock_obj) void RegisterOwner(const void* mock_obj)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex); GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
@@ -211,8 +212,7 @@ class GTEST_API_ UntypedFunctionMockerBase {
// arguments. This function can be safely called from multiple // arguments. This function can be safely called from multiple
// threads concurrently. The caller is responsible for deleting the // threads concurrently. The caller is responsible for deleting the
// result. // result.
UntypedActionResultHolderBase* UntypedInvokeWith( UntypedActionResultHolderBase* UntypedInvokeWith(void* untyped_args)
const void* untyped_args)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex); GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
protected: protected:
@@ -238,6 +238,14 @@ class GTEST_API_ UntypedFunctionMockerBase {
UntypedOnCallSpecs untyped_on_call_specs_; UntypedOnCallSpecs untyped_on_call_specs_;
// All expectations for this function mocker. // All expectations for this function mocker.
//
// It's undefined behavior to interleave expectations (EXPECT_CALLs
// or ON_CALLs) and mock function calls. Also, the order of
// expectations is important. Therefore it's a logic race condition
// to read/write untyped_expectations_ concurrently. In order for
// tools like tsan to catch concurrent read/write accesses to
// untyped_expectations, we deliberately leave accesses to it
// unprotected.
UntypedExpectations untyped_expectations_; UntypedExpectations untyped_expectations_;
}; // class UntypedFunctionMockerBase }; // class UntypedFunctionMockerBase
@@ -263,12 +271,14 @@ class UntypedOnCallSpecBase {
}; };
// Asserts that the ON_CALL() statement has a certain property. // Asserts that the ON_CALL() statement has a certain property.
void AssertSpecProperty(bool property, const string& failure_message) const { void AssertSpecProperty(bool property,
const std::string& failure_message) const {
Assert(property, file_, line_, failure_message); Assert(property, file_, line_, failure_message);
} }
// Expects that the ON_CALL() statement has a certain property. // Expects that the ON_CALL() statement has a certain property.
void ExpectSpecProperty(bool property, const string& failure_message) const { void ExpectSpecProperty(bool property,
const std::string& failure_message) const {
Expect(property, file_, line_, failure_message); Expect(property, file_, line_, failure_message);
} }
@@ -362,7 +372,6 @@ enum CallReaction {
kAllow, kAllow,
kWarn, kWarn,
kFail, kFail,
kDefault = kWarn // By default, warn about uninteresting calls.
}; };
} // namespace internal } // namespace internal
@@ -690,7 +699,7 @@ GTEST_API_ extern ThreadLocal<Sequence*> g_gmock_implicit_sequence;
class GTEST_API_ ExpectationBase { class GTEST_API_ ExpectationBase {
public: public:
// source_text is the EXPECT_CALL(...) source that created this Expectation. // source_text is the EXPECT_CALL(...) source that created this Expectation.
ExpectationBase(const char* file, int line, const string& source_text); ExpectationBase(const char* file, int line, const std::string& source_text);
virtual ~ExpectationBase(); virtual ~ExpectationBase();
@@ -738,12 +747,14 @@ class GTEST_API_ ExpectationBase {
virtual Expectation GetHandle() = 0; virtual Expectation GetHandle() = 0;
// Asserts that the EXPECT_CALL() statement has the given property. // Asserts that the EXPECT_CALL() statement has the given property.
void AssertSpecProperty(bool property, const string& failure_message) const { void AssertSpecProperty(bool property,
const std::string& failure_message) const {
Assert(property, file_, line_, failure_message); Assert(property, file_, line_, failure_message);
} }
// Expects that the EXPECT_CALL() statement has the given property. // Expects that the EXPECT_CALL() statement has the given property.
void ExpectSpecProperty(bool property, const string& failure_message) const { void ExpectSpecProperty(bool property,
const std::string& failure_message) const {
Expect(property, file_, line_, failure_message); Expect(property, file_, line_, failure_message);
} }
@@ -845,7 +856,7 @@ class GTEST_API_ ExpectationBase {
// an EXPECT_CALL() statement finishes. // an EXPECT_CALL() statement finishes.
const char* file_; // The file that contains the expectation. const char* file_; // The file that contains the expectation.
int line_; // The line number of the expectation. int line_; // The line number of the expectation.
const string source_text_; // The EXPECT_CALL(...) source text. const std::string source_text_; // The EXPECT_CALL(...) source text.
// True iff the cardinality is specified explicitly. // True iff the cardinality is specified explicitly.
bool cardinality_specified_; bool cardinality_specified_;
Cardinality cardinality_; // The cardinality of the expectation. Cardinality cardinality_; // The cardinality of the expectation.
@@ -880,8 +891,8 @@ class TypedExpectation : public ExpectationBase {
typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
typedef typename Function<F>::Result Result; typedef typename Function<F>::Result Result;
TypedExpectation(FunctionMockerBase<F>* owner, TypedExpectation(FunctionMockerBase<F>* owner, const char* a_file, int a_line,
const char* a_file, int a_line, const string& a_source_text, const std::string& a_source_text,
const ArgumentMatcherTuple& m) const ArgumentMatcherTuple& m)
: ExpectationBase(a_file, a_line, a_source_text), : ExpectationBase(a_file, a_line, a_source_text),
owner_(owner), owner_(owner),
@@ -1199,7 +1210,7 @@ class TypedExpectation : public ExpectationBase {
mocker->DescribeDefaultActionTo(args, what); mocker->DescribeDefaultActionTo(args, what);
DescribeCallCountTo(why); DescribeCallCountTo(why);
// TODO(wan@google.com): allow the user to control whether // FIXME: allow the user to control whether
// unexpected calls should fail immediately or continue using a // unexpected calls should fail immediately or continue using a
// flag --gmock_unexpected_calls_are_fatal. // flag --gmock_unexpected_calls_are_fatal.
return NULL; return NULL;
@@ -1240,7 +1251,7 @@ class TypedExpectation : public ExpectationBase {
// Logs a message including file and line number information. // Logs a message including file and line number information.
GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity, GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity,
const char* file, int line, const char* file, int line,
const string& message); const std::string& message);
template <typename F> template <typename F>
class MockSpec { class MockSpec {
@@ -1251,15 +1262,16 @@ class MockSpec {
// Constructs a MockSpec object, given the function mocker object // Constructs a MockSpec object, given the function mocker object
// that the spec is associated with. // that the spec is associated with.
explicit MockSpec(internal::FunctionMockerBase<F>* function_mocker) MockSpec(internal::FunctionMockerBase<F>* function_mocker,
: function_mocker_(function_mocker) {} const ArgumentMatcherTuple& matchers)
: function_mocker_(function_mocker), matchers_(matchers) {}
// Adds a new default action spec to the function mocker and returns // Adds a new default action spec to the function mocker and returns
// the newly created spec. // the newly created spec.
internal::OnCallSpec<F>& InternalDefaultActionSetAt( internal::OnCallSpec<F>& InternalDefaultActionSetAt(
const char* file, int line, const char* obj, const char* call) { const char* file, int line, const char* obj, const char* call) {
LogWithLocation(internal::kInfo, file, line, LogWithLocation(internal::kInfo, file, line,
string("ON_CALL(") + obj + ", " + call + ") invoked"); std::string("ON_CALL(") + obj + ", " + call + ") invoked");
return function_mocker_->AddNewOnCallSpec(file, line, matchers_); return function_mocker_->AddNewOnCallSpec(file, line, matchers_);
} }
@@ -1267,20 +1279,24 @@ class MockSpec {
// the newly created spec. // the newly created spec.
internal::TypedExpectation<F>& InternalExpectedAt( internal::TypedExpectation<F>& InternalExpectedAt(
const char* file, int line, const char* obj, const char* call) { const char* file, int line, const char* obj, const char* call) {
const string source_text(string("EXPECT_CALL(") + obj + ", " + call + ")"); const std::string source_text(std::string("EXPECT_CALL(") + obj + ", " +
call + ")");
LogWithLocation(internal::kInfo, file, line, source_text + " invoked"); LogWithLocation(internal::kInfo, file, line, source_text + " invoked");
return function_mocker_->AddNewExpectation( return function_mocker_->AddNewExpectation(
file, line, source_text, matchers_); file, line, source_text, matchers_);
} }
// This operator overload is used to swallow the superfluous parameter list
// introduced by the ON/EXPECT_CALL macros. See the macro comments for more
// explanation.
MockSpec<F>& operator()(const internal::WithoutMatchers&, void* const) {
return *this;
}
private: private:
template <typename Function> template <typename Function>
friend class internal::FunctionMocker; friend class internal::FunctionMocker;
void SetMatchers(const ArgumentMatcherTuple& matchers) {
matchers_ = matchers;
}
// The function mocker that owns this spec. // The function mocker that owns this spec.
internal::FunctionMockerBase<F>* const function_mocker_; internal::FunctionMockerBase<F>* const function_mocker_;
// The argument matchers specified in the spec. // The argument matchers specified in the spec.
@@ -1344,11 +1360,7 @@ class ReferenceOrValueWrapper<T&> {
// we need to temporarily disable the warning. We have to do it for // we need to temporarily disable the warning. We have to do it for
// the entire class to suppress the warning, even though it's about // the entire class to suppress the warning, even though it's about
// the constructor only. // the constructor only.
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355)
#ifdef _MSC_VER
# pragma warning(push) // Saves the current warning state.
# pragma warning(disable:4355) // Temporarily disables warning 4355.
#endif // _MSV_VER
// C++ treats the void type specially. For example, you cannot define // C++ treats the void type specially. For example, you cannot define
// a void-typed variable or pass a void value to a function. // a void-typed variable or pass a void value to a function.
@@ -1388,19 +1400,20 @@ class ActionResultHolder : public UntypedActionResultHolderBase {
template <typename F> template <typename F>
static ActionResultHolder* PerformDefaultAction( static ActionResultHolder* PerformDefaultAction(
const FunctionMockerBase<F>* func_mocker, const FunctionMockerBase<F>* func_mocker,
const typename Function<F>::ArgumentTuple& args, typename RvalueRef<typename Function<F>::ArgumentTuple>::type args,
const string& call_description) { const std::string& call_description) {
return new ActionResultHolder(Wrapper( return new ActionResultHolder(Wrapper(func_mocker->PerformDefaultAction(
func_mocker->PerformDefaultAction(args, call_description))); internal::move(args), call_description)));
} }
// Performs the given action and returns the result in a new-ed // Performs the given action and returns the result in a new-ed
// ActionResultHolder. // ActionResultHolder.
template <typename F> template <typename F>
static ActionResultHolder* static ActionResultHolder* PerformAction(
PerformAction(const Action<F>& action, const Action<F>& action,
const typename Function<F>::ArgumentTuple& args) { typename RvalueRef<typename Function<F>::ArgumentTuple>::type args) {
return new ActionResultHolder(Wrapper(action.Perform(args))); return new ActionResultHolder(
Wrapper(action.Perform(internal::move(args))));
} }
private: private:
@@ -1428,9 +1441,9 @@ class ActionResultHolder<void> : public UntypedActionResultHolderBase {
template <typename F> template <typename F>
static ActionResultHolder* PerformDefaultAction( static ActionResultHolder* PerformDefaultAction(
const FunctionMockerBase<F>* func_mocker, const FunctionMockerBase<F>* func_mocker,
const typename Function<F>::ArgumentTuple& args, typename RvalueRef<typename Function<F>::ArgumentTuple>::type args,
const string& call_description) { const std::string& call_description) {
func_mocker->PerformDefaultAction(args, call_description); func_mocker->PerformDefaultAction(internal::move(args), call_description);
return new ActionResultHolder; return new ActionResultHolder;
} }
@@ -1439,8 +1452,8 @@ class ActionResultHolder<void> : public UntypedActionResultHolderBase {
template <typename F> template <typename F>
static ActionResultHolder* PerformAction( static ActionResultHolder* PerformAction(
const Action<F>& action, const Action<F>& action,
const typename Function<F>::ArgumentTuple& args) { typename RvalueRef<typename Function<F>::ArgumentTuple>::type args) {
action.Perform(args); action.Perform(internal::move(args));
return new ActionResultHolder; return new ActionResultHolder;
} }
@@ -1459,7 +1472,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
typedef typename Function<F>::ArgumentTuple ArgumentTuple; typedef typename Function<F>::ArgumentTuple ArgumentTuple;
typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
FunctionMockerBase() : current_spec_(this) {} FunctionMockerBase() {}
// The destructor verifies that all expectations on this mock // The destructor verifies that all expectations on this mock
// function have been satisfied. If not, it will report Google Test // function have been satisfied. If not, it will report Google Test
@@ -1495,14 +1508,16 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// mutable state of this object, and thus can be called concurrently // mutable state of this object, and thus can be called concurrently
// without locking. // without locking.
// L = * // L = *
Result PerformDefaultAction(const ArgumentTuple& args, Result PerformDefaultAction(
const string& call_description) const { typename RvalueRef<typename Function<F>::ArgumentTuple>::type args,
const std::string& call_description) const {
const OnCallSpec<F>* const spec = const OnCallSpec<F>* const spec =
this->FindOnCallSpec(args); this->FindOnCallSpec(args);
if (spec != NULL) { if (spec != NULL) {
return spec->GetAction().Perform(args); return spec->GetAction().Perform(internal::move(args));
} }
const string message = call_description + const std::string message =
call_description +
"\n The mock function has no default action " "\n The mock function has no default action "
"set, and its return type has no default value set."; "set, and its return type has no default value set.";
#if GTEST_HAS_EXCEPTIONS #if GTEST_HAS_EXCEPTIONS
@@ -1521,11 +1536,11 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// action fails. The caller is responsible for deleting the result. // action fails. The caller is responsible for deleting the result.
// L = * // L = *
virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction( virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
const void* untyped_args, // must point to an ArgumentTuple void* untyped_args, // must point to an ArgumentTuple
const string& call_description) const { const std::string& call_description) const {
const ArgumentTuple& args = ArgumentTuple* args = static_cast<ArgumentTuple*>(untyped_args);
*static_cast<const ArgumentTuple*>(untyped_args); return ResultHolder::PerformDefaultAction(this, internal::move(*args),
return ResultHolder::PerformDefaultAction(this, args, call_description); call_description);
} }
// Performs the given action with the given arguments and returns // Performs the given action with the given arguments and returns
@@ -1533,13 +1548,12 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// result. // result.
// L = * // L = *
virtual UntypedActionResultHolderBase* UntypedPerformAction( virtual UntypedActionResultHolderBase* UntypedPerformAction(
const void* untyped_action, const void* untyped_args) const { const void* untyped_action, void* untyped_args) const {
// Make a copy of the action before performing it, in case the // Make a copy of the action before performing it, in case the
// action deletes the mock object (and thus deletes itself). // action deletes the mock object (and thus deletes itself).
const Action<F> action = *static_cast<const Action<F>*>(untyped_action); const Action<F> action = *static_cast<const Action<F>*>(untyped_action);
const ArgumentTuple& args = ArgumentTuple* args = static_cast<ArgumentTuple*>(untyped_args);
*static_cast<const ArgumentTuple*>(untyped_args); return ResultHolder::PerformAction(action, internal::move(*args));
return ResultHolder::PerformAction(action, args);
} }
// Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked(): // Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked():
@@ -1579,10 +1593,14 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// Returns the result of invoking this mock function with the given // Returns the result of invoking this mock function with the given
// arguments. This function can be safely called from multiple // arguments. This function can be safely called from multiple
// threads concurrently. // threads concurrently.
Result InvokeWith(const ArgumentTuple& args) Result InvokeWith(
typename RvalueRef<typename Function<F>::ArgumentTuple>::type args)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
// const_cast is required since in C++98 we still pass ArgumentTuple around
// by const& instead of rvalue reference.
void* untyped_args = const_cast<void*>(static_cast<const void*>(&args));
scoped_ptr<ResultHolder> holder( scoped_ptr<ResultHolder> holder(
DownCast_<ResultHolder*>(this->UntypedInvokeWith(&args))); DownCast_<ResultHolder*>(this->UntypedInvokeWith(untyped_args)));
return holder->Unwrap(); return holder->Unwrap();
} }
@@ -1598,16 +1616,16 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
} }
// Adds and returns an expectation spec for this mock function. // Adds and returns an expectation spec for this mock function.
TypedExpectation<F>& AddNewExpectation( TypedExpectation<F>& AddNewExpectation(const char* file, int line,
const char* file, const std::string& source_text,
int line,
const string& source_text,
const ArgumentMatcherTuple& m) const ArgumentMatcherTuple& m)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line); Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
TypedExpectation<F>* const expectation = TypedExpectation<F>* const expectation =
new TypedExpectation<F>(this, file, line, source_text, m); new TypedExpectation<F>(this, file, line, source_text, m);
const linked_ptr<ExpectationBase> untyped_expectation(expectation); const linked_ptr<ExpectationBase> untyped_expectation(expectation);
// See the definition of untyped_expectations_ for why access to
// it is unprotected here.
untyped_expectations_.push_back(untyped_expectation); untyped_expectations_.push_back(untyped_expectation);
// Adds this expectation into the implicit sequence if there is one. // Adds this expectation into the implicit sequence if there is one.
@@ -1619,10 +1637,6 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
return *expectation; return *expectation;
} }
// The current spec (either default action spec or expectation spec)
// being described on this function mocker.
MockSpec<F>& current_spec() { return current_spec_; }
private: private:
template <typename Func> friend class TypedExpectation; template <typename Func> friend class TypedExpectation;
@@ -1715,6 +1729,8 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
const ArgumentTuple& args) const const ArgumentTuple& args) const
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
// See the definition of untyped_expectations_ for why access to
// it is unprotected here.
for (typename UntypedExpectations::const_reverse_iterator it = for (typename UntypedExpectations::const_reverse_iterator it =
untyped_expectations_.rbegin(); untyped_expectations_.rbegin();
it != untyped_expectations_.rend(); ++it) { it != untyped_expectations_.rend(); ++it) {
@@ -1765,14 +1781,10 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
} }
} }
// The current spec (either default action spec or expectation spec)
// being described on this function mocker.
MockSpec<F> current_spec_;
// There is no generally useful and implementable semantics of // There is no generally useful and implementable semantics of
// copying a mock object, so copying a mock is usually a user error. // copying a mock object, so copying a mock is usually a user error.
// Thus we disallow copying function mockers. If the user really // Thus we disallow copying function mockers. If the user really
// wants to copy a mock object, he should implement his own copy // wants to copy a mock object, they should implement their own copy
// operation, for example: // operation, for example:
// //
// class MockFoo : public Foo { // class MockFoo : public Foo {
@@ -1784,9 +1796,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
GTEST_DISALLOW_COPY_AND_ASSIGN_(FunctionMockerBase); GTEST_DISALLOW_COPY_AND_ASSIGN_(FunctionMockerBase);
}; // class FunctionMockerBase }; // class FunctionMockerBase
#ifdef _MSC_VER GTEST_DISABLE_MSC_WARNINGS_POP_() // 4355
# pragma warning(pop) // Restores the warning state.
#endif // _MSV_VER
// Implements methods of FunctionMockerBase. // Implements methods of FunctionMockerBase.
@@ -1796,7 +1806,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// Reports an uninteresting call (whose description is in msg) in the // Reports an uninteresting call (whose description is in msg) in the
// manner specified by 'reaction'. // manner specified by 'reaction'.
void ReportUninterestingCall(CallReaction reaction, const string& msg); void ReportUninterestingCall(CallReaction reaction, const std::string& msg);
} // namespace internal } // namespace internal
@@ -1831,17 +1841,78 @@ inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT
} // namespace testing } // namespace testing
// A separate macro is required to avoid compile errors when the name GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
// of the method used in call is a result of macro expansion.
// See CompilesWithMethodNameExpandedFromMacro tests in
// internal/gmock-spec-builders_test.cc for more details.
#define GMOCK_ON_CALL_IMPL_(obj, call) \
((obj).gmock_##call).InternalDefaultActionSetAt(__FILE__, __LINE__, \
#obj, #call)
#define ON_CALL(obj, call) GMOCK_ON_CALL_IMPL_(obj, call)
#define GMOCK_EXPECT_CALL_IMPL_(obj, call) \ // Implementation for ON_CALL and EXPECT_CALL macros. A separate macro is
((obj).gmock_##call).InternalExpectedAt(__FILE__, __LINE__, #obj, #call) // required to avoid compile errors when the name of the method used in call is
#define EXPECT_CALL(obj, call) GMOCK_EXPECT_CALL_IMPL_(obj, call) // a result of macro expansion. See CompilesWithMethodNameExpandedFromMacro
// tests in internal/gmock-spec-builders_test.cc for more details.
//
// This macro supports statements both with and without parameter matchers. If
// the parameter list is omitted, gMock will accept any parameters, which allows
// tests to be written that don't need to encode the number of method
// parameter. This technique may only be used for non-overloaded methods.
//
// // These are the same:
// ON_CALL(mock, NoArgsMethod()).WillByDefault(...);
// ON_CALL(mock, NoArgsMethod).WillByDefault(...);
//
// // As are these:
// ON_CALL(mock, TwoArgsMethod(_, _)).WillByDefault(...);
// ON_CALL(mock, TwoArgsMethod).WillByDefault(...);
//
// // Can also specify args if you want, of course:
// ON_CALL(mock, TwoArgsMethod(_, 45)).WillByDefault(...);
//
// // Overloads work as long as you specify parameters:
// ON_CALL(mock, OverloadedMethod(_)).WillByDefault(...);
// ON_CALL(mock, OverloadedMethod(_, _)).WillByDefault(...);
//
// // Oops! Which overload did you want?
// ON_CALL(mock, OverloadedMethod).WillByDefault(...);
// => ERROR: call to member function 'gmock_OverloadedMethod' is ambiguous
//
// How this works: The mock class uses two overloads of the gmock_Method
// expectation setter method plus an operator() overload on the MockSpec object.
// In the matcher list form, the macro expands to:
//
// // This statement:
// ON_CALL(mock, TwoArgsMethod(_, 45))...
//
// // ...expands to:
// mock.gmock_TwoArgsMethod(_, 45)(WithoutMatchers(), nullptr)...
// |-------------v---------------||------------v-------------|
// invokes first overload swallowed by operator()
//
// // ...which is essentially:
// mock.gmock_TwoArgsMethod(_, 45)...
//
// Whereas the form without a matcher list:
//
// // This statement:
// ON_CALL(mock, TwoArgsMethod)...
//
// // ...expands to:
// mock.gmock_TwoArgsMethod(WithoutMatchers(), nullptr)...
// |-----------------------v--------------------------|
// invokes second overload
//
// // ...which is essentially:
// mock.gmock_TwoArgsMethod(_, _)...
//
// The WithoutMatchers() argument is used to disambiguate overloads and to
// block the caller from accidentally invoking the second overload directly. The
// second argument is an internal type derived from the method signature. The
// failure to disambiguate two overloads of this method in the ON_CALL statement
// is how we block callers from setting expectations on overloaded methods.
#define GMOCK_ON_CALL_IMPL_(mock_expr, Setter, call) \
((mock_expr).gmock_##call)(::testing::internal::GetWithoutMatchers(), NULL) \
.Setter(__FILE__, __LINE__, #mock_expr, #call)
#define ON_CALL(obj, call) \
GMOCK_ON_CALL_IMPL_(obj, InternalDefaultActionSetAt, call)
#define EXPECT_CALL(obj, call) \
GMOCK_ON_CALL_IMPL_(obj, InternalExpectedAt, call)
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ #endif // GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_

View File

@@ -26,13 +26,14 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // 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. // Google Mock - a framework for writing C++ mock classes.
// //
// This is the main header file a user should include. // This is the main header file a user should include.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_H_
@@ -59,8 +60,8 @@
#include "gmock/gmock-cardinalities.h" #include "gmock/gmock-cardinalities.h"
#include "gmock/gmock-generated-actions.h" #include "gmock/gmock-generated-actions.h"
#include "gmock/gmock-generated-function-mockers.h" #include "gmock/gmock-generated-function-mockers.h"
#include "gmock/gmock-generated-nice-strict.h"
#include "gmock/gmock-generated-matchers.h" #include "gmock/gmock-generated-matchers.h"
#include "gmock/gmock-generated-nice-strict.h"
#include "gmock/gmock-matchers.h" #include "gmock/gmock-matchers.h"
#include "gmock/gmock-more-actions.h" #include "gmock/gmock-more-actions.h"
#include "gmock/gmock-more-matchers.h" #include "gmock/gmock-more-matchers.h"
@@ -71,6 +72,7 @@ namespace testing {
// Declares Google Mock flags that we want a user to use programmatically. // Declares Google Mock flags that we want a user to use programmatically.
GMOCK_DECLARE_bool_(catch_leaked_mocks); GMOCK_DECLARE_bool_(catch_leaked_mocks);
GMOCK_DECLARE_string_(verbose); GMOCK_DECLARE_string_(verbose);
GMOCK_DECLARE_int32_(default_mock_behavior);
// Initializes Google Mock. This must be called before running the // Initializes Google Mock. This must be called before running the
// tests. In particular, it parses the command line for the flags // tests. In particular, it parses the command line for the flags

View File

@@ -0,0 +1,16 @@
# Customization Points
The custom directory is an injection point for custom user configurations.
## Header `gmock-port.h`
The following macros can be defined:
### Flag related macros:
* `GMOCK_DECLARE_bool_(name)`
* `GMOCK_DECLARE_int32_(name)`
* `GMOCK_DECLARE_string_(name)`
* `GMOCK_DEFINE_bool_(name, default_val, doc)`
* `GMOCK_DEFINE_int32_(name, default_val, doc)`
* `GMOCK_DEFINE_string_(name, default_val, doc)`

View File

@@ -2,6 +2,8 @@
// pump.py gmock-generated-actions.h.pump // pump.py gmock-generated-actions.h.pump
// DO NOT EDIT BY HAND!!! // DO NOT EDIT BY HAND!!!
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_

View File

@@ -1,9 +1,11 @@
$$ -*- mode: c++; -*- $$ -*- mode: c++; -*-
$$ This is a Pump source file (http://go/pump). Please use Pump to convert $$ This is a Pump source file. Please use Pump to convert
$$ it to callback-actions.h. $$ it to callback-actions.h.
$$ $$
$var max_callback_arity = 5 $var max_callback_arity = 5
$$}} This meta comment fixes auto-indentation in editors. $$}} This meta comment fixes auto-indentation in editors.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_

View File

@@ -27,13 +27,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// ============================================================ // Injection point for custom user configurations. See README for details
// An installation-specific extension point for gmock-matchers.h.
// ============================================================
// //
// Adds google3 callback support to CallableTraits. // GOOGLETEST_CM0002 DO NOT DELETE
//
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_ #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_

View File

@@ -27,19 +27,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Injection point for custom user configurations. // Injection point for custom user configurations. See README for details
// The following macros can be defined:
//
// Flag related macros:
// GMOCK_DECLARE_bool_(name)
// GMOCK_DECLARE_int32_(name)
// GMOCK_DECLARE_string_(name)
// GMOCK_DEFINE_bool_(name, default_val, doc)
// GMOCK_DEFINE_int32_(name, default_val, doc)
// GMOCK_DEFINE_string_(name, default_val, doc)
// //
// ** Custom implementation starts here ** // ** Custom implementation starts here **
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_

View File

@@ -30,14 +30,15 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // 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. // Google Mock - a framework for writing C++ mock classes.
// //
// This file contains template meta-programming utility classes needed // This file contains template meta-programming utility classes needed
// for implementing Google Mock. // for implementing Google Mock.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
@@ -90,42 +91,48 @@ struct MatcherTuple< ::testing::tuple<A1, A2, A3> > {
template <typename A1, typename A2, typename A3, typename A4> template <typename A1, typename A2, typename A3, typename A4>
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4> > { struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4> >
Matcher<A4> > type; type;
}; };
template <typename A1, typename A2, typename A3, typename A4, typename A5> template <typename A1, typename A2, typename A3, typename A4, typename A5>
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5> > { struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
Matcher<A5> > type; Matcher<A5> >
type;
}; };
template <typename A1, typename A2, typename A3, typename A4, typename A5, template <typename A1, typename A2, typename A3, typename A4, typename A5,
typename A6> typename A6>
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6> > { struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
Matcher<A5>, Matcher<A6> > type; Matcher<A5>, Matcher<A6> >
type;
}; };
template <typename A1, typename A2, typename A3, typename A4, typename A5, template <typename A1, typename A2, typename A3, typename A4, typename A5,
typename A6, typename A7> typename A6, typename A7>
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > { struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
Matcher<A5>, Matcher<A6>, Matcher<A7> > type; Matcher<A5>, Matcher<A6>, Matcher<A7> >
type;
}; };
template <typename A1, typename A2, typename A3, typename A4, typename A5, template <typename A1, typename A2, typename A3, typename A4, typename A5,
typename A6, typename A7, typename A8> typename A6, typename A7, typename A8>
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > { struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8> > type; Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8> >
type;
}; };
template <typename A1, typename A2, typename A3, typename A4, typename A5, template <typename A1, typename A2, typename A3, typename A4, typename A5,
typename A6, typename A7, typename A8, typename A9> typename A6, typename A7, typename A8, typename A9>
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > { struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9> > type; Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>,
Matcher<A9> >
type;
}; };
template <typename A1, typename A2, typename A3, typename A4, typename A5, template <typename A1, typename A2, typename A3, typename A4, typename A5,
@@ -133,8 +140,9 @@ template <typename A1, typename A2, typename A3, typename A4, typename A5,
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9, struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
A10> > { A10> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9>, Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>,
Matcher<A10> > type; Matcher<A9>, Matcher<A10> >
type;
}; };
// Template struct Function<F>, where F must be a function type, contains // Template struct Function<F>, where F must be a function type, contains

View File

@@ -31,14 +31,15 @@ $var n = 10 $$ The maximum arity we support.
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // 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. // Google Mock - a framework for writing C++ mock classes.
// //
// This file contains template meta-programming utility classes needed // This file contains template meta-programming utility classes needed
// for implementing Google Mock. // for implementing Google Mock.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_

View File

@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // 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. // Google Mock - a framework for writing C++ mock classes.
// //
@@ -35,13 +34,14 @@
// Mock. They are subject to change without notice, so please DO NOT // Mock. They are subject to change without notice, so please DO NOT
// USE THEM IN USER CODE. // USE THEM IN USER CODE.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
#include <stdio.h> #include <stdio.h>
#include <ostream> // NOLINT #include <ostream> // NOLINT
#include <string> #include <string>
#include "gmock/internal/gmock-generated-internal-utils.h" #include "gmock/internal/gmock-generated-internal-utils.h"
#include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@@ -49,11 +49,23 @@
namespace testing { namespace testing {
namespace internal { namespace internal {
// Silence MSVC C4100 (unreferenced formal parameter) and
// C4805('==': unsafe mix of type 'const int' and type 'const bool')
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable:4100)
# pragma warning(disable:4805)
#endif
// Joins a vector of strings as if they are fields of a tuple; returns
// the joined string.
GTEST_API_ std::string JoinAsTuple(const Strings& fields);
// Converts an identifier name to a space-separated list of lower-case // Converts an identifier name to a space-separated list of lower-case
// words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is // words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is
// treated as one word. For example, both "FooBar123" and // treated as one word. For example, both "FooBar123" and
// "foo_bar_123" are converted to "foo bar 123". // "foo_bar_123" are converted to "foo bar 123".
GTEST_API_ string ConvertIdentifierNameToWords(const char* id_name); GTEST_API_ std::string ConvertIdentifierNameToWords(const char* id_name);
// PointeeOf<Pointer>::type is the type of a value pointed to by a // PointeeOf<Pointer>::type is the type of a value pointed to by a
// Pointer, which can be either a smart pointer or a raw pointer. The // Pointer, which can be either a smart pointer or a raw pointer. The
@@ -114,9 +126,11 @@ struct LinkedPtrLessThan {
// To gcc, // To gcc,
// wchar_t == signed wchar_t != unsigned wchar_t == unsigned int // wchar_t == signed wchar_t != unsigned wchar_t == unsigned int
#ifdef __GNUC__ #ifdef __GNUC__
#if !defined(__WCHAR_UNSIGNED__)
// signed/unsigned wchar_t are valid types. // signed/unsigned wchar_t are valid types.
# define GMOCK_HAS_SIGNED_WCHAR_T_ 1 # define GMOCK_HAS_SIGNED_WCHAR_T_ 1
#endif #endif
#endif
// In what follows, we use the term "kind" to indicate whether a type // In what follows, we use the term "kind" to indicate whether a type
// is bool, an integer type (excluding bool), a floating-point type, // is bool, an integer type (excluding bool), a floating-point type,
@@ -267,7 +281,7 @@ class FailureReporterInterface {
// Reports a failure that occurred at the given source file location. // Reports a failure that occurred at the given source file location.
virtual void ReportFailure(FailureType type, const char* file, int line, virtual void ReportFailure(FailureType type, const char* file, int line,
const string& message) = 0; const std::string& message) = 0;
}; };
// Returns the failure reporter used by Google Mock. // Returns the failure reporter used by Google Mock.
@@ -279,7 +293,7 @@ GTEST_API_ FailureReporterInterface* GetFailureReporter();
// inline this function to prevent it from showing up in the stack // inline this function to prevent it from showing up in the stack
// trace. // trace.
inline void Assert(bool condition, const char* file, int line, inline void Assert(bool condition, const char* file, int line,
const string& msg) { const std::string& msg) {
if (!condition) { if (!condition) {
GetFailureReporter()->ReportFailure(FailureReporterInterface::kFatal, GetFailureReporter()->ReportFailure(FailureReporterInterface::kFatal,
file, line, msg); file, line, msg);
@@ -292,7 +306,7 @@ inline void Assert(bool condition, const char* file, int line) {
// Verifies that condition is true; generates a non-fatal failure if // Verifies that condition is true; generates a non-fatal failure if
// condition is false. // condition is false.
inline void Expect(bool condition, const char* file, int line, inline void Expect(bool condition, const char* file, int line,
const string& msg) { const std::string& msg) {
if (!condition) { if (!condition) {
GetFailureReporter()->ReportFailure(FailureReporterInterface::kNonfatal, GetFailureReporter()->ReportFailure(FailureReporterInterface::kNonfatal,
file, line, msg); file, line, msg);
@@ -328,11 +342,25 @@ GTEST_API_ bool LogIsVisible(LogSeverity severity);
// stack_frames_to_skip is treated as 0, since we don't know which // stack_frames_to_skip is treated as 0, since we don't know which
// function calls will be inlined by the compiler and need to be // function calls will be inlined by the compiler and need to be
// conservative. // conservative.
GTEST_API_ void Log(LogSeverity severity, GTEST_API_ void Log(LogSeverity severity, const std::string& message,
const string& message,
int stack_frames_to_skip); int stack_frames_to_skip);
// TODO(wan@google.com): group all type utilities together. // A marker class that is used to resolve parameterless expectations to the
// correct overload. This must not be instantiable, to prevent client code from
// accidentally resolving to the overload; for example:
//
// ON_CALL(mock, Method({}, nullptr))...
//
class WithoutMatchers {
private:
WithoutMatchers() {}
friend GTEST_API_ WithoutMatchers GetWithoutMatchers();
};
// Internal use only: access the singleton instance of WithoutMatchers.
GTEST_API_ WithoutMatchers GetWithoutMatchers();
// FIXME: group all type utilities together.
// Type traits. // Type traits.
@@ -504,8 +532,44 @@ struct RemoveConstFromKey<std::pair<const K, V> > {
template <bool kValue> template <bool kValue>
struct BooleanConstant {}; struct BooleanConstant {};
// Emit an assertion failure due to incorrect DoDefault() usage. Out-of-lined to
// reduce code size.
GTEST_API_ void IllegalDoDefault(const char* file, int line);
#if GTEST_LANG_CXX11
// Helper types for Apply() below.
template <size_t... Is> struct int_pack { typedef int_pack type; };
template <class Pack, size_t I> struct append;
template <size_t... Is, size_t I>
struct append<int_pack<Is...>, I> : int_pack<Is..., I> {};
template <size_t C>
struct make_int_pack : append<typename make_int_pack<C - 1>::type, C - 1> {};
template <> struct make_int_pack<0> : int_pack<> {};
template <typename F, typename Tuple, size_t... Idx>
auto ApplyImpl(F&& f, Tuple&& args, int_pack<Idx...>) -> decltype(
std::forward<F>(f)(std::get<Idx>(std::forward<Tuple>(args))...)) {
return std::forward<F>(f)(std::get<Idx>(std::forward<Tuple>(args))...);
}
// Apply the function to a tuple of arguments.
template <typename F, typename Tuple>
auto Apply(F&& f, Tuple&& args)
-> decltype(ApplyImpl(std::forward<F>(f), std::forward<Tuple>(args),
make_int_pack<std::tuple_size<Tuple>::value>())) {
return ApplyImpl(std::forward<F>(f), std::forward<Tuple>(args),
make_int_pack<std::tuple_size<Tuple>::value>());
}
#endif
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_

View File

@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: vadimb@google.com (Vadim Berman)
// //
// Low-level types and utilities for porting Google Mock to various // Low-level types and utilities for porting Google Mock to various
// platforms. All macros ending with _ and symbols defined in an // platforms. All macros ending with _ and symbols defined in an
@@ -36,6 +35,8 @@
// end with _ are part of Google Mock's public API and can be used by // end with _ are part of Google Mock's public API and can be used by
// code outside Google Mock. // code outside Google Mock.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
@@ -50,15 +51,11 @@
// portability utilities to Google Test's gtest-port.h instead of // portability utilities to Google Test's gtest-port.h instead of
// here, as Google Mock depends on Google Test. Only add a utility // here, as Google Mock depends on Google Test. Only add a utility
// here if it's truly specific to Google Mock. // here if it's truly specific to Google Mock.
#include "gtest/internal/gtest-linked_ptr.h" #include "gtest/internal/gtest-linked_ptr.h"
#include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-port.h"
#include "gmock/internal/custom/gmock-port.h" #include "gmock/internal/custom/gmock-port.h"
// To avoid conditional compilation everywhere, we make it
// gmock-port.h's responsibility to #include the header implementing
// tr1/tuple. gmock-port.h does this via gtest-port.h, which is
// guaranteed to pull in the tuple header.
// For MS Visual C++, check the compiler version. At least VS 2003 is // For MS Visual C++, check the compiler version. At least VS 2003 is
// required to compile Google Mock. // required to compile Google Mock.
#if defined(_MSC_VER) && _MSC_VER < 1310 #if defined(_MSC_VER) && _MSC_VER < 1310

View File

@@ -26,14 +26,14 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Author: wan@google.com (Zhanyong Wan) // The Google C++ Testing and Mocking Framework (Google Test)
//
// The Google C++ Testing Framework (Google Test)
// //
// This header file defines the public API for death tests. It is // This header file defines the public API for death tests. It is
// #included by gtest.h so a user doesn't need to include this // #included by gtest.h so a user doesn't need to include this
// directly. // directly.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
@@ -99,10 +99,11 @@ GTEST_API_ bool InDeathTestChild();
// //
// On the regular expressions used in death tests: // On the regular expressions used in death tests:
// //
// GOOGLETEST_CM0005 DO NOT DELETE
// On POSIX-compliant systems (*nix), we use the <regex.h> library, // On POSIX-compliant systems (*nix), we use the <regex.h> library,
// which uses the POSIX extended regex syntax. // which uses the POSIX extended regex syntax.
// //
// On other platforms (e.g. Windows), we only support a simple regex // On other platforms (e.g. Windows or Mac), we only support a simple regex
// syntax implemented as part of Google Test. This limited // syntax implemented as part of Google Test. This limited
// implementation should be enough most of the time when writing // implementation should be enough most of the time when writing
// death tests; though it lacks many features you can find in PCRE // death tests; though it lacks many features you can find in PCRE
@@ -160,7 +161,7 @@ GTEST_API_ bool InDeathTestChild();
// is rarely a problem as people usually don't put the test binary // is rarely a problem as people usually don't put the test binary
// directory in PATH. // directory in PATH.
// //
// TODO(wan@google.com): make thread-safe death tests search the PATH. // FIXME: make thread-safe death tests search the PATH.
// Asserts that a given statement causes the program to exit, with an // Asserts that a given statement causes the program to exit, with an
// integer exit status that satisfies predicate, and emitting error output // integer exit status that satisfies predicate, and emitting error output
@@ -198,9 +199,10 @@ class GTEST_API_ ExitedWithCode {
const int exit_code_; const int exit_code_;
}; };
# if !GTEST_OS_WINDOWS # if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA
// Tests that an exit code describes an exit due to termination by a // Tests that an exit code describes an exit due to termination by a
// given signal. // given signal.
// GOOGLETEST_CM0006 DO NOT DELETE
class GTEST_API_ KilledBySignal { class GTEST_API_ KilledBySignal {
public: public:
explicit KilledBySignal(int signum); explicit KilledBySignal(int signum);
@@ -272,6 +274,54 @@ class GTEST_API_ KilledBySignal {
# endif // NDEBUG for EXPECT_DEBUG_DEATH # endif // NDEBUG for EXPECT_DEBUG_DEATH
#endif // GTEST_HAS_DEATH_TEST #endif // GTEST_HAS_DEATH_TEST
// This macro is used for implementing macros such as
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
// death tests are not supported. Those macros must compile on such systems
// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
// systems that support death tests. This allows one to write such a macro
// on a system that does not support death tests and be sure that it will
// compile on a death-test supporting system. It is exposed publicly so that
// systems that have death-tests with stricter requirements than
// GTEST_HAS_DEATH_TEST can write their own equivalent of
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED.
//
// Parameters:
// statement - A statement that a macro such as EXPECT_DEATH would test
// for program termination. This macro has to make sure this
// statement is compiled but not executed, to ensure that
// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
// parameter iff EXPECT_DEATH compiles with it.
// regex - A regex that a macro such as EXPECT_DEATH would use to test
// the output of statement. This parameter has to be
// compiled but not evaluated by this macro, to ensure that
// this macro only accepts expressions that a macro such as
// EXPECT_DEATH would accept.
// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
// and a return statement for ASSERT_DEATH_IF_SUPPORTED.
// This ensures that ASSERT_DEATH_IF_SUPPORTED will not
// compile inside functions where ASSERT_DEATH doesn't
// compile.
//
// The branch that has an always false condition is used to ensure that
// statement and regex are compiled (and thus syntactically correct) but
// never executed. The unreachable code macro protects the terminator
// statement from generating an 'unreachable code' warning in case
// statement unconditionally returns or throws. The Message constructor at
// the end allows the syntax of streaming additional messages into the
// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
# define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::testing::internal::AlwaysTrue()) { \
GTEST_LOG_(WARNING) \
<< "Death tests are not supported on this platform.\n" \
<< "Statement '" #statement "' cannot be verified."; \
} else if (::testing::internal::AlwaysFalse()) { \
::testing::internal::RE::PartialMatch(".*", (regex)); \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
terminator; \
} else \
::testing::Message()
// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and // EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if // ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
// death tests are supported; otherwise they just issue a warning. This is // death tests are supported; otherwise they just issue a warning. This is
@@ -284,9 +334,9 @@ class GTEST_API_ KilledBySignal {
ASSERT_DEATH(statement, regex) ASSERT_DEATH(statement, regex)
#else #else
# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, ) GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, )
# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return) GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return)
#endif #endif
} // namespace testing } // namespace testing

View File

@@ -26,10 +26,9 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Author: wan@google.com (Zhanyong Wan) // The Google C++ Testing and Mocking Framework (Google Test)
//
// The Google C++ Testing Framework (Google Test)
// //
// This header file defines the Message class. // This header file defines the Message class.
// //
@@ -43,6 +42,8 @@
// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user // to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
// program! // program!
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ #define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
@@ -50,6 +51,9 @@
#include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-port.h"
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
/* class A needs to have dll-interface to be used by clients of class B */)
// Ensures that there is at least one operator<< in the global namespace. // Ensures that there is at least one operator<< in the global namespace.
// See Message& operator<<(...) below for why. // See Message& operator<<(...) below for why.
void operator<<(const testing::internal::Secret&, int); void operator<<(const testing::internal::Secret&, int);
@@ -196,7 +200,6 @@ class GTEST_API_ Message {
std::string GetString() const; std::string GetString() const;
private: private:
#if GTEST_OS_SYMBIAN #if GTEST_OS_SYMBIAN
// These are needed as the Nokia Symbian Compiler cannot decide between // These are needed as the Nokia Symbian Compiler cannot decide between
// const T& and const T* in a function template. The Nokia compiler _can_ // const T& and const T* in a function template. The Nokia compiler _can_
@@ -247,4 +250,6 @@ std::string StreamableToString(const T& streamable) {
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
#endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_

View File

@@ -31,13 +31,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Authors: vladl@google.com (Vlad Losev)
//
// Macros and functions for implementing parameterized tests // Macros and functions for implementing parameterized tests
// in Google C++ Testing Framework (Google Test) // in Google C++ Testing and Mocking Framework (Google Test)
// //
// This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
// //
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
@@ -185,15 +184,10 @@ TEST_P(DerivedTest, DoesBlah) {
# include <utility> # include <utility>
#endif #endif
// scripts/fuse_gtest.py depends on gtest's own header being #included
// *unconditionally*. Therefore these #includes cannot be moved
// inside #if GTEST_HAS_PARAM_TEST.
#include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util.h"
#include "gtest/internal/gtest-param-util-generated.h" #include "gtest/internal/gtest-param-util-generated.h"
#if GTEST_HAS_PARAM_TEST
namespace testing { namespace testing {
// Functions producing parameter generators. // Functions producing parameter generators.
@@ -273,7 +267,7 @@ internal::ParamGenerator<T> Range(T start, T end) {
// each with C-string values of "foo", "bar", and "baz": // each with C-string values of "foo", "bar", and "baz":
// //
// const char* strings[] = {"foo", "bar", "baz"}; // const char* strings[] = {"foo", "bar", "baz"};
// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings)); // INSTANTIATE_TEST_CASE_P(StringSequence, StringTest, ValuesIn(strings));
// //
// This instantiates tests from test case StlStringTest // This instantiates tests from test case StlStringTest
// each with STL strings with values "a" and "b": // each with STL strings with values "a" and "b":
@@ -1375,8 +1369,6 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
} }
# endif // GTEST_HAS_COMBINE # endif // GTEST_HAS_COMBINE
# define TEST_P(test_case_name, test_name) \ # define TEST_P(test_case_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
: public test_case_name { \ : public test_case_name { \
@@ -1390,8 +1382,8 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
#test_case_name, \ #test_case_name, \
::testing::internal::CodeLocation(\ ::testing::internal::CodeLocation(\
__FILE__, __LINE__))->AddTestPattern(\ __FILE__, __LINE__))->AddTestPattern(\
#test_case_name, \ GTEST_STRINGIFY_(test_case_name), \
#test_name, \ GTEST_STRINGIFY_(test_name), \
new ::testing::internal::TestMetaFactory< \ new ::testing::internal::TestMetaFactory< \
GTEST_TEST_CLASS_NAME_(\ GTEST_TEST_CLASS_NAME_(\
test_case_name, test_name)>()); \ test_case_name, test_name)>()); \
@@ -1412,21 +1404,21 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
// type testing::TestParamInfo<class ParamType>, and return std::string. // type testing::TestParamInfo<class ParamType>, and return std::string.
// //
// testing::PrintToStringParamName is a builtin test suffix generator that // testing::PrintToStringParamName is a builtin test suffix generator that
// returns the value of testing::PrintToString(GetParam()). It does not work // returns the value of testing::PrintToString(GetParam()).
// for std::string or C strings.
// //
// Note: test names must be non-empty, unique, and may only contain ASCII // Note: test names must be non-empty, unique, and may only contain ASCII
// alphanumeric characters or underscore. // alphanumeric characters or underscore. Because PrintToString adds quotes
// to std::string and C strings, it won't work for these types.
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \ # define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
::testing::internal::ParamGenerator<test_case_name::ParamType> \ static ::testing::internal::ParamGenerator<test_case_name::ParamType> \
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \ gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \ static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \ const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \ return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
(__VA_ARGS__)(info); \ (__VA_ARGS__)(info); \
} \ } \
int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \ static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
GetTestCasePatternHolder<test_case_name>(\ GetTestCasePatternHolder<test_case_name>(\
#test_case_name, \ #test_case_name, \
@@ -1439,6 +1431,4 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
} // namespace testing } // namespace testing
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_

View File

@@ -30,13 +30,12 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Authors: vladl@google.com (Vlad Losev)
//
// Macros and functions for implementing parameterized tests // Macros and functions for implementing parameterized tests
// in Google C++ Testing Framework (Google Test) // in Google C++ Testing and Mocking Framework (Google Test)
// //
// This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
// //
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
@@ -184,15 +183,10 @@ TEST_P(DerivedTest, DoesBlah) {
# include <utility> # include <utility>
#endif #endif
// scripts/fuse_gtest.py depends on gtest's own header being #included
// *unconditionally*. Therefore these #includes cannot be moved
// inside #if GTEST_HAS_PARAM_TEST.
#include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util.h"
#include "gtest/internal/gtest-param-util-generated.h" #include "gtest/internal/gtest-param-util-generated.h"
#if GTEST_HAS_PARAM_TEST
namespace testing { namespace testing {
// Functions producing parameter generators. // Functions producing parameter generators.
@@ -272,7 +266,7 @@ internal::ParamGenerator<T> Range(T start, T end) {
// each with C-string values of "foo", "bar", and "baz": // each with C-string values of "foo", "bar", and "baz":
// //
// const char* strings[] = {"foo", "bar", "baz"}; // const char* strings[] = {"foo", "bar", "baz"};
// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings)); // INSTANTIATE_TEST_CASE_P(StringSequence, StringTest, ValuesIn(strings));
// //
// This instantiates tests from test case StlStringTest // This instantiates tests from test case StlStringTest
// each with STL strings with values "a" and "b": // each with STL strings with values "a" and "b":
@@ -441,8 +435,6 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
]] ]]
# endif // GTEST_HAS_COMBINE # endif // GTEST_HAS_COMBINE
# define TEST_P(test_case_name, test_name) \ # define TEST_P(test_case_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
: public test_case_name { \ : public test_case_name { \
@@ -456,8 +448,8 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
#test_case_name, \ #test_case_name, \
::testing::internal::CodeLocation(\ ::testing::internal::CodeLocation(\
__FILE__, __LINE__))->AddTestPattern(\ __FILE__, __LINE__))->AddTestPattern(\
#test_case_name, \ GTEST_STRINGIFY_(test_case_name), \
#test_name, \ GTEST_STRINGIFY_(test_name), \
new ::testing::internal::TestMetaFactory< \ new ::testing::internal::TestMetaFactory< \
GTEST_TEST_CLASS_NAME_(\ GTEST_TEST_CLASS_NAME_(\
test_case_name, test_name)>()); \ test_case_name, test_name)>()); \
@@ -485,14 +477,14 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
// to std::string and C strings, it won't work for these types. // to std::string and C strings, it won't work for these types.
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \ # define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
::testing::internal::ParamGenerator<test_case_name::ParamType> \ static ::testing::internal::ParamGenerator<test_case_name::ParamType> \
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \ gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \ static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \ const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \ return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
(__VA_ARGS__)(info); \ (__VA_ARGS__)(info); \
} \ } \
int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \ static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
GetTestCasePatternHolder<test_case_name>(\ GetTestCasePatternHolder<test_case_name>(\
#test_case_name, \ #test_case_name, \
@@ -505,6 +497,4 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
} // namespace testing } // namespace testing
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_

View File

@@ -26,10 +26,9 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Test - The Google C++ Testing Framework
// Google Test - The Google C++ Testing and Mocking Framework
// //
// This file implements a universal value printer that can print a // This file implements a universal value printer that can print a
// value of any type T: // value of any type T:
@@ -46,6 +45,10 @@
// 2. operator<<(ostream&, const T&) defined in either foo or the // 2. operator<<(ostream&, const T&) defined in either foo or the
// global namespace. // global namespace.
// //
// However if T is an STL-style container then it is printed element-wise
// unless foo::PrintTo(const T&, ostream*) is defined. Note that
// operator<<() is ignored for container types.
//
// If none of the above is defined, it will print the debug string of // If none of the above is defined, it will print the debug string of
// the value if it is a protocol buffer, or print the raw bytes in the // the value if it is a protocol buffer, or print the raw bytes in the
// value otherwise. // value otherwise.
@@ -92,6 +95,8 @@
// being defined as many user-defined container types don't have // being defined as many user-defined container types don't have
// value_type. // value_type.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
#define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ #define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
@@ -107,6 +112,12 @@
# include <tuple> # include <tuple>
#endif #endif
#if GTEST_HAS_ABSL
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "absl/types/variant.h"
#endif // GTEST_HAS_ABSL
namespace testing { namespace testing {
// Definitions in the 'internal' and 'internal2' name spaces are // Definitions in the 'internal' and 'internal2' name spaces are
@@ -125,6 +136,10 @@ enum TypeKind {
kProtobuf, // a protobuf type kProtobuf, // a protobuf type
kConvertibleToInteger, // a type implicitly convertible to BiggestInt kConvertibleToInteger, // a type implicitly convertible to BiggestInt
// (e.g. a named or unnamed enum type) // (e.g. a named or unnamed enum type)
#if GTEST_HAS_ABSL
kConvertibleToStringView, // a type implicitly convertible to
// absl::string_view
#endif
kOtherType // anything else kOtherType // anything else
}; };
@@ -137,7 +152,8 @@ class TypeWithoutFormatter {
public: public:
// This default version is called when kTypeKind is kOtherType. // This default version is called when kTypeKind is kOtherType.
static void PrintValue(const T& value, ::std::ostream* os) { static void PrintValue(const T& value, ::std::ostream* os) {
PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value), PrintBytesInObjectTo(static_cast<const unsigned char*>(
reinterpret_cast<const void*>(&value)),
sizeof(value), os); sizeof(value), os);
} }
}; };
@@ -151,10 +167,10 @@ template <typename T>
class TypeWithoutFormatter<T, kProtobuf> { class TypeWithoutFormatter<T, kProtobuf> {
public: public:
static void PrintValue(const T& value, ::std::ostream* os) { static void PrintValue(const T& value, ::std::ostream* os) {
const ::testing::internal::string short_str = value.ShortDebugString(); std::string pretty_str = value.ShortDebugString();
const ::testing::internal::string pretty_str = if (pretty_str.length() > kProtobufOneLinerMaxLength) {
short_str.length() <= kProtobufOneLinerMaxLength ? pretty_str = "\n" + value.DebugString();
short_str : ("\n" + value.DebugString()); }
*os << ("<" + pretty_str + ">"); *os << ("<" + pretty_str + ">");
} }
}; };
@@ -175,6 +191,19 @@ class TypeWithoutFormatter<T, kConvertibleToInteger> {
} }
}; };
#if GTEST_HAS_ABSL
template <typename T>
class TypeWithoutFormatter<T, kConvertibleToStringView> {
public:
// Since T has neither operator<< nor PrintTo() but can be implicitly
// converted to absl::string_view, we print it as a absl::string_view.
//
// Note: the implementation is further below, as it depends on
// internal::PrintTo symbol which is defined later in the file.
static void PrintValue(const T& value, ::std::ostream* os);
};
#endif
// Prints the given value to the given ostream. If the value is a // Prints the given value to the given ostream. If the value is a
// protocol message, its debug string is printed; if it's an enum or // protocol message, its debug string is printed; if it's an enum or
// of a type implicitly convertible to BiggestInt, it's printed as an // of a type implicitly convertible to BiggestInt, it's printed as an
@@ -202,10 +231,19 @@ class TypeWithoutFormatter<T, kConvertibleToInteger> {
template <typename Char, typename CharTraits, typename T> template <typename Char, typename CharTraits, typename T>
::std::basic_ostream<Char, CharTraits>& operator<<( ::std::basic_ostream<Char, CharTraits>& operator<<(
::std::basic_ostream<Char, CharTraits>& os, const T& x) { ::std::basic_ostream<Char, CharTraits>& os, const T& x) {
TypeWithoutFormatter<T, TypeWithoutFormatter<T, (internal::IsAProtocolMessage<T>::value
(internal::IsAProtocolMessage<T>::value ? kProtobuf : ? kProtobuf
internal::ImplicitlyConvertible<const T&, internal::BiggestInt>::value ? : internal::ImplicitlyConvertible<
kConvertibleToInteger : kOtherType)>::PrintValue(x, &os); const T&, internal::BiggestInt>::value
? kConvertibleToInteger
:
#if GTEST_HAS_ABSL
internal::ImplicitlyConvertible<
const T&, absl::string_view>::value
? kConvertibleToStringView
:
#endif
kOtherType)>::PrintValue(x, &os);
return os; return os;
} }
@@ -364,11 +402,18 @@ class UniversalPrinter;
template <typename T> template <typename T>
void UniversalPrint(const T& value, ::std::ostream* os); void UniversalPrint(const T& value, ::std::ostream* os);
enum DefaultPrinterType {
kPrintContainer,
kPrintPointer,
kPrintFunctionPointer,
kPrintOther,
};
template <DefaultPrinterType type> struct WrapPrinterType {};
// Used to print an STL-style container when the user doesn't define // Used to print an STL-style container when the user doesn't define
// a PrintTo() for it. // a PrintTo() for it.
template <typename C> template <typename C>
void DefaultPrintTo(IsContainer /* dummy */, void DefaultPrintTo(WrapPrinterType<kPrintContainer> /* dummy */,
false_type /* is not a pointer */,
const C& container, ::std::ostream* os) { const C& container, ::std::ostream* os) {
const size_t kMaxCount = 32; // The maximum number of elements to print. const size_t kMaxCount = 32; // The maximum number of elements to print.
*os << '{'; *os << '{';
@@ -401,40 +446,34 @@ void DefaultPrintTo(IsContainer /* dummy */,
// implementation-defined. Therefore they will be printed as raw // implementation-defined. Therefore they will be printed as raw
// bytes.) // bytes.)
template <typename T> template <typename T>
void DefaultPrintTo(IsNotContainer /* dummy */, void DefaultPrintTo(WrapPrinterType<kPrintPointer> /* dummy */,
true_type /* is a pointer */,
T* p, ::std::ostream* os) { T* p, ::std::ostream* os) {
if (p == NULL) { if (p == NULL) {
*os << "NULL"; *os << "NULL";
} else { } else {
// C++ doesn't allow casting from a function pointer to any object
// pointer.
//
// IsTrue() silences warnings: "Condition is always true",
// "unreachable code".
if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {
// T is not a function type. We just call << to print p, // T is not a function type. We just call << to print p,
// relying on ADL to pick up user-defined << for their pointer // relying on ADL to pick up user-defined << for their pointer
// types, if any. // types, if any.
*os << p; *os << p;
}
}
template <typename T>
void DefaultPrintTo(WrapPrinterType<kPrintFunctionPointer> /* dummy */,
T* p, ::std::ostream* os) {
if (p == NULL) {
*os << "NULL";
} else { } else {
// T is a function type, so '*os << p' doesn't do what we want // T is a function type, so '*os << p' doesn't do what we want
// (it just prints p as bool). We want to print p as a const // (it just prints p as bool). We want to print p as a const
// void*. However, we cannot cast it to const void* directly, // void*.
// even using reinterpret_cast, as earlier versions of gcc *os << reinterpret_cast<const void*>(p);
// (e.g. 3.4.5) cannot compile the cast when p is a function
// pointer. Casting to UInt64 first solves the problem.
*os << reinterpret_cast<const void*>(
reinterpret_cast<internal::UInt64>(p));
}
} }
} }
// Used to print a non-container, non-pointer value when the user // Used to print a non-container, non-pointer value when the user
// doesn't define PrintTo() for it. // doesn't define PrintTo() for it.
template <typename T> template <typename T>
void DefaultPrintTo(IsNotContainer /* dummy */, void DefaultPrintTo(WrapPrinterType<kPrintOther> /* dummy */,
false_type /* is not a pointer */,
const T& value, ::std::ostream* os) { const T& value, ::std::ostream* os) {
::testing_internal::DefaultPrintNonContainerTo(value, os); ::testing_internal::DefaultPrintNonContainerTo(value, os);
} }
@@ -452,11 +491,8 @@ void DefaultPrintTo(IsNotContainer /* dummy */,
// wants). // wants).
template <typename T> template <typename T>
void PrintTo(const T& value, ::std::ostream* os) { void PrintTo(const T& value, ::std::ostream* os) {
// DefaultPrintTo() is overloaded. The type of its first two // DefaultPrintTo() is overloaded. The type of its first argument
// arguments determine which version will be picked. If T is an // determines which version will be picked.
// STL-style container, the version for container will be called; if
// T is a pointer, the pointer version will be called; otherwise the
// generic version will be called.
// //
// Note that we check for container types here, prior to we check // Note that we check for container types here, prior to we check
// for protocol message types in our operator<<. The rationale is: // for protocol message types in our operator<<. The rationale is:
@@ -468,13 +504,27 @@ void PrintTo(const T& value, ::std::ostream* os) {
// elements; therefore we check for container types here to ensure // elements; therefore we check for container types here to ensure
// that our format is used. // that our format is used.
// //
// The second argument of DefaultPrintTo() is needed to bypass a bug // Note that MSVC and clang-cl do allow an implicit conversion from
// in Symbian's C++ compiler that prevents it from picking the right // pointer-to-function to pointer-to-object, but clang-cl warns on it.
// overload between: // So don't use ImplicitlyConvertible if it can be helped since it will
// // cause this warning, and use a separate overload of DefaultPrintTo for
// PrintTo(const T& x, ...); // function pointers so that the `*os << p` in the object pointer overload
// PrintTo(T* x, ...); // doesn't cause that warning either.
DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os); DefaultPrintTo(
WrapPrinterType <
(sizeof(IsContainerTest<T>(0)) == sizeof(IsContainer)) &&
!IsRecursiveContainer<T>::value
? kPrintContainer
: !is_pointer<T>::value
? kPrintOther
#if GTEST_LANG_CXX11
: std::is_function<typename std::remove_pointer<T>::type>::value
#else
: !internal::ImplicitlyConvertible<T, const void*>::value
#endif
? kPrintFunctionPointer
: kPrintPointer > (),
value, os);
} }
// The following list of PrintTo() overloads tells // The following list of PrintTo() overloads tells
@@ -581,6 +631,17 @@ inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
} }
#endif // GTEST_HAS_STD_WSTRING #endif // GTEST_HAS_STD_WSTRING
#if GTEST_HAS_ABSL
// Overload for absl::string_view.
inline void PrintTo(absl::string_view sp, ::std::ostream* os) {
PrintTo(::std::string(sp), os);
}
#endif // GTEST_HAS_ABSL
#if GTEST_LANG_CXX11
inline void PrintTo(std::nullptr_t, ::std::ostream* os) { *os << "(nullptr)"; }
#endif // GTEST_LANG_CXX11
#if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ #if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
// Helper function for printing a tuple. T must be instantiated with // Helper function for printing a tuple. T must be instantiated with
// a tuple type. // a tuple type.
@@ -710,6 +771,48 @@ class UniversalPrinter {
GTEST_DISABLE_MSC_WARNINGS_POP_() GTEST_DISABLE_MSC_WARNINGS_POP_()
}; };
#if GTEST_HAS_ABSL
// Printer for absl::optional
template <typename T>
class UniversalPrinter<::absl::optional<T>> {
public:
static void Print(const ::absl::optional<T>& value, ::std::ostream* os) {
*os << '(';
if (!value) {
*os << "nullopt";
} else {
UniversalPrint(*value, os);
}
*os << ')';
}
};
// Printer for absl::variant
template <typename... T>
class UniversalPrinter<::absl::variant<T...>> {
public:
static void Print(const ::absl::variant<T...>& value, ::std::ostream* os) {
*os << '(';
absl::visit(Visitor{os}, value);
*os << ')';
}
private:
struct Visitor {
template <typename U>
void operator()(const U& u) const {
*os << "'" << GetTypeName<U>() << "' with value ";
UniversalPrint(u, os);
}
::std::ostream* os;
};
};
#endif // GTEST_HAS_ABSL
// UniversalPrintArray(begin, len, os) prints an array of 'len' // UniversalPrintArray(begin, len, os) prints an array of 'len'
// elements, starting at address 'begin'. // elements, starting at address 'begin'.
template <typename T> template <typename T>
@@ -723,7 +826,7 @@ void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
// If the array has more than kThreshold elements, we'll have to // If the array has more than kThreshold elements, we'll have to
// omit some details by printing only the first and the last // omit some details by printing only the first and the last
// kChunkSize elements. // kChunkSize elements.
// TODO(wan@google.com): let the user control the threshold using a flag. // FIXME: let the user control the threshold using a flag.
if (len <= kThreshold) { if (len <= kThreshold) {
PrintRawArrayTo(begin, len, os); PrintRawArrayTo(begin, len, os);
} else { } else {
@@ -805,7 +908,7 @@ class UniversalTersePrinter<const char*> {
if (str == NULL) { if (str == NULL) {
*os << "NULL"; *os << "NULL";
} else { } else {
UniversalPrint(string(str), os); UniversalPrint(std::string(str), os);
} }
} }
}; };
@@ -856,7 +959,7 @@ void UniversalPrint(const T& value, ::std::ostream* os) {
UniversalPrinter<T1>::Print(value, os); UniversalPrinter<T1>::Print(value, os);
} }
typedef ::std::vector<string> Strings; typedef ::std::vector< ::std::string> Strings;
// TuplePolicy<TupleT> must provide: // TuplePolicy<TupleT> must provide:
// - tuple_size // - tuple_size
@@ -875,12 +978,13 @@ struct TuplePolicy {
static const size_t tuple_size = ::std::tr1::tuple_size<Tuple>::value; static const size_t tuple_size = ::std::tr1::tuple_size<Tuple>::value;
template <size_t I> template <size_t I>
struct tuple_element : ::std::tr1::tuple_element<I, Tuple> {}; struct tuple_element : ::std::tr1::tuple_element<static_cast<int>(I), Tuple> {
};
template <size_t I> template <size_t I>
static typename AddReference< static typename AddReference<const typename ::std::tr1::tuple_element<
const typename ::std::tr1::tuple_element<I, Tuple>::type>::type get( static_cast<int>(I), Tuple>::type>::type
const Tuple& tuple) { get(const Tuple& tuple) {
return ::std::tr1::get<I>(tuple); return ::std::tr1::get<I>(tuple);
} }
}; };
@@ -976,6 +1080,16 @@ Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
} // namespace internal } // namespace internal
#if GTEST_HAS_ABSL
namespace internal2 {
template <typename T>
void TypeWithoutFormatter<T, kConvertibleToStringView>::PrintValue(
const T& value, ::std::ostream* os) {
internal::PrintTo(absl::string_view(value), os);
}
} // namespace internal2
#endif
template <typename T> template <typename T>
::std::string PrintToString(const T& value) { ::std::string PrintToString(const T& value) {
::std::stringstream ss; ::std::stringstream ss;

View File

@@ -26,17 +26,21 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// //
// Utilities for testing Google Test itself and code that uses Google Test // Utilities for testing Google Test itself and code that uses Google Test
// (e.g. frameworks built on top of Google Test). // (e.g. frameworks built on top of Google Test).
// GOOGLETEST_CM0004 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_
#define GTEST_INCLUDE_GTEST_GTEST_SPI_H_ #define GTEST_INCLUDE_GTEST_GTEST_SPI_H_
#include "gtest/gtest.h" #include "gtest/gtest.h"
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
/* class A needs to have dll-interface to be used by clients of class B */)
namespace testing { namespace testing {
// This helper class can be used to mock out Google Test failure reporting // This helper class can be used to mock out Google Test failure reporting
@@ -97,13 +101,12 @@ class GTEST_API_ SingleFailureChecker {
public: public:
// The constructor remembers the arguments. // The constructor remembers the arguments.
SingleFailureChecker(const TestPartResultArray* results, SingleFailureChecker(const TestPartResultArray* results,
TestPartResult::Type type, TestPartResult::Type type, const std::string& substr);
const string& substr);
~SingleFailureChecker(); ~SingleFailureChecker();
private: private:
const TestPartResultArray* const results_; const TestPartResultArray* const results_;
const TestPartResult::Type type_; const TestPartResult::Type type_;
const string substr_; const std::string substr_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker); GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
}; };
@@ -112,6 +115,8 @@ class GTEST_API_ SingleFailureChecker {
} // namespace testing } // namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
// A set of macros for testing Google Test assertions or code that's expected // A set of macros for testing Google Test assertions or code that's expected
// to generate Google Test fatal failures. It verifies that the given // to generate Google Test fatal failures. It verifies that the given
// statement will cause exactly one fatal Google Test failure with 'substr' // statement will cause exactly one fatal Google Test failure with 'substr'

View File

@@ -27,8 +27,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Author: mheule@google.com (Markus Heule) // GOOGLETEST_CM0001 DO NOT DELETE
//
#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
#define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ #define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
@@ -38,6 +37,9 @@
#include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-string.h" #include "gtest/internal/gtest-string.h"
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
/* class A needs to have dll-interface to be used by clients of class B */)
namespace testing { namespace testing {
// A copyable object representing the result of a test part (i.e. an // A copyable object representing the result of a test part (i.e. an
@@ -143,7 +145,7 @@ class GTEST_API_ TestPartResultArray {
}; };
// This interface knows how to report a test part result. // This interface knows how to report a test part result.
class TestPartResultReporterInterface { class GTEST_API_ TestPartResultReporterInterface {
public: public:
virtual ~TestPartResultReporterInterface() {} virtual ~TestPartResultReporterInterface() {}
@@ -176,4 +178,6 @@ class GTEST_API_ HasNewFatalFailureHelper
} // namespace testing } // namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
#endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_

View File

@@ -26,8 +26,9 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
#define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
@@ -82,6 +83,24 @@ TYPED_TEST(FooTest, DoesBlah) {
TYPED_TEST(FooTest, HasPropertyA) { ... } TYPED_TEST(FooTest, HasPropertyA) { ... }
// TYPED_TEST_CASE takes an optional third argument which allows to specify a
// class that generates custom test name suffixes based on the type. This should
// be a class which has a static template function GetName(int index) returning
// a string for each type. The provided integer index equals the index of the
// type in the provided type list. In many cases the index can be ignored.
//
// For example:
// class MyTypeNames {
// public:
// template <typename T>
// static std::string GetName(int) {
// if (std::is_same<T, char>()) return "char";
// if (std::is_same<T, int>()) return "int";
// if (std::is_same<T, unsigned int>()) return "unsignedInt";
// }
// };
// TYPED_TEST_CASE(FooTest, MyTypes, MyTypeNames);
#endif // 0 #endif // 0
// Type-parameterized tests are abstract test patterns parameterized // Type-parameterized tests are abstract test patterns parameterized
@@ -143,6 +162,11 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
// If the type list contains only one type, you can write that type // If the type list contains only one type, you can write that type
// directly without Types<...>: // directly without Types<...>:
// INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int); // INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
//
// Similar to the optional argument of TYPED_TEST_CASE above,
// INSTANTIATE_TEST_CASE_P takes an optional fourth argument which allows to
// generate custom names.
// INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes, MyTypeNames);
#endif // 0 #endif // 0
@@ -159,12 +183,19 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
// given test case. // given test case.
# define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_ # define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
// Expands to the name of the typedef for the NameGenerator, responsible for
// creating the suffixes of the name.
#define GTEST_NAME_GENERATOR_(TestCaseName) \
gtest_type_params_##TestCaseName##_NameGenerator
// The 'Types' template argument below must have spaces around it // The 'Types' template argument below must have spaces around it
// since some compilers may choke on '>>' when passing a template // since some compilers may choke on '>>' when passing a template
// instance (e.g. Types<int>) // instance (e.g. Types<int>)
# define TYPED_TEST_CASE(CaseName, Types) \ # define TYPED_TEST_CASE(CaseName, Types, ...) \
typedef ::testing::internal::TypeList< Types >::type \ typedef ::testing::internal::TypeList< Types >::type GTEST_TYPE_PARAMS_( \
GTEST_TYPE_PARAMS_(CaseName) CaseName); \
typedef ::testing::internal::NameGeneratorSelector<__VA_ARGS__>::type \
GTEST_NAME_GENERATOR_(CaseName)
# define TYPED_TEST(CaseName, TestName) \ # define TYPED_TEST(CaseName, TestName) \
template <typename gtest_TypeParam_> \ template <typename gtest_TypeParam_> \
@@ -175,16 +206,23 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
typedef gtest_TypeParam_ TypeParam; \ typedef gtest_TypeParam_ TypeParam; \
virtual void TestBody(); \ virtual void TestBody(); \
}; \ }; \
bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \ static bool gtest_##CaseName##_##TestName##_registered_ \
GTEST_ATTRIBUTE_UNUSED_ = \
::testing::internal::TypeParameterizedTest< \ ::testing::internal::TypeParameterizedTest< \
CaseName, \ CaseName, \
::testing::internal::TemplateSel< \ ::testing::internal::TemplateSel<GTEST_TEST_CLASS_NAME_(CaseName, \
GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \ TestName)>, \
GTEST_TYPE_PARAMS_(CaseName)>::Register(\ GTEST_TYPE_PARAMS_( \
"", ::testing::internal::CodeLocation(__FILE__, __LINE__), \ CaseName)>::Register("", \
#CaseName, #TestName, 0); \ ::testing::internal::CodeLocation( \
__FILE__, __LINE__), \
#CaseName, #TestName, 0, \
::testing::internal::GenerateNames< \
GTEST_NAME_GENERATOR_(CaseName), \
GTEST_TYPE_PARAMS_(CaseName)>()); \
template <typename gtest_TypeParam_> \ template <typename gtest_TypeParam_> \
void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody() void GTEST_TEST_CLASS_NAME_(CaseName, \
TestName)<gtest_TypeParam_>::TestBody()
#endif // GTEST_HAS_TYPED_TEST #endif // GTEST_HAS_TYPED_TEST
@@ -241,22 +279,27 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
namespace GTEST_CASE_NAMESPACE_(CaseName) { \ namespace GTEST_CASE_NAMESPACE_(CaseName) { \
typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \ typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
} \ } \
static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \ static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) \
GTEST_ATTRIBUTE_UNUSED_ = \
GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames( \ GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames( \
__FILE__, __LINE__, #__VA_ARGS__) __FILE__, __LINE__, #__VA_ARGS__)
// The 'Types' template argument below must have spaces around it // The 'Types' template argument below must have spaces around it
// since some compilers may choke on '>>' when passing a template // since some compilers may choke on '>>' when passing a template
// instance (e.g. Types<int>) // instance (e.g. Types<int>)
# define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \ # define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types, ...) \
bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \ static bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \
::testing::internal::TypeParameterizedTestCase<CaseName, \ ::testing::internal::TypeParameterizedTestCase< \
GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \ CaseName, GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
::testing::internal::TypeList< Types >::type>::Register(\ ::testing::internal::TypeList< Types >::type>:: \
#Prefix, \ Register(#Prefix, \
::testing::internal::CodeLocation(__FILE__, __LINE__), \ ::testing::internal::CodeLocation(__FILE__, __LINE__), \
&GTEST_TYPED_TEST_CASE_P_STATE_(CaseName), \ &GTEST_TYPED_TEST_CASE_P_STATE_(CaseName), #CaseName, \
#CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName)) GTEST_REGISTERED_TEST_NAMES_(CaseName), \
::testing::internal::GenerateNames< \
::testing::internal::NameGeneratorSelector< \
__VA_ARGS__>::type, \
::testing::internal::TypeList< Types >::type>())
#endif // GTEST_HAS_TYPED_TEST_P #endif // GTEST_HAS_TYPED_TEST_P

View File

@@ -26,10 +26,9 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Author: wan@google.com (Zhanyong Wan) // The Google C++ Testing and Mocking Framework (Google Test)
//
// The Google C++ Testing Framework (Google Test)
// //
// This header file defines the public API for Google Test. It should be // This header file defines the public API for Google Test. It should be
// included by any test program that uses Google Test. // included by any test program that uses Google Test.
@@ -48,6 +47,8 @@
// registration from Barthelemy Dagenais' (barthelemy@prologique.com) // registration from Barthelemy Dagenais' (barthelemy@prologique.com)
// easyUnit framework. // easyUnit framework.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_GTEST_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_H_
#define GTEST_INCLUDE_GTEST_GTEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_H_
@@ -65,6 +66,9 @@
#include "gtest/gtest-test-part.h" #include "gtest/gtest-test-part.h"
#include "gtest/gtest-typed-test.h" #include "gtest/gtest-typed-test.h"
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
/* class A needs to have dll-interface to be used by clients of class B */)
// Depending on the platform, different string classes are available. // Depending on the platform, different string classes are available.
// On Linux, in addition to ::std::string, Google also makes use of // On Linux, in addition to ::std::string, Google also makes use of
// class ::string, which has the same interface as ::std::string, but // class ::string, which has the same interface as ::std::string, but
@@ -82,6 +86,15 @@
namespace testing { namespace testing {
// Silence C4100 (unreferenced formal parameter) and 4805
// unsafe mix of type 'const int' and type 'const bool'
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable:4805)
# pragma warning(disable:4100)
#endif
// Declares the flags. // Declares the flags.
// This flag temporary enables the disabled tests. // This flag temporary enables the disabled tests.
@@ -103,6 +116,10 @@ GTEST_DECLARE_string_(color);
// the tests to run. If the filter is not given all tests are executed. // the tests to run. If the filter is not given all tests are executed.
GTEST_DECLARE_string_(filter); GTEST_DECLARE_string_(filter);
// This flag controls whether Google Test installs a signal handler that dumps
// debugging information when fatal signals are raised.
GTEST_DECLARE_bool_(install_failure_signal_handler);
// This flag causes the Google Test to list tests. None of the tests listed // This flag causes the Google Test to list tests. None of the tests listed
// are actually run if the flag is provided. // are actually run if the flag is provided.
GTEST_DECLARE_bool_(list_tests); GTEST_DECLARE_bool_(list_tests);
@@ -115,6 +132,9 @@ GTEST_DECLARE_string_(output);
// test. // test.
GTEST_DECLARE_bool_(print_time); GTEST_DECLARE_bool_(print_time);
// This flags control whether Google Test prints UTF8 characters as text.
GTEST_DECLARE_bool_(print_utf8);
// This flag specifies the random number seed. // This flag specifies the random number seed.
GTEST_DECLARE_int32_(random_seed); GTEST_DECLARE_int32_(random_seed);
@@ -135,7 +155,7 @@ GTEST_DECLARE_int32_(stack_trace_depth);
// When this flag is specified, a failed assertion will throw an // When this flag is specified, a failed assertion will throw an
// exception if exceptions are enabled, or exit the program with a // exception if exceptions are enabled, or exit the program with a
// non-zero code otherwise. // non-zero code otherwise. For use with an external test framework.
GTEST_DECLARE_bool_(throw_on_failure); GTEST_DECLARE_bool_(throw_on_failure);
// When this flag is set with a "host:port" string, on supported // When this flag is set with a "host:port" string, on supported
@@ -143,6 +163,10 @@ GTEST_DECLARE_bool_(throw_on_failure);
// the specified host machine. // the specified host machine.
GTEST_DECLARE_string_(stream_result_to); GTEST_DECLARE_string_(stream_result_to);
#if GTEST_USE_OWN_FLAGFILE_FLAG_
GTEST_DECLARE_string_(flagfile);
#endif // GTEST_USE_OWN_FLAGFILE_FLAG_
// The upper limit for valid stack trace depths. // The upper limit for valid stack trace depths.
const int kMaxStackTraceDepth = 100; const int kMaxStackTraceDepth = 100;
@@ -160,6 +184,7 @@ class TestEventListenersAccessor;
class TestEventRepeater; class TestEventRepeater;
class UnitTestRecordPropertyTestHelper; class UnitTestRecordPropertyTestHelper;
class WindowsDeathTest; class WindowsDeathTest;
class FuchsiaDeathTest;
class UnitTestImpl* GetUnitTestImpl(); class UnitTestImpl* GetUnitTestImpl();
void ReportFailureInUnknownLocation(TestPartResult::Type result_type, void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
const std::string& message); const std::string& message);
@@ -259,7 +284,9 @@ class GTEST_API_ AssertionResult {
// Used in EXPECT_TRUE/FALSE(assertion_result). // Used in EXPECT_TRUE/FALSE(assertion_result).
AssertionResult(const AssertionResult& other); AssertionResult(const AssertionResult& other);
#if defined(_MSC_VER) && _MSC_VER < 1910
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */) GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
#endif
// Used in the EXPECT_TRUE/FALSE(bool_expression). // Used in the EXPECT_TRUE/FALSE(bool_expression).
// //
@@ -276,7 +303,9 @@ class GTEST_API_ AssertionResult {
/*enabler*/ = NULL) /*enabler*/ = NULL)
: success_(success) {} : success_(success) {}
#if defined(_MSC_VER) && _MSC_VER < 1910
GTEST_DISABLE_MSC_WARNINGS_POP_() GTEST_DISABLE_MSC_WARNINGS_POP_()
#endif
// Assignment operator. // Assignment operator.
AssertionResult& operator=(AssertionResult other) { AssertionResult& operator=(AssertionResult other) {
@@ -297,7 +326,7 @@ class GTEST_API_ AssertionResult {
const char* message() const { const char* message() const {
return message_.get() != NULL ? message_->c_str() : ""; return message_.get() != NULL ? message_->c_str() : "";
} }
// TODO(vladl@google.com): Remove this after making sure no clients use it. // FIXME: Remove this after making sure no clients use it.
// Deprecated; please use message() instead. // Deprecated; please use message() instead.
const char* failure_message() const { return message(); } const char* failure_message() const { return message(); }
@@ -345,6 +374,15 @@ GTEST_API_ AssertionResult AssertionFailure();
// Deprecated; use AssertionFailure() << msg. // Deprecated; use AssertionFailure() << msg.
GTEST_API_ AssertionResult AssertionFailure(const Message& msg); GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
} // namespace testing
// Includes the auto-generated header that implements a family of generic
// predicate assertion macros. This include comes late because it relies on
// APIs declared above.
#include "gtest/gtest_pred_impl.h"
namespace testing {
// The abstract class that all tests inherit from. // The abstract class that all tests inherit from.
// //
// In Google Test, a unit test program contains one or many TestCases, and // In Google Test, a unit test program contains one or many TestCases, and
@@ -355,7 +393,7 @@ GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
// this for you. // this for you.
// //
// The only time you derive from Test is when defining a test fixture // The only time you derive from Test is when defining a test fixture
// to be used a TEST_F. For example: // to be used in a TEST_F. For example:
// //
// class FooTest : public testing::Test { // class FooTest : public testing::Test {
// protected: // protected:
@@ -550,9 +588,8 @@ class GTEST_API_ TestResult {
// Returns the elapsed time, in milliseconds. // Returns the elapsed time, in milliseconds.
TimeInMillis elapsed_time() const { return elapsed_time_; } TimeInMillis elapsed_time() const { return elapsed_time_; }
// Returns the i-th test part result among all the results. i can range // Returns the i-th test part result among all the results. i can range from 0
// from 0 to test_property_count() - 1. If i is not in that range, aborts // to total_part_count() - 1. If i is not in that range, aborts the program.
// the program.
const TestPartResult& GetTestPartResult(int i) const; const TestPartResult& GetTestPartResult(int i) const;
// Returns the i-th test property. i can range from 0 to // Returns the i-th test property. i can range from 0 to
@@ -569,6 +606,7 @@ class GTEST_API_ TestResult {
friend class internal::TestResultAccessor; friend class internal::TestResultAccessor;
friend class internal::UnitTestImpl; friend class internal::UnitTestImpl;
friend class internal::WindowsDeathTest; friend class internal::WindowsDeathTest;
friend class internal::FuchsiaDeathTest;
// Gets the vector of TestPartResults. // Gets the vector of TestPartResults.
const std::vector<TestPartResult>& test_part_results() const { const std::vector<TestPartResult>& test_part_results() const {
@@ -594,7 +632,7 @@ class GTEST_API_ TestResult {
// Adds a failure if the key is a reserved attribute of Google Test // Adds a failure if the key is a reserved attribute of Google Test
// testcase tags. Returns true if the property is valid. // testcase tags. Returns true if the property is valid.
// TODO(russr): Validate attribute names are legal and human readable. // FIXME: Validate attribute names are legal and human readable.
static bool ValidateTestProperty(const std::string& xml_element, static bool ValidateTestProperty(const std::string& xml_element,
const TestProperty& test_property); const TestProperty& test_property);
@@ -675,6 +713,9 @@ class GTEST_API_ TestInfo {
// Returns the line where this test is defined. // Returns the line where this test is defined.
int line() const { return location_.line; } int line() const { return location_.line; }
// Return true if this test should not be run because it's in another shard.
bool is_in_another_shard() const { return is_in_another_shard_; }
// Returns true if this test should run, that is if the test is not // Returns true if this test should run, that is if the test is not
// disabled (or it is disabled but the also_run_disabled_tests flag has // disabled (or it is disabled but the also_run_disabled_tests flag has
// been specified) and its full name matches the user-specified filter. // been specified) and its full name matches the user-specified filter.
@@ -695,10 +736,9 @@ class GTEST_API_ TestInfo {
// Returns true iff this test will appear in the XML report. // Returns true iff this test will appear in the XML report.
bool is_reportable() const { bool is_reportable() const {
// For now, the XML report includes all tests matching the filter. // The XML report includes tests matching the filter, excluding those
// In the future, we may trim tests that are excluded because of // run in other shards.
// sharding. return matches_filter_ && !is_in_another_shard_;
return matches_filter_;
} }
// Returns the result of the test. // Returns the result of the test.
@@ -762,6 +802,7 @@ class GTEST_API_ TestInfo {
bool is_disabled_; // True iff this test is disabled bool is_disabled_; // True iff this test is disabled
bool matches_filter_; // True if this test matches the bool matches_filter_; // True if this test matches the
// user-specified filter. // user-specified filter.
bool is_in_another_shard_; // Will be run in another shard.
internal::TestFactoryBase* const factory_; // The factory that creates internal::TestFactoryBase* const factory_; // The factory that creates
// the test object // the test object
@@ -986,6 +1027,18 @@ class Environment {
virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; } virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
}; };
#if GTEST_HAS_EXCEPTIONS
// Exception which can be thrown from TestEventListener::OnTestPartResult.
class GTEST_API_ AssertionException
: public internal::GoogleTestFailureException {
public:
explicit AssertionException(const TestPartResult& result)
: GoogleTestFailureException(result) {}
};
#endif // GTEST_HAS_EXCEPTIONS
// The interface for tracing execution of tests. The methods are organized in // The interface for tracing execution of tests. The methods are organized in
// the order the corresponding events are fired. // the order the corresponding events are fired.
class TestEventListener { class TestEventListener {
@@ -1014,6 +1067,8 @@ class TestEventListener {
virtual void OnTestStart(const TestInfo& test_info) = 0; virtual void OnTestStart(const TestInfo& test_info) = 0;
// Fired after a failed assertion or a SUCCEED() invocation. // Fired after a failed assertion or a SUCCEED() invocation.
// If you want to throw an exception from this function to skip to the next
// TEST, it must be AssertionException defined above, or inherited from it.
virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0; virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
// Fired after the test ends. // Fired after the test ends.
@@ -1180,14 +1235,12 @@ class GTEST_API_ UnitTest {
// Returns the random seed used at the start of the current test run. // Returns the random seed used at the start of the current test run.
int random_seed() const; int random_seed() const;
#if GTEST_HAS_PARAM_TEST
// Returns the ParameterizedTestCaseRegistry object used to keep track of // Returns the ParameterizedTestCaseRegistry object used to keep track of
// value-parameterized tests and instantiate and register them. // value-parameterized tests and instantiate and register them.
// //
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
internal::ParameterizedTestCaseRegistry& parameterized_test_registry() internal::ParameterizedTestCaseRegistry& parameterized_test_registry()
GTEST_LOCK_EXCLUDED_(mutex_); GTEST_LOCK_EXCLUDED_(mutex_);
#endif // GTEST_HAS_PARAM_TEST
// Gets the number of successful test cases. // Gets the number of successful test cases.
int successful_test_case_count() const; int successful_test_case_count() const;
@@ -1287,11 +1340,11 @@ class GTEST_API_ UnitTest {
internal::UnitTestImpl* impl() { return impl_; } internal::UnitTestImpl* impl() { return impl_; }
const internal::UnitTestImpl* impl() const { return impl_; } const internal::UnitTestImpl* impl() const { return impl_; }
// These classes and funcions are friends as they need to access private // These classes and functions are friends as they need to access private
// members of UnitTest. // members of UnitTest.
friend class ScopedTrace;
friend class Test; friend class Test;
friend class internal::AssertHelper; friend class internal::AssertHelper;
friend class internal::ScopedTrace;
friend class internal::StreamingListenerTest; friend class internal::StreamingListenerTest;
friend class internal::UnitTestRecordPropertyTestHelper; friend class internal::UnitTestRecordPropertyTestHelper;
friend Environment* AddGlobalTestEnvironment(Environment* env); friend Environment* AddGlobalTestEnvironment(Environment* env);
@@ -1388,11 +1441,9 @@ AssertionResult CmpHelperEQ(const char* lhs_expression,
const char* rhs_expression, const char* rhs_expression,
const T1& lhs, const T1& lhs,
const T2& rhs) { const T2& rhs) {
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4389 /* signed/unsigned mismatch */)
if (lhs == rhs) { if (lhs == rhs) {
return AssertionSuccess(); return AssertionSuccess();
} }
GTEST_DISABLE_MSC_WARNINGS_POP_()
return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs); return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs);
} }
@@ -1706,7 +1757,6 @@ class GTEST_API_ AssertHelper {
} // namespace internal } // namespace internal
#if GTEST_HAS_PARAM_TEST
// The pure interface class that all value-parameterized tests inherit from. // The pure interface class that all value-parameterized tests inherit from.
// A value-parameterized class must inherit from both ::testing::Test and // A value-parameterized class must inherit from both ::testing::Test and
// ::testing::WithParamInterface. In most cases that just means inheriting // ::testing::WithParamInterface. In most cases that just means inheriting
@@ -1783,8 +1833,6 @@ template <typename T>
class TestWithParam : public Test, public WithParamInterface<T> { class TestWithParam : public Test, public WithParamInterface<T> {
}; };
#endif // GTEST_HAS_PARAM_TEST
// Macros for indicating success/failure in test code. // Macros for indicating success/failure in test code.
// ADD_FAILURE unconditionally adds a failure to the current test. // ADD_FAILURE unconditionally adds a failure to the current test.
@@ -1857,22 +1905,18 @@ class TestWithParam : public Test, public WithParamInterface<T> {
// AssertionResult. For more information on how to use AssertionResult with // AssertionResult. For more information on how to use AssertionResult with
// these macros see comments on that class. // these macros see comments on that class.
#define EXPECT_TRUE(condition) \ #define EXPECT_TRUE(condition) \
GTEST_TEST_BOOLEAN_((condition), #condition, false, true, \ GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
GTEST_NONFATAL_FAILURE_) GTEST_NONFATAL_FAILURE_)
#define EXPECT_FALSE(condition) \ #define EXPECT_FALSE(condition) \
GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
GTEST_NONFATAL_FAILURE_) GTEST_NONFATAL_FAILURE_)
#define ASSERT_TRUE(condition) \ #define ASSERT_TRUE(condition) \
GTEST_TEST_BOOLEAN_((condition), #condition, false, true, \ GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
GTEST_FATAL_FAILURE_) GTEST_FATAL_FAILURE_)
#define ASSERT_FALSE(condition) \ #define ASSERT_FALSE(condition) \
GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
GTEST_FATAL_FAILURE_) GTEST_FATAL_FAILURE_)
// Includes the auto-generated header that implements a family of
// generic predicate assertion macros.
#include "gtest/gtest_pred_impl.h"
// Macros for testing equalities and inequalities. // Macros for testing equalities and inequalities.
// //
// * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2 // * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2
@@ -1914,8 +1958,8 @@ class TestWithParam : public Test, public WithParamInterface<T> {
// //
// Examples: // Examples:
// //
// EXPECT_NE(5, Foo()); // EXPECT_NE(Foo(), 5);
// EXPECT_EQ(NULL, a_pointer); // EXPECT_EQ(a_pointer, NULL);
// ASSERT_LT(i, array_size); // ASSERT_LT(i, array_size);
// ASSERT_GT(records.size(), 0) << "There is no record left."; // ASSERT_GT(records.size(), 0) << "There is no record left.";
@@ -2101,6 +2145,57 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
#define EXPECT_NO_FATAL_FAILURE(statement) \ #define EXPECT_NO_FATAL_FAILURE(statement) \
GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_) GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
// Causes a trace (including the given source file path and line number,
// and the given message) to be included in every test failure message generated
// by code in the scope of the lifetime of an instance of this class. The effect
// is undone with the destruction of the instance.
//
// The message argument can be anything streamable to std::ostream.
//
// Example:
// testing::ScopedTrace trace("file.cc", 123, "message");
//
class GTEST_API_ ScopedTrace {
public:
// The c'tor pushes the given source file location and message onto
// a trace stack maintained by Google Test.
// Template version. Uses Message() to convert the values into strings.
// Slow, but flexible.
template <typename T>
ScopedTrace(const char* file, int line, const T& message) {
PushTrace(file, line, (Message() << message).GetString());
}
// Optimize for some known types.
ScopedTrace(const char* file, int line, const char* message) {
PushTrace(file, line, message ? message : "(null)");
}
#if GTEST_HAS_GLOBAL_STRING
ScopedTrace(const char* file, int line, const ::string& message) {
PushTrace(file, line, message);
}
#endif
ScopedTrace(const char* file, int line, const std::string& message) {
PushTrace(file, line, message);
}
// The d'tor pops the info pushed by the c'tor.
//
// Note that the d'tor is not virtual in order to be efficient.
// Don't inherit from ScopedTrace!
~ScopedTrace();
private:
void PushTrace(const char* file, int line, std::string message);
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
// c'tor and d'tor. Therefore it doesn't
// need to be used otherwise.
// Causes a trace (including the source file path, the current line // Causes a trace (including the source file path, the current line
// number, and the given message) to be included in every test failure // number, and the given message) to be included in every test failure
// message generated by code in the current scope. The effect is // message generated by code in the current scope. The effect is
@@ -2112,9 +2207,14 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s // of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
// to appear in the same block - as long as they are on different // to appear in the same block - as long as they are on different
// lines. // lines.
//
// Assuming that each thread maintains its own stack of traces.
// Therefore, a SCOPED_TRACE() would (correctly) only affect the
// assertions in its own thread.
#define SCOPED_TRACE(message) \ #define SCOPED_TRACE(message) \
::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\ ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
__FILE__, __LINE__, ::testing::Message() << (message)) __FILE__, __LINE__, (message))
// Compile-time assertion for type equality. // Compile-time assertion for type equality.
// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are // StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
@@ -2194,7 +2294,7 @@ bool StaticAssertTypeEq() {
// name of the test within the test case. // name of the test within the test case.
// //
// A test fixture class must be declared earlier. The user should put // A test fixture class must be declared earlier. The user should put
// his test code between braces after using this macro. Example: // the test code between braces after using this macro. Example:
// //
// class FooTest : public testing::Test { // class FooTest : public testing::Test {
// protected: // protected:
@@ -2209,14 +2309,22 @@ bool StaticAssertTypeEq() {
// } // }
// //
// TEST_F(FooTest, ReturnsElementCountCorrectly) { // TEST_F(FooTest, ReturnsElementCountCorrectly) {
// EXPECT_EQ(0, a_.size()); // EXPECT_EQ(a_.size(), 0);
// EXPECT_EQ(1, b_.size()); // EXPECT_EQ(b_.size(), 1);
// } // }
#define TEST_F(test_fixture, test_name)\ #define TEST_F(test_fixture, test_name)\
GTEST_TEST_(test_fixture, test_name, test_fixture, \ GTEST_TEST_(test_fixture, test_name, test_fixture, \
::testing::internal::GetTypeId<test_fixture>()) ::testing::internal::GetTypeId<test_fixture>())
// Returns a path to temporary directory.
// Tries to determine an appropriate directory for the platform.
GTEST_API_ std::string TempDir();
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace testing } // namespace testing
// Use this function in main() to run all tests. It returns 0 if all // Use this function in main() to run all tests. It returns 0 if all
@@ -2233,4 +2341,6 @@ inline int RUN_ALL_TESTS() {
return ::testing::UnitTest::GetInstance()->Run(); return ::testing::UnitTest::GetInstance()->Run();
} }
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
#endif // GTEST_INCLUDE_GTEST_GTEST_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_H_

View File

@@ -27,18 +27,19 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command // This file is AUTOMATICALLY GENERATED on 01/02/2018 by command
// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND! // 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
// //
// Implements a family of generic predicate assertion macros. // Implements a family of generic predicate assertion macros.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ #define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
// Makes sure this header is not included before gtest.h. #include "gtest/gtest.h"
#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
# error Do not include gtest_pred_impl.h directly. Include gtest.h instead. namespace testing {
#endif // GTEST_INCLUDE_GTEST_GTEST_H_
// This header implements a family of generic predicate assertion // This header implements a family of generic predicate assertion
// macros: // macros:
@@ -66,8 +67,6 @@
// We also define the EXPECT_* variations. // We also define the EXPECT_* variations.
// //
// For now we only support predicates whose arity is at most 5. // For now we only support predicates whose arity is at most 5.
// Please email googletestframework@googlegroups.com if you need
// support for higher arities.
// GTEST_ASSERT_ is the basic statement to which all of the assertions // GTEST_ASSERT_ is the basic statement to which all of the assertions
// in this file reduce. Don't use this in your code. // in this file reduce. Don't use this in your code.
@@ -355,4 +354,6 @@ AssertionResult AssertPred5Helper(const char* pred_text,
} // namespace testing
#endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_

View File

@@ -26,10 +26,10 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Author: wan@google.com (Zhanyong Wan) // Google C++ Testing and Mocking Framework definitions useful in production code.
// // GOOGLETEST_CM0003 DO NOT DELETE
// Google C++ Testing Framework definitions useful in production code.
#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
@@ -40,17 +40,20 @@
// //
// class MyClass { // class MyClass {
// private: // private:
// void MyMethod(); // void PrivateMethod();
// FRIEND_TEST(MyClassTest, MyMethod); // FRIEND_TEST(MyClassTest, PrivateMethodWorks);
// }; // };
// //
// class MyClassTest : public testing::Test { // class MyClassTest : public testing::Test {
// // ... // // ...
// }; // };
// //
// TEST_F(MyClassTest, MyMethod) { // TEST_F(MyClassTest, PrivateMethodWorks) {
// // Can call MyClass::MyMethod() here. // // Can call MyClass::PrivateMethod() here.
// } // }
//
// Note: The test class must be in the same namespace as the class being tested.
// For example, putting MyClassTest in an anonymous namespace will not work.
#define FRIEND_TEST(test_case_name, test_name)\ #define FRIEND_TEST(test_case_name, test_name)\
friend class test_case_name##_##test_name##_Test friend class test_case_name##_##test_name##_Test

View File

@@ -0,0 +1,56 @@
# Customization Points
The custom directory is an injection point for custom user configurations.
## Header `gtest.h`
### The following macros can be defined:
* `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of
`OsStackTraceGetterInterface`.
* `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See
`testing::TempDir` for semantics and signature.
## Header `gtest-port.h`
The following macros can be defined:
### Flag related macros:
* `GTEST_FLAG(flag_name)`
* `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its
own flagfile flag parsing.
* `GTEST_DECLARE_bool_(name)`
* `GTEST_DECLARE_int32_(name)`
* `GTEST_DECLARE_string_(name)`
* `GTEST_DEFINE_bool_(name, default_val, doc)`
* `GTEST_DEFINE_int32_(name, default_val, doc)`
* `GTEST_DEFINE_string_(name, default_val, doc)`
### Logging:
* `GTEST_LOG_(severity)`
* `GTEST_CHECK_(condition)`
* Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too.
### Threading:
* `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided.
* `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal`
are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)`
and `GTEST_DEFINE_STATIC_MUTEX_(mutex)`
* `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)`
* `GTEST_LOCK_EXCLUDED_(locks)`
### Underlying library support features
* `GTEST_HAS_CXXABI_H_`
### Exporting API symbols:
* `GTEST_API_` - Specifier for exported symbols.
## Header `gtest-printers.h`
* See documentation at `gtest/gtest-printers.h` for details on how to define a
custom printer.

View File

@@ -27,39 +27,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Injection point for custom user configurations. // Injection point for custom user configurations. See README for details
// The following macros can be defined:
//
// Flag related macros:
// GTEST_FLAG(flag_name)
// GTEST_USE_OWN_FLAGFILE_FLAG_ - Define to 0 when the system provides its
// own flagfile flag parsing.
// GTEST_DECLARE_bool_(name)
// GTEST_DECLARE_int32_(name)
// GTEST_DECLARE_string_(name)
// GTEST_DEFINE_bool_(name, default_val, doc)
// GTEST_DEFINE_int32_(name, default_val, doc)
// GTEST_DEFINE_string_(name, default_val, doc)
//
// Test filtering:
// GTEST_TEST_FILTER_ENV_VAR_ - The name of an environment variable that
// will be used if --GTEST_FLAG(test_filter)
// is not provided.
//
// Logging:
// GTEST_LOG_(severity)
// GTEST_CHECK_(condition)
// Functions LogToStderr() and FlushInfoLog() have to be provided too.
//
// Threading:
// GTEST_HAS_NOTIFICATION_ - Enabled if Notification is already provided.
// GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Enabled if Mutex and ThreadLocal are
// already provided.
// Must also provide GTEST_DECLARE_STATIC_MUTEX_(mutex) and
// GTEST_DEFINE_STATIC_MUTEX_(mutex)
//
// GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
// GTEST_LOCK_EXCLUDED_(locks)
// //
// ** Custom implementation starts here ** // ** Custom implementation starts here **

View File

@@ -31,8 +31,8 @@
// installation of gTest. // installation of gTest.
// It will be included from gtest-printers.h and the overrides in this file // It will be included from gtest-printers.h and the overrides in this file
// will be visible to everyone. // will be visible to everyone.
// See documentation at gtest/gtest-printers.h for details on how to define a //
// custom printer. // Injection point for custom user configurations. See README for details
// //
// ** Custom implementation starts here ** // ** Custom implementation starts here **

View File

@@ -27,11 +27,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Injection point for custom user configurations. // Injection point for custom user configurations. See README for details
// The following macros can be defined:
//
// GTEST_OS_STACK_TRACE_GETTER_ - The name of an implementation of
// OsStackTraceGetterInterface.
// //
// ** Custom implementation starts here ** // ** Custom implementation starts here **

View File

@@ -27,12 +27,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee) // The Google C++ Testing and Mocking Framework (Google Test)
//
// The Google C++ Testing Framework (Google Test)
// //
// This header file defines internal utilities needed for implementing // This header file defines internal utilities needed for implementing
// death tests. They are subject to change without notice. // death tests. They are subject to change without notice.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
@@ -53,6 +52,9 @@ const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
#if GTEST_HAS_DEATH_TEST #if GTEST_HAS_DEATH_TEST
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
/* class A needs to have dll-interface to be used by clients of class B */)
// DeathTest is a class that hides much of the complexity of the // DeathTest is a class that hides much of the complexity of the
// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method // GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
// returns a concrete class that depends on the prevailing death test // returns a concrete class that depends on the prevailing death test
@@ -136,6 +138,8 @@ class GTEST_API_ DeathTest {
GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest); GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
}; };
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
// Factory interface for death tests. May be mocked out for testing. // Factory interface for death tests. May be mocked out for testing.
class DeathTestFactory { class DeathTestFactory {
public: public:
@@ -218,13 +222,17 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
// can be streamed. // can be streamed.
// This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in // This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
// NDEBUG mode. In this case we need the statements to be executed, the regex is // NDEBUG mode. In this case we need the statements to be executed and the macro
// ignored, and the macro must accept a streamed message even though the message // must accept a streamed message even though the message is never printed.
// is never printed. // The regex object is not evaluated, but it is used to prevent "unused"
// warnings and to avoid an expression that doesn't compile in debug mode.
#define GTEST_EXECUTE_STATEMENT_(statement, regex) \ #define GTEST_EXECUTE_STATEMENT_(statement, regex) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::testing::internal::AlwaysTrue()) { \ if (::testing::internal::AlwaysTrue()) { \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} else if (!::testing::internal::AlwaysTrue()) { \
const ::testing::internal::RE& gtest_regex = (regex); \
static_cast<void>(gtest_regex); \
} else \ } else \
::testing::Message() ::testing::Message()
@@ -264,53 +272,6 @@ class InternalRunDeathTestFlag {
// the flag is specified; otherwise returns NULL. // the flag is specified; otherwise returns NULL.
InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag(); InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
#else // GTEST_HAS_DEATH_TEST
// This macro is used for implementing macros such as
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
// death tests are not supported. Those macros must compile on such systems
// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
// systems that support death tests. This allows one to write such a macro
// on a system that does not support death tests and be sure that it will
// compile on a death-test supporting system.
//
// Parameters:
// statement - A statement that a macro such as EXPECT_DEATH would test
// for program termination. This macro has to make sure this
// statement is compiled but not executed, to ensure that
// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
// parameter iff EXPECT_DEATH compiles with it.
// regex - A regex that a macro such as EXPECT_DEATH would use to test
// the output of statement. This parameter has to be
// compiled but not evaluated by this macro, to ensure that
// this macro only accepts expressions that a macro such as
// EXPECT_DEATH would accept.
// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
// and a return statement for ASSERT_DEATH_IF_SUPPORTED.
// This ensures that ASSERT_DEATH_IF_SUPPORTED will not
// compile inside functions where ASSERT_DEATH doesn't
// compile.
//
// The branch that has an always false condition is used to ensure that
// statement and regex are compiled (and thus syntactically correct) but
// never executed. The unreachable code macro protects the terminator
// statement from generating an 'unreachable code' warning in case
// statement unconditionally returns or throws. The Message constructor at
// the end allows the syntax of streaming additional messages into the
// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
# define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::testing::internal::AlwaysTrue()) { \
GTEST_LOG_(WARNING) \
<< "Death tests are not supported on this platform.\n" \
<< "Statement '" #statement "' cannot be verified."; \
} else if (::testing::internal::AlwaysFalse()) { \
::testing::internal::RE::PartialMatch(".*", (regex)); \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
terminator; \
} else \
::testing::Message()
#endif // GTEST_HAS_DEATH_TEST #endif // GTEST_HAS_DEATH_TEST
} // namespace internal } // namespace internal

View File

@@ -27,21 +27,24 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Author: keith.ray@gmail.com (Keith Ray)
//
// Google Test filepath utilities // Google Test filepath utilities
// //
// This header file declares classes and functions used internally by // This header file declares classes and functions used internally by
// Google Test. They are subject to change without notice. // Google Test. They are subject to change without notice.
// //
// This file is #included in <gtest/internal/gtest-internal.h>. // This file is #included in gtest/internal/gtest-internal.h.
// Do not include this header file separately! // Do not include this header file separately!
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
#include "gtest/internal/gtest-string.h" #include "gtest/internal/gtest-string.h"
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
/* class A needs to have dll-interface to be used by clients of class B */)
namespace testing { namespace testing {
namespace internal { namespace internal {
@@ -203,4 +206,6 @@ class GTEST_API_ FilePath {
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_

View File

@@ -27,13 +27,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee) // The Google C++ Testing and Mocking Framework (Google Test)
//
// The Google C++ Testing Framework (Google Test)
// //
// This header file declares functions and macros used internally by // This header file declares functions and macros used internally by
// Google Test. They are subject to change without notice. // Google Test. They are subject to change without notice.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
@@ -61,8 +61,8 @@
#include <vector> #include <vector>
#include "gtest/gtest-message.h" #include "gtest/gtest-message.h"
#include "gtest/internal/gtest-string.h"
#include "gtest/internal/gtest-filepath.h" #include "gtest/internal/gtest-filepath.h"
#include "gtest/internal/gtest-string.h"
#include "gtest/internal/gtest-type-util.h" #include "gtest/internal/gtest-type-util.h"
// Due to C++ preprocessor weirdness, we need double indirection to // Due to C++ preprocessor weirdness, we need double indirection to
@@ -76,6 +76,9 @@
#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar) #define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar #define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
// Stringifies its argument.
#define GTEST_STRINGIFY_(name) #name
class ProtocolMessage; class ProtocolMessage;
namespace proto2 { class Message; } namespace proto2 { class Message; }
@@ -96,7 +99,6 @@ template <typename T>
namespace internal { namespace internal {
struct TraceInfo; // Information about a trace point. struct TraceInfo; // Information about a trace point.
class ScopedTrace; // Implements scoped trace.
class TestInfoImpl; // Opaque implementation of TestInfo class TestInfoImpl; // Opaque implementation of TestInfo
class UnitTestImpl; // Opaque implementation of UnitTest class UnitTestImpl; // Opaque implementation of UnitTest
@@ -139,6 +141,9 @@ GTEST_API_ std::string AppendUserMessage(
#if GTEST_HAS_EXCEPTIONS #if GTEST_HAS_EXCEPTIONS
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4275 \
/* an exported class was derived from a class that was not exported */)
// This exception is thrown by (and only by) a failed Google Test // This exception is thrown by (and only by) a failed Google Test
// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions // assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
// are enabled). We derive it from std::runtime_error, which is for // are enabled). We derive it from std::runtime_error, which is for
@@ -150,32 +155,15 @@ class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
explicit GoogleTestFailureException(const TestPartResult& failure); explicit GoogleTestFailureException(const TestPartResult& failure);
}; };
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4275
#endif // GTEST_HAS_EXCEPTIONS #endif // GTEST_HAS_EXCEPTIONS
// A helper class for creating scoped traces in user programs.
class GTEST_API_ ScopedTrace {
public:
// The c'tor pushes the given source file location and message onto
// a trace stack maintained by Google Test.
ScopedTrace(const char* file, int line, const Message& message);
// The d'tor pops the info pushed by the c'tor.
//
// Note that the d'tor is not virtual in order to be efficient.
// Don't inherit from ScopedTrace!
~ScopedTrace();
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
// c'tor and d'tor. Therefore it doesn't
// need to be used otherwise.
namespace edit_distance { namespace edit_distance {
// Returns the optimal edits to go from 'left' to 'right'. // Returns the optimal edits to go from 'left' to 'right'.
// All edits cost the same, with replace having lower priority than // All edits cost the same, with replace having lower priority than
// add/remove. // add/remove.
// Simple implementation of the WagnerFischer algorithm. // Simple implementation of the Wagner-Fischer algorithm.
// See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm // See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm
enum EditType { kMatch, kAdd, kRemove, kReplace }; enum EditType { kMatch, kAdd, kRemove, kReplace };
GTEST_API_ std::vector<EditType> CalculateOptimalEdits( GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
@@ -502,9 +490,10 @@ typedef void (*SetUpTestCaseFunc)();
typedef void (*TearDownTestCaseFunc)(); typedef void (*TearDownTestCaseFunc)();
struct CodeLocation { struct CodeLocation {
CodeLocation(const string& a_file, int a_line) : file(a_file), line(a_line) {} CodeLocation(const std::string& a_file, int a_line)
: file(a_file), line(a_line) {}
string file; std::string file;
int line; int line;
}; };
@@ -544,6 +533,9 @@ GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
/* class A needs to have dll-interface to be used by clients of class B */)
// State of the definition of a type-parameterized test case. // State of the definition of a type-parameterized test case.
class GTEST_API_ TypedTestCasePState { class GTEST_API_ TypedTestCasePState {
public: public:
@@ -589,6 +581,8 @@ class GTEST_API_ TypedTestCasePState {
RegisteredTestsMap registered_tests_; RegisteredTestsMap registered_tests_;
}; };
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
// Skips to the first non-space char after the first comma in 'str'; // Skips to the first non-space char after the first comma in 'str';
// returns NULL if no comma is found in 'str'. // returns NULL if no comma is found in 'str'.
inline const char* SkipComma(const char* str) { inline const char* SkipComma(const char* str) {
@@ -612,6 +606,37 @@ inline std::string GetPrefixUntilComma(const char* str) {
void SplitString(const ::std::string& str, char delimiter, void SplitString(const ::std::string& str, char delimiter,
::std::vector< ::std::string>* dest); ::std::vector< ::std::string>* dest);
// The default argument to the template below for the case when the user does
// not provide a name generator.
struct DefaultNameGenerator {
template <typename T>
static std::string GetName(int i) {
return StreamableToString(i);
}
};
template <typename Provided = DefaultNameGenerator>
struct NameGeneratorSelector {
typedef Provided type;
};
template <typename NameGenerator>
void GenerateNamesRecursively(Types0, std::vector<std::string>*, int) {}
template <typename NameGenerator, typename Types>
void GenerateNamesRecursively(Types, std::vector<std::string>* result, int i) {
result->push_back(NameGenerator::template GetName<typename Types::Head>(i));
GenerateNamesRecursively<NameGenerator>(typename Types::Tail(), result,
i + 1);
}
template <typename NameGenerator, typename Types>
std::vector<std::string> GenerateNames() {
std::vector<std::string> result;
GenerateNamesRecursively<NameGenerator>(Types(), &result, 0);
return result;
}
// TypeParameterizedTest<Fixture, TestSel, Types>::Register() // TypeParameterizedTest<Fixture, TestSel, Types>::Register()
// registers a list of type-parameterized tests with Google Test. The // registers a list of type-parameterized tests with Google Test. The
// return value is insignificant - we just need to return something // return value is insignificant - we just need to return something
@@ -626,10 +651,10 @@ class TypeParameterizedTest {
// specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase, // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,
// Types). Valid values for 'index' are [0, N - 1] where N is the // Types). Valid values for 'index' are [0, N - 1] where N is the
// length of Types. // length of Types.
static bool Register(const char* prefix, static bool Register(const char* prefix, const CodeLocation& code_location,
CodeLocation code_location, const char* case_name, const char* test_names, int index,
const char* case_name, const char* test_names, const std::vector<std::string>& type_names =
int index) { GenerateNames<DefaultNameGenerator, Types>()) {
typedef typename Types::Head Type; typedef typename Types::Head Type;
typedef Fixture<Type> FixtureClass; typedef Fixture<Type> FixtureClass;
typedef typename GTEST_BIND_(TestSel, Type) TestClass; typedef typename GTEST_BIND_(TestSel, Type) TestClass;
@@ -637,20 +662,23 @@ class TypeParameterizedTest {
// First, registers the first type-parameterized test in the type // First, registers the first type-parameterized test in the type
// list. // list.
MakeAndRegisterTestInfo( MakeAndRegisterTestInfo(
(std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + "/" (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name +
+ StreamableToString(index)).c_str(), "/" + type_names[index])
.c_str(),
StripTrailingSpaces(GetPrefixUntilComma(test_names)).c_str(), StripTrailingSpaces(GetPrefixUntilComma(test_names)).c_str(),
GetTypeName<Type>().c_str(), GetTypeName<Type>().c_str(),
NULL, // No value parameter. NULL, // No value parameter.
code_location, code_location, GetTypeId<FixtureClass>(), TestClass::SetUpTestCase,
GetTypeId<FixtureClass>(), TestClass::TearDownTestCase, new TestFactoryImpl<TestClass>);
TestClass::SetUpTestCase,
TestClass::TearDownTestCase,
new TestFactoryImpl<TestClass>);
// Next, recurses (at compile time) with the tail of the type list. // Next, recurses (at compile time) with the tail of the type list.
return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail> return TypeParameterizedTest<Fixture, TestSel,
::Register(prefix, code_location, case_name, test_names, index + 1); typename Types::Tail>::Register(prefix,
code_location,
case_name,
test_names,
index + 1,
type_names);
} }
}; };
@@ -658,9 +686,11 @@ class TypeParameterizedTest {
template <GTEST_TEMPLATE_ Fixture, class TestSel> template <GTEST_TEMPLATE_ Fixture, class TestSel>
class TypeParameterizedTest<Fixture, TestSel, Types0> { class TypeParameterizedTest<Fixture, TestSel, Types0> {
public: public:
static bool Register(const char* /*prefix*/, CodeLocation, static bool Register(const char* /*prefix*/, const CodeLocation&,
const char* /*case_name*/, const char* /*test_names*/, const char* /*case_name*/, const char* /*test_names*/,
int /*index*/) { int /*index*/,
const std::vector<std::string>& =
std::vector<std::string>() /*type_names*/) {
return true; return true;
} }
}; };
@@ -673,8 +703,10 @@ template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
class TypeParameterizedTestCase { class TypeParameterizedTestCase {
public: public:
static bool Register(const char* prefix, CodeLocation code_location, static bool Register(const char* prefix, CodeLocation code_location,
const TypedTestCasePState* state, const TypedTestCasePState* state, const char* case_name,
const char* case_name, const char* test_names) { const char* test_names,
const std::vector<std::string>& type_names =
GenerateNames<DefaultNameGenerator, Types>()) {
std::string test_name = StripTrailingSpaces( std::string test_name = StripTrailingSpaces(
GetPrefixUntilComma(test_names)); GetPrefixUntilComma(test_names));
if (!state->TestExists(test_name)) { if (!state->TestExists(test_name)) {
@@ -691,12 +723,14 @@ class TypeParameterizedTestCase {
// First, register the first test in 'Test' for each type in 'Types'. // First, register the first test in 'Test' for each type in 'Types'.
TypeParameterizedTest<Fixture, Head, Types>::Register( TypeParameterizedTest<Fixture, Head, Types>::Register(
prefix, test_location, case_name, test_names, 0); prefix, test_location, case_name, test_names, 0, type_names);
// Next, recurses (at compile time) with the tail of the test list. // Next, recurses (at compile time) with the tail of the test list.
return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types> return TypeParameterizedTestCase<Fixture, typename Tests::Tail,
::Register(prefix, code_location, state, Types>::Register(prefix, code_location,
case_name, SkipComma(test_names)); state, case_name,
SkipComma(test_names),
type_names);
} }
}; };
@@ -704,9 +738,11 @@ class TypeParameterizedTestCase {
template <GTEST_TEMPLATE_ Fixture, typename Types> template <GTEST_TEMPLATE_ Fixture, typename Types>
class TypeParameterizedTestCase<Fixture, Templates0, Types> { class TypeParameterizedTestCase<Fixture, Templates0, Types> {
public: public:
static bool Register(const char* /*prefix*/, CodeLocation, static bool Register(const char* /*prefix*/, const CodeLocation&,
const TypedTestCasePState* /*state*/, const TypedTestCasePState* /*state*/,
const char* /*case_name*/, const char* /*test_names*/) { const char* /*case_name*/, const char* /*test_names*/,
const std::vector<std::string>& =
std::vector<std::string>() /*type_names*/) {
return true; return true;
} }
}; };
@@ -823,31 +859,6 @@ struct RemoveConst<T[N]> {
#define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \ #define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T)) GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))
// Adds reference to a type if it is not a reference type,
// otherwise leaves it unchanged. This is the same as
// tr1::add_reference, which is not widely available yet.
template <typename T>
struct AddReference { typedef T& type; }; // NOLINT
template <typename T>
struct AddReference<T&> { typedef T& type; }; // NOLINT
// A handy wrapper around AddReference that works when the argument T
// depends on template parameters.
#define GTEST_ADD_REFERENCE_(T) \
typename ::testing::internal::AddReference<T>::type
// Adds a reference to const on top of T as necessary. For example,
// it transforms
//
// char ==> const char&
// const char ==> const char&
// char& ==> const char&
// const char& ==> const char&
//
// The argument T must depend on some template parameters.
#define GTEST_REFERENCE_TO_CONST_(T) \
GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T))
// ImplicitlyConvertible<From, To>::value is a compile-time bool // ImplicitlyConvertible<From, To>::value is a compile-time bool
// constant that's true iff type From can be implicitly converted to // constant that's true iff type From can be implicitly converted to
// type To. // type To.
@@ -917,8 +928,11 @@ struct IsAProtocolMessage
// a container class by checking the type of IsContainerTest<C>(0). // a container class by checking the type of IsContainerTest<C>(0).
// The value of the expression is insignificant. // The value of the expression is insignificant.
// //
// Note that we look for both C::iterator and C::const_iterator. The // In C++11 mode we check the existence of a const_iterator and that an
// reason is that C++ injects the name of a class as a member of the // iterator is properly implemented for the container.
//
// For pre-C++11 that we look for both C::iterator and C::const_iterator.
// The reason is that C++ injects the name of a class as a member of the
// class itself (e.g. you can refer to class iterator as either // class itself (e.g. you can refer to class iterator as either
// 'iterator' or 'iterator::iterator'). If we look for C::iterator // 'iterator' or 'iterator::iterator'). If we look for C::iterator
// only, for example, we would mistakenly think that a class named // only, for example, we would mistakenly think that a class named
@@ -928,17 +942,96 @@ struct IsAProtocolMessage
// IsContainerTest(typename C::const_iterator*) and // IsContainerTest(typename C::const_iterator*) and
// IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++. // IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
typedef int IsContainer; typedef int IsContainer;
#if GTEST_LANG_CXX11
template <class C,
class Iterator = decltype(::std::declval<const C&>().begin()),
class = decltype(::std::declval<const C&>().end()),
class = decltype(++::std::declval<Iterator&>()),
class = decltype(*::std::declval<Iterator>()),
class = typename C::const_iterator>
IsContainer IsContainerTest(int /* dummy */) {
return 0;
}
#else
template <class C> template <class C>
IsContainer IsContainerTest(int /* dummy */, IsContainer IsContainerTest(int /* dummy */,
typename C::iterator* /* it */ = NULL, typename C::iterator* /* it */ = NULL,
typename C::const_iterator* /* const_it */ = NULL) { typename C::const_iterator* /* const_it */ = NULL) {
return 0; return 0;
} }
#endif // GTEST_LANG_CXX11
typedef char IsNotContainer; typedef char IsNotContainer;
template <class C> template <class C>
IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; } IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
// Trait to detect whether a type T is a hash table.
// The heuristic used is that the type contains an inner type `hasher` and does
// not contain an inner type `reverse_iterator`.
// If the container is iterable in reverse, then order might actually matter.
template <typename T>
struct IsHashTable {
private:
template <typename U>
static char test(typename U::hasher*, typename U::reverse_iterator*);
template <typename U>
static int test(typename U::hasher*, ...);
template <typename U>
static char test(...);
public:
static const bool value = sizeof(test<T>(0, 0)) == sizeof(int);
};
template <typename T>
const bool IsHashTable<T>::value;
template<typename T>
struct VoidT {
typedef void value_type;
};
template <typename T, typename = void>
struct HasValueType : false_type {};
template <typename T>
struct HasValueType<T, VoidT<typename T::value_type> > : true_type {
};
template <typename C,
bool = sizeof(IsContainerTest<C>(0)) == sizeof(IsContainer),
bool = HasValueType<C>::value>
struct IsRecursiveContainerImpl;
template <typename C, bool HV>
struct IsRecursiveContainerImpl<C, false, HV> : public false_type {};
// Since the IsRecursiveContainerImpl depends on the IsContainerTest we need to
// obey the same inconsistencies as the IsContainerTest, namely check if
// something is a container is relying on only const_iterator in C++11 and
// is relying on both const_iterator and iterator otherwise
template <typename C>
struct IsRecursiveContainerImpl<C, true, false> : public false_type {};
template <typename C>
struct IsRecursiveContainerImpl<C, true, true> {
#if GTEST_LANG_CXX11
typedef typename IteratorTraits<typename C::const_iterator>::value_type
value_type;
#else
typedef typename IteratorTraits<typename C::iterator>::value_type value_type;
#endif
typedef is_same<value_type, C> type;
};
// IsRecursiveContainer<Type> is a unary compile-time predicate that
// evaluates whether C is a recursive container type. A recursive container
// type is a container type whose value_type is equal to the container type
// itself. An example for a recursive container type is
// boost::filesystem::path, whose iterator has a value_type that is equal to
// boost::filesystem::path.
template <typename C>
struct IsRecursiveContainer : public IsRecursiveContainerImpl<C>::type {};
// EnableIf<condition>::type is void when 'Cond' is true, and // EnableIf<condition>::type is void when 'Cond' is true, and
// undefined when 'Cond' is false. To use SFINAE to make a function // undefined when 'Cond' is false. To use SFINAE to make a function
// overload only apply when a particular expression is true, add // overload only apply when a particular expression is true, add
@@ -1070,7 +1163,7 @@ class NativeArray {
private: private:
enum { enum {
kCheckTypeIsNotConstOrAReference = StaticAssertTypeEqHelper< kCheckTypeIsNotConstOrAReference = StaticAssertTypeEqHelper<
Element, GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>::value, Element, GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>::value
}; };
// Initializes this object with a copy of the input. // Initializes this object with a copy of the input.
@@ -1115,7 +1208,7 @@ class NativeArray {
#define GTEST_SUCCESS_(message) \ #define GTEST_SUCCESS_(message) \
GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess) GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
// Suppresses MSVC warnings 4072 (unreachable code) for the code following // Suppress MSVC warning 4702 (unreachable code) for the code following
// statement if it returns or throws (or doesn't return or throw in some // statement if it returns or throws (or doesn't return or throw in some
// situations). // situations).
#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \ #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
@@ -1235,4 +1328,3 @@ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_

View File

@@ -27,8 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Authors: Dan Egnor (egnor@google.com)
//
// A "smart" pointer type with reference tracking. Every pointer to a // A "smart" pointer type with reference tracking. Every pointer to a
// particular object is kept on a circular linked list. When the last pointer // particular object is kept on a circular linked list. When the last pointer
// to an object is destroyed or reassigned, the object is deleted. // to an object is destroyed or reassigned, the object is deleted.
@@ -62,9 +60,11 @@
// raw pointer (e.g. via get()) concurrently, and // raw pointer (e.g. via get()) concurrently, and
// - it's safe to write to two linked_ptrs that point to the same // - it's safe to write to two linked_ptrs that point to the same
// shared object concurrently. // shared object concurrently.
// TODO(wan@google.com): rename this to safe_linked_ptr to avoid // FIXME: rename this to safe_linked_ptr to avoid
// confusion with normal linked_ptr. // confusion with normal linked_ptr.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_

View File

@@ -30,8 +30,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: vladl@google.com (Vlad Losev)
// Type and function utilities for implementing parameterized tests. // Type and function utilities for implementing parameterized tests.
// This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
@@ -43,17 +42,14 @@
// by the maximum arity of the implementation of tuple which is // by the maximum arity of the implementation of tuple which is
// currently set at 10. // currently set at 10.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
// scripts/fuse_gtest.py depends on gtest's own header being #included
// *unconditionally*. Therefore these #includes cannot be moved
// inside #if GTEST_HAS_PARAM_TEST.
#include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util.h"
#include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-port.h"
#if GTEST_HAS_PARAM_TEST
namespace testing { namespace testing {
// Forward declarations of ValuesIn(), which is implemented in // Forward declarations of ValuesIn(), which is implemented in
@@ -84,6 +80,8 @@ class ValueArray1 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray1(const ValueArray1& other) : v1_(other.v1_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray1& other); void operator=(const ValueArray1& other);
@@ -102,6 +100,8 @@ class ValueArray2 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray2(const ValueArray2& other) : v1_(other.v1_), v2_(other.v2_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray2& other); void operator=(const ValueArray2& other);
@@ -122,6 +122,9 @@ class ValueArray3 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray3(const ValueArray3& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray3& other); void operator=(const ValueArray3& other);
@@ -144,6 +147,9 @@ class ValueArray4 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray4(const ValueArray4& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray4& other); void operator=(const ValueArray4& other);
@@ -167,6 +173,9 @@ class ValueArray5 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray5(const ValueArray5& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray5& other); void operator=(const ValueArray5& other);
@@ -193,6 +202,9 @@ class ValueArray6 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray6(const ValueArray6& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray6& other); void operator=(const ValueArray6& other);
@@ -220,6 +232,10 @@ class ValueArray7 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray7(const ValueArray7& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray7& other); void operator=(const ValueArray7& other);
@@ -249,6 +265,10 @@ class ValueArray8 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray8(const ValueArray8& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray8& other); void operator=(const ValueArray8& other);
@@ -280,6 +300,10 @@ class ValueArray9 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray9(const ValueArray9& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray9& other); void operator=(const ValueArray9& other);
@@ -312,6 +336,10 @@ class ValueArray10 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray10(const ValueArray10& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray10& other); void operator=(const ValueArray10& other);
@@ -346,6 +374,11 @@ class ValueArray11 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray11(const ValueArray11& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray11& other); void operator=(const ValueArray11& other);
@@ -382,6 +415,11 @@ class ValueArray12 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray12(const ValueArray12& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray12& other); void operator=(const ValueArray12& other);
@@ -420,6 +458,11 @@ class ValueArray13 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray13(const ValueArray13& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray13& other); void operator=(const ValueArray13& other);
@@ -459,6 +502,11 @@ class ValueArray14 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray14(const ValueArray14& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray14& other); void operator=(const ValueArray14& other);
@@ -500,6 +548,12 @@ class ValueArray15 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray15(const ValueArray15& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray15& other); void operator=(const ValueArray15& other);
@@ -544,6 +598,12 @@ class ValueArray16 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray16(const ValueArray16& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray16& other); void operator=(const ValueArray16& other);
@@ -589,6 +649,12 @@ class ValueArray17 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray17(const ValueArray17& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray17& other); void operator=(const ValueArray17& other);
@@ -636,6 +702,12 @@ class ValueArray18 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray18(const ValueArray18& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray18& other); void operator=(const ValueArray18& other);
@@ -684,6 +756,13 @@ class ValueArray19 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray19(const ValueArray19& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray19& other); void operator=(const ValueArray19& other);
@@ -734,6 +813,13 @@ class ValueArray20 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray20(const ValueArray20& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray20& other); void operator=(const ValueArray20& other);
@@ -787,6 +873,13 @@ class ValueArray21 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray21(const ValueArray21& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray21& other); void operator=(const ValueArray21& other);
@@ -841,6 +934,13 @@ class ValueArray22 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray22(const ValueArray22& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray22& other); void operator=(const ValueArray22& other);
@@ -897,6 +997,14 @@ class ValueArray23 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray23(const ValueArray23& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray23& other); void operator=(const ValueArray23& other);
@@ -955,6 +1063,14 @@ class ValueArray24 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray24(const ValueArray24& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray24& other); void operator=(const ValueArray24& other);
@@ -1014,6 +1130,14 @@ class ValueArray25 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray25(const ValueArray25& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray25& other); void operator=(const ValueArray25& other);
@@ -1075,6 +1199,14 @@ class ValueArray26 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray26(const ValueArray26& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray26& other); void operator=(const ValueArray26& other);
@@ -1139,6 +1271,15 @@ class ValueArray27 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray27(const ValueArray27& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray27& other); void operator=(const ValueArray27& other);
@@ -1204,6 +1345,15 @@ class ValueArray28 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray28(const ValueArray28& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray28& other); void operator=(const ValueArray28& other);
@@ -1270,6 +1420,15 @@ class ValueArray29 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray29(const ValueArray29& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray29& other); void operator=(const ValueArray29& other);
@@ -1339,6 +1498,15 @@ class ValueArray30 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray30(const ValueArray30& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray30& other); void operator=(const ValueArray30& other);
@@ -1410,6 +1578,16 @@ class ValueArray31 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray31(const ValueArray31& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray31& other); void operator=(const ValueArray31& other);
@@ -1482,6 +1660,16 @@ class ValueArray32 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray32(const ValueArray32& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray32& other); void operator=(const ValueArray32& other);
@@ -1557,6 +1745,16 @@ class ValueArray33 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray33(const ValueArray33& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray33& other); void operator=(const ValueArray33& other);
@@ -1633,6 +1831,16 @@ class ValueArray34 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray34(const ValueArray34& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray34& other); void operator=(const ValueArray34& other);
@@ -1710,6 +1918,17 @@ class ValueArray35 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray35(const ValueArray35& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray35& other); void operator=(const ValueArray35& other);
@@ -1790,6 +2009,17 @@ class ValueArray36 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray36(const ValueArray36& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray36& other); void operator=(const ValueArray36& other);
@@ -1872,6 +2102,17 @@ class ValueArray37 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray37(const ValueArray37& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_), v37_(other.v37_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray37& other); void operator=(const ValueArray37& other);
@@ -1955,6 +2196,17 @@ class ValueArray38 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray38(const ValueArray38& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray38& other); void operator=(const ValueArray38& other);
@@ -2040,6 +2292,18 @@ class ValueArray39 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray39(const ValueArray39& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_),
v39_(other.v39_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray39& other); void operator=(const ValueArray39& other);
@@ -2127,6 +2391,18 @@ class ValueArray40 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray40(const ValueArray40& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_),
v39_(other.v39_), v40_(other.v40_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray40& other); void operator=(const ValueArray40& other);
@@ -2216,6 +2492,18 @@ class ValueArray41 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray41(const ValueArray41& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_),
v39_(other.v39_), v40_(other.v40_), v41_(other.v41_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray41& other); void operator=(const ValueArray41& other);
@@ -2307,6 +2595,18 @@ class ValueArray42 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray42(const ValueArray42& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_),
v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray42& other); void operator=(const ValueArray42& other);
@@ -2399,6 +2699,19 @@ class ValueArray43 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray43(const ValueArray43& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_),
v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_),
v43_(other.v43_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray43& other); void operator=(const ValueArray43& other);
@@ -2493,6 +2806,19 @@ class ValueArray44 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray44(const ValueArray44& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_),
v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_),
v43_(other.v43_), v44_(other.v44_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray44& other); void operator=(const ValueArray44& other);
@@ -2589,6 +2915,19 @@ class ValueArray45 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray45(const ValueArray45& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_),
v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_),
v43_(other.v43_), v44_(other.v44_), v45_(other.v45_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray45& other); void operator=(const ValueArray45& other);
@@ -2687,6 +3026,19 @@ class ValueArray46 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray46(const ValueArray46& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_),
v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_),
v43_(other.v43_), v44_(other.v44_), v45_(other.v45_), v46_(other.v46_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray46& other); void operator=(const ValueArray46& other);
@@ -2787,6 +3139,20 @@ class ValueArray47 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray47(const ValueArray47& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_),
v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_),
v43_(other.v43_), v44_(other.v44_), v45_(other.v45_), v46_(other.v46_),
v47_(other.v47_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray47& other); void operator=(const ValueArray47& other);
@@ -2889,6 +3255,20 @@ class ValueArray48 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray48(const ValueArray48& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_),
v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_),
v43_(other.v43_), v44_(other.v44_), v45_(other.v45_), v46_(other.v46_),
v47_(other.v47_), v48_(other.v48_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray48& other); void operator=(const ValueArray48& other);
@@ -2992,6 +3372,20 @@ class ValueArray49 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray49(const ValueArray49& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_),
v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_),
v43_(other.v43_), v44_(other.v44_), v45_(other.v45_), v46_(other.v46_),
v47_(other.v47_), v48_(other.v48_), v49_(other.v49_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray49& other); void operator=(const ValueArray49& other);
@@ -3096,6 +3490,20 @@ class ValueArray50 {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray50(const ValueArray50& other) : v1_(other.v1_), v2_(other.v2_),
v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_),
v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_),
v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_),
v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_),
v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_),
v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_),
v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_),
v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_),
v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_),
v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_),
v43_(other.v43_), v44_(other.v44_), v45_(other.v45_), v46_(other.v46_),
v47_(other.v47_), v48_(other.v48_), v49_(other.v49_), v50_(other.v50_) {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray50& other); void operator=(const ValueArray50& other);
@@ -3208,7 +3616,7 @@ class CartesianProductGenerator2
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@@ -3240,7 +3648,7 @@ class CartesianProductGenerator2
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_); current_value_.reset(new ParamType(*current1_, *current2_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@@ -3262,7 +3670,7 @@ class CartesianProductGenerator2
const typename ParamGenerator<T2>::iterator begin2_; const typename ParamGenerator<T2>::iterator begin2_;
const typename ParamGenerator<T2>::iterator end2_; const typename ParamGenerator<T2>::iterator end2_;
typename ParamGenerator<T2>::iterator current2_; typename ParamGenerator<T2>::iterator current2_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator2::Iterator }; // class CartesianProductGenerator2::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@@ -3331,7 +3739,7 @@ class CartesianProductGenerator3
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@@ -3367,7 +3775,7 @@ class CartesianProductGenerator3
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_); current_value_.reset(new ParamType(*current1_, *current2_, *current3_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@@ -3393,7 +3801,7 @@ class CartesianProductGenerator3
const typename ParamGenerator<T3>::iterator begin3_; const typename ParamGenerator<T3>::iterator begin3_;
const typename ParamGenerator<T3>::iterator end3_; const typename ParamGenerator<T3>::iterator end3_;
typename ParamGenerator<T3>::iterator current3_; typename ParamGenerator<T3>::iterator current3_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator3::Iterator }; // class CartesianProductGenerator3::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@@ -3472,7 +3880,7 @@ class CartesianProductGenerator4
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@@ -3512,8 +3920,8 @@ class CartesianProductGenerator4
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_, current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_); *current4_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@@ -3543,7 +3951,7 @@ class CartesianProductGenerator4
const typename ParamGenerator<T4>::iterator begin4_; const typename ParamGenerator<T4>::iterator begin4_;
const typename ParamGenerator<T4>::iterator end4_; const typename ParamGenerator<T4>::iterator end4_;
typename ParamGenerator<T4>::iterator current4_; typename ParamGenerator<T4>::iterator current4_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator4::Iterator }; // class CartesianProductGenerator4::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@@ -3630,7 +4038,7 @@ class CartesianProductGenerator5
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@@ -3674,8 +4082,8 @@ class CartesianProductGenerator5
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_, current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_); *current4_, *current5_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@@ -3709,7 +4117,7 @@ class CartesianProductGenerator5
const typename ParamGenerator<T5>::iterator begin5_; const typename ParamGenerator<T5>::iterator begin5_;
const typename ParamGenerator<T5>::iterator end5_; const typename ParamGenerator<T5>::iterator end5_;
typename ParamGenerator<T5>::iterator current5_; typename ParamGenerator<T5>::iterator current5_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator5::Iterator }; // class CartesianProductGenerator5::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@@ -3807,7 +4215,7 @@ class CartesianProductGenerator6
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@@ -3855,8 +4263,8 @@ class CartesianProductGenerator6
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_, current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_); *current4_, *current5_, *current6_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@@ -3894,7 +4302,7 @@ class CartesianProductGenerator6
const typename ParamGenerator<T6>::iterator begin6_; const typename ParamGenerator<T6>::iterator begin6_;
const typename ParamGenerator<T6>::iterator end6_; const typename ParamGenerator<T6>::iterator end6_;
typename ParamGenerator<T6>::iterator current6_; typename ParamGenerator<T6>::iterator current6_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator6::Iterator }; // class CartesianProductGenerator6::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@@ -4001,7 +4409,7 @@ class CartesianProductGenerator7
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@@ -4053,8 +4461,8 @@ class CartesianProductGenerator7
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_, current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_, *current7_); *current4_, *current5_, *current6_, *current7_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@@ -4096,7 +4504,7 @@ class CartesianProductGenerator7
const typename ParamGenerator<T7>::iterator begin7_; const typename ParamGenerator<T7>::iterator begin7_;
const typename ParamGenerator<T7>::iterator end7_; const typename ParamGenerator<T7>::iterator end7_;
typename ParamGenerator<T7>::iterator current7_; typename ParamGenerator<T7>::iterator current7_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator7::Iterator }; // class CartesianProductGenerator7::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@@ -4214,7 +4622,7 @@ class CartesianProductGenerator8
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@@ -4270,8 +4678,8 @@ class CartesianProductGenerator8
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_, current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_, *current7_, *current8_); *current4_, *current5_, *current6_, *current7_, *current8_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@@ -4317,7 +4725,7 @@ class CartesianProductGenerator8
const typename ParamGenerator<T8>::iterator begin8_; const typename ParamGenerator<T8>::iterator begin8_;
const typename ParamGenerator<T8>::iterator end8_; const typename ParamGenerator<T8>::iterator end8_;
typename ParamGenerator<T8>::iterator current8_; typename ParamGenerator<T8>::iterator current8_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator8::Iterator }; // class CartesianProductGenerator8::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@@ -4443,7 +4851,7 @@ class CartesianProductGenerator9
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@@ -4503,9 +4911,9 @@ class CartesianProductGenerator9
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_, current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_, *current7_, *current8_, *current4_, *current5_, *current6_, *current7_, *current8_,
*current9_); *current9_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@@ -4555,7 +4963,7 @@ class CartesianProductGenerator9
const typename ParamGenerator<T9>::iterator begin9_; const typename ParamGenerator<T9>::iterator begin9_;
const typename ParamGenerator<T9>::iterator end9_; const typename ParamGenerator<T9>::iterator end9_;
typename ParamGenerator<T9>::iterator current9_; typename ParamGenerator<T9>::iterator current9_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator9::Iterator }; // class CartesianProductGenerator9::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@@ -4690,7 +5098,7 @@ class CartesianProductGenerator10
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@@ -4754,9 +5162,9 @@ class CartesianProductGenerator10
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_, current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_, *current7_, *current8_, *current4_, *current5_, *current6_, *current7_, *current8_,
*current9_, *current10_); *current9_, *current10_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@@ -4810,7 +5218,7 @@ class CartesianProductGenerator10
const typename ParamGenerator<T10>::iterator begin10_; const typename ParamGenerator<T10>::iterator begin10_;
const typename ParamGenerator<T10>::iterator end10_; const typename ParamGenerator<T10>::iterator end10_;
typename ParamGenerator<T10>::iterator current10_; typename ParamGenerator<T10>::iterator current10_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator10::Iterator }; // class CartesianProductGenerator10::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@@ -5141,6 +5549,4 @@ CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_

View File

@@ -29,8 +29,7 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: vladl@google.com (Vlad Losev)
// Type and function utilities for implementing parameterized tests. // Type and function utilities for implementing parameterized tests.
// This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
@@ -42,17 +41,14 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
// by the maximum arity of the implementation of tuple which is // by the maximum arity of the implementation of tuple which is
// currently set at $maxtuple. // currently set at $maxtuple.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
// scripts/fuse_gtest.py depends on gtest's own header being #included
// *unconditionally*. Therefore these #includes cannot be moved
// inside #if GTEST_HAS_PARAM_TEST.
#include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util.h"
#include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-port.h"
#if GTEST_HAS_PARAM_TEST
namespace testing { namespace testing {
// Forward declarations of ValuesIn(), which is implemented in // Forward declarations of ValuesIn(), which is implemented in
@@ -87,6 +83,8 @@ class ValueArray$i {
return ValuesIn(array); return ValuesIn(array);
} }
ValueArray$i(const ValueArray$i& other) : $for j, [[v$(j)_(other.v$(j)_)]] {}
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray$i& other); void operator=(const ValueArray$i& other);
@@ -165,7 +163,7 @@ $for k [[
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@@ -197,7 +195,7 @@ $for k [[
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType($for j, [[*current$(j)_]]); current_value_.reset(new ParamType($for j, [[*current$(j)_]]));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@@ -222,7 +220,7 @@ $for j [[
typename ParamGenerator<T$j>::iterator current$(j)_; typename ParamGenerator<T$j>::iterator current$(j)_;
]] ]]
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator$i::Iterator }; // class CartesianProductGenerator$i::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@@ -281,6 +279,4 @@ $for j [[
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_

View File

@@ -26,11 +26,12 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: vladl@google.com (Vlad Losev)
// Type and function utilities for implementing parameterized tests. // Type and function utilities for implementing parameterized tests.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
@@ -41,16 +42,11 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
// scripts/fuse_gtest.py depends on gtest's own header being #included
// *unconditionally*. Therefore these #includes cannot be moved
// inside #if GTEST_HAS_PARAM_TEST.
#include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-linked_ptr.h" #include "gtest/internal/gtest-linked_ptr.h"
#include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-port.h"
#include "gtest/gtest-printers.h" #include "gtest/gtest-printers.h"
#if GTEST_HAS_PARAM_TEST
namespace testing { namespace testing {
// Input to a parameterized test name generator, describing a test parameter. // Input to a parameterized test name generator, describing a test parameter.
@@ -472,7 +468,7 @@ class ParameterizedTestCaseInfoBase {
virtual ~ParameterizedTestCaseInfoBase() {} virtual ~ParameterizedTestCaseInfoBase() {}
// Base part of test case name for display purposes. // Base part of test case name for display purposes.
virtual const string& GetTestCaseName() const = 0; virtual const std::string& GetTestCaseName() const = 0;
// Test case id to verify identity. // Test case id to verify identity.
virtual TypeId GetTestCaseTypeId() const = 0; virtual TypeId GetTestCaseTypeId() const = 0;
// UnitTest class invokes this method to register tests in this // UnitTest class invokes this method to register tests in this
@@ -511,7 +507,7 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
: test_case_name_(name), code_location_(code_location) {} : test_case_name_(name), code_location_(code_location) {}
// Test case base name for display purposes. // Test case base name for display purposes.
virtual const string& GetTestCaseName() const { return test_case_name_; } virtual const std::string& GetTestCaseName() const { return test_case_name_; }
// Test case id to verify identity. // Test case id to verify identity.
virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); } virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }
// TEST_P macro uses AddTestPattern() to record information // TEST_P macro uses AddTestPattern() to record information
@@ -529,11 +525,10 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
} }
// INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information
// about a generator. // about a generator.
int AddTestCaseInstantiation(const string& instantiation_name, int AddTestCaseInstantiation(const std::string& instantiation_name,
GeneratorCreationFunc* func, GeneratorCreationFunc* func,
ParamNameGeneratorFunc* name_func, ParamNameGeneratorFunc* name_func,
const char* file, const char* file, int line) {
int line) {
instantiations_.push_back( instantiations_.push_back(
InstantiationInfo(instantiation_name, func, name_func, file, line)); InstantiationInfo(instantiation_name, func, name_func, file, line));
return 0; // Return value used only to run this method in namespace scope. return 0; // Return value used only to run this method in namespace scope.
@@ -550,13 +545,13 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
for (typename InstantiationContainer::iterator gen_it = for (typename InstantiationContainer::iterator gen_it =
instantiations_.begin(); gen_it != instantiations_.end(); instantiations_.begin(); gen_it != instantiations_.end();
++gen_it) { ++gen_it) {
const string& instantiation_name = gen_it->name; const std::string& instantiation_name = gen_it->name;
ParamGenerator<ParamType> generator((*gen_it->generator)()); ParamGenerator<ParamType> generator((*gen_it->generator)());
ParamNameGeneratorFunc* name_func = gen_it->name_func; ParamNameGeneratorFunc* name_func = gen_it->name_func;
const char* file = gen_it->file; const char* file = gen_it->file;
int line = gen_it->line; int line = gen_it->line;
string test_case_name; std::string test_case_name;
if ( !instantiation_name.empty() ) if ( !instantiation_name.empty() )
test_case_name = instantiation_name + "/"; test_case_name = instantiation_name + "/";
test_case_name += test_info->test_case_base_name; test_case_name += test_info->test_case_base_name;
@@ -609,8 +604,8 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
test_base_name(a_test_base_name), test_base_name(a_test_base_name),
test_meta_factory(a_test_meta_factory) {} test_meta_factory(a_test_meta_factory) {}
const string test_case_base_name; const std::string test_case_base_name;
const string test_base_name; const std::string test_base_name;
const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory; const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
}; };
typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer; typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;
@@ -651,7 +646,7 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
return true; return true;
} }
const string test_case_name_; const std::string test_case_name_;
CodeLocation code_location_; CodeLocation code_location_;
TestInfoContainer tests_; TestInfoContainer tests_;
InstantiationContainer instantiations_; InstantiationContainer instantiations_;
@@ -726,6 +721,4 @@ class ParameterizedTestCaseRegistry {
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_

View File

@@ -27,7 +27,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// The Google C++ Testing Framework (Google Test) // The Google C++ Testing and Mocking Framework (Google Test)
// //
// This header file defines the GTEST_OS_* macro. // This header file defines the GTEST_OS_* macro.
// It is separate from gtest-port.h so that custom/gtest-port.h can include it. // It is separate from gtest-port.h so that custom/gtest-port.h can include it.
@@ -54,6 +54,9 @@
# define GTEST_OS_WINDOWS_PHONE 1 # define GTEST_OS_WINDOWS_PHONE 1
# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
# define GTEST_OS_WINDOWS_RT 1 # define GTEST_OS_WINDOWS_RT 1
# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)
# define GTEST_OS_WINDOWS_PHONE 1
# define GTEST_OS_WINDOWS_TV_TITLE 1
# else # else
// WINAPI_FAMILY defined but no known partition matched. // WINAPI_FAMILY defined but no known partition matched.
// Default to desktop. // Default to desktop.
@@ -69,6 +72,8 @@
# endif # endif
#elif defined __FreeBSD__ #elif defined __FreeBSD__
# define GTEST_OS_FREEBSD 1 # define GTEST_OS_FREEBSD 1
#elif defined __Fuchsia__
# define GTEST_OS_FUCHSIA 1
#elif defined __linux__ #elif defined __linux__
# define GTEST_OS_LINUX 1 # define GTEST_OS_LINUX 1
# if defined __ANDROID__ # if defined __ANDROID__
@@ -84,6 +89,8 @@
# define GTEST_OS_HPUX 1 # define GTEST_OS_HPUX 1
#elif defined __native_client__ #elif defined __native_client__
# define GTEST_OS_NACL 1 # define GTEST_OS_NACL 1
#elif defined __NetBSD__
# define GTEST_OS_NETBSD 1
#elif defined __OpenBSD__ #elif defined __OpenBSD__
# define GTEST_OS_OPENBSD 1 # define GTEST_OS_OPENBSD 1
#elif defined __QNX__ #elif defined __QNX__

View File

@@ -27,8 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Authors: wan@google.com (Zhanyong Wan)
//
// Low-level types and utilities for porting Google Test to various // Low-level types and utilities for porting Google Test to various
// platforms. All macros ending with _ and symbols defined in an // platforms. All macros ending with _ and symbols defined in an
// internal namespace are subject to change without notice. Code // internal namespace are subject to change without notice. Code
@@ -40,6 +38,8 @@
// files are expected to #include this. Therefore, it cannot #include // files are expected to #include this. Therefore, it cannot #include
// any other Google Test header. // any other Google Test header.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
@@ -73,11 +73,9 @@
// GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions // GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions
// are enabled. // are enabled.
// GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string // GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string
// is/isn't available (some systems define // is/isn't available
// ::string, which is different to std::string). // GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::wstring
// GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string // is/isn't available
// is/isn't available (some systems define
// ::wstring, which is different to std::wstring).
// GTEST_HAS_POSIX_RE - Define it to 1/0 to indicate that POSIX regular // GTEST_HAS_POSIX_RE - Define it to 1/0 to indicate that POSIX regular
// expressions are/aren't available. // expressions are/aren't available.
// GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h> // GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h>
@@ -109,6 +107,12 @@
// GTEST_CREATE_SHARED_LIBRARY // GTEST_CREATE_SHARED_LIBRARY
// - Define to 1 when compiling Google Test itself // - Define to 1 when compiling Google Test itself
// as a shared library. // as a shared library.
// GTEST_DEFAULT_DEATH_TEST_STYLE
// - The default value of --gtest_death_test_style.
// The legacy default has been "fast" in the open
// source version since 2008. The recommended value
// is "threadsafe", and can be set in
// custom/gtest-port.h.
// Platform-indicating macros // Platform-indicating macros
// -------------------------- // --------------------------
@@ -122,12 +126,14 @@
// GTEST_OS_AIX - IBM AIX // GTEST_OS_AIX - IBM AIX
// GTEST_OS_CYGWIN - Cygwin // GTEST_OS_CYGWIN - Cygwin
// GTEST_OS_FREEBSD - FreeBSD // GTEST_OS_FREEBSD - FreeBSD
// GTEST_OS_FUCHSIA - Fuchsia
// GTEST_OS_HPUX - HP-UX // GTEST_OS_HPUX - HP-UX
// GTEST_OS_LINUX - Linux // GTEST_OS_LINUX - Linux
// GTEST_OS_LINUX_ANDROID - Google Android // GTEST_OS_LINUX_ANDROID - Google Android
// GTEST_OS_MAC - Mac OS X // GTEST_OS_MAC - Mac OS X
// GTEST_OS_IOS - iOS // GTEST_OS_IOS - iOS
// GTEST_OS_NACL - Google Native Client (NaCl) // GTEST_OS_NACL - Google Native Client (NaCl)
// GTEST_OS_NETBSD - NetBSD
// GTEST_OS_OPENBSD - OpenBSD // GTEST_OS_OPENBSD - OpenBSD
// GTEST_OS_QNX - QNX // GTEST_OS_QNX - QNX
// GTEST_OS_SOLARIS - Sun Solaris // GTEST_OS_SOLARIS - Sun Solaris
@@ -169,15 +175,15 @@
// GTEST_HAS_COMBINE - the Combine() function (for value-parameterized // GTEST_HAS_COMBINE - the Combine() function (for value-parameterized
// tests) // tests)
// GTEST_HAS_DEATH_TEST - death tests // GTEST_HAS_DEATH_TEST - death tests
// GTEST_HAS_PARAM_TEST - value-parameterized tests
// GTEST_HAS_TYPED_TEST - typed tests // GTEST_HAS_TYPED_TEST - typed tests
// GTEST_HAS_TYPED_TEST_P - type-parameterized tests // GTEST_HAS_TYPED_TEST_P - type-parameterized tests
// GTEST_IS_THREADSAFE - Google Test is thread-safe. // GTEST_IS_THREADSAFE - Google Test is thread-safe.
// GOOGLETEST_CM0007 DO NOT DELETE
// GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse with // GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse with
// GTEST_HAS_POSIX_RE (see above) which users can // GTEST_HAS_POSIX_RE (see above) which users can
// define themselves. // define themselves.
// GTEST_USES_SIMPLE_RE - our own simple regex is used; // GTEST_USES_SIMPLE_RE - our own simple regex is used;
// the above two are mutually exclusive. // the above RE\b(s) are mutually exclusive.
// GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ(). // GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
// Misc public macros // Misc public macros
@@ -206,6 +212,7 @@
// //
// C++11 feature wrappers: // C++11 feature wrappers:
// //
// testing::internal::forward - portability wrapper for std::forward.
// testing::internal::move - portability wrapper for std::move. // testing::internal::move - portability wrapper for std::move.
// //
// Synchronization: // Synchronization:
@@ -222,10 +229,10 @@
// //
// Regular expressions: // Regular expressions:
// RE - a simple regular expression class using the POSIX // RE - a simple regular expression class using the POSIX
// Extended Regular Expression syntax on UNIX-like // Extended Regular Expression syntax on UNIX-like platforms
// platforms, or a reduced regular exception syntax on // GOOGLETEST_CM0008 DO NOT DELETE
// other platforms, including Windows. // or a reduced regular exception syntax on other
// // platforms, including Windows.
// Logging: // Logging:
// GTEST_LOG_() - logs messages at the specified severity level. // GTEST_LOG_() - logs messages at the specified severity level.
// LogToStderr() - directs all log messages to stderr. // LogToStderr() - directs all log messages to stderr.
@@ -271,10 +278,12 @@
# include <TargetConditionals.h> # include <TargetConditionals.h>
#endif #endif
// Brings in the definition of HAS_GLOBAL_STRING. This must be done
// BEFORE we test HAS_GLOBAL_STRING.
#include <string> // NOLINT
#include <algorithm> // NOLINT #include <algorithm> // NOLINT
#include <iostream> // NOLINT #include <iostream> // NOLINT
#include <sstream> // NOLINT #include <sstream> // NOLINT
#include <string> // NOLINT
#include <utility> #include <utility>
#include <vector> // NOLINT #include <vector> // NOLINT
@@ -306,7 +315,7 @@
// GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385) // GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385)
// /* code that triggers warnings C4800 and C4385 */ // /* code that triggers warnings C4800 and C4385 */
// GTEST_DISABLE_MSC_WARNINGS_POP_() // GTEST_DISABLE_MSC_WARNINGS_POP_()
#if _MSC_VER >= 1500 #if _MSC_VER >= 1400
# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \ # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \
__pragma(warning(push)) \ __pragma(warning(push)) \
__pragma(warning(disable: warnings)) __pragma(warning(disable: warnings))
@@ -318,12 +327,28 @@
# define GTEST_DISABLE_MSC_WARNINGS_POP_() # define GTEST_DISABLE_MSC_WARNINGS_POP_()
#endif #endif
// Clang on Windows does not understand MSVC's pragma warning.
// We need clang-specific way to disable function deprecation warning.
#ifdef __clang__
# define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
_Pragma("clang diagnostic ignored \"-Wdeprecated-implementations\"")
#define GTEST_DISABLE_MSC_DEPRECATED_POP_() \
_Pragma("clang diagnostic pop")
#else
# define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
# define GTEST_DISABLE_MSC_DEPRECATED_POP_() \
GTEST_DISABLE_MSC_WARNINGS_POP_()
#endif
#ifndef GTEST_LANG_CXX11 #ifndef GTEST_LANG_CXX11
// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when // gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
// -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a // -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a
// value for __cplusplus, and recent versions of clang, gcc, and // value for __cplusplus, and recent versions of clang, gcc, and
// probably other compilers set that too in C++11 mode. // probably other compilers set that too in C++11 mode.
# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L # if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L || _MSC_VER >= 1900
// Compiling in at least C++11 mode. // Compiling in at least C++11 mode.
# define GTEST_LANG_CXX11 1 # define GTEST_LANG_CXX11 1
# else # else
@@ -355,12 +380,16 @@
#if GTEST_STDLIB_CXX11 #if GTEST_STDLIB_CXX11
# define GTEST_HAS_STD_BEGIN_AND_END_ 1 # define GTEST_HAS_STD_BEGIN_AND_END_ 1
# define GTEST_HAS_STD_FORWARD_LIST_ 1 # define GTEST_HAS_STD_FORWARD_LIST_ 1
# if !defined(_MSC_VER) || (_MSC_FULL_VER >= 190023824)
// works only with VS2015U2 and better
# define GTEST_HAS_STD_FUNCTION_ 1 # define GTEST_HAS_STD_FUNCTION_ 1
# endif
# define GTEST_HAS_STD_INITIALIZER_LIST_ 1 # define GTEST_HAS_STD_INITIALIZER_LIST_ 1
# define GTEST_HAS_STD_MOVE_ 1 # define GTEST_HAS_STD_MOVE_ 1
# define GTEST_HAS_STD_SHARED_PTR_ 1
# define GTEST_HAS_STD_TYPE_TRAITS_ 1
# define GTEST_HAS_STD_UNIQUE_PTR_ 1 # define GTEST_HAS_STD_UNIQUE_PTR_ 1
# define GTEST_HAS_STD_SHARED_PTR_ 1
# define GTEST_HAS_UNORDERED_MAP_ 1
# define GTEST_HAS_UNORDERED_SET_ 1
#endif #endif
// C++11 specifies that <tuple> provides std::tuple. // C++11 specifies that <tuple> provides std::tuple.
@@ -368,7 +397,8 @@
#if GTEST_LANG_CXX11 #if GTEST_LANG_CXX11
# define GTEST_HAS_STD_TUPLE_ 1 # define GTEST_HAS_STD_TUPLE_ 1
# if defined(__clang__) # if defined(__clang__)
// Inspired by http://clang.llvm.org/docs/LanguageExtensions.html#__has_include // Inspired by
// https://clang.llvm.org/docs/LanguageExtensions.html#include-file-checking-macros
# if defined(__has_include) && !__has_include(<tuple>) # if defined(__has_include) && !__has_include(<tuple>)
# undef GTEST_HAS_STD_TUPLE_ # undef GTEST_HAS_STD_TUPLE_
# endif # endif
@@ -380,7 +410,7 @@
# elif defined(__GLIBCXX__) # elif defined(__GLIBCXX__)
// Inspired by boost/config/stdlib/libstdcpp3.hpp, // Inspired by boost/config/stdlib/libstdcpp3.hpp,
// http://gcc.gnu.org/gcc-4.2/changes.html and // http://gcc.gnu.org/gcc-4.2/changes.html and
// http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt01ch01.html#manual.intro.status.standard.200x // https://web.archive.org/web/20140227044429/gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt01ch01.html#manual.intro.status.standard.200x
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2) # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
# undef GTEST_HAS_STD_TUPLE_ # undef GTEST_HAS_STD_TUPLE_
# endif # endif
@@ -396,10 +426,16 @@
# include <io.h> # include <io.h>
# endif # endif
// In order to avoid having to include <windows.h>, use forward declaration // In order to avoid having to include <windows.h>, use forward declaration
// assuming CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION. #if GTEST_OS_WINDOWS_MINGW && !defined(__MINGW64_VERSION_MAJOR)
// MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two
// separate (equivalent) structs, instead of using typedef
typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION;
#else
// Assume CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
// This assumption is verified by // This assumption is verified by
// WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION. // WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
struct _RTL_CRITICAL_SECTION; typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
#endif
#else #else
// This assumes that non-Windows OSes provide unistd.h. For OSes where this // This assumes that non-Windows OSes provide unistd.h. For OSes where this
// is not the case, we need to include headers that provide the functions // is not the case, we need to include headers that provide the functions
@@ -453,8 +489,11 @@ struct _RTL_CRITICAL_SECTION;
#ifndef GTEST_HAS_EXCEPTIONS #ifndef GTEST_HAS_EXCEPTIONS
// The user didn't tell us whether exceptions are enabled, so we need // The user didn't tell us whether exceptions are enabled, so we need
// to figure it out. // to figure it out.
# if defined(_MSC_VER) || defined(__BORLANDC__) # if defined(_MSC_VER) && defined(_CPPUNWIND)
// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS // MSVC defines _CPPUNWIND to 1 iff exceptions are enabled.
# define GTEST_HAS_EXCEPTIONS 1
# elif defined(__BORLANDC__)
// C++Builder's implementation of the STL uses the _HAS_EXCEPTIONS
// macro to enable exceptions, so we'll do the same. // macro to enable exceptions, so we'll do the same.
// Assumes that exceptions are enabled by default. // Assumes that exceptions are enabled by default.
# ifndef _HAS_EXCEPTIONS # ifndef _HAS_EXCEPTIONS
@@ -498,21 +537,17 @@ struct _RTL_CRITICAL_SECTION;
# define GTEST_HAS_STD_STRING 1 # define GTEST_HAS_STD_STRING 1
#elif !GTEST_HAS_STD_STRING #elif !GTEST_HAS_STD_STRING
// The user told us that ::std::string isn't available. // The user told us that ::std::string isn't available.
# error "Google Test cannot be used where ::std::string isn't available." # error "::std::string isn't available."
#endif // !defined(GTEST_HAS_STD_STRING) #endif // !defined(GTEST_HAS_STD_STRING)
#ifndef GTEST_HAS_GLOBAL_STRING #ifndef GTEST_HAS_GLOBAL_STRING
// The user didn't tell us whether ::string is available, so we need
// to figure it out.
# define GTEST_HAS_GLOBAL_STRING 0 # define GTEST_HAS_GLOBAL_STRING 0
#endif // GTEST_HAS_GLOBAL_STRING #endif // GTEST_HAS_GLOBAL_STRING
#ifndef GTEST_HAS_STD_WSTRING #ifndef GTEST_HAS_STD_WSTRING
// The user didn't tell us whether ::std::wstring is available, so we need // The user didn't tell us whether ::std::wstring is available, so we need
// to figure it out. // to figure it out.
// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring // FIXME: uses autoconf to detect whether ::std::wstring
// is available. // is available.
// Cygwin 1.7 and below doesn't support ::std::wstring. // Cygwin 1.7 and below doesn't support ::std::wstring.
@@ -600,8 +635,9 @@ struct _RTL_CRITICAL_SECTION;
// //
// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0 // To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
// to your compiler flags. // to your compiler flags.
# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \ #define GTEST_HAS_PTHREAD \
|| GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NACL) (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX || GTEST_OS_QNX || \
GTEST_OS_FREEBSD || GTEST_OS_NACL || GTEST_OS_NETBSD || GTEST_OS_FUCHSIA)
#endif // GTEST_HAS_PTHREAD #endif // GTEST_HAS_PTHREAD
#if GTEST_HAS_PTHREAD #if GTEST_HAS_PTHREAD
@@ -616,7 +652,7 @@ struct _RTL_CRITICAL_SECTION;
// Determines if hash_map/hash_set are available. // Determines if hash_map/hash_set are available.
// Only used for testing against those containers. // Only used for testing against those containers.
#if !defined(GTEST_HAS_HASH_MAP_) #if !defined(GTEST_HAS_HASH_MAP_)
# if _MSC_VER # if defined(_MSC_VER) && (_MSC_VER < 1900)
# define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available. # define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available.
# define GTEST_HAS_HASH_SET_ 1 // Indicates that hash_set is available. # define GTEST_HAS_HASH_SET_ 1 // Indicates that hash_set is available.
# endif // _MSC_VER # endif // _MSC_VER
@@ -629,6 +665,14 @@ struct _RTL_CRITICAL_SECTION;
# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR)
// STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>. // STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>.
# define GTEST_HAS_TR1_TUPLE 0 # define GTEST_HAS_TR1_TUPLE 0
# elif defined(_MSC_VER) && (_MSC_VER >= 1910)
// Prevent `warning C4996: 'std::tr1': warning STL4002:
// The non-Standard std::tr1 namespace and TR1-only machinery
// are deprecated and will be REMOVED.`
# define GTEST_HAS_TR1_TUPLE 0
# elif GTEST_LANG_CXX11 && defined(_LIBCPP_VERSION)
// libc++ doesn't support TR1.
# define GTEST_HAS_TR1_TUPLE 0
# else # else
// The user didn't tell us not to do it, so we assume it's OK. // The user didn't tell us not to do it, so we assume it's OK.
# define GTEST_HAS_TR1_TUPLE 1 # define GTEST_HAS_TR1_TUPLE 1
@@ -638,6 +682,10 @@ struct _RTL_CRITICAL_SECTION;
// Determines whether Google Test's own tr1 tuple implementation // Determines whether Google Test's own tr1 tuple implementation
// should be used. // should be used.
#ifndef GTEST_USE_OWN_TR1_TUPLE #ifndef GTEST_USE_OWN_TR1_TUPLE
// We use our own tuple implementation on Symbian.
# if GTEST_OS_SYMBIAN
# define GTEST_USE_OWN_TR1_TUPLE 1
# else
// The user didn't tell us, so we need to figure it out. // The user didn't tell us, so we need to figure it out.
// We use our own TR1 tuple if we aren't sure the user has an // We use our own TR1 tuple if we aren't sure the user has an
@@ -651,7 +699,8 @@ struct _RTL_CRITICAL_SECTION;
// support TR1 tuple. libc++ only provides std::tuple, in C++11 mode, // support TR1 tuple. libc++ only provides std::tuple, in C++11 mode,
// and it can be used with some compilers that define __GNUC__. // and it can be used with some compilers that define __GNUC__.
# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \ # if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
&& !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600 && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) \
|| (_MSC_VER >= 1600 && _MSC_VER < 1900)
# define GTEST_ENV_HAS_TR1_TUPLE_ 1 # define GTEST_ENV_HAS_TR1_TUPLE_ 1
# endif # endif
@@ -667,12 +716,11 @@ struct _RTL_CRITICAL_SECTION;
# else # else
# define GTEST_USE_OWN_TR1_TUPLE 1 # define GTEST_USE_OWN_TR1_TUPLE 1
# endif # endif
# endif // GTEST_OS_SYMBIAN
#endif // GTEST_USE_OWN_TR1_TUPLE #endif // GTEST_USE_OWN_TR1_TUPLE
// To avoid conditional compilation everywhere, we make it // To avoid conditional compilation we make it gtest-port.h's responsibility
// gtest-port.h's responsibility to #include the header implementing // to #include the header implementing tuple.
// tuple.
#if GTEST_HAS_STD_TUPLE_ #if GTEST_HAS_STD_TUPLE_
# include <tuple> // IWYU pragma: export # include <tuple> // IWYU pragma: export
# define GTEST_TUPLE_NAMESPACE_ ::std # define GTEST_TUPLE_NAMESPACE_ ::std
@@ -687,22 +735,6 @@ struct _RTL_CRITICAL_SECTION;
# if GTEST_USE_OWN_TR1_TUPLE # if GTEST_USE_OWN_TR1_TUPLE
# include "gtest/internal/gtest-tuple.h" // IWYU pragma: export // NOLINT # include "gtest/internal/gtest-tuple.h" // IWYU pragma: export // NOLINT
# elif GTEST_ENV_HAS_STD_TUPLE_
# include <tuple>
// C++11 puts its tuple into the ::std namespace rather than
// ::std::tr1. gtest expects tuple to live in ::std::tr1, so put it there.
// This causes undefined behavior, but supported compilers react in
// the way we intend.
namespace std {
namespace tr1 {
using ::std::get;
using ::std::make_tuple;
using ::std::tuple;
using ::std::tuple_element;
using ::std::tuple_size;
}
}
# elif GTEST_OS_SYMBIAN # elif GTEST_OS_SYMBIAN
// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to // On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
@@ -727,20 +759,22 @@ using ::std::tuple_size;
// Until version 4.3.2, gcc has a bug that causes <tr1/functional>, // Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
// which is #included by <tr1/tuple>, to not compile when RTTI is // which is #included by <tr1/tuple>, to not compile when RTTI is
// disabled. _TR1_FUNCTIONAL is the header guard for // disabled. _TR1_FUNCTIONAL is the header guard for
// <tr1/functional>. Hence the following #define is a hack to prevent // <tr1/functional>. Hence the following #define is used to prevent
// <tr1/functional> from being included. // <tr1/functional> from being included.
# define _TR1_FUNCTIONAL 1 # define _TR1_FUNCTIONAL 1
# include <tr1/tuple> # include <tr1/tuple>
# undef _TR1_FUNCTIONAL // Allows the user to #include # undef _TR1_FUNCTIONAL // Allows the user to #include
// <tr1/functional> if he chooses to. // <tr1/functional> if they choose to.
# else # else
# include <tr1/tuple> // NOLINT # include <tr1/tuple> // NOLINT
# endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 # endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
# else // VS 2010 now has tr1 support.
// If the compiler is not GCC 4.0+, we assume the user is using a # elif _MSC_VER >= 1600
// spec-conforming TR1 implementation.
# include <tuple> // IWYU pragma: export // NOLINT # include <tuple> // IWYU pragma: export // NOLINT
# else // GTEST_USE_OWN_TR1_TUPLE
# include <tr1/tuple> // IWYU pragma: export // NOLINT
# endif // GTEST_USE_OWN_TR1_TUPLE # endif // GTEST_USE_OWN_TR1_TUPLE
#endif // GTEST_HAS_TR1_TUPLE #endif // GTEST_HAS_TR1_TUPLE
@@ -754,8 +788,12 @@ using ::std::tuple_size;
# if GTEST_OS_LINUX && !defined(__ia64__) # if GTEST_OS_LINUX && !defined(__ia64__)
# if GTEST_OS_LINUX_ANDROID # if GTEST_OS_LINUX_ANDROID
// On Android, clone() is only available on ARM starting with Gingerbread. // On Android, clone() became available at different API levels for each 32-bit
# if defined(__arm__) && __ANDROID_API__ >= 9 // architecture.
# if defined(__LP64__) || \
(defined(__arm__) && __ANDROID_API__ >= 9) || \
(defined(__mips__) && __ANDROID_API__ >= 12) || \
(defined(__i386__) && __ANDROID_API__ >= 17)
# define GTEST_HAS_CLONE 1 # define GTEST_HAS_CLONE 1
# else # else
# define GTEST_HAS_CLONE 0 # define GTEST_HAS_CLONE 0
@@ -790,15 +828,11 @@ using ::std::tuple_size;
(GTEST_OS_MAC && !GTEST_OS_IOS) || \ (GTEST_OS_MAC && !GTEST_OS_IOS) || \
(GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \ (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \ GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD) GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD || \
GTEST_OS_NETBSD || GTEST_OS_FUCHSIA)
# define GTEST_HAS_DEATH_TEST 1 # define GTEST_HAS_DEATH_TEST 1
#endif #endif
// We don't support MSVC 7.1 with exceptions disabled now. Therefore
// all the compilers we care about are adequate for supporting
// value-parameterized tests.
#define GTEST_HAS_PARAM_TEST 1
// Determines whether to support type-driven tests. // Determines whether to support type-driven tests.
// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0, // Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
@@ -813,7 +847,7 @@ using ::std::tuple_size;
// value-parameterized tests are enabled. The implementation doesn't // value-parameterized tests are enabled. The implementation doesn't
// work on Sun Studio since it doesn't understand templated conversion // work on Sun Studio since it doesn't understand templated conversion
// operators. // operators.
#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC) #if (GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_) && !defined(__SUNPRO_CC)
# define GTEST_HAS_COMBINE 1 # define GTEST_HAS_COMBINE 1
#endif #endif
@@ -864,15 +898,39 @@ using ::std::tuple_size;
# define GTEST_ATTRIBUTE_UNUSED_ # define GTEST_ATTRIBUTE_UNUSED_
#endif #endif
#if GTEST_LANG_CXX11
# define GTEST_CXX11_EQUALS_DELETE_ = delete
#else // GTEST_LANG_CXX11
# define GTEST_CXX11_EQUALS_DELETE_
#endif // GTEST_LANG_CXX11
// Use this annotation before a function that takes a printf format string.
#if (defined(__GNUC__) || defined(__clang__)) && !defined(COMPILER_ICC)
# if defined(__MINGW_PRINTF_FORMAT)
// MinGW has two different printf implementations. Ensure the format macro
// matches the selected implementation. See
// https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/.
# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
__attribute__((__format__(__MINGW_PRINTF_FORMAT, string_index, \
first_to_check)))
# else
# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
__attribute__((__format__(__printf__, string_index, first_to_check)))
# endif
#else
# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
#endif
// A macro to disallow operator= // A macro to disallow operator=
// This should be used in the private: declarations for a class. // This should be used in the private: declarations for a class.
#define GTEST_DISALLOW_ASSIGN_(type) \ #define GTEST_DISALLOW_ASSIGN_(type) \
void operator=(type const &) void operator=(type const &) GTEST_CXX11_EQUALS_DELETE_
// A macro to disallow copy constructor and operator= // A macro to disallow copy constructor and operator=
// This should be used in the private: declarations for a class. // This should be used in the private: declarations for a class.
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type) \ #define GTEST_DISALLOW_COPY_AND_ASSIGN_(type) \
type(type const &);\ type(type const &) GTEST_CXX11_EQUALS_DELETE_; \
GTEST_DISALLOW_ASSIGN_(type) GTEST_DISALLOW_ASSIGN_(type)
// Tell the compiler to warn about unused return values for functions declared // Tell the compiler to warn about unused return values for functions declared
@@ -920,6 +978,11 @@ using ::std::tuple_size;
#endif // GTEST_HAS_SEH #endif // GTEST_HAS_SEH
// GTEST_API_ qualifies all symbols that must be exported. The definitions below
// are guarded by #ifndef to give embedders a chance to define GTEST_API_ in
// gtest/internal/custom/gtest-port.h
#ifndef GTEST_API_
#ifdef _MSC_VER #ifdef _MSC_VER
# if GTEST_LINKED_AS_SHARED_LIBRARY # if GTEST_LINKED_AS_SHARED_LIBRARY
# define GTEST_API_ __declspec(dllimport) # define GTEST_API_ __declspec(dllimport)
@@ -930,9 +993,15 @@ using ::std::tuple_size;
# define GTEST_API_ __attribute__((visibility ("default"))) # define GTEST_API_ __attribute__((visibility ("default")))
#endif // _MSC_VER #endif // _MSC_VER
#endif // GTEST_API_
#ifndef GTEST_API_ #ifndef GTEST_API_
# define GTEST_API_ # define GTEST_API_
#endif #endif // GTEST_API_
#ifndef GTEST_DEFAULT_DEATH_TEST_STYLE
# define GTEST_DEFAULT_DEATH_TEST_STYLE "fast"
#endif // GTEST_DEFAULT_DEATH_TEST_STYLE
#ifdef __GNUC__ #ifdef __GNUC__
// Ask the compiler to never inline a given function. // Ask the compiler to never inline a given function.
@@ -942,11 +1011,13 @@ using ::std::tuple_size;
#endif #endif
// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project. // _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
#if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION) #if !defined(GTEST_HAS_CXXABI_H_)
# if defined(__GLIBCXX__) || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER))
# define GTEST_HAS_CXXABI_H_ 1 # define GTEST_HAS_CXXABI_H_ 1
# else # else
# define GTEST_HAS_CXXABI_H_ 0 # define GTEST_HAS_CXXABI_H_ 0
# endif # endif
#endif
// A function level attribute to disable checking for use of uninitialized // A function level attribute to disable checking for use of uninitialized
// memory when built with MemorySanitizer. // memory when built with MemorySanitizer.
@@ -1088,6 +1159,16 @@ struct StaticAssertTypeEqHelper<T, T> {
enum { value = true }; enum { value = true };
}; };
// Same as std::is_same<>.
template <typename T, typename U>
struct IsSame {
enum { value = false };
};
template <typename T>
struct IsSame<T, T> {
enum { value = true };
};
// Evaluates to the number of elements in 'array'. // Evaluates to the number of elements in 'array'.
#define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0])) #define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0]))
@@ -1151,6 +1232,10 @@ class scoped_ptr {
// Defines RE. // Defines RE.
#if GTEST_USES_PCRE
// if used, PCRE is injected by custom/gtest-port.h
#elif GTEST_USES_POSIX_RE || GTEST_USES_SIMPLE_RE
// A simple C++ wrapper for <regex.h>. It uses the POSIX Extended // A simple C++ wrapper for <regex.h>. It uses the POSIX Extended
// Regular Expression syntax. // Regular Expression syntax.
class GTEST_API_ RE { class GTEST_API_ RE {
@@ -1179,7 +1264,7 @@ class GTEST_API_ RE {
// PartialMatch(str, re) returns true iff regular expression re // PartialMatch(str, re) returns true iff regular expression re
// matches a substring of str (including str itself). // matches a substring of str (including str itself).
// //
// TODO(wan@google.com): make FullMatch() and PartialMatch() work // FIXME: make FullMatch() and PartialMatch() work
// when str contains NUL characters. // when str contains NUL characters.
static bool FullMatch(const ::std::string& str, const RE& re) { static bool FullMatch(const ::std::string& str, const RE& re) {
return FullMatch(str.c_str(), re); return FullMatch(str.c_str(), re);
@@ -1206,7 +1291,7 @@ class GTEST_API_ RE {
void Init(const char* regex); void Init(const char* regex);
// We use a const char* instead of an std::string, as Google Test used to be // We use a const char* instead of an std::string, as Google Test used to be
// used where std::string is not available. TODO(wan@google.com): change to // used where std::string is not available. FIXME: change to
// std::string. // std::string.
const char* pattern_; const char* pattern_;
bool is_valid_; bool is_valid_;
@@ -1225,6 +1310,8 @@ class GTEST_API_ RE {
GTEST_DISALLOW_ASSIGN_(RE); GTEST_DISALLOW_ASSIGN_(RE);
}; };
#endif // GTEST_USES_PCRE
// Formats a source file path and a line number as they would appear // Formats a source file path and a line number as they would appear
// in an error message from the compiler used to compile this code. // in an error message from the compiler used to compile this code.
GTEST_API_ ::std::string FormatFileLocation(const char* file, int line); GTEST_API_ ::std::string FormatFileLocation(const char* file, int line);
@@ -1310,13 +1397,59 @@ inline void FlushInfoLog() { fflush(NULL); }
GTEST_LOG_(FATAL) << #posix_call << "failed with error " \ GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
<< gtest_error << gtest_error
// Adds reference to a type if it is not a reference type,
// otherwise leaves it unchanged. This is the same as
// tr1::add_reference, which is not widely available yet.
template <typename T>
struct AddReference { typedef T& type; }; // NOLINT
template <typename T>
struct AddReference<T&> { typedef T& type; }; // NOLINT
// A handy wrapper around AddReference that works when the argument T
// depends on template parameters.
#define GTEST_ADD_REFERENCE_(T) \
typename ::testing::internal::AddReference<T>::type
// Transforms "T" into "const T&" according to standard reference collapsing
// rules (this is only needed as a backport for C++98 compilers that do not
// support reference collapsing). Specifically, it transforms:
//
// char ==> const char&
// const char ==> const char&
// char& ==> char&
// const char& ==> const char&
//
// Note that the non-const reference will not have "const" added. This is
// standard, and necessary so that "T" can always bind to "const T&".
template <typename T>
struct ConstRef { typedef const T& type; };
template <typename T>
struct ConstRef<T&> { typedef T& type; };
// The argument T must depend on some template parameters.
#define GTEST_REFERENCE_TO_CONST_(T) \
typename ::testing::internal::ConstRef<T>::type
#if GTEST_HAS_STD_MOVE_ #if GTEST_HAS_STD_MOVE_
using std::forward;
using std::move; using std::move;
template <typename T>
struct RvalueRef {
typedef T&& type;
};
#else // GTEST_HAS_STD_MOVE_ #else // GTEST_HAS_STD_MOVE_
template <typename T> template <typename T>
const T& move(const T& t) { const T& move(const T& t) {
return t; return t;
} }
template <typename T>
GTEST_ADD_REFERENCE_(T) forward(GTEST_ADD_REFERENCE_(T) t) { return t; }
template <typename T>
struct RvalueRef {
typedef const T& type;
};
#endif // GTEST_HAS_STD_MOVE_ #endif // GTEST_HAS_STD_MOVE_
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
@@ -1417,10 +1550,6 @@ GTEST_API_ void CaptureStderr();
GTEST_API_ std::string GetCapturedStderr(); GTEST_API_ std::string GetCapturedStderr();
#endif // GTEST_HAS_STREAM_REDIRECTION #endif // GTEST_HAS_STREAM_REDIRECTION
// Returns a path to temporary directory.
GTEST_API_ std::string TempDir();
// Returns the size (in bytes) of a file. // Returns the size (in bytes) of a file.
GTEST_API_ size_t GetFileSize(FILE* file); GTEST_API_ size_t GetFileSize(FILE* file);
@@ -1428,14 +1557,18 @@ GTEST_API_ size_t GetFileSize(FILE* file);
GTEST_API_ std::string ReadEntireFile(FILE* file); GTEST_API_ std::string ReadEntireFile(FILE* file);
// All command line arguments. // All command line arguments.
GTEST_API_ const ::std::vector<testing::internal::string>& GetArgvs(); GTEST_API_ std::vector<std::string> GetArgvs();
#if GTEST_HAS_DEATH_TEST #if GTEST_HAS_DEATH_TEST
const ::std::vector<testing::internal::string>& GetInjectableArgvs(); std::vector<std::string> GetInjectableArgvs();
void SetInjectableArgvs(const ::std::vector<testing::internal::string>* // Deprecated: pass the args vector by value instead.
new_argvs); void SetInjectableArgvs(const std::vector<std::string>* new_argvs);
void SetInjectableArgvs(const std::vector<std::string>& new_argvs);
#if GTEST_HAS_GLOBAL_STRING
void SetInjectableArgvs(const std::vector< ::string>& new_argvs);
#endif // GTEST_HAS_GLOBAL_STRING
void ClearInjectableArgvs();
#endif // GTEST_HAS_DEATH_TEST #endif // GTEST_HAS_DEATH_TEST
@@ -1685,7 +1818,7 @@ class GTEST_API_ Mutex {
// Initializes owner_thread_id_ and critical_section_ in static mutexes. // Initializes owner_thread_id_ and critical_section_ in static mutexes.
void ThreadSafeLazyInit(); void ThreadSafeLazyInit();
// Per http://blogs.msdn.com/b/oldnewthing/archive/2004/02/23/78395.aspx, // Per https://blogs.msdn.microsoft.com/oldnewthing/20040223-00/?p=40503,
// we assume that 0 is an invalid value for thread IDs. // we assume that 0 is an invalid value for thread IDs.
unsigned int owner_thread_id_; unsigned int owner_thread_id_;
@@ -1693,7 +1826,7 @@ class GTEST_API_ Mutex {
// by the linker. // by the linker.
MutexType type_; MutexType type_;
long critical_section_init_phase_; // NOLINT long critical_section_init_phase_; // NOLINT
_RTL_CRITICAL_SECTION* critical_section_; GTEST_CRITICAL_SECTION* critical_section_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex); GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
}; };
@@ -1969,8 +2102,13 @@ class MutexBase {
extern ::testing::internal::MutexBase mutex extern ::testing::internal::MutexBase mutex
// Defines and statically (i.e. at link time) initializes a static mutex. // Defines and statically (i.e. at link time) initializes a static mutex.
// The initialization list here does not explicitly initialize each field,
// instead relying on default initialization for the unspecified fields. In
// particular, the owner_ field (a pthread_t) is not explicitly initialized.
// This allows initialization to work whether pthread_t is a scalar or struct.
// The flag -Wmissing-field-initializers must not be specified for this to work.
#define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ #define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false, pthread_t() } ::testing::internal::MutexBase mutex = {PTHREAD_MUTEX_INITIALIZER, false, 0}
// The Mutex class can only be used for mutexes created at runtime. It // The Mutex class can only be used for mutexes created at runtime. It
// shares its API with MutexBase otherwise. // shares its API with MutexBase otherwise.
@@ -2027,7 +2165,7 @@ extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
// Implements thread-local storage on pthreads-based systems. // Implements thread-local storage on pthreads-based systems.
template <typename T> template <typename T>
class ThreadLocal { class GTEST_API_ ThreadLocal {
public: public:
ThreadLocal() ThreadLocal()
: key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {} : key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {}
@@ -2159,7 +2297,7 @@ class GTestMutexLock {
typedef GTestMutexLock MutexLock; typedef GTestMutexLock MutexLock;
template <typename T> template <typename T>
class ThreadLocal { class GTEST_API_ ThreadLocal {
public: public:
ThreadLocal() : value_() {} ThreadLocal() : value_() {}
explicit ThreadLocal(const T& value) : value_(value) {} explicit ThreadLocal(const T& value) : value_(value) {}
@@ -2178,12 +2316,13 @@ class ThreadLocal {
GTEST_API_ size_t GetThreadCount(); GTEST_API_ size_t GetThreadCount();
// Passing non-POD classes through ellipsis (...) crashes the ARM // Passing non-POD classes through ellipsis (...) crashes the ARM
// compiler and generates a warning in Sun Studio. The Nokia Symbian // compiler and generates a warning in Sun Studio before 12u4. The Nokia Symbian
// and the IBM XL C/C++ compiler try to instantiate a copy constructor // and the IBM XL C/C++ compiler try to instantiate a copy constructor
// for objects passed through ellipsis (...), failing for uncopyable // for objects passed through ellipsis (...), failing for uncopyable
// objects. We define this to ensure that only POD is passed through // objects. We define this to ensure that only POD is passed through
// ellipsis on these systems. // ellipsis on these systems.
#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC) #if defined(__SYMBIAN32__) || defined(__IBMCPP__) || \
(defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5130)
// We lose support for NULL detection where the compiler doesn't like // We lose support for NULL detection where the compiler doesn't like
// passing non-POD classes through ellipsis (...). // passing non-POD classes through ellipsis (...).
# define GTEST_ELLIPSIS_NEEDS_POD_ 1 # define GTEST_ELLIPSIS_NEEDS_POD_ 1
@@ -2209,6 +2348,13 @@ template <bool bool_value> const bool bool_constant<bool_value>::value;
typedef bool_constant<false> false_type; typedef bool_constant<false> false_type;
typedef bool_constant<true> true_type; typedef bool_constant<true> true_type;
template <typename T, typename U>
struct is_same : public false_type {};
template <typename T>
struct is_same<T, T> : public true_type {};
template <typename T> template <typename T>
struct is_pointer : public false_type {}; struct is_pointer : public false_type {};
@@ -2220,6 +2366,7 @@ struct IteratorTraits {
typedef typename Iterator::value_type value_type; typedef typename Iterator::value_type value_type;
}; };
template <typename T> template <typename T>
struct IteratorTraits<T*> { struct IteratorTraits<T*> {
typedef T value_type; typedef T value_type;
@@ -2351,7 +2498,7 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
// Functions deprecated by MSVC 8.0. // Functions deprecated by MSVC 8.0.
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996 /* deprecated function */) GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
inline const char* StrNCpy(char* dest, const char* src, size_t n) { inline const char* StrNCpy(char* dest, const char* src, size_t n) {
return strncpy(dest, src, n); return strncpy(dest, src, n);
@@ -2385,7 +2532,7 @@ inline int Close(int fd) { return close(fd); }
inline const char* StrError(int errnum) { return strerror(errnum); } inline const char* StrError(int errnum) { return strerror(errnum); }
#endif #endif
inline const char* GetEnv(const char* name) { inline const char* GetEnv(const char* name) {
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE | GTEST_OS_WINDOWS_RT #if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT
// We are on Windows CE, which has no environment variables. // We are on Windows CE, which has no environment variables.
static_cast<void>(name); // To prevent 'unused argument' warning. static_cast<void>(name); // To prevent 'unused argument' warning.
return NULL; return NULL;
@@ -2399,7 +2546,7 @@ inline const char* GetEnv(const char* name) {
#endif #endif
} }
GTEST_DISABLE_MSC_WARNINGS_POP_() GTEST_DISABLE_MSC_DEPRECATED_POP_()
#if GTEST_OS_WINDOWS_MOBILE #if GTEST_OS_WINDOWS_MOBILE
// Windows CE has no C library. The abort() function is used in // Windows CE has no C library. The abort() function is used in
@@ -2537,7 +2684,7 @@ typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
// Parses 'str' for a 32-bit signed integer. If successful, writes the result // Parses 'str' for a 32-bit signed integer. If successful, writes the result
// to *value and returns true; otherwise leaves *value unchanged and returns // to *value and returns true; otherwise leaves *value unchanged and returns
// false. // false.
// TODO(chandlerc): Find a better way to refactor flag and environment parsing // FIXME: Find a better way to refactor flag and environment parsing
// out of both gtest-port.cc and gtest.cc to avoid exporting this utility // out of both gtest-port.cc and gtest.cc to avoid exporting this utility
// function. // function.
bool ParseInt32(const Message& src_text, const char* str, Int32* value); bool ParseInt32(const Message& src_text, const char* str, Int32* value);
@@ -2546,7 +2693,8 @@ bool ParseInt32(const Message& src_text, const char* str, Int32* value);
// corresponding to the given Google Test flag. // corresponding to the given Google Test flag.
bool BoolFromGTestEnv(const char* flag, bool default_val); bool BoolFromGTestEnv(const char* flag, bool default_val);
GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val); GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
std::string StringFromGTestEnv(const char* flag, const char* default_val); std::string OutputFlagAlsoCheckEnvVar();
const char* StringFromGTestEnv(const char* flag, const char* default_val);
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing

View File

@@ -27,17 +27,17 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee) // The Google C++ Testing and Mocking Framework (Google Test)
//
// The Google C++ Testing Framework (Google Test)
// //
// This header file declares the String class and functions used internally by // This header file declares the String class and functions used internally by
// Google Test. They are subject to change without notice. They should not used // Google Test. They are subject to change without notice. They should not used
// by code external to Google Test. // by code external to Google Test.
// //
// This header file is #included by <gtest/internal/gtest-internal.h>. // This header file is #included by gtest-internal.h.
// It should not be #included by other files. // It should not be #included by other files.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_

View File

@@ -30,11 +30,12 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Implements a subset of TR1 tuple needed by Google Test and Google Mock. // Implements a subset of TR1 tuple needed by Google Test and Google Mock.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
@@ -42,7 +43,7 @@
// The compiler used in Symbian has a bug that prevents us from declaring the // The compiler used in Symbian has a bug that prevents us from declaring the
// tuple template as a friend (it complains that tuple is redefined). This // tuple template as a friend (it complains that tuple is redefined). This
// hack bypasses the bug by declaring the members that should otherwise be // bypasses the bug by declaring the members that should otherwise be
// private as public. // private as public.
// Sun Studio versions < 12 also have the above bug. // Sun Studio versions < 12 also have the above bug.
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)

View File

@@ -29,11 +29,12 @@ $$ This meta comment fixes auto-indentation in Emacs. }}
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Implements a subset of TR1 tuple needed by Google Test and Google Mock. // Implements a subset of TR1 tuple needed by Google Test and Google Mock.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
@@ -41,7 +42,7 @@ $$ This meta comment fixes auto-indentation in Emacs. }}
// The compiler used in Symbian has a bug that prevents us from declaring the // The compiler used in Symbian has a bug that prevents us from declaring the
// tuple template as a friend (it complains that tuple is redefined). This // tuple template as a friend (it complains that tuple is redefined). This
// hack bypasses the bug by declaring the members that should otherwise be // bypasses the bug by declaring the members that should otherwise be
// private as public. // private as public.
// Sun Studio versions < 12 also have the above bug. // Sun Studio versions < 12 also have the above bug.
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)

View File

@@ -30,8 +30,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Type utilities needed for implementing typed and type-parameterized // Type utilities needed for implementing typed and type-parameterized
// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
@@ -41,6 +40,8 @@
// Please contact googletestframework@googlegroups.com if you need // Please contact googletestframework@googlegroups.com if you need
// more. // more.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
@@ -57,6 +58,22 @@
namespace testing { namespace testing {
namespace internal { namespace internal {
// Canonicalizes a given name with respect to the Standard C++ Library.
// This handles removing the inline namespace within `std` that is
// used by various standard libraries (e.g., `std::__1`). Names outside
// of namespace std are returned unmodified.
inline std::string CanonicalizeForStdLibVersioning(std::string s) {
static const char prefix[] = "std::__";
if (s.compare(0, strlen(prefix), prefix) == 0) {
std::string::size_type end = s.find("::", strlen(prefix));
if (end != s.npos) {
// Erase everything between the initial `std` and the second `::`.
s.erase(strlen("std"), end - strlen("std"));
}
}
return s;
}
// GetTypeName<T>() returns a human-readable name of type T. // GetTypeName<T>() returns a human-readable name of type T.
// NB: This function is also used in Google Mock, so don't move it inside of // NB: This function is also used in Google Mock, so don't move it inside of
// the typed-test-only section below. // the typed-test-only section below.
@@ -75,7 +92,7 @@ std::string GetTypeName() {
char* const readable_name = __cxa_demangle(name, 0, 0, &status); char* const readable_name = __cxa_demangle(name, 0, 0, &status);
const std::string name_str(status == 0 ? readable_name : name); const std::string name_str(status == 0 ? readable_name : name);
free(readable_name); free(readable_name);
return name_str; return CanonicalizeForStdLibVersioning(name_str);
# else # else
return name; return name;
# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC # endif // GTEST_HAS_CXXABI_H_ || __HP_aCC

View File

@@ -28,8 +28,7 @@ $var n = 50 $$ Maximum length of type lists we want to support.
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Type utilities needed for implementing typed and type-parameterized // Type utilities needed for implementing typed and type-parameterized
// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
@@ -39,6 +38,8 @@ $var n = 50 $$ Maximum length of type lists we want to support.
// Please contact googletestframework@googlegroups.com if you need // Please contact googletestframework@googlegroups.com if you need
// more. // more.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
@@ -55,6 +56,22 @@ $var n = 50 $$ Maximum length of type lists we want to support.
namespace testing { namespace testing {
namespace internal { namespace internal {
// Canonicalizes a given name with respect to the Standard C++ Library.
// This handles removing the inline namespace within `std` that is
// used by various standard libraries (e.g., `std::__1`). Names outside
// of namespace std are returned unmodified.
inline std::string CanonicalizeForStdLibVersioning(std::string s) {
static const char prefix[] = "std::__";
if (s.compare(0, strlen(prefix), prefix) == 0) {
std::string::size_type end = s.find("::", strlen(prefix));
if (end != s.npos) {
// Erase everything between the initial `std` and the second `::`.
s.erase(strlen("std"), end - strlen("std"));
}
}
return s;
}
// GetTypeName<T>() returns a human-readable name of type T. // GetTypeName<T>() returns a human-readable name of type T.
// NB: This function is also used in Google Mock, so don't move it inside of // NB: This function is also used in Google Mock, so don't move it inside of
// the typed-test-only section below. // the typed-test-only section below.
@@ -73,7 +90,7 @@ std::string GetTypeName() {
char* const readable_name = __cxa_demangle(name, 0, 0, &status); char* const readable_name = __cxa_demangle(name, 0, 0, &status);
const std::string name_str(status == 0 ? readable_name : name); const std::string name_str(status == 0 ? readable_name : name);
free(readable_name); free(readable_name);
return name_str; return CanonicalizeForStdLibVersioning(name_str);
# else # else
return name; return name;
# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC # endif // GTEST_HAS_CXXABI_H_ || __HP_aCC

View File

@@ -1 +1 @@
libglog.so.0.3.5 libglog.so.0

Binary file not shown.

View File

@@ -0,0 +1 @@
libglog.so.0.4.0

View File

@@ -1 +0,0 @@
libglog.so.0

Binary file not shown.

Binary file not shown.

Binary file not shown.