gmock-actions.h   gmock-actions.h 
skipping to change at line 39 skipping to change at line 39
// //
// Author: wan@google.com (Zhanyong Wan) // 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.
#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_
#include <algorithm>
#include <string>
#ifndef _WIN32_WCE #ifndef _WIN32_WCE
# include <errno.h> # include <errno.h>
#endif #endif
#include <algorithm>
#include <string>
#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"
namespace testing { namespace testing {
// To implement an action Foo, define: // To implement an action Foo, define:
// 1. a class FooAction that implements the ActionInterface interface, an d // 1. a class FooAction that implements the ActionInterface interface, an d
// 2. a factory function that creates an Action object from a // 2. a factory function that creates an Action object from a
// const FooAction*. // const FooAction*.
// //
skipping to change at line 192 skipping to change at line 192
return IsSet() || internal::BuiltInDefaultValue<T>::Exists(); return IsSet() || internal::BuiltInDefaultValue<T>::Exists();
} }
// Returns the default value for type T if the user has set one; // Returns the default value for type T if the user has set one;
// otherwise returns the built-in default value if there is one; // otherwise returns the built-in default value if there is one;
// otherwise aborts the process. // otherwise aborts the process.
static T Get() { static T Get() {
return value_ == NULL ? return value_ == NULL ?
internal::BuiltInDefaultValue<T>::Get() : *value_; internal::BuiltInDefaultValue<T>::Get() : *value_;
} }
private: private:
static const T* value_; static const T* value_;
}; };
// This partial specialization allows a user to set default values for // This partial specialization allows a user to set default values for
// reference types. // reference types.
template <typename T> template <typename T>
class DefaultValue<T&> { class DefaultValue<T&> {
public: public:
// Sets the default value for type T&. // Sets the default value for type T&.
skipping to change at line 227 skipping to change at line 228
return IsSet() || internal::BuiltInDefaultValue<T&>::Exists(); return IsSet() || internal::BuiltInDefaultValue<T&>::Exists();
} }
// Returns the default value for type T& if the user has set one; // Returns the default value for type T& if the user has set one;
// otherwise returns the built-in default value if there is one; // otherwise returns the built-in default value if there is one;
// otherwise aborts the process. // otherwise aborts the process.
static T& Get() { static T& Get() {
return address_ == NULL ? return address_ == NULL ?
internal::BuiltInDefaultValue<T&>::Get() : *address_; internal::BuiltInDefaultValue<T&>::Get() : *address_;
} }
private: private:
static T* address_; static T* address_;
}; };
// This specialization allows DefaultValue<void>::Get() to // This specialization allows DefaultValue<void>::Get() to
// compile. // compile.
template <> template <>
class DefaultValue<void> { class DefaultValue<void> {
public: public:
static bool Exists() { return true; } static bool Exists() { return true; }
 End of changes. 4 change blocks. 
3 lines changed or deleted 5 lines changed or added


 gmock-cardinalities.h   gmock-cardinalities.h 
skipping to change at line 83 skipping to change at line 83
// Describes self to an ostream. // Describes self to an ostream.
virtual void DescribeTo(::std::ostream* os) const = 0; virtual void DescribeTo(::std::ostream* os) const = 0;
}; };
// A Cardinality is a copyable and IMMUTABLE (except by assignment) // A Cardinality is a copyable and IMMUTABLE (except by assignment)
// object that specifies how many times a mock function is expected to // object that specifies how many times a mock function is expected to
// be called. The implementation of Cardinality is just a linked_ptr // be called. The implementation of Cardinality is just a linked_ptr
// to const CardinalityInterface, so copying is fairly cheap. // to const CardinalityInterface, so copying is fairly cheap.
// Don't inherit from Cardinality! // Don't inherit from Cardinality!
class Cardinality { class GTEST_API_ Cardinality {
public: public:
// Constructs a null cardinality. Needed for storing Cardinality // Constructs a null cardinality. Needed for storing Cardinality
// objects in STL containers. // objects in STL containers.
Cardinality() {} Cardinality() {}
// Constructs a Cardinality from its implementation. // Constructs a Cardinality from its implementation.
explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {} explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {}
// Conservative estimate on the lower/upper bound of the number of // Conservative estimate on the lower/upper bound of the number of
// calls allowed. // calls allowed.
skipping to change at line 120 skipping to change at line 120
return impl_->IsSaturatedByCallCount(call_count) && return impl_->IsSaturatedByCallCount(call_count) &&
!impl_->IsSatisfiedByCallCount(call_count); !impl_->IsSatisfiedByCallCount(call_count);
} }
// Describes self to an ostream // Describes self to an ostream
void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); } void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); }
// Describes the given actual call count to an ostream. // Describes the given actual call count to an ostream.
static void DescribeActualCallCountTo(int actual_call_count, static void DescribeActualCallCountTo(int actual_call_count,
::std::ostream* os); ::std::ostream* os);
private: private:
internal::linked_ptr<const CardinalityInterface> impl_; internal::linked_ptr<const CardinalityInterface> impl_;
}; };
// Creates a cardinality that allows at least n calls. // Creates a cardinality that allows at least n calls.
Cardinality AtLeast(int n); GTEST_API_ Cardinality AtLeast(int n);
// Creates a cardinality that allows at most n calls. // Creates a cardinality that allows at most n calls.
Cardinality AtMost(int n); GTEST_API_ Cardinality AtMost(int n);
// Creates a cardinality that allows any number of calls. // Creates a cardinality that allows any number of calls.
Cardinality AnyNumber(); GTEST_API_ Cardinality AnyNumber();
// Creates a cardinality that allows between min and max calls. // Creates a cardinality that allows between min and max calls.
Cardinality Between(int min, int max); GTEST_API_ Cardinality Between(int min, int max);
// Creates a cardinality that allows exactly n calls. // Creates a cardinality that allows exactly n calls.
Cardinality Exactly(int n); GTEST_API_ Cardinality Exactly(int n);
// Creates a cardinality from its implementation. // Creates a cardinality from its implementation.
inline Cardinality MakeCardinality(const CardinalityInterface* c) { inline Cardinality MakeCardinality(const CardinalityInterface* c) {
return Cardinality(c); return Cardinality(c);
} }
} // namespace testing } // namespace testing
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ #endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
 End of changes. 7 change blocks. 
6 lines changed or deleted 7 lines changed or added


 gmock-generated-actions.h   gmock-generated-actions.h 
skipping to change at line 384 skipping to change at line 384
} }
// Calls a 10-ary callable. // Calls a 10-ary callable.
template <typename Function, typename A1, typename A2, typename A3, template <typename Function, typename A1, typename A2, typename A3,
typename A4, typename A5, typename A6, typename A7, typename A8, typename A4, typename A5, typename A6, typename A7, typename A8,
typename A9, typename A10> typename A9, typename A10>
static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 , static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ,
A7 a7, A8 a8, A9 a9, A10 a10) { A7 a7, A8 a8, A9 a9, A10 a10) {
return function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); return function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
} }
}; // class CallableHelper }; // class CallableHelper
// 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) \
typename ::std::tr1::tuple_element<N, Tuple>::type typename ::std::tr1::tuple_element<N, Tuple>::type
// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the
// type of an n-ary function whose i-th (1-based) argument type is the // type of an n-ary function whose i-th (1-based) argument type is the
// k{i}-th (0-based) field of ArgumentTuple, which must be a tuple // k{i}-th (0-based) field of ArgumentTuple, which must be a tuple
skipping to change at line 1021 skipping to change at line 1020
// Once that's done, we'll consider supporting using ACTION*() inside // Once that's done, we'll consider supporting using ACTION*() inside
// a function. // a function.
// //
// 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 http://code.google.com/p/googlemock/wiki/CookBook.
// 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_\
const args_type& args GTEST_ATTRIBUTE_UNUSED_,\ const args_type& args GTEST_ATTRIBUTE_UNUSED_, \
arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_,\ arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_, \
arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_,\ arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_, \
arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_,\ arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_, \
arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_,\ arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_, \
arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_,\ arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_, \
arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_,\ arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_, \
arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_,\ arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_, \
arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_,\ arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_, \
arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_,\ arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_, \
arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_ arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_
// Sometimes you want to give an action explicit template parameters // Sometimes you want to give an action explicit template parameters
// that cannot be inferred from its value parameters. ACTION() and // that cannot be inferred from its value parameters. ACTION() and
// ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that // ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that
// and can be viewed as an extension to ACTION() and ACTION_P*(). // and can be viewed as an extension to ACTION() and ACTION_P*().
// //
// The syntax: // The syntax:
// //
// ACTION_TEMPLATE(ActionName, // ACTION_TEMPLATE(ActionName,
skipping to change at line 1436 skipping to change at line 1435
GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\ GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\
GMOCK_INTERNAL_DECL_##value_params) {\ GMOCK_INTERNAL_DECL_##value_params) {\
return GMOCK_ACTION_CLASS_(name, value_params)<\ return GMOCK_ACTION_CLASS_(name, value_params)<\
GMOCK_INTERNAL_LIST_##template_params\ GMOCK_INTERNAL_LIST_##template_params\
GMOCK_INTERNAL_LIST_TYPE_##value_params>(\ GMOCK_INTERNAL_LIST_TYPE_##value_params>(\
GMOCK_INTERNAL_LIST_##value_params);\ GMOCK_INTERNAL_LIST_##value_params);\
}\ }\
template <GMOCK_INTERNAL_DECL_##template_params\ template <GMOCK_INTERNAL_DECL_##template_params\
GMOCK_INTERNAL_DECL_TYPE_##value_params>\ GMOCK_INTERNAL_DECL_TYPE_##value_params>\
template <typename F>\ template <typename F>\
template <typename arg0_type, typename arg1_type, typename arg2_type,\ template <typename arg0_type, typename arg1_type, typename arg2_type, \
typename arg3_type, typename arg4_type, typename arg5_type,\ typename arg3_type, typename arg4_type, typename arg5_type, \
typename arg6_type, typename arg7_type, typename arg8_type,\ typename arg6_type, typename arg7_type, typename arg8_type, \
typename arg9_type>\ typename arg9_type>\
typename ::testing::internal::Function<F>::Result\ typename ::testing::internal::Function<F>::Result\
GMOCK_ACTION_CLASS_(name, value_params)<\ GMOCK_ACTION_CLASS_(name, value_params)<\
GMOCK_INTERNAL_LIST_##template_params\ GMOCK_INTERNAL_LIST_##template_params\
GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\ GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\
gmock_PerformImpl(\ gmock_PerformImpl(\
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
#define ACTION(name)\ #define ACTION(name)\
class name##Action {\ class name##Action {\
skipping to change at line 2220 skipping to change at line 2219
template <typename arg0_type, typename arg1_type, typename arg2_type, \ template <typename arg0_type, typename arg1_type, typename arg2_type, \
typename arg3_type, typename arg4_type, typename arg5_type, \ typename arg3_type, typename arg4_type, typename arg5_type, \
typename arg6_type, typename arg7_type, typename arg8_type, \ typename arg6_type, typename arg7_type, typename arg8_type, \
typename arg9_type>\ typename arg9_type>\
typename ::testing::internal::Function<F>::Result\ typename ::testing::internal::Function<F>::Result\
name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type , \ name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type , \
p5##_type, p6##_type, p7##_type, p8##_type, \ p5##_type, p6##_type, p7##_type, p8##_type, \
p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\ p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
// TODO(wan@google.com): move the following to a different .h file
// such that we don't have to run 'pump' every time the code is
// updated.
namespace testing { namespace testing {
// The ACTION*() macros trigger warning C4100 (unreferenced formal // The ACTION*() macros trigger warning C4100 (unreferenced formal
// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in // parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
// the macro definition, as the warnings are generated when the macro // the macro definition, as the warnings are generated when the macro
// is expanded and macro expansion cannot contain #pragma. Therefore // is expanded and macro expansion cannot contain #pragma. Therefore
// we suppress them here. // we suppress them here.
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning(push) # pragma warning(push)
# pragma warning(disable:4100) # pragma warning(disable:4100)
 End of changes. 4 change blocks. 
17 lines changed or deleted 13 lines changed or added


 gmock-generated-actions.h.pump   gmock-generated-actions.h.pump 
skipping to change at line 137 skipping to change at line 137
$var Aas = [[$for j, [[A$j a$j]]]] $var Aas = [[$for j, [[A$j a$j]]]]
$var as = [[$for j, [[a$j]]]] $var as = [[$for j, [[a$j]]]]
$var typename_Ts = [[$for j, [[typename T$j]]]] $var typename_Ts = [[$for j, [[typename T$j]]]]
$var Ts = [[$for j, [[T$j]]]] $var Ts = [[$for j, [[T$j]]]]
template <typename Function, $typename_As> template <typename Function, $typename_As>
static R Call(Function function, $Aas) { static R Call(Function function, $Aas) {
return function($as); return function($as);
} }
]] ]]
}; // class CallableHelper }; // class CallableHelper
// 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) \
typename ::std::tr1::tuple_element<N, Tuple>::type typename ::std::tr1::tuple_element<N, Tuple>::type
$range i 1..n $range i 1..n
// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the
skipping to change at line 425 skipping to change at line 424
// //
// 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 http://code.google.com/p/googlemock/wiki/CookBook.
$range i 0..n $range i 0..n
$range k 0..n-1 $range k 0..n-1
// 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_\
const args_type& args GTEST_ATTRIBUTE_UNUSED_ const args_type& args GTEST_ATTRIBUTE_UNUSED_
$for k [[,\ $for k [[, \
arg$k[[]]_type arg$k GTEST_ATTRIBUTE_UNUSED_]] arg$k[[]]_type arg$k GTEST_ATTRIBUTE_UNUSED_]]
// Sometimes you want to give an action explicit template parameters // Sometimes you want to give an action explicit template parameters
// that cannot be inferred from its value parameters. ACTION() and // that cannot be inferred from its value parameters. ACTION() and
// ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that // ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that
// and can be viewed as an extension to ACTION() and ACTION_P*(). // and can be viewed as an extension to ACTION() and ACTION_P*().
// //
// The syntax: // The syntax:
// //
// ACTION_TEMPLATE(ActionName, // ACTION_TEMPLATE(ActionName,
skipping to change at line 644 skipping to change at line 643
GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\ GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\
GMOCK_INTERNAL_DECL_##value_params) {\ GMOCK_INTERNAL_DECL_##value_params) {\
return GMOCK_ACTION_CLASS_(name, value_params)<\ return GMOCK_ACTION_CLASS_(name, value_params)<\
GMOCK_INTERNAL_LIST_##template_params\ GMOCK_INTERNAL_LIST_##template_params\
GMOCK_INTERNAL_LIST_TYPE_##value_params>(\ GMOCK_INTERNAL_LIST_TYPE_##value_params>(\
GMOCK_INTERNAL_LIST_##value_params);\ GMOCK_INTERNAL_LIST_##value_params);\
}\ }\
template <GMOCK_INTERNAL_DECL_##template_params\ template <GMOCK_INTERNAL_DECL_##template_params\
GMOCK_INTERNAL_DECL_TYPE_##value_params>\ GMOCK_INTERNAL_DECL_TYPE_##value_params>\
template <typename F>\ template <typename F>\
template <typename arg0_type, typename arg1_type, typename arg2_type,\ template <typename arg0_type, typename arg1_type, typename arg2_type, \
typename arg3_type, typename arg4_type, typename arg5_type,\ typename arg3_type, typename arg4_type, typename arg5_type, \
typename arg6_type, typename arg7_type, typename arg8_type,\ typename arg6_type, typename arg7_type, typename arg8_type, \
typename arg9_type>\ typename arg9_type>\
typename ::testing::internal::Function<F>::Result\ typename ::testing::internal::Function<F>::Result\
GMOCK_ACTION_CLASS_(name, value_params)<\ GMOCK_ACTION_CLASS_(name, value_params)<\
GMOCK_INTERNAL_LIST_##template_params\ GMOCK_INTERNAL_LIST_##template_params\
GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\ GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\
gmock_PerformImpl(\ gmock_PerformImpl(\
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
$for i $for i
skipping to change at line 726 skipping to change at line 725
}\$template }\$template
template <typename F>\ template <typename F>\
template <$typename_arg_types>\ template <$typename_arg_types>\
typename ::testing::internal::Function<F>::Result\ typename ::testing::internal::Function<F>::Result\
$class_name$param_types::gmock_Impl<F>::gmock_PerformImpl(\ $class_name$param_types::gmock_Impl<F>::gmock_PerformImpl(\
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
]] ]]
$$ } // This meta comment fixes auto-indentation in Emacs. It won't $$ } // This meta comment fixes auto-indentation in Emacs. It won't
$$ // show up in the generated code. $$ // show up in the generated code.
// TODO(wan@google.com): move the following to a different .h file
// such that we don't have to run 'pump' every time the code is
// updated.
namespace testing { namespace testing {
// The ACTION*() macros trigger warning C4100 (unreferenced formal // The ACTION*() macros trigger warning C4100 (unreferenced formal
// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in // parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
// the macro definition, as the warnings are generated when the macro // the macro definition, as the warnings are generated when the macro
// is expanded and macro expansion cannot contain #pragma. Therefore // is expanded and macro expansion cannot contain #pragma. Therefore
// we suppress them here. // we suppress them here.
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning(push) # pragma warning(push)
# pragma warning(disable:4100) # pragma warning(disable:4100)
 End of changes. 4 change blocks. 
8 lines changed or deleted 4 lines changed or added


 gmock-generated-function-mockers.h   gmock-generated-function-mockers.h 
skipping to change at line 329 skipping to change at line 329
} // namespace internal } // namespace internal
// The style guide prohibits "using" statements in a namespace scope // The style guide prohibits "using" statements in a namespace scope
// inside a header file. However, the FunctionMocker class template // inside a header file. However, the FunctionMocker class template
// is meant to be defined in the ::testing namespace. The following // is meant to be defined in the ::testing namespace. The following
// line is just a trick for working around a bug in MSVC 8.0, which // line is just a trick for working around a bug in MSVC 8.0, which
// cannot handle it if we define FunctionMocker in ::testing. // cannot handle it if we define FunctionMocker in ::testing.
using internal::FunctionMocker; using internal::FunctionMocker;
// The result type of function type F. // GMOCK_RESULT_(tn, F) expands to the result type of function type F.
// We define this as a variadic macro in case F contains unprotected
// commas (the same reason that we use variadic macros in other places
// in this file).
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_RESULT_(tn, F) tn ::testing::internal::Function<F>::Result #define GMOCK_RESULT_(tn, ...) \
tn ::testing::internal::Function<__VA_ARGS__>::Result
// The type of argument N of function type F. // The type of argument N of the given function type.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_ARG_(tn, F, N) tn ::testing::internal::Function<F>::Argument# #define GMOCK_ARG_(tn, N, ...) \
#N tn ::testing::internal::Function<__VA_ARGS__>::Argument##N
// The matcher type for argument N of function type F. // The matcher type for argument N of the given function type.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_MATCHER_(tn, F, N) const ::testing::Matcher<GMOCK_ARG_(tn, F, #define GMOCK_MATCHER_(tn, N, ...) \
N)>& const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>&
// The variable for mocking the given method. // The variable for mocking the given method.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_MOCKER_(arity, constness, Method) \ #define GMOCK_MOCKER_(arity, constness, Method) \
GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__) GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD0_(tn, constness, ct, Method, F) \ #define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, F) ct Method() constness { \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ ) constness { \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 0, \ GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size<
\
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::valu
e \
== 0), \
this_method_does_not_take_0_arguments); \ this_method_does_not_take_0_arguments); \
GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \ GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(0, constness, Method).Invoke(); \ return GMOCK_MOCKER_(0, constness, Method).Invoke(); \
} \ } \
::testing::MockSpec<F>& \ ::testing::MockSpec<__VA_ARGS__>& \
gmock_##Method() constness { \ gmock_##Method() constness { \
GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \ GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \
return GMOCK_MOCKER_(0, constness, Method).With(); \ return GMOCK_MOCKER_(0, constness, Method).With(); \
} \ } \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(0, constness, Method) mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness
, \
Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD1_(tn, constness, ct, Method, F) \ #define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1) constness { GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
\ GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size<
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 1, \ \
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::valu
e \
== 1), \
this_method_does_not_take_1_argument); \ this_method_does_not_take_1_argument); \
GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \ GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(1, constness, Method).Invoke(gmock_a1); \ return GMOCK_MOCKER_(1, constness, Method).Invoke(gmock_a1); \
} \ } \
::testing::MockSpec<F>& \ ::testing::MockSpec<__VA_ARGS__>& \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1) constness { \ gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness
{ \
GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \ GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \
return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \ return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \
} \ } \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(1, constness, Method) mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness
, \
Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD2_(tn, constness, ct, Method, F) \ #define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, F, 2) gmock_a2) constness { GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
\ GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size<
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 2, \ \
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::valu
e \
== 2), \
this_method_does_not_take_2_arguments); \ this_method_does_not_take_2_arguments); \
GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \ GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(2, constness, Method).Invoke(gmock_a1, gmock_a2); \ return GMOCK_MOCKER_(2, constness, Method).Invoke(gmock_a1, gmock_a2); \
} \ } \
::testing::MockSpec<F>& \ ::testing::MockSpec<__VA_ARGS__>& \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2) constness { \ GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) constness
{ \
GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \ GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \
return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \ return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \
} \ } \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(2, constness, Method) mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness
, \
Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD3_(tn, constness, ct, Method, F) \ #define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, F, 2) gmock_a2, \ GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_ARG_(tn, F, 3) gmock_a3) constness { GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
\ GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size<
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 3, \ \
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::valu
e \
== 3), \
this_method_does_not_take_3_arguments); \ this_method_does_not_take_3_arguments); \
GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \ GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(3, constness, Method).Invoke(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(3, constness, Method).Invoke(gmock_a1, gmock_a2, \
gmock_a3); \ gmock_a3); \
} \ } \
::testing::MockSpec<F>& \ ::testing::MockSpec<__VA_ARGS__>& \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3) constness { \ GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) constness
{ \
GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \ GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \
return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \
gmock_a3); \ gmock_a3); \
} \ } \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(3, constness, Method) mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness
, \
Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD4_(tn, constness, ct, Method, F) \ #define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, F, 2) gmock_a2, \ GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_ARG_(tn, F, 3) gmock_a3, \ GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_ARG_(tn, F, 4) gmock_a4) constness { GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
\ GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size<
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 4, \ \
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::valu
e \
== 4), \
this_method_does_not_take_4_arguments); \ this_method_does_not_take_4_arguments); \
GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \ GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(4, constness, Method).Invoke(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(4, constness, Method).Invoke(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4); \ gmock_a3, gmock_a4); \
} \ } \
::testing::MockSpec<F>& \ ::testing::MockSpec<__VA_ARGS__>& \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_MATCHER_(tn, F, 4) gmock_a4) constness { \ GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) constness
{ \
GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \ GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \
return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4); \ gmock_a3, gmock_a4); \
} \ } \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(4, constness, Method) mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness
, \
Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD5_(tn, constness, ct, Method, F) \ #define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, F, 2) gmock_a2, \ GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_ARG_(tn, F, 3) gmock_a3, \ GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_ARG_(tn, F, 4) gmock_a4, \ GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_ARG_(tn, F, 5) gmock_a5) constness { GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
\ GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size<
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 5, \ \
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::valu
e \
== 5), \
this_method_does_not_take_5_arguments); \ this_method_does_not_take_5_arguments); \
GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \ GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(5, constness, Method).Invoke(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(5, constness, Method).Invoke(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5); \ gmock_a3, gmock_a4, gmock_a5); \
} \ } \
::testing::MockSpec<F>& \ ::testing::MockSpec<__VA_ARGS__>& \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
GMOCK_MATCHER_(tn, F, 5) gmock_a5) constness { \ GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) constness
{ \
GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \ GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \
return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5); \ gmock_a3, gmock_a4, gmock_a5); \
} \ } \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(5, constness, Method) mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness
, \
Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD6_(tn, constness, ct, Method, F) \ #define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, F, 2) gmock_a2, \ GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_ARG_(tn, F, 3) gmock_a3, \ GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_ARG_(tn, F, 4) gmock_a4, \ GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_ARG_(tn, F, 5) gmock_a5, \ GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
GMOCK_ARG_(tn, F, 6) gmock_a6) constness { GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
\ GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size<
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 6, \ \
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::valu
e \
== 6), \
this_method_does_not_take_6_arguments); \ this_method_does_not_take_6_arguments); \
GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \ GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(6, constness, Method).Invoke(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(6, constness, Method).Invoke(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6); \ gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
} \ } \
::testing::MockSpec<F>& \ ::testing::MockSpec<__VA_ARGS__>& \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
GMOCK_MATCHER_(tn, F, 6) gmock_a6) constness { \ GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) constness
{ \
GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \ GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \
return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6); \ gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
} \ } \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(6, constness, Method) mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness
, \
Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD7_(tn, constness, ct, Method, F) \ #define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, F, 2) gmock_a2, \ GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_ARG_(tn, F, 3) gmock_a3, \ GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_ARG_(tn, F, 4) gmock_a4, \ GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_ARG_(tn, F, 5) gmock_a5, \ GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
GMOCK_ARG_(tn, F, 6) gmock_a6, \ GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
GMOCK_ARG_(tn, F, 7) gmock_a7) constness { GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
\ GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size<
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 7, \ \
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::valu
e \
== 7), \
this_method_does_not_take_7_arguments); \ this_method_does_not_take_7_arguments); \
GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \ GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(7, constness, Method).Invoke(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(7, constness, Method).Invoke(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
} \ } \
::testing::MockSpec<F>& \ ::testing::MockSpec<__VA_ARGS__>& \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
GMOCK_MATCHER_(tn, F, 7) gmock_a7) constness { \ GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) constness
{ \
GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \ GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \
return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
} \ } \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(7, constness, Method) mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness
, \
Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD8_(tn, constness, ct, Method, F) \ #define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, F, 2) gmock_a2, \ GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_ARG_(tn, F, 3) gmock_a3, \ GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_ARG_(tn, F, 4) gmock_a4, \ GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_ARG_(tn, F, 5) gmock_a5, \ GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
GMOCK_ARG_(tn, F, 6) gmock_a6, \ GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
GMOCK_ARG_(tn, F, 7) gmock_a7, \ GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
GMOCK_ARG_(tn, F, 8) gmock_a8) constness { GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
\ GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size<
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 8, \ \
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::valu
e \
== 8), \
this_method_does_not_take_8_arguments); \ this_method_does_not_take_8_arguments); \
GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \ GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(8, constness, Method).Invoke(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(8, constness, Method).Invoke(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
} \ } \
::testing::MockSpec<F>& \ ::testing::MockSpec<__VA_ARGS__>& \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
GMOCK_MATCHER_(tn, F, 7) gmock_a7, \ GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
GMOCK_MATCHER_(tn, F, 8) gmock_a8) constness { \ GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) constness
{ \
GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \ GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \
return GMOCK_MOCKER_(8, constness, Method).With(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(8, constness, Method).With(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
} \ } \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(8, constness, Method) mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness
, \
Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD9_(tn, constness, ct, Method, F) \ #define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, F, 2) gmock_a2, \ GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_ARG_(tn, F, 3) gmock_a3, \ GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_ARG_(tn, F, 4) gmock_a4, \ GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_ARG_(tn, F, 5) gmock_a5, \ GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
GMOCK_ARG_(tn, F, 6) gmock_a6, \ GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
GMOCK_ARG_(tn, F, 7) gmock_a7, \ GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
GMOCK_ARG_(tn, F, 8) gmock_a8, \ GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
GMOCK_ARG_(tn, F, 9) gmock_a9) constness { GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
\ GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size<
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 9, \ \
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::valu
e \
== 9), \
this_method_does_not_take_9_arguments); \ this_method_does_not_take_9_arguments); \
GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \ GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(9, constness, Method).Invoke(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(9, constness, Method).Invoke(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \ gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
gmock_a9); \ gmock_a9); \
} \ } \
::testing::MockSpec<F>& \ ::testing::MockSpec<__VA_ARGS__>& \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
GMOCK_MATCHER_(tn, F, 7) gmock_a7, \ GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
GMOCK_MATCHER_(tn, F, 8) gmock_a8, \ GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
GMOCK_MATCHER_(tn, F, 9) gmock_a9) constness { \ GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) constness
{ \
GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \ GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \
return GMOCK_MOCKER_(9, constness, Method).With(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(9, constness, Method).With(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \ gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
gmock_a9); \ gmock_a9); \
} \ } \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(9, constness, Method) mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness
, \
Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD10_(tn, constness, ct, Method, F) \ #define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, F, 2) gmock_a2, \ GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_ARG_(tn, F, 3) gmock_a3, \ GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_ARG_(tn, F, 4) gmock_a4, \ GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_ARG_(tn, F, 5) gmock_a5, \ GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
GMOCK_ARG_(tn, F, 6) gmock_a6, \ GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
GMOCK_ARG_(tn, F, 7) gmock_a7, \ GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
GMOCK_ARG_(tn, F, 8) gmock_a8, \ GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
GMOCK_ARG_(tn, F, 9) gmock_a9, \ GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
GMOCK_ARG_(tn, F, 10) gmock_a10) constness GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9, \
{ \ GMOCK_ARG_(tn, 10, __VA_ARGS__) gmock_a10) constness { \
GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size<
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 10, \ \
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::valu
e \
== 10), \
this_method_does_not_take_10_arguments); \ this_method_does_not_take_10_arguments); \
GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \ GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(10, constness, Method).Invoke(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(10, constness, Method).Invoke(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a 9, \ gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a 9, \
gmock_a10); \ gmock_a10); \
} \ } \
::testing::MockSpec<F>& \ ::testing::MockSpec<__VA_ARGS__>& \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
GMOCK_MATCHER_(tn, F, 7) gmock_a7, \ GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
GMOCK_MATCHER_(tn, F, 8) gmock_a8, \ GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
GMOCK_MATCHER_(tn, F, 9) gmock_a9, \ GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \
GMOCK_MATCHER_(tn, F, 10) gmock_a10) constness { \ GMOCK_MATCHER_(tn, 10, \
__VA_ARGS__) gmock_a10) constness { \
GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \ GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \
return GMOCK_MOCKER_(10, constness, Method).With(gmock_a1, gmock_a2, \ return GMOCK_MOCKER_(10, constness, Method).With(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a 9, \ gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a 9, \
gmock_a10); \ gmock_a10); \
} \ } \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(10, constness, Method) mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constnes
s, \
Method)
#define MOCK_METHOD0(m, F) GMOCK_METHOD0_(, , , m, F) #define MOCK_METHOD0(m, ...) GMOCK_METHOD0_(, , , m, __VA_ARGS__)
#define MOCK_METHOD1(m, F) GMOCK_METHOD1_(, , , m, F) #define MOCK_METHOD1(m, ...) GMOCK_METHOD1_(, , , m, __VA_ARGS__)
#define MOCK_METHOD2(m, F) GMOCK_METHOD2_(, , , m, F) #define MOCK_METHOD2(m, ...) GMOCK_METHOD2_(, , , m, __VA_ARGS__)
#define MOCK_METHOD3(m, F) GMOCK_METHOD3_(, , , m, F) #define MOCK_METHOD3(m, ...) GMOCK_METHOD3_(, , , m, __VA_ARGS__)
#define MOCK_METHOD4(m, F) GMOCK_METHOD4_(, , , m, F) #define MOCK_METHOD4(m, ...) GMOCK_METHOD4_(, , , m, __VA_ARGS__)
#define MOCK_METHOD5(m, F) GMOCK_METHOD5_(, , , m, F) #define MOCK_METHOD5(m, ...) GMOCK_METHOD5_(, , , m, __VA_ARGS__)
#define MOCK_METHOD6(m, F) GMOCK_METHOD6_(, , , m, F) #define MOCK_METHOD6(m, ...) GMOCK_METHOD6_(, , , m, __VA_ARGS__)
#define MOCK_METHOD7(m, F) GMOCK_METHOD7_(, , , m, F) #define MOCK_METHOD7(m, ...) GMOCK_METHOD7_(, , , m, __VA_ARGS__)
#define MOCK_METHOD8(m, F) GMOCK_METHOD8_(, , , m, F) #define MOCK_METHOD8(m, ...) GMOCK_METHOD8_(, , , m, __VA_ARGS__)
#define MOCK_METHOD9(m, F) GMOCK_METHOD9_(, , , m, F) #define MOCK_METHOD9(m, ...) GMOCK_METHOD9_(, , , m, __VA_ARGS__)
#define MOCK_METHOD10(m, F) GMOCK_METHOD10_(, , , m, F) #define MOCK_METHOD10(m, ...) GMOCK_METHOD10_(, , , m, __VA_ARGS__)
#define MOCK_CONST_METHOD0(m, F) GMOCK_METHOD0_(, const, , m, F) #define MOCK_CONST_METHOD0(m, ...) GMOCK_METHOD0_(, const, , m, __VA_ARGS__
#define MOCK_CONST_METHOD1(m, F) GMOCK_METHOD1_(, const, , m, F) )
#define MOCK_CONST_METHOD2(m, F) GMOCK_METHOD2_(, const, , m, F) #define MOCK_CONST_METHOD1(m, ...) GMOCK_METHOD1_(, const, , m, __VA_ARGS__
#define MOCK_CONST_METHOD3(m, F) GMOCK_METHOD3_(, const, , m, F) )
#define MOCK_CONST_METHOD4(m, F) GMOCK_METHOD4_(, const, , m, F) #define MOCK_CONST_METHOD2(m, ...) GMOCK_METHOD2_(, const, , m, __VA_ARGS__
#define MOCK_CONST_METHOD5(m, F) GMOCK_METHOD5_(, const, , m, F) )
#define MOCK_CONST_METHOD6(m, F) GMOCK_METHOD6_(, const, , m, F) #define MOCK_CONST_METHOD3(m, ...) GMOCK_METHOD3_(, const, , m, __VA_ARGS__
#define MOCK_CONST_METHOD7(m, F) GMOCK_METHOD7_(, const, , m, F) )
#define MOCK_CONST_METHOD8(m, F) GMOCK_METHOD8_(, const, , m, F) #define MOCK_CONST_METHOD4(m, ...) GMOCK_METHOD4_(, const, , m, __VA_ARGS__
#define MOCK_CONST_METHOD9(m, F) GMOCK_METHOD9_(, const, , m, F) )
#define MOCK_CONST_METHOD10(m, F) GMOCK_METHOD10_(, const, , m, F) #define MOCK_CONST_METHOD5(m, ...) GMOCK_METHOD5_(, const, , m, __VA_ARGS__
)
#define MOCK_METHOD0_T(m, F) GMOCK_METHOD0_(typename, , , m, F) #define MOCK_CONST_METHOD6(m, ...) GMOCK_METHOD6_(, const, , m, __VA_ARGS__
#define MOCK_METHOD1_T(m, F) GMOCK_METHOD1_(typename, , , m, F) )
#define MOCK_METHOD2_T(m, F) GMOCK_METHOD2_(typename, , , m, F) #define MOCK_CONST_METHOD7(m, ...) GMOCK_METHOD7_(, const, , m, __VA_ARGS__
#define MOCK_METHOD3_T(m, F) GMOCK_METHOD3_(typename, , , m, F) )
#define MOCK_METHOD4_T(m, F) GMOCK_METHOD4_(typename, , , m, F) #define MOCK_CONST_METHOD8(m, ...) GMOCK_METHOD8_(, const, , m, __VA_ARGS__
#define MOCK_METHOD5_T(m, F) GMOCK_METHOD5_(typename, , , m, F) )
#define MOCK_METHOD6_T(m, F) GMOCK_METHOD6_(typename, , , m, F) #define MOCK_CONST_METHOD9(m, ...) GMOCK_METHOD9_(, const, , m, __VA_ARGS__
#define MOCK_METHOD7_T(m, F) GMOCK_METHOD7_(typename, , , m, F) )
#define MOCK_METHOD8_T(m, F) GMOCK_METHOD8_(typename, , , m, F) #define MOCK_CONST_METHOD10(m, ...) GMOCK_METHOD10_(, const, , m, __VA_ARGS
#define MOCK_METHOD9_T(m, F) GMOCK_METHOD9_(typename, , , m, F) __)
#define MOCK_METHOD10_T(m, F) GMOCK_METHOD10_(typename, , , m, F)
#define MOCK_METHOD0_T(m, ...) GMOCK_METHOD0_(typename, , , m, __VA_ARGS__)
#define MOCK_CONST_METHOD0_T(m, F) GMOCK_METHOD0_(typename, const, , m, F) #define MOCK_METHOD1_T(m, ...) GMOCK_METHOD1_(typename, , , m, __VA_ARGS__)
#define MOCK_CONST_METHOD1_T(m, F) GMOCK_METHOD1_(typename, const, , m, F) #define MOCK_METHOD2_T(m, ...) GMOCK_METHOD2_(typename, , , m, __VA_ARGS__)
#define MOCK_CONST_METHOD2_T(m, F) GMOCK_METHOD2_(typename, const, , m, F) #define MOCK_METHOD3_T(m, ...) GMOCK_METHOD3_(typename, , , m, __VA_ARGS__)
#define MOCK_CONST_METHOD3_T(m, F) GMOCK_METHOD3_(typename, const, , m, F) #define MOCK_METHOD4_T(m, ...) GMOCK_METHOD4_(typename, , , m, __VA_ARGS__)
#define MOCK_CONST_METHOD4_T(m, F) GMOCK_METHOD4_(typename, const, , m, F) #define MOCK_METHOD5_T(m, ...) GMOCK_METHOD5_(typename, , , m, __VA_ARGS__)
#define MOCK_CONST_METHOD5_T(m, F) GMOCK_METHOD5_(typename, const, , m, F) #define MOCK_METHOD6_T(m, ...) GMOCK_METHOD6_(typename, , , m, __VA_ARGS__)
#define MOCK_CONST_METHOD6_T(m, F) GMOCK_METHOD6_(typename, const, , m, F) #define MOCK_METHOD7_T(m, ...) GMOCK_METHOD7_(typename, , , m, __VA_ARGS__)
#define MOCK_CONST_METHOD7_T(m, F) GMOCK_METHOD7_(typename, const, , m, F) #define MOCK_METHOD8_T(m, ...) GMOCK_METHOD8_(typename, , , m, __VA_ARGS__)
#define MOCK_CONST_METHOD8_T(m, F) GMOCK_METHOD8_(typename, const, , m, F) #define MOCK_METHOD9_T(m, ...) GMOCK_METHOD9_(typename, , , m, __VA_ARGS__)
#define MOCK_CONST_METHOD9_T(m, F) GMOCK_METHOD9_(typename, const, , m, F) #define MOCK_METHOD10_T(m, ...) GMOCK_METHOD10_(typename, , , m, __VA_ARGS_
#define MOCK_CONST_METHOD10_T(m, F) GMOCK_METHOD10_(typename, const, , m, F _)
)
#define MOCK_CONST_METHOD0_T(m, ...) \
#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD0_(, , ct, m, F) GMOCK_METHOD0_(typename, const, , m, __VA_ARGS__)
#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD1_(, , ct, m, F) #define MOCK_CONST_METHOD1_T(m, ...) \
#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD2_(, , ct, m, F) GMOCK_METHOD1_(typename, const, , m, __VA_ARGS__)
#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD3_(, , ct, m, F) #define MOCK_CONST_METHOD2_T(m, ...) \
#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD4_(, , ct, m, F) GMOCK_METHOD2_(typename, const, , m, __VA_ARGS__)
#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD5_(, , ct, m, F) #define MOCK_CONST_METHOD3_T(m, ...) \
#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD6_(, , ct, m, F) GMOCK_METHOD3_(typename, const, , m, __VA_ARGS__)
#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD7_(, , ct, m, F) #define MOCK_CONST_METHOD4_T(m, ...) \
#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD8_(, , ct, m, F) GMOCK_METHOD4_(typename, const, , m, __VA_ARGS__)
#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD9_(, , ct, m, F) #define MOCK_CONST_METHOD5_T(m, ...) \
#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD10_(, , ct, m, F) GMOCK_METHOD5_(typename, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD6_T(m, ...) \
#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD6_(typename, const, , m, __VA_ARGS__)
GMOCK_METHOD0_(, const, ct, m, F) #define MOCK_CONST_METHOD7_T(m, ...) \
#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD7_(typename, const, , m, __VA_ARGS__)
GMOCK_METHOD1_(, const, ct, m, F) #define MOCK_CONST_METHOD8_T(m, ...) \
#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD8_(typename, const, , m, __VA_ARGS__)
GMOCK_METHOD2_(, const, ct, m, F) #define MOCK_CONST_METHOD9_T(m, ...) \
#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD9_(typename, const, , m, __VA_ARGS__)
GMOCK_METHOD3_(, const, ct, m, F) #define MOCK_CONST_METHOD10_T(m, ...) \
#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD10_(typename, const, , m, __VA_ARGS__)
GMOCK_METHOD4_(, const, ct, m, F)
#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, F) \ #define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD5_(, const, ct, m, F) GMOCK_METHOD0_(, , ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, F) \ #define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD6_(, const, ct, m, F) GMOCK_METHOD1_(, , ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, F) \ #define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD7_(, const, ct, m, F) GMOCK_METHOD2_(, , ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, F) \ #define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD8_(, const, ct, m, F) GMOCK_METHOD3_(, , ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, F) \ #define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD9_(, const, ct, m, F) GMOCK_METHOD4_(, , ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, F) \ #define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD10_(, const, ct, m, F) GMOCK_METHOD5_(, , ct, m, __VA_ARGS__)
#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \
#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD6_(, , ct, m, __VA_ARGS__)
GMOCK_METHOD0_(typename, , ct, m, F) #define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \
#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD7_(, , ct, m, __VA_ARGS__)
GMOCK_METHOD1_(typename, , ct, m, F) #define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \
#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD8_(, , ct, m, __VA_ARGS__)
GMOCK_METHOD2_(typename, , ct, m, F) #define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \
#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD9_(, , ct, m, __VA_ARGS__)
GMOCK_METHOD3_(typename, , ct, m, F) #define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \
#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD10_(, , ct, m, __VA_ARGS__)
GMOCK_METHOD4_(typename, , ct, m, F)
#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, F) \ #define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD5_(typename, , ct, m, F) GMOCK_METHOD0_(, const, ct, m, __VA_ARGS__)
#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, F) \ #define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD6_(typename, , ct, m, F) GMOCK_METHOD1_(, const, ct, m, __VA_ARGS__)
#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, F) \ #define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD7_(typename, , ct, m, F) GMOCK_METHOD2_(, const, ct, m, __VA_ARGS__)
#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, F) \ #define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD8_(typename, , ct, m, F) GMOCK_METHOD3_(, const, ct, m, __VA_ARGS__)
#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, F) \ #define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD9_(typename, , ct, m, F) GMOCK_METHOD4_(, const, ct, m, __VA_ARGS__)
#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, F) \ #define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD10_(typename, , ct, m, F) GMOCK_METHOD5_(, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \
#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD6_(, const, ct, m, __VA_ARGS__)
GMOCK_METHOD0_(typename, const, ct, m, F) #define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \
#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD7_(, const, ct, m, __VA_ARGS__)
GMOCK_METHOD1_(typename, const, ct, m, F) #define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \
#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD8_(, const, ct, m, __VA_ARGS__)
GMOCK_METHOD2_(typename, const, ct, m, F) #define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \
#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD9_(, const, ct, m, __VA_ARGS__)
GMOCK_METHOD3_(typename, const, ct, m, F) #define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \
#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, F) \ GMOCK_METHOD10_(, const, ct, m, __VA_ARGS__)
GMOCK_METHOD4_(typename, const, ct, m, F)
#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, F) \ #define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD5_(typename, const, ct, m, F) GMOCK_METHOD0_(typename, , ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, F) \ #define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD6_(typename, const, ct, m, F) GMOCK_METHOD1_(typename, , ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, F) \ #define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD7_(typename, const, ct, m, F) GMOCK_METHOD2_(typename, , ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, F) \ #define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD8_(typename, const, ct, m, F) GMOCK_METHOD3_(typename, , ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, F) \ #define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD9_(typename, const, ct, m, F) GMOCK_METHOD4_(typename, , ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, F) \ #define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD10_(typename, const, ct, m, F) GMOCK_METHOD5_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD6_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD7_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD8_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD9_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD10_(typename, , ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD0_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD1_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD2_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD3_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD4_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD5_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD6_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD7_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD8_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD9_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD10_(typename, const, ct, m, __VA_ARGS__)
// A MockFunction<F> class has one mock method whose type is F. It is // A MockFunction<F> class has one mock method whose type is F. It is
// useful when you just want your test code to emit some messages and // useful when you just want your test code to emit some messages and
// have Google Mock verify the right messages are sent (and perhaps at // have Google Mock verify the right messages are sent (and perhaps at
// the right times). For example, if you are exercising code: // the right times). For example, if you are exercising code:
// //
// Foo(1); // Foo(1);
// Foo(2); // Foo(2);
// Foo(3); // Foo(3);
// //
 End of changes. 40 change blocks. 
313 lines changed or deleted 416 lines changed or added


 gmock-generated-function-mockers.h.pump   gmock-generated-function-mockers.h.pump 
skipping to change at line 105 skipping to change at line 105
]] ]]
} // namespace internal } // namespace internal
// The style guide prohibits "using" statements in a namespace scope // The style guide prohibits "using" statements in a namespace scope
// inside a header file. However, the FunctionMocker class template // inside a header file. However, the FunctionMocker class template
// is meant to be defined in the ::testing namespace. The following // is meant to be defined in the ::testing namespace. The following
// line is just a trick for working around a bug in MSVC 8.0, which // line is just a trick for working around a bug in MSVC 8.0, which
// cannot handle it if we define FunctionMocker in ::testing. // cannot handle it if we define FunctionMocker in ::testing.
using internal::FunctionMocker; using internal::FunctionMocker;
// The result type of function type F. // GMOCK_RESULT_(tn, F) expands to the result type of function type F.
// We define this as a variadic macro in case F contains unprotected
// commas (the same reason that we use variadic macros in other places
// in this file).
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_RESULT_(tn, F) tn ::testing::internal::Function<F>::Result #define GMOCK_RESULT_(tn, ...) \
tn ::testing::internal::Function<__VA_ARGS__>::Result
// The type of argument N of function type F. // The type of argument N of the given function type.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_ARG_(tn, F, N) tn ::testing::internal::Function<F>::Argument# #define GMOCK_ARG_(tn, N, ...) \
#N tn ::testing::internal::Function<__VA_ARGS__>::Argument##N
// The matcher type for argument N of function type F. // The matcher type for argument N of the given function type.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_MATCHER_(tn, F, N) const ::testing::Matcher<GMOCK_ARG_(tn, F, #define GMOCK_MATCHER_(tn, N, ...) \
N)>& const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>&
// The variable for mocking the given method. // The variable for mocking the given method.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_MOCKER_(arity, constness, Method) \ #define GMOCK_MOCKER_(arity, constness, Method) \
GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__) GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
$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, F, $j) gmock_a$j]]]] [[GMOCK_ARG_(tn, $j, __VA_ARGS__) gmock_a$j]]]]
$var as = [[$for j, [[gmock_a$j]]]] $var as = [[$for j, [[gmock_a$j]]]]
$var matcher_as = [[$for j, \ $var matcher_as = [[$for j, \
[[GMOCK_MATCHER_(tn, F, $j) gmock_a$j]]]] [[GMOCK_MATCHER_(tn, $j, __VA_ARGS__) gmock_a$j]]]]
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, F) \ #define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, F) ct Method($arg_as) constness { \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ $arg_as) constness { \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == $i, \ GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size<
\
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::valu
e == $i), \
this_method_does_not_take_$i[[]]_argument[[$if i != 1 [[s]]]]); \ this_method_does_not_take_$i[[]]_argument[[$if i != 1 [[s]]]]); \
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<F>& \ ::testing::MockSpec<__VA_ARGS__>& \
gmock_##Method($matcher_as) constness { \ gmock_##Method($matcher_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($as); \
} \ } \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_($i, constness, Method) mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_($i, constnes s, Method)
]] ]]
$for i [[ $for i [[
#define MOCK_METHOD$i(m, F) GMOCK_METHOD$i[[]]_(, , , m, F) #define MOCK_METHOD$i(m, ...) GMOCK_METHOD$i[[]]_(, , , m, __VA_ARGS__)
]] ]]
$for i [[ $for i [[
#define MOCK_CONST_METHOD$i(m, F) GMOCK_METHOD$i[[]]_(, const, , m, F) #define MOCK_CONST_METHOD$i(m, ...) GMOCK_METHOD$i[[]]_(, const, , m, __VA_ ARGS__)
]] ]]
$for i [[ $for i [[
#define MOCK_METHOD$i[[]]_T(m, F) GMOCK_METHOD$i[[]]_(typename, , , m, F) #define MOCK_METHOD$i[[]]_T(m, ...) GMOCK_METHOD$i[[]]_(typename, , , m, __ VA_ARGS__)
]] ]]
$for i [[ $for i [[
#define MOCK_CONST_METHOD$i[[]]_T(m, F) [[]] #define MOCK_CONST_METHOD$i[[]]_T(m, ...) \
GMOCK_METHOD$i[[]]_(typename, const, , m, F) GMOCK_METHOD$i[[]]_(typename, const, , m, __VA_ARGS__)
]] ]]
$for i [[ $for i [[
#define MOCK_METHOD$i[[]]_WITH_CALLTYPE(ct, m, F) [[]] #define MOCK_METHOD$i[[]]_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD$i[[]]_(, , ct, m, F) GMOCK_METHOD$i[[]]_(, , ct, m, __VA_ARGS__)
]] ]]
$for i [[ $for i [[
#define MOCK_CONST_METHOD$i[[]]_WITH_CALLTYPE(ct, m, F) \ #define MOCK_CONST_METHOD$i[[]]_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD$i[[]]_(, const, ct, m, F) GMOCK_METHOD$i[[]]_(, const, ct, m, __VA_ARGS__)
]] ]]
$for i [[ $for i [[
#define MOCK_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, F) \ #define MOCK_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD$i[[]]_(typename, , ct, m, F) GMOCK_METHOD$i[[]]_(typename, , ct, m, __VA_ARGS__)
]] ]]
$for i [[ $for i [[
#define MOCK_CONST_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, F) \ #define MOCK_CONST_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, ...) \
GMOCK_METHOD$i[[]]_(typename, const, ct, m, F) GMOCK_METHOD$i[[]]_(typename, const, ct, m, __VA_ARGS__)
]] ]]
// A MockFunction<F> class has one mock method whose type is F. It is // A MockFunction<F> class has one mock method whose type is F. It is
// useful when you just want your test code to emit some messages and // useful when you just want your test code to emit some messages and
// have Google Mock verify the right messages are sent (and perhaps at // have Google Mock verify the right messages are sent (and perhaps at
// the right times). For example, if you are exercising code: // the right times). For example, if you are exercising code:
// //
// Foo(1); // Foo(1);
// Foo(2); // Foo(2);
 End of changes. 19 change blocks. 
29 lines changed or deleted 36 lines changed or added


 gmock-generated-internal-utils.h   gmock-generated-internal-utils.h 
// This file was GENERATED by a script. DO NOT EDIT BY HAND!!! // This file was GENERATED by command:
// pump.py gmock-generated-internal-utils.h.pump
// DO NOT EDIT BY HAND!!!
// Copyright 2007, Google Inc. // Copyright 2007, Google Inc.
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
// //
// * Redistributions of source code must retain the above copyright // * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer. // notice, this list of conditions and the following disclaimer.
skipping to change at line 61 skipping to change at line 63
// An IgnoredValue object can be implicitly constructed from ANY value. // An IgnoredValue object can be implicitly constructed from ANY value.
// This is used in implementing the IgnoreResult(a) action. // This is used in implementing the IgnoreResult(a) action.
class IgnoredValue { class IgnoredValue {
public: public:
// This constructor template allows any value to be implicitly // This constructor template allows any value to be implicitly
// converted to IgnoredValue. The object has no data member and // converted to IgnoredValue. The object has no data member and
// doesn't try to remember anything about the argument. We // doesn't try to remember anything about the argument. We
// deliberately omit the 'explicit' keyword in order to allow the // deliberately omit the 'explicit' keyword in order to allow the
// conversion to be implicit. // conversion to be implicit.
template <typename T> template <typename T>
IgnoredValue(const T&) {} IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
}; };
// MatcherTuple<T>::type is a tuple type where each field is a Matcher // MatcherTuple<T>::type is a tuple type where each field is a Matcher
// for the corresponding field in tuple type T. // for the corresponding field in tuple type T.
template <typename Tuple> template <typename Tuple>
struct MatcherTuple; struct MatcherTuple;
template <> template <>
struct MatcherTuple< ::std::tr1::tuple<> > { struct MatcherTuple< ::std::tr1::tuple<> > {
typedef ::std::tr1::tuple< > type; typedef ::std::tr1::tuple< > type;
 End of changes. 2 change blocks. 
2 lines changed or deleted 4 lines changed or added


 gmock-generated-internal-utils.h.pump   gmock-generated-internal-utils.h.pump 
skipping to change at line 64 skipping to change at line 64
// An IgnoredValue object can be implicitly constructed from ANY value. // An IgnoredValue object can be implicitly constructed from ANY value.
// This is used in implementing the IgnoreResult(a) action. // This is used in implementing the IgnoreResult(a) action.
class IgnoredValue { class IgnoredValue {
public: public:
// This constructor template allows any value to be implicitly // This constructor template allows any value to be implicitly
// converted to IgnoredValue. The object has no data member and // converted to IgnoredValue. The object has no data member and
// doesn't try to remember anything about the argument. We // doesn't try to remember anything about the argument. We
// deliberately omit the 'explicit' keyword in order to allow the // deliberately omit the 'explicit' keyword in order to allow the
// conversion to be implicit. // conversion to be implicit.
template <typename T> template <typename T>
IgnoredValue(const T&) {} IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
}; };
// MatcherTuple<T>::type is a tuple type where each field is a Matcher // MatcherTuple<T>::type is a tuple type where each field is a Matcher
// for the corresponding field in tuple type T. // for the corresponding field in tuple type T.
template <typename Tuple> template <typename Tuple>
struct MatcherTuple; struct MatcherTuple;
$range i 0..n $range i 0..n
$for i [[ $for i [[
$range j 1..i $range j 1..i
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 gmock-generated-matchers.h   gmock-generated-matchers.h 
skipping to change at line 41 skipping to change at line 41
// (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.
// 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 matchers. // This file implements some commonly used variadic matchers.
#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_
#include <iterator>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <vector> #include <vector>
#include "gmock/gmock-matchers.h" #include "gmock/gmock-matchers.h"
namespace testing { namespace testing {
namespace internal { namespace internal {
// The type of the i-th (0-based) field of Tuple. // The type of the i-th (0-based) field of Tuple.
#define GMOCK_FIELD_TYPE_(Tuple, i) \ #define GMOCK_FIELD_TYPE_(Tuple, i) \
skipping to change at line 308 skipping to change at line 309
return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, k0, k1, k2, k3, k4, k 5, return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, k0, k1, k2, k3, k4, k 5,
k6, k7, k8, k9>(inner_matcher_)); k6, k7, k8, k9>(inner_matcher_));
} }
private: private:
const InnerMatcher inner_matcher_; const InnerMatcher inner_matcher_;
GTEST_DISALLOW_ASSIGN_(ArgsMatcher); GTEST_DISALLOW_ASSIGN_(ArgsMatcher);
}; };
// Implements ElementsAre() of 1-10 arguments. // A set of metafunctions for computing the result type of AllOf.
// AllOf(m1, ..., mN) returns
template <typename T1> // AllOfResultN<decltype(m1), ..., decltype(mN)>::type.
class ElementsAreMatcher1 {
public: // Although AllOf isn't defined for one argument, AllOfResult1 is defined
explicit ElementsAreMatcher1(const T1& e1) : e1_(e1) {} // to simplify the implementation.
template <typename M1>
template <typename Container> struct AllOfResult1 {
operator Matcher<Container>() const { typedef M1 type;
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; };
typedef typename internal::StlContainerView<RawContainer>::type::value_
type template <typename M1, typename M2>
Element; struct AllOfResult2 {
typedef BothOfMatcher<
// Nokia's Symbian Compiler has a nasty bug where the object put typename AllOfResult1<M1>::type,
// in a one-element local array is not destructed when the array typename AllOfResult1<M2>::type
// goes out of scope. This leads to obvious badness as we've > type;
// added the linked_ptr in it to our other linked_ptrs list. };
// Hence we implement ElementsAreMatcher1 specially to avoid using
// a local array. template <typename M1, typename M2, typename M3>
const Matcher<const Element&> matcher = struct AllOfResult3 {
MatcherCast<const Element&>(e1_); typedef BothOfMatcher<
return MakeMatcher(new ElementsAreMatcherImpl<Container>(&matcher, 1)); typename AllOfResult1<M1>::type,
} typename AllOfResult2<M2, M3>::type
> type;
private: };
const T1& e1_;
template <typename M1, typename M2, typename M3, typename M4>
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher1); struct AllOfResult4 {
}; typedef BothOfMatcher<
typename AllOfResult2<M1, M2>::type,
template <typename T1, typename T2> typename AllOfResult2<M3, M4>::type
class ElementsAreMatcher2 { > type;
public: };
ElementsAreMatcher2(const T1& e1, const T2& e2) : e1_(e1), e2_(e2) {}
template <typename M1, typename M2, typename M3, typename M4, typename M5>
template <typename Container> struct AllOfResult5 {
operator Matcher<Container>() const { typedef BothOfMatcher<
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; typename AllOfResult2<M1, M2>::type,
typedef typename internal::StlContainerView<RawContainer>::type::value_ typename AllOfResult3<M3, M4, M5>::type
type > type;
Element; };
const Matcher<const Element&> matchers[] = { template <typename M1, typename M2, typename M3, typename M4, typename M5,
MatcherCast<const Element&>(e1_), typename M6>
MatcherCast<const Element&>(e2_), struct AllOfResult6 {
}; typedef BothOfMatcher<
typename AllOfResult3<M1, M2, M3>::type,
return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 2)); typename AllOfResult3<M4, M5, M6>::type
} > type;
};
private:
const T1& e1_; template <typename M1, typename M2, typename M3, typename M4, typename M5,
const T2& e2_; typename M6, typename M7>
struct AllOfResult7 {
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher2); typedef BothOfMatcher<
}; typename AllOfResult3<M1, M2, M3>::type,
typename AllOfResult4<M4, M5, M6, M7>::type
template <typename T1, typename T2, typename T3> > type;
class ElementsAreMatcher3 { };
public:
ElementsAreMatcher3(const T1& e1, const T2& e2, const T3& e3) : e1_(e1), template <typename M1, typename M2, typename M3, typename M4, typename M5,
e2_(e2), e3_(e3) {} typename M6, typename M7, typename M8>
struct AllOfResult8 {
template <typename Container> typedef BothOfMatcher<
operator Matcher<Container>() const { typename AllOfResult4<M1, M2, M3, M4>::type,
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; typename AllOfResult4<M5, M6, M7, M8>::type
typedef typename internal::StlContainerView<RawContainer>::type::value_ > type;
type };
Element;
template <typename M1, typename M2, typename M3, typename M4, typename M5,
const Matcher<const Element&> matchers[] = { typename M6, typename M7, typename M8, typename M9>
MatcherCast<const Element&>(e1_), struct AllOfResult9 {
MatcherCast<const Element&>(e2_), typedef BothOfMatcher<
MatcherCast<const Element&>(e3_), typename AllOfResult4<M1, M2, M3, M4>::type,
}; typename AllOfResult5<M5, M6, M7, M8, M9>::type
> type;
return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 3)); };
}
template <typename M1, typename M2, typename M3, typename M4, typename M5,
private: typename M6, typename M7, typename M8, typename M9, typename M10>
const T1& e1_; struct AllOfResult10 {
const T2& e2_; typedef BothOfMatcher<
const T3& e3_; typename AllOfResult5<M1, M2, M3, M4, M5>::type,
typename AllOfResult5<M6, M7, M8, M9, M10>::type
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher3); > type;
}; };
template <typename T1, typename T2, typename T3, typename T4> // A set of metafunctions for computing the result type of AnyOf.
class ElementsAreMatcher4 { // AnyOf(m1, ..., mN) returns
public: // AnyOfResultN<decltype(m1), ..., decltype(mN)>::type.
ElementsAreMatcher4(const T1& e1, const T2& e2, const T3& e3,
const T4& e4) : e1_(e1), e2_(e2), e3_(e3), e4_(e4) {} // Although AnyOf isn't defined for one argument, AnyOfResult1 is defined
// to simplify the implementation.
template <typename Container> template <typename M1>
operator Matcher<Container>() const { struct AnyOfResult1 {
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; typedef M1 type;
typedef typename internal::StlContainerView<RawContainer>::type::value_ };
type
Element; template <typename M1, typename M2>
struct AnyOfResult2 {
const Matcher<const Element&> matchers[] = { typedef EitherOfMatcher<
MatcherCast<const Element&>(e1_), typename AnyOfResult1<M1>::type,
MatcherCast<const Element&>(e2_), typename AnyOfResult1<M2>::type
MatcherCast<const Element&>(e3_), > type;
MatcherCast<const Element&>(e4_), };
};
template <typename M1, typename M2, typename M3>
return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 4)); struct AnyOfResult3 {
} typedef EitherOfMatcher<
typename AnyOfResult1<M1>::type,
private: typename AnyOfResult2<M2, M3>::type
const T1& e1_; > type;
const T2& e2_; };
const T3& e3_;
const T4& e4_; template <typename M1, typename M2, typename M3, typename M4>
struct AnyOfResult4 {
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher4); typedef EitherOfMatcher<
}; typename AnyOfResult2<M1, M2>::type,
typename AnyOfResult2<M3, M4>::type
template <typename T1, typename T2, typename T3, typename T4, typename T5> > type;
class ElementsAreMatcher5 { };
public:
ElementsAreMatcher5(const T1& e1, const T2& e2, const T3& e3, const T4& e template <typename M1, typename M2, typename M3, typename M4, typename M5>
4, struct AnyOfResult5 {
const T5& e5) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5) {} typedef EitherOfMatcher<
typename AnyOfResult2<M1, M2>::type,
template <typename Container> typename AnyOfResult3<M3, M4, M5>::type
operator Matcher<Container>() const { > type;
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; };
typedef typename internal::StlContainerView<RawContainer>::type::value_
type template <typename M1, typename M2, typename M3, typename M4, typename M5,
Element; typename M6>
struct AnyOfResult6 {
const Matcher<const Element&> matchers[] = { typedef EitherOfMatcher<
MatcherCast<const Element&>(e1_), typename AnyOfResult3<M1, M2, M3>::type,
MatcherCast<const Element&>(e2_), typename AnyOfResult3<M4, M5, M6>::type
MatcherCast<const Element&>(e3_), > type;
MatcherCast<const Element&>(e4_), };
MatcherCast<const Element&>(e5_),
}; template <typename M1, typename M2, typename M3, typename M4, typename M5,
typename M6, typename M7>
return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 5)); struct AnyOfResult7 {
} typedef EitherOfMatcher<
typename AnyOfResult3<M1, M2, M3>::type,
private: typename AnyOfResult4<M4, M5, M6, M7>::type
const T1& e1_; > type;
const T2& e2_; };
const T3& e3_;
const T4& e4_; template <typename M1, typename M2, typename M3, typename M4, typename M5,
const T5& e5_; typename M6, typename M7, typename M8>
struct AnyOfResult8 {
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher5); typedef EitherOfMatcher<
}; typename AnyOfResult4<M1, M2, M3, M4>::type,
typename AnyOfResult4<M5, M6, M7, M8>::type
template <typename T1, typename T2, typename T3, typename T4, typename T5, > type;
typename T6> };
class ElementsAreMatcher6 {
public: template <typename M1, typename M2, typename M3, typename M4, typename M5,
ElementsAreMatcher6(const T1& e1, const T2& e2, const T3& e3, const T4& e typename M6, typename M7, typename M8, typename M9>
4, struct AnyOfResult9 {
const T5& e5, const T6& e6) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), typedef EitherOfMatcher<
e5_(e5), e6_(e6) {} typename AnyOfResult4<M1, M2, M3, M4>::type,
typename AnyOfResult5<M5, M6, M7, M8, M9>::type
template <typename Container> > type;
operator Matcher<Container>() const { };
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_ template <typename M1, typename M2, typename M3, typename M4, typename M5,
type typename M6, typename M7, typename M8, typename M9, typename M10>
Element; struct AnyOfResult10 {
typedef EitherOfMatcher<
const Matcher<const Element&> matchers[] = { typename AnyOfResult5<M1, M2, M3, M4, M5>::type,
MatcherCast<const Element&>(e1_), typename AnyOfResult5<M6, M7, M8, M9, M10>::type
MatcherCast<const Element&>(e2_), > type;
MatcherCast<const Element&>(e3_),
MatcherCast<const Element&>(e4_),
MatcherCast<const Element&>(e5_),
MatcherCast<const Element&>(e6_),
};
return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 6));
}
private:
const T1& e1_;
const T2& e2_;
const T3& e3_;
const T4& e4_;
const T5& e5_;
const T6& e6_;
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher6);
};
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7>
class ElementsAreMatcher7 {
public:
ElementsAreMatcher7(const T1& e1, const T2& e2, const T3& e3, const T4& e
4,
const T5& e5, const T6& e6, const T7& e7) : e1_(e1), e2_(e2), e3_(e3)
,
e4_(e4), e5_(e5), e6_(e6), e7_(e7) {}
template <typename Container>
operator Matcher<Container>() const {
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_
type
Element;
const Matcher<const Element&> matchers[] = {
MatcherCast<const Element&>(e1_),
MatcherCast<const Element&>(e2_),
MatcherCast<const Element&>(e3_),
MatcherCast<const Element&>(e4_),
MatcherCast<const Element&>(e5_),
MatcherCast<const Element&>(e6_),
MatcherCast<const Element&>(e7_),
};
return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 7));
}
private:
const T1& e1_;
const T2& e2_;
const T3& e3_;
const T4& e4_;
const T5& e5_;
const T6& e6_;
const T7& e7_;
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher7);
};
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8>
class ElementsAreMatcher8 {
public:
ElementsAreMatcher8(const T1& e1, const T2& e2, const T3& e3, const T4& e
4,
const T5& e5, const T6& e6, const T7& e7, const T8& e8) : e1_(e1),
e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6), e7_(e7), e8_(e8) {}
template <typename Container>
operator Matcher<Container>() const {
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_
type
Element;
const Matcher<const Element&> matchers[] = {
MatcherCast<const Element&>(e1_),
MatcherCast<const Element&>(e2_),
MatcherCast<const Element&>(e3_),
MatcherCast<const Element&>(e4_),
MatcherCast<const Element&>(e5_),
MatcherCast<const Element&>(e6_),
MatcherCast<const Element&>(e7_),
MatcherCast<const Element&>(e8_),
};
return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 8));
}
private:
const T1& e1_;
const T2& e2_;
const T3& e3_;
const T4& e4_;
const T5& e5_;
const T6& e6_;
const T7& e7_;
const T8& e8_;
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher8);
};
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9>
class ElementsAreMatcher9 {
public:
ElementsAreMatcher9(const T1& e1, const T2& e2, const T3& e3, const T4& e
4,
const T5& e5, const T6& e6, const T7& e7, const T8& e8,
const T9& e9) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6),
e7_(e7), e8_(e8), e9_(e9) {}
template <typename Container>
operator Matcher<Container>() const {
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_
type
Element;
const Matcher<const Element&> matchers[] = {
MatcherCast<const Element&>(e1_),
MatcherCast<const Element&>(e2_),
MatcherCast<const Element&>(e3_),
MatcherCast<const Element&>(e4_),
MatcherCast<const Element&>(e5_),
MatcherCast<const Element&>(e6_),
MatcherCast<const Element&>(e7_),
MatcherCast<const Element&>(e8_),
MatcherCast<const Element&>(e9_),
};
return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 9));
}
private:
const T1& e1_;
const T2& e2_;
const T3& e3_;
const T4& e4_;
const T5& e5_;
const T6& e6_;
const T7& e7_;
const T8& e8_;
const T9& e9_;
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher9);
};
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10>
class ElementsAreMatcher10 {
public:
ElementsAreMatcher10(const T1& e1, const T2& e2, const T3& e3, const T4&
e4,
const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9,
const T10& e10) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6
),
e7_(e7), e8_(e8), e9_(e9), e10_(e10) {}
template <typename Container>
operator Matcher<Container>() const {
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_
type
Element;
const Matcher<const Element&> matchers[] = {
MatcherCast<const Element&>(e1_),
MatcherCast<const Element&>(e2_),
MatcherCast<const Element&>(e3_),
MatcherCast<const Element&>(e4_),
MatcherCast<const Element&>(e5_),
MatcherCast<const Element&>(e6_),
MatcherCast<const Element&>(e7_),
MatcherCast<const Element&>(e8_),
MatcherCast<const Element&>(e9_),
MatcherCast<const Element&>(e10_),
};
return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 10))
;
}
private:
const T1& e1_;
const T2& e2_;
const T3& e3_;
const T4& e4_;
const T5& e5_;
const T6& e6_;
const T7& e7_;
const T8& e8_;
const T9& e9_;
const T10& e10_;
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher10);
}; };
} // namespace internal } // namespace internal
// Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected // Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected
// fields of it matches a_matcher. C++ doesn't support default // fields of it matches a_matcher. C++ doesn't support default
// arguments for function templates, so we have to overload it. // arguments for function templates, so we have to overload it.
template <typename InnerMatcher> template <typename InnerMatcher>
inline internal::ArgsMatcher<InnerMatcher> inline internal::ArgsMatcher<InnerMatcher>
Args(const InnerMatcher& matcher) { Args(const InnerMatcher& matcher) {
skipping to change at line 744 skipping to change at line 565
template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
int k9, int k10, typename InnerMatcher> int k9, int k10, typename InnerMatcher>
inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9, inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9,
k10> k10>
Args(const InnerMatcher& matcher) { Args(const InnerMatcher& matcher) {
return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8 , return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8 ,
k9, k10>(matcher); k9, k10>(matcher);
} }
// ElementsAre(e0, e1, ..., e_n) matches an STL-style container with // ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with
// (n + 1) elements, where the i-th element in the container must // n elements, where the i-th element in the container must
// match the i-th argument in the list. Each argument of // match the i-th argument in the list. Each argument of
// ElementsAre() can be either a value or a matcher. We support up to // ElementsAre() can be either a value or a matcher. We support up to
// 10 arguments. // 10 arguments.
// //
// The use of DecayArray in the implementation allows ElementsAre()
// to accept string literals, whose type is const char[N], but we
// want to treat them as const char*.
//
// NOTE: Since ElementsAre() cares about the order of the elements, it // NOTE: Since ElementsAre() cares about the order of the elements, it
// must not be used with containers whose elements's order is // must not be used with containers whose elements's order is
// undefined (e.g. hash_map). // undefined (e.g. hash_map).
inline internal::ElementsAreMatcher0 ElementsAre() { inline internal::ElementsAreMatcher<
return internal::ElementsAreMatcher0(); std::tr1::tuple<> >
ElementsAre() {
typedef std::tr1::tuple<> Args;
return internal::ElementsAreMatcher<Args>(Args());
} }
template <typename T1> template <typename T1>
inline internal::ElementsAreMatcher1<T1> ElementsAre(const T1& e1) { inline internal::ElementsAreMatcher<
return internal::ElementsAreMatcher1<T1>(e1); std::tr1::tuple<
typename internal::DecayArray<T1>::type> >
ElementsAre(const T1& e1) {
typedef std::tr1::tuple<
typename internal::DecayArray<T1>::type> Args;
return internal::ElementsAreMatcher<Args>(Args(e1));
} }
template <typename T1, typename T2> template <typename T1, typename T2>
inline internal::ElementsAreMatcher2<T1, T2> ElementsAre(const T1& e1, inline internal::ElementsAreMatcher<
const T2& e2) { std::tr1::tuple<
return internal::ElementsAreMatcher2<T1, T2>(e1, e2); typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type> >
ElementsAre(const T1& e1, const T2& e2) {
typedef std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type> Args;
return internal::ElementsAreMatcher<Args>(Args(e1, e2));
} }
template <typename T1, typename T2, typename T3> template <typename T1, typename T2, typename T3>
inline internal::ElementsAreMatcher3<T1, T2, T3> ElementsAre(const T1& e1, inline internal::ElementsAreMatcher<
const T2& e2, const T3& e3) { std::tr1::tuple<
return internal::ElementsAreMatcher3<T1, T2, T3>(e1, e2, e3); typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type> >
ElementsAre(const T1& e1, const T2& e2, const T3& e3) {
typedef std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type> Args;
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3));
} }
template <typename T1, typename T2, typename T3, typename T4> template <typename T1, typename T2, typename T3, typename T4>
inline internal::ElementsAreMatcher4<T1, T2, T3, T4> ElementsAre(const T1& inline internal::ElementsAreMatcher<
e1, std::tr1::tuple<
const T2& e2, const T3& e3, const T4& e4) { typename internal::DecayArray<T1>::type,
return internal::ElementsAreMatcher4<T1, T2, T3, T4>(e1, e2, e3, e4); typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type> >
ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) {
typedef std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type> Args;
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4));
} }
template <typename T1, typename T2, typename T3, typename T4, typename T5> template <typename T1, typename T2, typename T3, typename T4, typename T5>
inline internal::ElementsAreMatcher5<T1, T2, T3, T4, inline internal::ElementsAreMatcher<
T5> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type> >
ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
const T5& e5) { const T5& e5) {
return internal::ElementsAreMatcher5<T1, T2, T3, T4, T5>(e1, e2, e3, e4, typedef std::tr1::tuple<
e5); typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type> Args;
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5));
} }
template <typename T1, typename T2, typename T3, typename T4, typename T5, template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6> typename T6>
inline internal::ElementsAreMatcher6<T1, T2, T3, T4, T5, inline internal::ElementsAreMatcher<
T6> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type> >
ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
const T5& e5, const T6& e6) { const T5& e5, const T6& e6) {
return internal::ElementsAreMatcher6<T1, T2, T3, T4, T5, T6>(e1, e2, e3, typedef std::tr1::tuple<
e4, typename internal::DecayArray<T1>::type,
e5, e6); typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type> Args;
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6));
} }
template <typename T1, typename T2, typename T3, typename T4, typename T5, template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7> typename T6, typename T7>
inline internal::ElementsAreMatcher7<T1, T2, T3, T4, T5, T6, inline internal::ElementsAreMatcher<
T7> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type> >
ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
const T5& e5, const T6& e6, const T7& e7) { const T5& e5, const T6& e6, const T7& e7) {
return internal::ElementsAreMatcher7<T1, T2, T3, T4, T5, T6, T7>(e1, e2, typedef std::tr1::tuple<
e3, typename internal::DecayArray<T1>::type,
e4, e5, e6, e7); typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type> Args;
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7
));
} }
template <typename T1, typename T2, typename T3, typename T4, typename T5, template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8> typename T6, typename T7, typename T8>
inline internal::ElementsAreMatcher8<T1, T2, T3, T4, T5, T6, T7, inline internal::ElementsAreMatcher<
T8> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type,
typename internal::DecayArray<T8>::type> >
ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
const T5& e5, const T6& e6, const T7& e7, const T8& e8) { const T5& e5, const T6& e6, const T7& e7, const T8& e8) {
return internal::ElementsAreMatcher8<T1, T2, T3, T4, T5, T6, T7, T8>(e1, typedef std::tr1::tuple<
e2, typename internal::DecayArray<T1>::type,
e3, e4, e5, e6, e7, e8); typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type,
typename internal::DecayArray<T8>::type> Args;
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7
,
e8));
} }
template <typename T1, typename T2, typename T3, typename T4, typename T5, template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9> typename T6, typename T7, typename T8, typename T9>
inline internal::ElementsAreMatcher9<T1, T2, T3, T4, T5, T6, T7, T8, inline internal::ElementsAreMatcher<
T9> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type,
typename internal::DecayArray<T8>::type,
typename internal::DecayArray<T9>::type> >
ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) { const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) {
return internal::ElementsAreMatcher9<T1, T2, T3, T4, T5, T6, T7, T8, T9>( typedef std::tr1::tuple<
e1, typename internal::DecayArray<T1>::type,
e2, e3, e4, e5, e6, e7, e8, e9); typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type,
typename internal::DecayArray<T8>::type,
typename internal::DecayArray<T9>::type> Args;
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7
,
e8, e9));
} }
template <typename T1, typename T2, typename T3, typename T4, typename T5, template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10> typename T6, typename T7, typename T8, typename T9, typename T10>
inline internal::ElementsAreMatcher10<T1, T2, T3, T4, T5, T6, T7, T8, T9, inline internal::ElementsAreMatcher<
T10> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4 std::tr1::tuple<
, typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type,
typename internal::DecayArray<T8>::type,
typename internal::DecayArray<T9>::type,
typename internal::DecayArray<T10>::type> >
ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9, const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9,
const T10& e10) { const T10& e10) {
return internal::ElementsAreMatcher10<T1, T2, T3, T4, T5, T6, T7, T8, T9, typedef std::tr1::tuple<
T10>(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10); typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type,
typename internal::DecayArray<T8>::type,
typename internal::DecayArray<T9>::type,
typename internal::DecayArray<T10>::type> Args;
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7
,
e8, e9, e10));
}
// 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.
inline internal::UnorderedElementsAreMatcher<
std::tr1::tuple<> >
UnorderedElementsAre() {
typedef std::tr1::tuple<> Args;
return internal::UnorderedElementsAreMatcher<Args>(Args());
}
template <typename T1>
inline internal::UnorderedElementsAreMatcher<
std::tr1::tuple<
typename internal::DecayArray<T1>::type> >
UnorderedElementsAre(const T1& e1) {
typedef std::tr1::tuple<
typename internal::DecayArray<T1>::type> Args;
return internal::UnorderedElementsAreMatcher<Args>(Args(e1));
}
template <typename T1, typename T2>
inline internal::UnorderedElementsAreMatcher<
std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type> >
UnorderedElementsAre(const T1& e1, const T2& e2) {
typedef std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type> Args;
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2));
} }
// ElementsAreArray(array) and ElementAreArray(array, count) are like template <typename T1, typename T2, typename T3>
// ElementsAre(), except that they take an array of values or inline internal::UnorderedElementsAreMatcher<
// matchers. The former form infers the size of 'array', which must std::tr1::tuple<
// be a static C-style array. In the latter form, 'array' can either typename internal::DecayArray<T1>::type,
// be a static array or a pointer to a dynamically created array. typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type> >
template <typename T> UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3) {
inline internal::ElementsAreArrayMatcher<T> ElementsAreArray( typedef std::tr1::tuple<
const T* first, size_t count) { typename internal::DecayArray<T1>::type,
return internal::ElementsAreArrayMatcher<T>(first, count); typename internal::DecayArray<T2>::type,
} typename internal::DecayArray<T3>::type> Args;
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3));
template <typename T, size_t N> }
inline internal::ElementsAreArrayMatcher<T>
ElementsAreArray(const T (&array)[N]) { template <typename T1, typename T2, typename T3, typename T4>
return internal::ElementsAreArrayMatcher<T>(array, N); inline internal::UnorderedElementsAreMatcher<
std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type> >
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4
) {
typedef std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type> Args;
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4));
}
template <typename T1, typename T2, typename T3, typename T4, typename T5>
inline internal::UnorderedElementsAreMatcher<
std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type> >
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4
,
const T5& e5) {
typedef std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type> Args;
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e
5));
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6>
inline internal::UnorderedElementsAreMatcher<
std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type> >
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4
,
const T5& e5, const T6& e6) {
typedef std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type> Args;
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e
5,
e6));
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7>
inline internal::UnorderedElementsAreMatcher<
std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type> >
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4
,
const T5& e5, const T6& e6, const T7& e7) {
typedef std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type> Args;
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e
5,
e6, e7));
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8>
inline internal::UnorderedElementsAreMatcher<
std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type,
typename internal::DecayArray<T8>::type> >
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4
,
const T5& e5, const T6& e6, const T7& e7, const T8& e8) {
typedef std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type,
typename internal::DecayArray<T8>::type> Args;
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e
5,
e6, e7, e8));
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9>
inline internal::UnorderedElementsAreMatcher<
std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type,
typename internal::DecayArray<T8>::type,
typename internal::DecayArray<T9>::type> >
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4
,
const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) {
typedef std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type,
typename internal::DecayArray<T8>::type,
typename internal::DecayArray<T9>::type> Args;
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e
5,
e6, e7, e8, e9));
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10>
inline internal::UnorderedElementsAreMatcher<
std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type,
typename internal::DecayArray<T8>::type,
typename internal::DecayArray<T9>::type,
typename internal::DecayArray<T10>::type> >
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4
,
const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9,
const T10& e10) {
typedef std::tr1::tuple<
typename internal::DecayArray<T1>::type,
typename internal::DecayArray<T2>::type,
typename internal::DecayArray<T3>::type,
typename internal::DecayArray<T4>::type,
typename internal::DecayArray<T5>::type,
typename internal::DecayArray<T6>::type,
typename internal::DecayArray<T7>::type,
typename internal::DecayArray<T8>::type,
typename internal::DecayArray<T9>::type,
typename internal::DecayArray<T10>::type> Args;
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e
5,
e6, e7, e8, e9, e10));
} }
// AllOf(m1, m2, ..., mk) matches any value that matches all of the given // AllOf(m1, m2, ..., mk) matches any value that matches all of the given
// sub-matchers. AllOf is called fully qualified to prevent ADL from firin g. // sub-matchers. AllOf is called fully qualified to prevent ADL from firin g.
template <typename Matcher1, typename Matcher2> template <typename M1, typename M2>
inline internal::BothOfMatcher<Matcher1, Matcher2> inline typename internal::AllOfResult2<M1, M2>::type
AllOf(Matcher1 m1, Matcher2 m2) { AllOf(M1 m1, M2 m2) {
return internal::BothOfMatcher<Matcher1, Matcher2>(m1, m2); return typename internal::AllOfResult2<M1, M2>::type(
} m1,
m2);
template <typename Matcher1, typename Matcher2, typename Matcher3> }
inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2,
Matcher3> > template <typename M1, typename M2, typename M3>
AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3) { inline typename internal::AllOfResult3<M1, M2, M3>::type
return ::testing::AllOf(m1, ::testing::AllOf(m2, m3)); AllOf(M1 m1, M2 m2, M3 m3) {
} return typename internal::AllOfResult3<M1, M2, M3>::type(
m1,
template <typename Matcher1, typename Matcher2, typename Matcher3, ::testing::AllOf(m2, m3));
typename Matcher4> }
inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2,
internal::BothOfMatcher<Matcher3, Matcher4> > > template <typename M1, typename M2, typename M3, typename M4>
AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4) { inline typename internal::AllOfResult4<M1, M2, M3, M4>::type
return ::testing::AllOf(m1, ::testing::AllOf(m2, m3, m4)); AllOf(M1 m1, M2 m2, M3 m3, M4 m4) {
} return typename internal::AllOfResult4<M1, M2, M3, M4>::type(
::testing::AllOf(m1, m2),
template <typename Matcher1, typename Matcher2, typename Matcher3, ::testing::AllOf(m3, m4));
typename Matcher4, typename Matcher5> }
inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2,
internal::BothOfMatcher<Matcher3, internal::BothOfMatcher<Matcher4, template <typename M1, typename M2, typename M3, typename M4, typename M5>
Matcher5> > > > inline typename internal::AllOfResult5<M1, M2, M3, M4, M5>::type
AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5) { AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) {
return ::testing::AllOf(m1, ::testing::AllOf(m2, m3, m4, m5)); return typename internal::AllOfResult5<M1, M2, M3, M4, M5>::type(
} ::testing::AllOf(m1, m2),
::testing::AllOf(m3, m4, m5));
template <typename Matcher1, typename Matcher2, typename Matcher3, }
typename Matcher4, typename Matcher5, typename Matcher6>
inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2, template <typename M1, typename M2, typename M3, typename M4, typename M5,
internal::BothOfMatcher<Matcher3, internal::BothOfMatcher<Matcher4, typename M6>
internal::BothOfMatcher<Matcher5, Matcher6> > > > > inline typename internal::AllOfResult6<M1, M2, M3, M4, M5, M6>::type
AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5, AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) {
Matcher6 m6) { return typename internal::AllOfResult6<M1, M2, M3, M4, M5, M6>::type(
return ::testing::AllOf(m1, ::testing::AllOf(m2, m3, m4, m5, m6)); ::testing::AllOf(m1, m2, m3),
} ::testing::AllOf(m4, m5, m6));
}
template <typename Matcher1, typename Matcher2, typename Matcher3,
typename Matcher4, typename Matcher5, typename Matcher6, typename Match template <typename M1, typename M2, typename M3, typename M4, typename M5,
er7> typename M6, typename M7>
inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2, inline typename internal::AllOfResult7<M1, M2, M3, M4, M5, M6, M7>::type
internal::BothOfMatcher<Matcher3, internal::BothOfMatcher<Matcher4, AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) {
internal::BothOfMatcher<Matcher5, internal::BothOfMatcher<Matcher6, return typename internal::AllOfResult7<M1, M2, M3, M4, M5, M6, M7>::type(
Matcher7> > > > > > ::testing::AllOf(m1, m2, m3),
AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5, ::testing::AllOf(m4, m5, m6, m7));
Matcher6 m6, Matcher7 m7) { }
return ::testing::AllOf(m1, ::testing::AllOf(m2, m3, m4, m5, m6, m7));
} template <typename M1, typename M2, typename M3, typename M4, typename M5,
typename M6, typename M7, typename M8>
template <typename Matcher1, typename Matcher2, typename Matcher3, inline typename internal::AllOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::typ
typename Matcher4, typename Matcher5, typename Matcher6, typename Match e
er7, AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) {
typename Matcher8> return typename internal::AllOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::t
inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2, ype(
internal::BothOfMatcher<Matcher3, internal::BothOfMatcher<Matcher4, ::testing::AllOf(m1, m2, m3, m4),
internal::BothOfMatcher<Matcher5, internal::BothOfMatcher<Matcher6, ::testing::AllOf(m5, m6, m7, m8));
internal::BothOfMatcher<Matcher7, Matcher8> > > > > > > }
AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5,
Matcher6 m6, Matcher7 m7, Matcher8 m8) { template <typename M1, typename M2, typename M3, typename M4, typename M5,
return ::testing::AllOf(m1, ::testing::AllOf(m2, m3, m4, m5, m6, m7, m8)) typename M6, typename M7, typename M8, typename M9>
; inline typename internal::AllOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, M9>:
} :type
AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) {
template <typename Matcher1, typename Matcher2, typename Matcher3, return typename internal::AllOfResult9<M1, M2, M3, M4, M5, M6, M7, M8,
typename Matcher4, typename Matcher5, typename Matcher6, typename Match M9>::type(
er7, ::testing::AllOf(m1, m2, m3, m4),
typename Matcher8, typename Matcher9> ::testing::AllOf(m5, m6, m7, m8, m9));
inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2, }
internal::BothOfMatcher<Matcher3, internal::BothOfMatcher<Matcher4,
internal::BothOfMatcher<Matcher5, internal::BothOfMatcher<Matcher6, template <typename M1, typename M2, typename M3, typename M4, typename M5,
internal::BothOfMatcher<Matcher7, internal::BothOfMatcher<Matcher8, typename M6, typename M7, typename M8, typename M9, typename M10>
Matcher9> > > > > > > > inline typename internal::AllOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9,
AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5, M10>::type
Matcher6 m6, Matcher7 m7, Matcher8 m8, Matcher9 m9) { AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m1
return ::testing::AllOf(m1, ::testing::AllOf(m2, m3, m4, m5, m6, m7, m8, 0) {
m9)); return typename internal::AllOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M
} 9,
M10>::type(
template <typename Matcher1, typename Matcher2, typename Matcher3, ::testing::AllOf(m1, m2, m3, m4, m5),
typename Matcher4, typename Matcher5, typename Matcher6, typename Match ::testing::AllOf(m6, m7, m8, m9, m10));
er7,
typename Matcher8, typename Matcher9, typename Matcher10>
inline internal::BothOfMatcher<Matcher1, internal::BothOfMatcher<Matcher2,
internal::BothOfMatcher<Matcher3, internal::BothOfMatcher<Matcher4,
internal::BothOfMatcher<Matcher5, internal::BothOfMatcher<Matcher6,
internal::BothOfMatcher<Matcher7, internal::BothOfMatcher<Matcher8,
internal::BothOfMatcher<Matcher9, Matcher10> > > > > > > > >
AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5,
Matcher6 m6, Matcher7 m7, Matcher8 m8, Matcher9 m9, Matcher10 m10) {
return ::testing::AllOf(m1, ::testing::AllOf(m2, m3, m4, m5, m6, m7, m8,
m9,
m10));
} }
// AnyOf(m1, m2, ..., mk) matches any value that matches any of the given // AnyOf(m1, m2, ..., mk) matches any value that matches any of the given
// sub-matchers. AnyOf is called fully qualified to prevent ADL from firin g. // sub-matchers. AnyOf is called fully qualified to prevent ADL from firin g.
template <typename Matcher1, typename Matcher2> template <typename M1, typename M2>
inline internal::EitherOfMatcher<Matcher1, Matcher2> inline typename internal::AnyOfResult2<M1, M2>::type
AnyOf(Matcher1 m1, Matcher2 m2) { AnyOf(M1 m1, M2 m2) {
return internal::EitherOfMatcher<Matcher1, Matcher2>(m1, m2); return typename internal::AnyOfResult2<M1, M2>::type(
} m1,
m2);
template <typename Matcher1, typename Matcher2, typename Matcher3> }
inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matche
r2, template <typename M1, typename M2, typename M3>
Matcher3> > inline typename internal::AnyOfResult3<M1, M2, M3>::type
AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3) { AnyOf(M1 m1, M2 m2, M3 m3) {
return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3)); return typename internal::AnyOfResult3<M1, M2, M3>::type(
} m1,
::testing::AnyOf(m2, m3));
template <typename Matcher1, typename Matcher2, typename Matcher3, }
typename Matcher4>
inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matche template <typename M1, typename M2, typename M3, typename M4>
r2, inline typename internal::AnyOfResult4<M1, M2, M3, M4>::type
internal::EitherOfMatcher<Matcher3, Matcher4> > > AnyOf(M1 m1, M2 m2, M3 m3, M4 m4) {
AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4) { return typename internal::AnyOfResult4<M1, M2, M3, M4>::type(
return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3, m4)); ::testing::AnyOf(m1, m2),
} ::testing::AnyOf(m3, m4));
}
template <typename Matcher1, typename Matcher2, typename Matcher3,
typename Matcher4, typename Matcher5> template <typename M1, typename M2, typename M3, typename M4, typename M5>
inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matche inline typename internal::AnyOfResult5<M1, M2, M3, M4, M5>::type
r2, AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) {
internal::EitherOfMatcher<Matcher3, internal::EitherOfMatcher<Matcher4, return typename internal::AnyOfResult5<M1, M2, M3, M4, M5>::type(
Matcher5> > > > ::testing::AnyOf(m1, m2),
AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5) { ::testing::AnyOf(m3, m4, m5));
return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3, m4, m5)); }
}
template <typename M1, typename M2, typename M3, typename M4, typename M5,
template <typename Matcher1, typename Matcher2, typename Matcher3, typename M6>
typename Matcher4, typename Matcher5, typename Matcher6> inline typename internal::AnyOfResult6<M1, M2, M3, M4, M5, M6>::type
inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matche AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) {
r2, return typename internal::AnyOfResult6<M1, M2, M3, M4, M5, M6>::type(
internal::EitherOfMatcher<Matcher3, internal::EitherOfMatcher<Matcher4, ::testing::AnyOf(m1, m2, m3),
internal::EitherOfMatcher<Matcher5, Matcher6> > > > > ::testing::AnyOf(m4, m5, m6));
AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5, }
Matcher6 m6) {
return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3, m4, m5, m6)); template <typename M1, typename M2, typename M3, typename M4, typename M5,
} typename M6, typename M7>
inline typename internal::AnyOfResult7<M1, M2, M3, M4, M5, M6, M7>::type
template <typename Matcher1, typename Matcher2, typename Matcher3, AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) {
typename Matcher4, typename Matcher5, typename Matcher6, typename Match return typename internal::AnyOfResult7<M1, M2, M3, M4, M5, M6, M7>::type(
er7> ::testing::AnyOf(m1, m2, m3),
inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matche ::testing::AnyOf(m4, m5, m6, m7));
r2, }
internal::EitherOfMatcher<Matcher3, internal::EitherOfMatcher<Matcher4,
internal::EitherOfMatcher<Matcher5, internal::EitherOfMatcher<Matcher6, template <typename M1, typename M2, typename M3, typename M4, typename M5,
Matcher7> > > > > > typename M6, typename M7, typename M8>
AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5, inline typename internal::AnyOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::typ
Matcher6 m6, Matcher7 m7) { e
return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3, m4, m5, m6, m7)); AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) {
} return typename internal::AnyOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::t
ype(
template <typename Matcher1, typename Matcher2, typename Matcher3, ::testing::AnyOf(m1, m2, m3, m4),
typename Matcher4, typename Matcher5, typename Matcher6, typename Match ::testing::AnyOf(m5, m6, m7, m8));
er7, }
typename Matcher8>
inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matche template <typename M1, typename M2, typename M3, typename M4, typename M5,
r2, typename M6, typename M7, typename M8, typename M9>
internal::EitherOfMatcher<Matcher3, internal::EitherOfMatcher<Matcher4, inline typename internal::AnyOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, M9>:
internal::EitherOfMatcher<Matcher5, internal::EitherOfMatcher<Matcher6, :type
internal::EitherOfMatcher<Matcher7, Matcher8> > > > > > > AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) {
AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5, return typename internal::AnyOfResult9<M1, M2, M3, M4, M5, M6, M7, M8,
Matcher6 m6, Matcher7 m7, Matcher8 m8) { M9>::type(
return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3, m4, m5, m6, m7, m8)) ::testing::AnyOf(m1, m2, m3, m4),
; ::testing::AnyOf(m5, m6, m7, m8, m9));
} }
template <typename Matcher1, typename Matcher2, typename Matcher3, template <typename M1, typename M2, typename M3, typename M4, typename M5,
typename Matcher4, typename Matcher5, typename Matcher6, typename Match typename M6, typename M7, typename M8, typename M9, typename M10>
er7, inline typename internal::AnyOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9,
typename Matcher8, typename Matcher9> M10>::type
inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matche AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m1
r2, 0) {
internal::EitherOfMatcher<Matcher3, internal::EitherOfMatcher<Matcher4, return typename internal::AnyOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M
internal::EitherOfMatcher<Matcher5, internal::EitherOfMatcher<Matcher6, 9,
internal::EitherOfMatcher<Matcher7, internal::EitherOfMatcher<Matcher8, M10>::type(
Matcher9> > > > > > > > ::testing::AnyOf(m1, m2, m3, m4, m5),
AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5, ::testing::AnyOf(m6, m7, m8, m9, m10));
Matcher6 m6, Matcher7 m7, Matcher8 m8, Matcher9 m9) {
return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3, m4, m5, m6, m7, m8,
m9));
}
template <typename Matcher1, typename Matcher2, typename Matcher3,
typename Matcher4, typename Matcher5, typename Matcher6, typename Match
er7,
typename Matcher8, typename Matcher9, typename Matcher10>
inline internal::EitherOfMatcher<Matcher1, internal::EitherOfMatcher<Matche
r2,
internal::EitherOfMatcher<Matcher3, internal::EitherOfMatcher<Matcher4,
internal::EitherOfMatcher<Matcher5, internal::EitherOfMatcher<Matcher6,
internal::EitherOfMatcher<Matcher7, internal::EitherOfMatcher<Matcher8,
internal::EitherOfMatcher<Matcher9, Matcher10> > > > > > > > >
AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5,
Matcher6 m6, Matcher7 m7, Matcher8 m8, Matcher9 m9, Matcher10 m10) {
return ::testing::AnyOf(m1, ::testing::AnyOf(m2, m3, m4, m5, m6, m7, m8,
m9,
m10));
} }
} // namespace testing } // namespace testing
// The MATCHER* family of macros can be used in a namespace scope to // The MATCHER* family of macros can be used in a namespace scope to
// define custom matchers easily. // define custom matchers easily.
// //
// Basic Usage // Basic Usage
// =========== // ===========
// //
skipping to change at line 1277 skipping to change at line 1413
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description) ;\ const ::testing::internal::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(\
negation, #name,\ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::std::tr1::tuple<>()));\ ::std::tr1::tuple<>()));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ 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>());\ new gmock_Impl<arg_type>());\
}\ }\
name##Matcher() {\ name##Matcher() {\
}\ }\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##Matcher);\ 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,\ arg_type arg, \
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\
const const
#define MATCHER_P(name, p0, description)\ #define MATCHER_P(name, p0, description)\
template <typename p0##_type>\ template <typename p0##_type>\
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<arg_type> {\
public:\ public:\
skipping to change at line 1326 skipping to change at line 1462
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 p0;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description) ;\ const ::testing::internal::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(\
negation, #name,\ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::std::tr1::tuple<p0##_type>(p0)));\ ::std::tr1::tuple<p0##_type>(p0)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ 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));\
}\ }\
skipping to change at line 1350 skipping to change at line 1486
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP);\ 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) {\
return name##MatcherP<p0##_type>(p0);\ return name##MatcherP<p0##_type>(p0);\
}\ }\
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,\ arg_type arg, \
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\
const const
#define MATCHER_P2(name, p0, p1, description)\ #define MATCHER_P2(name, p0, p1, description)\
template <typename p0##_type, typename p1##_type>\ template <typename p0##_type, typename p1##_type>\
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<arg_type> {\
public:\ public:\
skipping to change at line 1379 skipping to change at line 1515
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type p0;\
p1##_type p1;\ p1##_type p1;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description) ;\ const ::testing::internal::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(\
negation, #name,\ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::std::tr1::tuple<p0##_type, p1##_type>(p0, p1)));\ ::std::tr1::tuple<p0##_type, p1##_type>(p0, p1)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ 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));\
}\ }\
skipping to change at line 1407 skipping to change at line 1543
};\ };\
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, \
p1##_type p1) {\ p1##_type p1) {\
return name##MatcherP2<p0##_type, p1##_type>(p0, p1);\ return name##MatcherP2<p0##_type, p1##_type>(p0, p1);\
}\ }\
template <typename p0##_type, typename p1##_type>\ template <typename p0##_type, typename p1##_type>\
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,\ arg_type arg, \
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\
const const
#define MATCHER_P3(name, p0, p1, p2, description)\ #define MATCHER_P3(name, p0, p1, p2, description)\
template <typename p0##_type, typename p1##_type, typename p2##_type>\ template <typename p0##_type, typename p1##_type, typename p2##_type>\
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<arg_type> {\
public:\ public:\
skipping to change at line 1437 skipping to change at line 1573
}\ }\
p0##_type p0;\ p0##_type p0;\
p1##_type p1;\ p1##_type p1;\
p2##_type p2;\ p2##_type p2;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description) ;\ const ::testing::internal::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(\
negation, #name,\ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::std::tr1::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \ ::std::tr1::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \
p2)));\ p2)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ 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, p2));\ new gmock_Impl<arg_type>(p0, p1, p2));\
skipping to change at line 1467 skipping to change at line 1603
};\ };\
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 , \
p1##_type p1, p2##_type p2) {\ p1##_type p1, p2##_type p2) {\
return name##MatcherP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\ return name##MatcherP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
}\ }\
template <typename p0##_type, typename p1##_type, typename p2##_type>\ template <typename p0##_type, typename p1##_type, typename p2##_type>\
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,\ arg_type arg, \
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\
const const
#define MATCHER_P4(name, p0, p1, p2, p3, description)\ #define MATCHER_P4(name, p0, p1, p2, p3, description)\
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>\
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<arg_type> {\
skipping to change at line 1500 skipping to change at line 1636
p0##_type p0;\ p0##_type p0;\
p1##_type p1;\ p1##_type p1;\
p2##_type p2;\ p2##_type p2;\
p3##_type p3;\ p3##_type p3;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description) ;\ const ::testing::internal::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(\
negation, #name,\ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::std::tr1::tuple<p0##_type, p1##_type, p2##_type, \ ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, \
p3##_type>(p0, p1, p2, p3)));\ p3##_type>(p0, p1, p2, p3)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ 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, p2, p3));\ new gmock_Impl<arg_type>(p0, p1, p2, p3));\
skipping to change at line 1536 skipping to change at line 1672
p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
p3##_type p3) {\ p3##_type p3) {\
return name##MatcherP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, \ return name##MatcherP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, \
p1, p2, p3);\ p1, p2, p3);\
}\ }\
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>\
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,\ arg_type arg, \
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\
const const
#define MATCHER_P5(name, p0, p1, p2, p3, p4, description)\ #define MATCHER_P5(name, p0, p1, p2, p3, p4, description)\
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>\
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<arg_type> {\
skipping to change at line 1571 skipping to change at line 1707
p1##_type p1;\ p1##_type p1;\
p2##_type p2;\ p2##_type p2;\
p3##_type p3;\ p3##_type p3;\
p4##_type p4;\ p4##_type p4;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description) ;\ const ::testing::internal::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(\
negation, #name,\ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_typ e, \ ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_typ e, \
p4##_type>(p0, p1, p2, p3, p4)));\ p4##_type>(p0, p1, p2, p3, p4)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ 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, p2, p3, p4));\ new gmock_Impl<arg_type>(p0, p1, p2, p3, p4));\
skipping to change at line 1609 skipping to change at line 1745
p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p 3, \ p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p 3, \
p4##_type p4) {\ p4##_type p4) {\
return name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \ return name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type>(p0, p1, p2, p3, p4);\ p4##_type>(p0, p1, p2, p3, p4);\
}\ }\
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>\
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,\ arg_type arg, \
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\
const const
#define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)\ #define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)\
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>\
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<arg_type> {\
skipping to change at line 1645 skipping to change at line 1781
p2##_type p2;\ p2##_type p2;\
p3##_type p3;\ p3##_type p3;\
p4##_type p4;\ p4##_type p4;\
p5##_type p5;\ p5##_type p5;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description) ;\ const ::testing::internal::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(\
negation, #name,\ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_typ e, \ ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_typ e, \
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);\ 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, p2, p3, p4, p5));\ new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5));\
skipping to change at line 1684 skipping to change at line 1820
p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
p3##_type p3, p4##_type p4, p5##_type p5) {\ p3##_type p3, p4##_type p4, p5##_type p5) {\
return name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \ return name##MatcherP6<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);\
}\ }\
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>\
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_typ e, \ bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_typ e, \
p5##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p5##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg,\ arg_type arg, \
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\
const const
#define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description)\ #define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description)\
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, \
typename p6##_type>\ typename p6##_type>\
class name##MatcherP7 {\ class name##MatcherP7 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
skipping to change at line 1723 skipping to change at line 1859
p3##_type p3;\ p3##_type p3;\
p4##_type p4;\ p4##_type p4;\
p5##_type p5;\ p5##_type p5;\
p6##_type p6;\ p6##_type p6;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description) ;\ const ::testing::internal::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(\
negation, #name,\ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_typ e, \ ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_typ e, \
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);\ 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>(\
skipping to change at line 1768 skipping to change at line 1904
p6##_type p6) {\ p6##_type p6) {\
return name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \ return name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\ p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
}\ }\
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, \
typename p6##_type>\ typename p6##_type>\
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_typ e, \ bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_typ e, \
p5##_type, p6##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p5##_type, p6##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg,\ arg_type arg, \
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\
const const
#define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description)\ #define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description)\
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, \
typename p6##_type, typename p7##_type>\ typename p6##_type, typename p7##_type>\
class name##MatcherP8 {\ class name##MatcherP8 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
skipping to change at line 1808 skipping to change at line 1944
p4##_type p4;\ p4##_type p4;\
p5##_type p5;\ p5##_type p5;\
p6##_type p6;\ p6##_type p6;\
p7##_type p7;\ p7##_type p7;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description) ;\ const ::testing::internal::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(\
negation, #name,\ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_typ e, \ ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_typ e, \
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);\ 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>(\
skipping to change at line 1857 skipping to change at line 1993
p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \ p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
p6, p7);\ p6, p7);\
}\ }\
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, \
typename p6##_type, typename p7##_type>\ typename p6##_type, typename p7##_type>\
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_typ e, \ bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_typ e, \
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,\ arg_type arg, \
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\
const const
#define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description)\ #define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description)\
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, \
typename p6##_type, typename p7##_type, typename p8##_type>\ typename p6##_type, typename p7##_type, typename p8##_type>\
class name##MatcherP9 {\ class name##MatcherP9 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
skipping to change at line 1899 skipping to change at line 2035
p5##_type p5;\ p5##_type p5;\
p6##_type p6;\ p6##_type p6;\
p7##_type p7;\ p7##_type p7;\
p8##_type p8;\ p8##_type p8;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description) ;\ const ::testing::internal::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(\
negation, #name,\ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_typ e, \ ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_typ e, \
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);\ 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>(\
skipping to change at line 1950 skipping to change at line 2086
p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \ p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
p3, p4, p5, p6, p7, p8);\ p3, p4, p5, p6, p7, p8);\
}\ }\
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, \
typename p6##_type, typename p7##_type, typename p8##_type>\ typename p6##_type, typename p7##_type, typename p8##_type>\
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_typ e, \ bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_typ e, \
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,\ arg_type arg, \
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\
const const
#define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, descripti on)\ #define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, descripti on)\
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, \
typename p6##_type, typename p7##_type, typename p8##_type, \ typename p6##_type, typename p7##_type, typename p8##_type, \
typename p9##_type>\ typename p9##_type>\
class name##MatcherP10 {\ class name##MatcherP10 {\
public:\ public:\
skipping to change at line 1995 skipping to change at line 2131
p6##_type p6;\ p6##_type p6;\
p7##_type p7;\ p7##_type p7;\
p8##_type p8;\ p8##_type p8;\
p9##_type p9;\ p9##_type p9;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description) ;\ const ::testing::internal::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(\
negation, #name,\ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_typ e, \ ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_typ e, \
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);\ 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>(\
skipping to change at line 2049 skipping to change at line 2185
p1, p2, p3, p4, p5, p6, p7, p8, p9);\ p1, p2, p3, p4, p5, p6, p7, p8, p9);\
}\ }\
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, \
typename p6##_type, typename p7##_type, typename p8##_type, \ typename p6##_type, typename p7##_type, typename p8##_type, \
typename p9##_type>\ typename p9##_type>\
template <typename arg_type>\ template <typename arg_type>\
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,\ arg_type arg, \
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\
const const
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
 End of changes. 46 change blocks. 
654 lines changed or deleted 769 lines changed or added


 gmock-generated-matchers.h.pump   gmock-generated-matchers.h.pump 
skipping to change at line 43 skipping to change at line 43
// (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.
// 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 matchers. // This file implements some commonly used variadic matchers.
#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_
#include <iterator>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <vector> #include <vector>
#include "gmock/gmock-matchers.h" #include "gmock/gmock-matchers.h"
namespace testing { namespace testing {
namespace internal { namespace internal {
$range i 0..n-1 $range i 0..n-1
skipping to change at line 189 skipping to change at line 190
operator Matcher<ArgsTuple>() const { operator Matcher<ArgsTuple>() const {
return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, $ks>(inner_matcher_)) ; return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, $ks>(inner_matcher_)) ;
} }
private: private:
const InnerMatcher inner_matcher_; const InnerMatcher inner_matcher_;
GTEST_DISALLOW_ASSIGN_(ArgsMatcher); GTEST_DISALLOW_ASSIGN_(ArgsMatcher);
}; };
// Implements ElementsAre() of 1-$n arguments. // A set of metafunctions for computing the result type of AllOf.
// AllOf(m1, ..., mN) returns
// AllOfResultN<decltype(m1), ..., decltype(mN)>::type.
// Although AllOf isn't defined for one argument, AllOfResult1 is defined
// to simplify the implementation.
template <typename M1>
struct AllOfResult1 {
typedef M1 type;
};
$range i 1..n $range i 1..n
$for i [[
$range j 1..i
template <$for j, [[typename T$j]]>
class ElementsAreMatcher$i {
public:
$if i==1 [[explicit ]]ElementsAreMatcher$i($for j, [[const T$j& e$j]])$if
i > 0 [[ : ]]
$for j, [[e$j[[]]_(e$j)]] {}
template <typename Container>
operator Matcher<Container>() const {
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_
type
Element;
$if i==1 [[
// Nokia's Symbian Compiler has a nasty bug where the object put
// in a one-element local array is not destructed when the array
// goes out of scope. This leads to obvious badness as we've
// added the linked_ptr in it to our other linked_ptrs list.
// Hence we implement ElementsAreMatcher1 specially to avoid using
// a local array.
const Matcher<const Element&> matcher =
MatcherCast<const Element&>(e1_);
return MakeMatcher(new ElementsAreMatcherImpl<Container>(&matcher, 1));
]] $else [[
const Matcher<const Element&> matchers[] = { $range i 2..n
$for i [[
$for j [[ $range j 2..i
MatcherCast<const Element&>(e$j[[]]_), $var m = i/2
$range k 1..m
]] $range t m+1..i
};
template <typename M1$for j [[, typename M$j]]>
struct AllOfResult$i {
typedef BothOfMatcher<
typename AllOfResult$m<$for k, [[M$k]]>::type,
typename AllOfResult$(i-m)<$for t, [[M$t]]>::type
> type;
};
return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, $i)) ;
]] ]]
} // A set of metafunctions for computing the result type of AnyOf.
// AnyOf(m1, ..., mN) returns
private: // AnyOfResultN<decltype(m1), ..., decltype(mN)>::type.
$for j [[ // Although AnyOf isn't defined for one argument, AnyOfResult1 is defined
const T$j& e$j[[]]_; // to simplify the implementation.
template <typename M1>
struct AnyOfResult1 {
typedef M1 type;
};
]] $range i 1..n
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher$i); $range i 2..n
$for i [[
$range j 2..i
$var m = i/2
$range k 1..m
$range t m+1..i
template <typename M1$for j [[, typename M$j]]>
struct AnyOfResult$i {
typedef EitherOfMatcher<
typename AnyOfResult$m<$for k, [[M$k]]>::type,
typename AnyOfResult$(i-m)<$for t, [[M$t]]>::type
> type;
}; };
]] ]]
} // namespace internal } // namespace internal
// Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected // Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected
// fields of it matches a_matcher. C++ doesn't support default // fields of it matches a_matcher. C++ doesn't support default
// arguments for function templates, so we have to overload it. // arguments for function templates, so we have to overload it.
$range i 0..n $range i 0..n
$for i [[ $for i [[
$range j 1..i $range j 1..i
template <$for j [[int k$j, ]]typename InnerMatcher> template <$for j [[int k$j, ]]typename InnerMatcher>
inline internal::ArgsMatcher<InnerMatcher$for j [[, k$j]]> inline internal::ArgsMatcher<InnerMatcher$for j [[, k$j]]>
Args(const InnerMatcher& matcher) { Args(const InnerMatcher& matcher) {
return internal::ArgsMatcher<InnerMatcher$for j [[, k$j]]>(matcher); return internal::ArgsMatcher<InnerMatcher$for j [[, k$j]]>(matcher);
} }
]] ]]
// ElementsAre(e0, e1, ..., e_n) matches an STL-style container with // ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with
// (n + 1) elements, where the i-th element in the container must // n elements, where the i-th element in the container must
// match the i-th argument in the list. Each argument of // match the i-th argument in the list. Each argument of
// ElementsAre() can be either a value or a matcher. We support up to // ElementsAre() can be either a value or a matcher. We support up to
// $n arguments. // $n arguments.
// //
// The use of DecayArray in the implementation allows ElementsAre()
// to accept string literals, whose type is const char[N], but we
// want to treat them as const char*.
//
// NOTE: Since ElementsAre() cares about the order of the elements, it // NOTE: Since ElementsAre() cares about the order of the elements, it
// must not be used with containers whose elements's order is // must not be used with containers whose elements's order is
// undefined (e.g. hash_map). // undefined (e.g. hash_map).
inline internal::ElementsAreMatcher0 ElementsAre() { $range i 0..n
return internal::ElementsAreMatcher0();
}
$range i 1..n
$for i [[ $for i [[
$range j 1..i $range j 1..i
template <$for j, [[typename T$j]]> $if i>0 [[
inline internal::ElementsAreMatcher$i<$for j, [[T$j]]> ElementsAre($for j,
[[const T$j& e$j]]) {
return internal::ElementsAreMatcher$i<$for j, [[T$j]]>($for j, [[e$j]]);
}
template <$for j, [[typename T$j]]>
]] ]]
// ElementsAreArray(array) and ElementAreArray(array, count) are like inline internal::ElementsAreMatcher<
// ElementsAre(), except that they take an array of values or std::tr1::tuple<
// matchers. The former form infers the size of 'array', which must $for j, [[
// be a static C-style array. In the latter form, 'array' can either
// be a static array or a pointer to a dynamically created array. typename internal::DecayArray<T$j[[]]>::type]]> >
ElementsAre($for j, [[const T$j& e$j]]) {
template <typename T> typedef std::tr1::tuple<
inline internal::ElementsAreArrayMatcher<T> ElementsAreArray( $for j, [[
const T* first, size_t count) {
return internal::ElementsAreArrayMatcher<T>(first, count);
}
template <typename T, size_t N> typename internal::DecayArray<T$j[[]]>::type]]> Args;
inline internal::ElementsAreArrayMatcher<T> return internal::ElementsAreMatcher<Args>(Args($for j, [[e$j]]));
ElementsAreArray(const T (&array)[N]) {
return internal::ElementsAreArrayMatcher<T>(array, N);
} }
// AllOf(m1, m2, ..., mk) matches any value that matches all of the given ]]
// sub-matchers. AllOf is called fully qualified to prevent ADL from firin
g.
$range i 2..n // 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.
$range i 0..n
$for i [[ $for i [[
$range j 1..i
$range k 1..i-1
template <$for j, [[typename Matcher$j]]> $range j 1..i
inline $for k[[internal::BothOfMatcher<Matcher$k, ]]Matcher$i[[]]$for k [[>
]]
AllOf($for j, [[Matcher$j m$j]]) { $if i>0 [[
$if i == 2 [[ template <$for j, [[typename T$j]]>
return internal::BothOfMatcher<Matcher1, Matcher2>(m1, m2);
]] $else [[
return ::testing::AllOf(m1, ::testing::AllOf($for k, [[m$(k + 1)]]));
]] ]]
inline internal::UnorderedElementsAreMatcher<
std::tr1::tuple<
$for j, [[
typename internal::DecayArray<T$j[[]]>::type]]> >
UnorderedElementsAre($for j, [[const T$j& e$j]]) {
typedef std::tr1::tuple<
$for j, [[
typename internal::DecayArray<T$j[[]]>::type]]> Args;
return internal::UnorderedElementsAreMatcher<Args>(Args($for j, [[e$j]]))
;
} }
]] ]]
// AnyOf(m1, m2, ..., mk) matches any value that matches any of the given // AllOf(m1, m2, ..., mk) matches any value that matches all of the given
// sub-matchers. AnyOf is called fully qualified to prevent ADL from firin // sub-matchers. AllOf is called fully qualified to prevent ADL from firin
g. g.
$range i 2..n $range i 2..n
$for i [[ $for i [[
$range j 1..i $range j 1..i
$range k 1..i-1 $var m = i/2
$range k 1..m
template <$for j, [[typename Matcher$j]]> $range t m+1..i
inline $for k[[internal::EitherOfMatcher<Matcher$k, ]]Matcher$i[[]]$for k [
[> ]] template <$for j, [[typename M$j]]>
inline typename internal::AllOfResult$i<$for j, [[M$j]]>::type
AnyOf($for j, [[Matcher$j m$j]]) { AllOf($for j, [[M$j m$j]]) {
return typename internal::AllOfResult$i<$for j, [[M$j]]>::type(
$if m == 1 [[m1]] $else [[::testing::AllOf($for k, [[m$k]])]],
$if m+1 == i [[m$i]] $else [[::testing::AllOf($for t, [[m$t]])]]);
}
$if i == 2 [[
return internal::EitherOfMatcher<Matcher1, Matcher2>(m1, m2);
]] $else [[
return ::testing::AnyOf(m1, ::testing::AnyOf($for k, [[m$(k + 1)]]));
]] ]]
// AnyOf(m1, m2, ..., mk) matches any value that matches any of the given
// sub-matchers. AnyOf is called fully qualified to prevent ADL from firin
g.
$range i 2..n
$for i [[
$range j 1..i
$var m = i/2
$range k 1..m
$range t m+1..i
template <$for j, [[typename M$j]]>
inline typename internal::AnyOfResult$i<$for j, [[M$j]]>::type
AnyOf($for j, [[M$j m$j]]) {
return typename internal::AnyOfResult$i<$for j, [[M$j]]>::type(
$if m == 1 [[m1]] $else [[::testing::AnyOf($for k, [[m$k]])]],
$if m+1 == i [[m$i]] $else [[::testing::AnyOf($for t, [[m$t]])]]);
} }
]] ]]
} // namespace testing } // namespace testing
$$ } // This Pump meta comment fixes auto-indentation in Emacs. It will not $$ } // This Pump meta comment fixes auto-indentation in Emacs. It will not
$$ // show up in the generated code. $$ // show up in the generated code.
// The MATCHER* family of macros can be used in a namespace scope to // The MATCHER* family of macros can be used in a namespace scope to
// define custom matchers easily. // define custom matchers easily.
skipping to change at line 620 skipping to change at line 645
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\$param_field_decls }\$param_field_decls
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description) ;\ const ::testing::internal::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(\
negation, #name,\ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::std::tr1::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])) );\ ::std::tr1::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])) );\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ 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>($params));\ new gmock_Impl<arg_type>($params));\
}\ }\
$class_name($ctor_param_list)$inits {\ $class_name($ctor_param_list)$inits {\
}\$param_field_decls2 }\$param_field_decls2
private:\ private:\
GTEST_DISALLOW_ASSIGN_($class_name);\ 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,\ arg_type arg, \
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSE D_)\
const const
]] ]]
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
 End of changes. 30 change blocks. 
102 lines changed or deleted 123 lines changed or added


 gmock-generated-nice-strict.h   gmock-generated-nice-strict.h 
// This file was GENERATED by a script. DO NOT EDIT BY HAND!!! // This file was GENERATED by command:
// pump.py gmock-generated-nice-strict.h.pump
// DO NOT EDIT BY HAND!!!
// Copyright 2008, Google Inc. // Copyright 2008, Google Inc.
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
// //
// * Redistributions of source code must retain the above copyright // * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer. // notice, this list of conditions and the following disclaimer.
skipping to change at line 34 skipping to change at line 36
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// 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) // Author: wan@google.com (Zhanyong Wan)
// Implements class templates NiceMock and StrictMock. // Implements class templates NiceMock, NaggyMock, and StrictMock.
// //
// Given a mock class MockFoo that is created using Google Mock, // Given a mock class MockFoo that is created using Google Mock,
// NiceMock<MockFoo> is a subclass of MockFoo that allows // NiceMock<MockFoo> is a subclass of MockFoo that allows
// uninteresting calls (i.e. calls to mock methods that have no // uninteresting calls (i.e. calls to mock methods that have no
// EXPECT_CALL specs), and StrictMock<MockFoo> is a subclass of // EXPECT_CALL specs), NaggyMock<MockFoo> is a subclass of MockFoo
// MockFoo that treats all uninteresting calls as errors. // that prints a warning when an uninteresting call occurs, and
// StrictMock<MockFoo> is a subclass of MockFoo that treats all
// uninteresting calls as errors.
// //
// NiceMock and StrictMock "inherits" the constructors of their // Currently a mock is naggy by default, so MockFoo and
// respective base class, with up-to 10 arguments. Therefore you can // NaggyMock<MockFoo> behave like the same. However, we will soon
// write NiceMock<MockFoo>(5, "a") to construct a nice mock where // switch the default behavior of mocks to be nice, as that in general
// MockFoo has a constructor that accepts (int, const char*), for // leads to more maintainable tests. When that happens, MockFoo will
// example. // stop behaving like NaggyMock<MockFoo> and start behaving like
// NiceMock<MockFoo>.
// //
// A known limitation is that NiceMock<MockFoo> and // NiceMock, NaggyMock, and StrictMock "inherit" the constructors of
// StrictMock<MockFoo> only works for mock methods defined using the // their respective base class, with up-to 10 arguments. Therefore
// MOCK_METHOD* family of macros DIRECTLY in the MockFoo class. If a // you can write NiceMock<MockFoo>(5, "a") to construct a nice mock
// mock method is defined in a base class of MockFoo, the "nice" or // where MockFoo has a constructor that accepts (int, const char*),
// "strict" modifier may not affect it, depending on the compiler. In // for example.
// particular, nesting NiceMock and StrictMock is NOT supported. //
// A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>,
// and StrictMock<MockFoo> only works for mock methods defined using
// the MOCK_METHOD* family of macros DIRECTLY in the MockFoo class.
// If a mock method is defined in a base class of MockFoo, the "nice"
// or "strict" modifier may not affect it, depending on the compiler.
// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT
// supported.
// //
// Another known limitation is that the constructors of the base mock // Another known limitation is that the constructors of the base mock
// cannot have arguments passed by non-const reference, which are // cannot have arguments passed by non-const reference, which are
// banned by the Google C++ style guide anyway. // 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_
#include "gmock/gmock-spec-builders.h" #include "gmock/gmock-spec-builders.h"
#include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-port.h"
skipping to change at line 164 skipping to change at line 176
virtual ~NiceMock() { virtual ~NiceMock() {
::testing::Mock::UnregisterCallReaction( ::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock); GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock);
}; };
template <class MockClass> template <class MockClass>
class NaggyMock : public MockClass {
public:
// We don't factor out the constructor body to a common method, as
// we have to avoid a possible clash with members of MockClass.
NaggyMock() {
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
// C++ doesn't (yet) allow inheritance of constructors, so we have
// to define it for each arity.
template <typename A1>
explicit NaggyMock(const A1& a1) : MockClass(a1) {
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2>
NaggyMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename A3>
NaggyMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a
3) {
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename A3, typename A4>
NaggyMock(const A1& a1, const A2& a2, const A3& a3,
const A4& a4) : MockClass(a1, a2, a3, a4) {
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename A3, typename A4, typename A5
>
NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
const A5& a5) : MockClass(a1, a2, a3, a4, a5) {
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename A3, typename A4, typename A5
,
typename A6>
NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename A3, typename A4, typename A5
,
typename A6, typename A7>
NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4,
a5,
a6, a7) {
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename A3, typename A4, typename A5
,
typename A6, typename A7, typename A8>
NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a
1,
a2, a3, a4, a5, a6, a7, a8) {
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename A3, typename A4, typename A5
,
typename A6, typename A7, typename A8, typename A9>
NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
const A5& a5, const A6& a6, const A7& a7, const A8& a8,
const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename A3, typename A4, typename A5
,
typename A6, typename A7, typename A8, typename A9, typename A10>
NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9,
const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
{
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
virtual ~NaggyMock() {
::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this));
}
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(NaggyMock);
};
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 // We don't factor out the constructor body to a common method, as
// we have to avoid a possible clash with members of MockClass. // we have to avoid a possible clash with members of MockClass.
StrictMock() { 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
// to define it 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(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
template <typename A1, typename A2> template <typename A1, typename A2>
StrictMock(const A1& a1, const A2& a2) : MockClass(a1, a2) { StrictMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
::testing::Mock::FailUninterestingCalls( ::testing::Mock::FailUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
skipping to change at line 261 skipping to change at line 371
} }
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(StrictMock); GTEST_DISALLOW_COPY_AND_ASSIGN_(StrictMock);
}; };
// The following specializations catch some (relatively more common) // The following specializations catch some (relatively more common)
// user errors of nesting nice and strict mocks. They do NOT catch // user errors of nesting nice and strict mocks. They do NOT catch
// all possible errors. // all possible errors.
// These specializations are declared but not defined, as NiceMock and // These specializations are declared but not defined, as NiceMock,
// StrictMock cannot be nested. // NaggyMock, and StrictMock cannot be nested.
template <typename MockClass> template <typename MockClass>
class NiceMock<NiceMock<MockClass> >; class NiceMock<NiceMock<MockClass> >;
template <typename MockClass> template <typename MockClass>
class NiceMock<NaggyMock<MockClass> >;
template <typename MockClass>
class NiceMock<StrictMock<MockClass> >; class NiceMock<StrictMock<MockClass> >;
template <typename MockClass>
class NaggyMock<NiceMock<MockClass> >;
template <typename MockClass>
class NaggyMock<NaggyMock<MockClass> >;
template <typename MockClass>
class NaggyMock<StrictMock<MockClass> >;
template <typename MockClass> template <typename MockClass>
class StrictMock<NiceMock<MockClass> >; class StrictMock<NiceMock<MockClass> >;
template <typename MockClass> template <typename MockClass>
class StrictMock<NaggyMock<MockClass> >;
template <typename MockClass>
class StrictMock<StrictMock<MockClass> >; class StrictMock<StrictMock<MockClass> >;
} // namespace testing } // namespace testing
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
 End of changes. 11 change blocks. 
17 lines changed or deleted 150 lines changed or added


 gmock-generated-nice-strict.h.pump   gmock-generated-nice-strict.h.pump 
skipping to change at line 37 skipping to change at line 37
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// 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) // Author: wan@google.com (Zhanyong Wan)
// Implements class templates NiceMock and StrictMock. // Implements class templates NiceMock, NaggyMock, and StrictMock.
// //
// Given a mock class MockFoo that is created using Google Mock, // Given a mock class MockFoo that is created using Google Mock,
// NiceMock<MockFoo> is a subclass of MockFoo that allows // NiceMock<MockFoo> is a subclass of MockFoo that allows
// uninteresting calls (i.e. calls to mock methods that have no // uninteresting calls (i.e. calls to mock methods that have no
// EXPECT_CALL specs), and StrictMock<MockFoo> is a subclass of // EXPECT_CALL specs), NaggyMock<MockFoo> is a subclass of MockFoo
// MockFoo that treats all uninteresting calls as errors. // that prints a warning when an uninteresting call occurs, and
// StrictMock<MockFoo> is a subclass of MockFoo that treats all
// uninteresting calls as errors.
// //
// NiceMock and StrictMock "inherits" the constructors of their // Currently a mock is naggy by default, so MockFoo and
// respective base class, with up-to $n arguments. Therefore you can // NaggyMock<MockFoo> behave like the same. However, we will soon
// write NiceMock<MockFoo>(5, "a") to construct a nice mock where // switch the default behavior of mocks to be nice, as that in general
// MockFoo has a constructor that accepts (int, const char*), for // leads to more maintainable tests. When that happens, MockFoo will
// example. // stop behaving like NaggyMock<MockFoo> and start behaving like
// // NiceMock<MockFoo>.
// A known limitation is that NiceMock<MockFoo> and //
// StrictMock<MockFoo> only works for mock methods defined using the // NiceMock, NaggyMock, and StrictMock "inherit" the constructors of
// MOCK_METHOD* family of macros DIRECTLY in the MockFoo class. If a // their respective base class, with up-to $n arguments. Therefore
// mock method is defined in a base class of MockFoo, the "nice" or // you can write NiceMock<MockFoo>(5, "a") to construct a nice mock
// "strict" modifier may not affect it, depending on the compiler. In // where MockFoo has a constructor that accepts (int, const char*),
// particular, nesting NiceMock and StrictMock is NOT supported. // for example.
//
// A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>,
// and StrictMock<MockFoo> only works for mock methods defined using
// the MOCK_METHOD* family of macros DIRECTLY in the MockFoo class.
// If a mock method is defined in a base class of MockFoo, the "nice"
// or "strict" modifier may not affect it, depending on the compiler.
// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT
// supported.
// //
// Another known limitation is that the constructors of the base mock // Another known limitation is that the constructors of the base mock
// cannot have arguments passed by non-const reference, which are // cannot have arguments passed by non-const reference, which are
// banned by the Google C++ style guide anyway. // 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_
#include "gmock/gmock-spec-builders.h" #include "gmock/gmock-spec-builders.h"
#include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-port.h"
namespace testing { namespace testing {
$range kind 0..2
$for kind [[
$var clazz=[[$if kind==0 [[NiceMock]]
$elif kind==1 [[NaggyMock]]
$else [[StrictMock]]]]
$var method=[[$if kind==0 [[AllowUninterestingCalls]]
$elif kind==1 [[WarnUninterestingCalls]]
$else [[FailUninterestingCalls]]]]
template <class MockClass> template <class MockClass>
class NiceMock : public MockClass { class $clazz : public MockClass {
public: public:
// We don't factor out the constructor body to a common method, as // We don't factor out the constructor body to a common method, as
// we have to avoid a possible clash with members of MockClass. // we have to avoid a possible clash with members of MockClass.
NiceMock() { $clazz() {
::testing::Mock::AllowUninterestingCalls( ::testing::Mock::$method(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
// C++ doesn't (yet) allow inheritance of constructors, so we have // C++ doesn't (yet) allow inheritance of constructors, so we have
// to define it for each arity. // to define it for each arity.
template <typename A1> template <typename A1>
explicit NiceMock(const A1& a1) : MockClass(a1) { explicit $clazz(const A1& a1) : MockClass(a1) {
::testing::Mock::AllowUninterestingCalls( ::testing::Mock::$method(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
$range i 2..n $range i 2..n
$for i [[ $for i [[
$range j 1..i $range j 1..i
template <$for j, [[typename A$j]]> template <$for j, [[typename A$j]]>
NiceMock($for j, [[const A$j& a$j]]) : MockClass($for j, [[a$j]]) { $clazz($for j, [[const A$j& a$j]]) : MockClass($for j, [[a$j]]) {
::testing::Mock::AllowUninterestingCalls( ::testing::Mock::$method(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
]] ]]
virtual ~NiceMock() { virtual ~$clazz() {
::testing::Mock::UnregisterCallReaction( ::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock); GTEST_DISALLOW_COPY_AND_ASSIGN_($clazz);
}; };
template <class MockClass>
class StrictMock : public MockClass {
public:
// We don't factor out the constructor body to a common method, as
// we have to avoid a possible clash with members of MockClass.
StrictMock() {
::testing::Mock::FailUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1>
explicit StrictMock(const A1& a1) : MockClass(a1) {
::testing::Mock::FailUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
$for i [[
$range j 1..i
template <$for j, [[typename A$j]]>
StrictMock($for j, [[const A$j& a$j]]) : MockClass($for j, [[a$j]]) {
::testing::Mock::FailUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
]] ]]
virtual ~StrictMock() {
::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this));
}
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(StrictMock);
};
// The following specializations catch some (relatively more common) // The following specializations catch some (relatively more common)
// user errors of nesting nice and strict mocks. They do NOT catch // user errors of nesting nice and strict mocks. They do NOT catch
// all possible errors. // all possible errors.
// These specializations are declared but not defined, as NiceMock and // These specializations are declared but not defined, as NiceMock,
// StrictMock cannot be nested. // NaggyMock, and StrictMock cannot be nested.
template <typename MockClass> template <typename MockClass>
class NiceMock<NiceMock<MockClass> >; class NiceMock<NiceMock<MockClass> >;
template <typename MockClass> template <typename MockClass>
class NiceMock<NaggyMock<MockClass> >;
template <typename MockClass>
class NiceMock<StrictMock<MockClass> >; class NiceMock<StrictMock<MockClass> >;
template <typename MockClass>
class NaggyMock<NiceMock<MockClass> >;
template <typename MockClass>
class NaggyMock<NaggyMock<MockClass> >;
template <typename MockClass>
class NaggyMock<StrictMock<MockClass> >;
template <typename MockClass> template <typename MockClass>
class StrictMock<NiceMock<MockClass> >; class StrictMock<NiceMock<MockClass> >;
template <typename MockClass> template <typename MockClass>
class StrictMock<NaggyMock<MockClass> >;
template <typename MockClass>
class StrictMock<StrictMock<MockClass> >; class StrictMock<StrictMock<MockClass> >;
} // namespace testing } // namespace testing
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
 End of changes. 16 change blocks. 
58 lines changed or deleted 60 lines changed or added


 gmock-internal-utils.h   gmock-internal-utils.h 
skipping to change at line 56 skipping to change at line 56
#include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace testing { namespace testing {
namespace internal { namespace internal {
// 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".
string ConvertIdentifierNameToWords(const char* id_name); GTEST_API_ 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
// following default implementation is for the case where Pointer is a // following default implementation is for the case where Pointer is a
// smart pointer. // smart pointer.
template <typename Pointer> template <typename Pointer>
struct PointeeOf { struct PointeeOf {
// Smart pointer classes define type element_type as the type of // Smart pointer classes define type element_type as the type of
// their pointees. // their pointees.
typedef typename Pointer::element_type type; typedef typename Pointer::element_type type;
}; };
// This specialization is for the raw pointer case. // This specialization is for the raw pointer case.
template <typename T> template <typename T>
struct PointeeOf<T*> { typedef T type; }; // NOLINT struct PointeeOf<T*> { typedef T type; }; // NOLINT
// GetRawPointer(p) returns the raw pointer underlying p when p is a // GetRawPointer(p) returns the raw pointer underlying p when p is a
// smart pointer, or returns p itself when p is already a raw pointer. // smart pointer, or returns p itself when p is already a raw pointer.
// The following default implementation is for the smart pointer case. // The following default implementation is for the smart pointer case.
template <typename Pointer> template <typename Pointer>
inline typename Pointer::element_type* GetRawPointer(const Pointer& p) { inline const typename Pointer::element_type* GetRawPointer(const Pointer& p ) {
return p.get(); return p.get();
} }
// This overloaded version is for the raw pointer case. // This overloaded version is for the raw pointer case.
template <typename Element> template <typename Element>
inline Element* GetRawPointer(Element* p) { return p; } inline Element* GetRawPointer(Element* p) { return p; }
// This comparator allows linked_ptr to be stored in sets. // This comparator allows linked_ptr to be stored in sets.
template <typename T> template <typename T>
struct LinkedPtrLessThan { struct LinkedPtrLessThan {
bool operator()(const ::testing::internal::linked_ptr<T>& lhs, bool operator()(const ::testing::internal::linked_ptr<T>& lhs,
skipping to change at line 263 skipping to change at line 263
struct LosslessArithmeticConvertible struct LosslessArithmeticConvertible
: public LosslessArithmeticConvertibleImpl< : public LosslessArithmeticConvertibleImpl<
GMOCK_KIND_OF_(From), From, GMOCK_KIND_OF_(To), To> {}; // NOLINT GMOCK_KIND_OF_(From), From, GMOCK_KIND_OF_(To), To> {}; // NOLINT
// This interface knows how to report a Google Mock failure (either // This interface knows how to report a Google Mock failure (either
// non-fatal or fatal). // non-fatal or fatal).
class FailureReporterInterface { class FailureReporterInterface {
public: public:
// The type of a failure (either non-fatal or fatal). // The type of a failure (either non-fatal or fatal).
enum FailureType { enum FailureType {
NONFATAL, FATAL kNonfatal, kFatal
}; };
virtual ~FailureReporterInterface() {} virtual ~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 string& message) = 0;
}; };
// Returns the failure reporter used by Google Mock. // Returns the failure reporter used by Google Mock.
FailureReporterInterface* GetFailureReporter(); GTEST_API_ FailureReporterInterface* GetFailureReporter();
// Asserts that condition is true; aborts the process with the given // Asserts that condition is true; aborts the process with the given
// message if condition is false. We cannot use LOG(FATAL) or CHECK() // message if condition is false. We cannot use LOG(FATAL) or CHECK()
// as Google Mock might be used to mock the log sink itself. We // as Google Mock might be used to mock the log sink itself. We
// 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 string& msg) {
if (!condition) { if (!condition) {
GetFailureReporter()->ReportFailure(FailureReporterInterface::FATAL, GetFailureReporter()->ReportFailure(FailureReporterInterface::kFatal,
file, line, msg); file, line, msg);
} }
} }
inline void Assert(bool condition, const char* file, int line) { inline void Assert(bool condition, const char* file, int line) {
Assert(condition, file, line, "Assertion failed."); Assert(condition, file, line, "Assertion failed.");
} }
// 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 string& msg) {
if (!condition) { if (!condition) {
GetFailureReporter()->ReportFailure(FailureReporterInterface::NONFATAL, GetFailureReporter()->ReportFailure(FailureReporterInterface::kNonfatal ,
file, line, msg); file, line, msg);
} }
} }
inline void Expect(bool condition, const char* file, int line) { inline void Expect(bool condition, const char* file, int line) {
Expect(condition, file, line, "Expectation failed."); Expect(condition, file, line, "Expectation failed.");
} }
// Severity level of a log. // Severity level of a log.
enum LogSeverity { enum LogSeverity {
INFO = 0, kInfo = 0,
WARNING = 1 kWarning = 1
}; };
// Valid values for the --gmock_verbose flag. // Valid values for the --gmock_verbose flag.
// All logs (informational and warnings) are printed. // All logs (informational and warnings) are printed.
const char kInfoVerbosity[] = "info"; const char kInfoVerbosity[] = "info";
// Only warnings are printed. // Only warnings are printed.
const char kWarningVerbosity[] = "warning"; const char kWarningVerbosity[] = "warning";
// No logs are printed. // No logs are printed.
const char kErrorVerbosity[] = "error"; const char kErrorVerbosity[] = "error";
// Returns true iff a log with the given severity is visible according // Returns true iff a log with the given severity is visible according
// to the --gmock_verbose flag. // to the --gmock_verbose flag.
bool LogIsVisible(LogSeverity severity); GTEST_API_ bool LogIsVisible(LogSeverity severity);
// Prints the given message to stdout iff 'severity' >= the level // Prints the given message to stdout iff 'severity' >= the level
// specified by the --gmock_verbose flag. If stack_frames_to_skip >= // specified by the --gmock_verbose flag. If stack_frames_to_skip >=
// 0, also prints the stack trace excluding the top // 0, also prints the stack trace excluding the top
// stack_frames_to_skip frames. In opt mode, any positive // stack_frames_to_skip frames. In opt mode, any positive
// 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.
void Log(LogSeverity severity, const string& message, int stack_frames_to_s GTEST_API_ void Log(LogSeverity severity,
kip); const string& message,
int stack_frames_to_skip);
// TODO(wan@google.com): group all type utilities together. // TODO(wan@google.com): group all type utilities together.
// Type traits. // Type traits.
// is_reference<T>::value is non-zero iff T is a reference type. // is_reference<T>::value is non-zero iff T is a reference type.
template <typename T> struct is_reference : public false_type {}; template <typename T> struct is_reference : public false_type {};
template <typename T> struct is_reference<T&> : public true_type {}; template <typename T> struct is_reference<T&> : public true_type {};
// type_equals<T1, T2>::value is non-zero iff T1 and T2 are the same type. // type_equals<T1, T2>::value is non-zero iff T1 and T2 are the same type.
template <typename T1, typename T2> struct type_equals : public false_type {}; template <typename T1, typename T2> struct type_equals : public false_type {};
template <typename T> struct type_equals<T, T> : public true_type {}; template <typename T> struct type_equals<T, T> : public true_type {};
// remove_reference<T>::type removes the reference from type T, if any. // remove_reference<T>::type removes the reference from type T, if any.
template <typename T> struct remove_reference { typedef T type; }; // NOLI NT template <typename T> struct remove_reference { typedef T type; }; // NOLI NT
template <typename T> struct remove_reference<T&> { typedef T type; }; // N OLINT template <typename T> struct remove_reference<T&> { typedef T type; }; // N OLINT
// DecayArray<T>::type turns an array type U[N] to const U* and preserves
// other types. Useful for saving a copy of a function argument.
template <typename T> struct DecayArray { typedef T type; }; // NOLINT
template <typename T, size_t N> struct DecayArray<T[N]> {
typedef const T* type;
};
// Sometimes people use arrays whose size is not available at the use site
// (e.g. extern const char kNamePrefix[]). This specialization covers that
// case.
template <typename T> struct DecayArray<T[]> {
typedef const T* type;
};
// Invalid<T>() returns an invalid value of type T. This is useful // Invalid<T>() returns an invalid value of type T. This is useful
// when a value of type T is needed for compilation, but the statement // when a value of type T is needed for compilation, but the statement
// will not really be executed (or we don't care if the statement // will not really be executed (or we don't care if the statement
// crashes). // crashes).
template <typename T> template <typename T>
inline T Invalid() { inline T Invalid() {
return *static_cast<typename remove_reference<T>::type*>(NULL); return const_cast<typename remove_reference<T>::type&>(
*static_cast<volatile typename remove_reference<T>::type*>(NULL));
} }
template <> template <>
inline void Invalid<void>() {} inline void Invalid<void>() {}
// Given a raw type (i.e. having no top-level reference or const // Given a raw type (i.e. having no top-level reference or const
// modifier) RawContainer that's either an STL-style container or a // modifier) RawContainer that's either an STL-style container or a
// native array, class StlContainerView<RawContainer> has the // native array, class StlContainerView<RawContainer> has the
// following members: // following members:
// //
// - type is a type that provides an STL-style container view to // - type is a type that provides an STL-style container view to
skipping to change at line 460 skipping to change at line 476
static type Copy(const ::std::tr1::tuple<ElementPointer, Size>& array) { static type Copy(const ::std::tr1::tuple<ElementPointer, Size>& array) {
using ::std::tr1::get; using ::std::tr1::get;
return type(get<0>(array), get<1>(array), kCopy); return type(get<0>(array), get<1>(array), kCopy);
} }
}; };
// The following specialization prevents the user from instantiating // The following specialization prevents the user from instantiating
// StlContainer with a reference type. // StlContainer with a reference type.
template <typename T> class StlContainerView<T&>; template <typename T> class StlContainerView<T&>;
// A type transform to remove constness from the first part of a pair.
// Pairs like that are used as the value_type of associative containers,
// and this transform produces a similar but assignable pair.
template <typename T>
struct RemoveConstFromKey {
typedef T type;
};
// Partially specialized to remove constness from std::pair<const K, V>.
template <typename K, typename V>
struct RemoveConstFromKey<std::pair<const K, V> > {
typedef std::pair<K, V> type;
};
// Mapping from booleans to types. Similar to boost::bool_<kValue> and
// std::integral_constant<bool, kValue>.
template <bool kValue>
struct BooleanConstant {};
} // 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_
 End of changes. 12 change blocks. 
12 lines changed or deleted 46 lines changed or added


 gmock-matchers.h   gmock-matchers.h 
skipping to change at line 41 skipping to change at line 41
// Google Mock - a framework for writing C++ mock classes. // Google Mock - a framework for writing C++ mock classes.
// //
// This file implements some commonly used argument matchers. More // This file implements some commonly used argument matchers. More
// matchers can be defined by the user implementing the // matchers can be defined by the user implementing the
// MatcherInterface<T> interface if necessary. // MatcherInterface<T> interface if necessary.
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
#include <math.h>
#include <algorithm> #include <algorithm>
#include <iterator>
#include <limits> #include <limits>
#include <ostream> // NOLINT #include <ostream> // NOLINT
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
#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"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#if GTEST_LANG_CXX11
#include <initializer_list> // NOLINT -- must be after gtest.h
#endif
namespace testing { namespace testing {
// To implement a matcher Foo for type T, define: // To implement a matcher Foo for type T, define:
// 1. a class FooMatcherImpl that implements the // 1. a class FooMatcherImpl that implements the
// MatcherInterface<T> interface, and // MatcherInterface<T> interface, and
// 2. a factory function that creates a Matcher<T> object from a // 2. a factory function that creates a Matcher<T> object from a
// FooMatcherImpl*. // FooMatcherImpl*.
// //
// The two-level delegation design makes it possible to allow a user // The two-level delegation design makes it possible to allow a user
// to write "v" instead of "Eq(v)" where a Matcher is expected, which // to write "v" instead of "Eq(v)" where a Matcher is expected, which
skipping to change at line 77 skipping to change at line 83
// MatchResultListener is an abstract class. Its << operator can be // MatchResultListener is an abstract class. Its << operator can be
// used by a matcher to explain why a value matches or doesn't match. // used by a matcher to explain why a value matches or doesn't match.
// //
// TODO(wan@google.com): add method // TODO(wan@google.com): add method
// bool InterestedInWhy(bool result) const; // bool InterestedInWhy(bool result) const;
// to indicate whether the listener is interested in why the match // to indicate whether the listener is interested in why the match
// result is 'result'. // result is 'result'.
class MatchResultListener { class MatchResultListener {
public: public:
// Creates a listener object with the given underlying ostream. The // Creates a listener object with the given underlying ostream. The
// listener does not own the ostream. // listener does not own the ostream, and does not dereference it
// in the constructor or destructor.
explicit MatchResultListener(::std::ostream* os) : stream_(os) {} explicit MatchResultListener(::std::ostream* os) : stream_(os) {}
virtual ~MatchResultListener() = 0; // Makes this class abstract. virtual ~MatchResultListener() = 0; // Makes this class abstract.
// Streams x to the underlying ostream; does nothing if the ostream // Streams x to the underlying ostream; does nothing if the ostream
// is NULL. // is NULL.
template <typename T> template <typename T>
MatchResultListener& operator<<(const T& x) { MatchResultListener& operator<<(const T& x) {
if (stream_ != NULL) if (stream_ != NULL)
*stream_ << x; *stream_ << x;
return *this; return *this;
skipping to change at line 108 skipping to change at line 115
private: private:
::std::ostream* const stream_; ::std::ostream* const stream_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener); GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener);
}; };
inline MatchResultListener::~MatchResultListener() { inline MatchResultListener::~MatchResultListener() {
} }
// The implementation of a matcher. // An instance of a subclass of this knows how to describe itself as a
template <typename T> // matcher.
class MatcherInterface { class MatcherDescriberInterface {
public: public:
virtual ~MatcherInterface() {} virtual ~MatcherDescriberInterface() {}
// Returns true iff the matcher matches x; also explains the match
// result to 'listener', in the form of a non-restrictive relative
// clause ("which ...", "whose ...", etc) that describes x. For
// example, the MatchAndExplain() method of the Pointee(...) matcher
// should generate an explanation like "which points to ...".
//
// You should override this method when defining a new matcher.
//
// It's the responsibility of the caller (Google Mock) to guarantee
// that 'listener' is not NULL. This helps to simplify a matcher's
// implementation when it doesn't care about the performance, as it
// can talk to 'listener' without checking its validity first.
// However, in order to implement dummy listeners efficiently,
// listener->stream() may be NULL.
virtual bool MatchAndExplain(T x, MatchResultListener* listener) const =
0;
// Describes this matcher to an ostream. The function should print // Describes this matcher to an ostream. The function should print
// a verb phrase that describes the property a value matching this // a verb phrase that describes the property a value matching this
// matcher should have. The subject of the verb phrase is the value // matcher should have. The subject of the verb phrase is the value
// being matched. For example, the DescribeTo() method of the Gt(7) // being matched. For example, the DescribeTo() method of the Gt(7)
// matcher prints "is greater than 7". // matcher prints "is greater than 7".
virtual void DescribeTo(::std::ostream* os) const = 0; virtual void DescribeTo(::std::ostream* os) const = 0;
// Describes the negation of this matcher to an ostream. For // Describes the negation of this matcher to an ostream. For
// example, if the description of this matcher is "is greater than // example, if the description of this matcher is "is greater than
skipping to change at line 150 skipping to change at line 141
// You are not required to override this when implementing // You are not required to override this when implementing
// MatcherInterface, but it is highly advised so that your matcher // MatcherInterface, but it is highly advised so that your matcher
// can produce good error messages. // can produce good error messages.
virtual void DescribeNegationTo(::std::ostream* os) const { virtual void DescribeNegationTo(::std::ostream* os) const {
*os << "not ("; *os << "not (";
DescribeTo(os); DescribeTo(os);
*os << ")"; *os << ")";
} }
}; };
// The implementation of a matcher.
template <typename T>
class MatcherInterface : public MatcherDescriberInterface {
public:
// Returns true iff the matcher matches x; also explains the match
// result to 'listener' if necessary (see the next paragraph), in
// the form of a non-restrictive relative clause ("which ...",
// "whose ...", etc) that describes x. For example, the
// MatchAndExplain() method of the Pointee(...) matcher should
// generate an explanation like "which points to ...".
//
// Implementations of MatchAndExplain() should add an explanation of
// the match result *if and only if* they can provide additional
// information that's not already present (or not obvious) in the
// print-out of x and the matcher's description. Whether the match
// succeeds is not a factor in deciding whether an explanation is
// needed, as sometimes the caller needs to print a failure message
// when the match succeeds (e.g. when the matcher is used inside
// Not()).
//
// For example, a "has at least 10 elements" matcher should explain
// what the actual element count is, regardless of the match result,
// as it is useful information to the reader; on the other hand, an
// "is empty" matcher probably only needs to explain what the actual
// size is when the match fails, as it's redundant to say that the
// size is 0 when the value is already known to be empty.
//
// You should override this method when defining a new matcher.
//
// It's the responsibility of the caller (Google Mock) to guarantee
// that 'listener' is not NULL. This helps to simplify a matcher's
// implementation when it doesn't care about the performance, as it
// can talk to 'listener' without checking its validity first.
// However, in order to implement dummy listeners efficiently,
// listener->stream() may be NULL.
virtual bool MatchAndExplain(T x, MatchResultListener* listener) const =
0;
// Inherits these methods from MatcherDescriberInterface:
// virtual void DescribeTo(::std::ostream* os) const = 0;
// virtual void DescribeNegationTo(::std::ostream* os) const;
};
// A match result listener that stores the explanation in a string.
class StringMatchResultListener : public MatchResultListener {
public:
StringMatchResultListener() : MatchResultListener(&ss_) {}
// Returns the explanation accumulated so far.
internal::string str() const { return ss_.str(); }
// Clears the explanation accumulated so far.
void Clear() { ss_.str(""); }
private:
::std::stringstream ss_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(StringMatchResultListener);
};
namespace internal { namespace internal {
// A match result listener that ignores the explanation. // A match result listener that ignores the explanation.
class DummyMatchResultListener : public MatchResultListener { class DummyMatchResultListener : public MatchResultListener {
public: public:
DummyMatchResultListener() : MatchResultListener(NULL) {} DummyMatchResultListener() : MatchResultListener(NULL) {}
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener); GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener);
}; };
skipping to change at line 173 skipping to change at line 223
// that the former is concrete. // that the former is concrete.
class StreamMatchResultListener : public MatchResultListener { class StreamMatchResultListener : public MatchResultListener {
public: public:
explicit StreamMatchResultListener(::std::ostream* os) explicit StreamMatchResultListener(::std::ostream* os)
: MatchResultListener(os) {} : MatchResultListener(os) {}
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener); GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener);
}; };
// A match result listener that stores the explanation in a string.
class StringMatchResultListener : public MatchResultListener {
public:
StringMatchResultListener() : MatchResultListener(&ss_) {}
// Returns the explanation heard so far.
internal::string str() const { return ss_.str(); }
private:
::std::stringstream ss_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(StringMatchResultListener);
};
// An internal class for implementing Matcher<T>, which will derive // An internal class for implementing Matcher<T>, which will derive
// from it. We put functionalities common to all Matcher<T> // from it. We put functionalities common to all Matcher<T>
// specializations here to avoid code duplication. // specializations here to avoid code duplication.
template <typename T> template <typename T>
class MatcherBase { class MatcherBase {
public: public:
// Returns true iff the matcher matches x; also explains the match // Returns true iff the matcher matches x; also explains the match
// result to 'listener'. // result to 'listener'.
bool MatchAndExplain(T x, MatchResultListener* listener) const { bool MatchAndExplain(T x, MatchResultListener* listener) const {
return impl_->MatchAndExplain(x, listener); return impl_->MatchAndExplain(x, listener);
skipping to change at line 219 skipping to change at line 255
void DescribeNegationTo(::std::ostream* os) const { void DescribeNegationTo(::std::ostream* os) const {
impl_->DescribeNegationTo(os); impl_->DescribeNegationTo(os);
} }
// Explains why x matches, or doesn't match, the matcher. // Explains why x matches, or doesn't match, the matcher.
void ExplainMatchResultTo(T x, ::std::ostream* os) const { void ExplainMatchResultTo(T x, ::std::ostream* os) const {
StreamMatchResultListener listener(os); StreamMatchResultListener listener(os);
MatchAndExplain(x, &listener); MatchAndExplain(x, &listener);
} }
// Returns the describer for this matcher object; retains ownership
// of the describer, which is only guaranteed to be alive when
// this matcher object is alive.
const MatcherDescriberInterface* GetDescriber() const {
return impl_.get();
}
protected: protected:
MatcherBase() {} MatcherBase() {}
// Constructs a matcher from its implementation. // Constructs a matcher from its implementation.
explicit MatcherBase(const MatcherInterface<T>* impl) explicit MatcherBase(const MatcherInterface<T>* impl)
: impl_(impl) {} : impl_(impl) {}
virtual ~MatcherBase() {} virtual ~MatcherBase() {}
private: private:
skipping to change at line 271 skipping to change at line 314
// Implicit constructor here allows people to write // Implicit constructor here allows people to write
// EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) somet imes // EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) somet imes
Matcher(T value); // NOLINT Matcher(T value); // NOLINT
}; };
// The following two specializations allow the user to write str // The following two specializations allow the user to write str
// instead of Eq(str) and "foo" instead of Eq("foo") when a string // instead of Eq(str) and "foo" instead of Eq("foo") when a string
// matcher is expected. // matcher is expected.
template <> template <>
class Matcher<const internal::string&> class GTEST_API_ Matcher<const internal::string&>
: public internal::MatcherBase<const internal::string&> { : public internal::MatcherBase<const internal::string&> {
public: public:
Matcher() {} Matcher() {}
explicit Matcher(const MatcherInterface<const internal::string&>* impl) explicit Matcher(const MatcherInterface<const internal::string&>* impl)
: internal::MatcherBase<const internal::string&>(impl) {} : internal::MatcherBase<const internal::string&>(impl) {}
// Allows the user to write str instead of Eq(str) sometimes, where // Allows the user to write str instead of Eq(str) sometimes, where
// str is a string object. // str is a string object.
Matcher(const internal::string& s); // NOLINT Matcher(const internal::string& s); // NOLINT
// Allows the user to write "foo" instead of Eq("foo") sometimes. // Allows the user to write "foo" instead of Eq("foo") sometimes.
Matcher(const char* s); // NOLINT Matcher(const char* s); // NOLINT
}; };
template <> template <>
class Matcher<internal::string> class GTEST_API_ Matcher<internal::string>
: public internal::MatcherBase<internal::string> { : public internal::MatcherBase<internal::string> {
public: public:
Matcher() {} Matcher() {}
explicit Matcher(const MatcherInterface<internal::string>* impl) explicit Matcher(const MatcherInterface<internal::string>* impl)
: internal::MatcherBase<internal::string>(impl) {} : internal::MatcherBase<internal::string>(impl) {}
// Allows the user to write str instead of Eq(str) sometimes, where // Allows the user to write str instead of Eq(str) sometimes, where
// str is a string object. // str is a string object.
Matcher(const internal::string& s); // NOLINT Matcher(const internal::string& s); // NOLINT
// Allows the user to write "foo" instead of Eq("foo") sometimes. // Allows the user to write "foo" instead of Eq("foo") sometimes.
Matcher(const char* s); // NOLINT Matcher(const char* s); // NOLINT
}; };
#if GTEST_HAS_STRING_PIECE_
// The following two specializations allow the user to write str
// instead of Eq(str) and "foo" instead of Eq("foo") when a StringPiece
// matcher is expected.
template <>
class GTEST_API_ Matcher<const StringPiece&>
: public internal::MatcherBase<const StringPiece&> {
public:
Matcher() {}
explicit Matcher(const MatcherInterface<const StringPiece&>* impl)
: internal::MatcherBase<const StringPiece&>(impl) {}
// Allows the user to write str instead of Eq(str) sometimes, where
// str is a string object.
Matcher(const internal::string& s); // NOLINT
// Allows the user to write "foo" instead of Eq("foo") sometimes.
Matcher(const char* s); // NOLINT
// Allows the user to pass StringPieces directly.
Matcher(StringPiece s); // NOLINT
};
template <>
class GTEST_API_ Matcher<StringPiece>
: public internal::MatcherBase<StringPiece> {
public:
Matcher() {}
explicit Matcher(const MatcherInterface<StringPiece>* impl)
: internal::MatcherBase<StringPiece>(impl) {}
// Allows the user to write str instead of Eq(str) sometimes, where
// str is a string object.
Matcher(const internal::string& s); // NOLINT
// Allows the user to write "foo" instead of Eq("foo") sometimes.
Matcher(const char* s); // NOLINT
// Allows the user to pass StringPieces directly.
Matcher(StringPiece s); // NOLINT
};
#endif // GTEST_HAS_STRING_PIECE_
// The PolymorphicMatcher class template makes it easy to implement a // The PolymorphicMatcher class template makes it easy to implement a
// polymorphic matcher (i.e. a matcher that can match values of more // polymorphic matcher (i.e. a matcher that can match values of more
// than one type, e.g. Eq(n) and NotNull()). // than one type, e.g. Eq(n) and NotNull()).
// //
// To define a polymorphic matcher, a user should provide an Impl // To define a polymorphic matcher, a user should provide an Impl
// class that has a DescribeTo() method and a DescribeNegationTo() // class that has a DescribeTo() method and a DescribeNegationTo()
// method, and define a member function (or member function template) // method, and define a member function (or member function template)
// //
// bool MatchAndExplain(const Value& value, // bool MatchAndExplain(const Value& value,
// MatchResultListener* listener) const; // MatchResultListener* listener) const;
skipping to change at line 373 skipping to change at line 461
// Creates a matcher from its implementation. This is easier to use // Creates a matcher from its implementation. This is easier to use
// than the Matcher<T> constructor as it doesn't require you to // than the Matcher<T> constructor as it doesn't require you to
// explicitly write the template argument, e.g. // explicitly write the template argument, e.g.
// //
// MakeMatcher(foo); // MakeMatcher(foo);
// vs // vs
// Matcher<const string&>(foo); // Matcher<const string&>(foo);
template <typename T> template <typename T>
inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) { inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) {
return Matcher<T>(impl); return Matcher<T>(impl);
}; }
// Creates a polymorphic matcher from its implementation. This is // Creates a polymorphic matcher from its implementation. This is
// easier to use than the PolymorphicMatcher<Impl> constructor as it // easier to use than the PolymorphicMatcher<Impl> constructor as it
// doesn't require you to explicitly write the template argument, e.g. // doesn't require you to explicitly write the template argument, e.g.
// //
// MakePolymorphicMatcher(foo); // MakePolymorphicMatcher(foo);
// vs // vs
// PolymorphicMatcher<TypeOfFoo>(foo); // PolymorphicMatcher<TypeOfFoo>(foo);
template <class Impl> template <class Impl>
inline PolymorphicMatcher<Impl> MakePolymorphicMatcher(const Impl& impl) { inline PolymorphicMatcher<Impl> MakePolymorphicMatcher(const Impl& impl) {
return PolymorphicMatcher<Impl>(impl); return PolymorphicMatcher<Impl>(impl);
} }
// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION
// and MUST NOT BE USED IN USER CODE!!!
namespace internal {
// The MatcherCastImpl class template is a helper for implementing
// MatcherCast(). We need this helper in order to partially
// specialize the implementation of MatcherCast() (C++ allows
// class/struct templates to be partially specialized, but not
// function templates.).
// This general version is used when MatcherCast()'s argument is a
// polymorphic matcher (i.e. something that can be converted to a
// Matcher but is not one yet; for example, Eq(value)) or a value (for
// example, "hello").
template <typename T, typename M>
class MatcherCastImpl {
public:
static Matcher<T> Cast(M polymorphic_matcher_or_value) {
// M can be a polymorhic matcher, in which case we want to use
// its conversion operator to create Matcher<T>. Or it can be a value
// that should be passed to the Matcher<T>'s constructor.
//
// We can't call Matcher<T>(polymorphic_matcher_or_value) when M is a
// polymorphic matcher because it'll be ambiguous if T has an implicit
// constructor from M (this usually happens when T has an implicit
// constructor from any type).
//
// It won't work to unconditionally implict_cast
// polymorphic_matcher_or_value to Matcher<T> because it won't trigger
// a user-defined conversion from M to T if one exists (assuming M is
// a value).
return CastImpl(
polymorphic_matcher_or_value,
BooleanConstant<
internal::ImplicitlyConvertible<M, Matcher<T> >::value>());
}
private:
static Matcher<T> CastImpl(M value, BooleanConstant<false>) {
// M can't be implicitly converted to Matcher<T>, so M isn't a polymorp
hic
// matcher. It must be a value then. Use direct initialization to cre
ate
// a matcher.
return Matcher<T>(ImplicitCast_<T>(value));
}
static Matcher<T> CastImpl(M polymorphic_matcher_or_value,
BooleanConstant<true>) {
// M is implicitly convertible to Matcher<T>, which means that either
// M is a polymorhpic matcher or Matcher<T> has an implicit constructor
// from M. In both cases using the implicit conversion will produce a
// matcher.
//
// Even if T has an implicit constructor from M, it won't be called bec
ause
// creating Matcher<T> would require a chain of two user-defined conver
sions
// (first to create T from M and then to create Matcher<T> from T).
return polymorphic_matcher_or_value;
}
};
// This more specialized version is used when MatcherCast()'s argument
// is already a Matcher. This only compiles when type T can be
// statically converted to type U.
template <typename T, typename U>
class MatcherCastImpl<T, Matcher<U> > {
public:
static Matcher<T> Cast(const Matcher<U>& source_matcher) {
return Matcher<T>(new Impl(source_matcher));
}
private:
class Impl : public MatcherInterface<T> {
public:
explicit Impl(const Matcher<U>& source_matcher)
: source_matcher_(source_matcher) {}
// We delegate the matching logic to the source matcher.
virtual bool MatchAndExplain(T x, MatchResultListener* listener) const
{
return source_matcher_.MatchAndExplain(static_cast<U>(x), listener);
}
virtual void DescribeTo(::std::ostream* os) const {
source_matcher_.DescribeTo(os);
}
virtual void DescribeNegationTo(::std::ostream* os) const {
source_matcher_.DescribeNegationTo(os);
}
private:
const Matcher<U> source_matcher_;
GTEST_DISALLOW_ASSIGN_(Impl);
};
};
// This even more specialized version is used for efficiently casting
// a matcher to its own type.
template <typename T>
class MatcherCastImpl<T, Matcher<T> > {
public:
static Matcher<T> Cast(const Matcher<T>& matcher) { return matcher; }
};
} // namespace internal
// In order to be safe and clear, casting between different matcher // In order to be safe and clear, casting between different matcher
// types is done explicitly via MatcherCast<T>(m), which takes a // types is done explicitly via MatcherCast<T>(m), which takes a
// matcher m and returns a Matcher<T>. It compiles only when T can be // matcher m and returns a Matcher<T>. It compiles only when T can be
// statically converted to the argument type of m. // statically converted to the argument type of m.
template <typename T, typename M> template <typename T, typename M>
Matcher<T> MatcherCast(M m); inline Matcher<T> MatcherCast(M matcher) {
return internal::MatcherCastImpl<T, M>::Cast(matcher);
}
// Implements SafeMatcherCast(). // Implements SafeMatcherCast().
// //
// We use an intermediate class to do the actual safe casting as Nokia's // We use an intermediate class to do the actual safe casting as Nokia's
// Symbian compiler cannot decide between // Symbian compiler cannot decide between
// template <T, M> ... (M) and // template <T, M> ... (M) and
// template <T, U> ... (const Matcher<U>&) // template <T, U> ... (const Matcher<U>&)
// for function templates but can for member function templates. // for function templates but can for member function templates.
template <typename T> template <typename T>
class SafeMatcherCastImpl { class SafeMatcherCastImpl {
public: public:
// This overload handles polymorphic matchers only since monomorphic // This overload handles polymorphic matchers and values only since
// matchers are handled by the next one. // monomorphic matchers are handled by the next one.
template <typename M> template <typename M>
static inline Matcher<T> Cast(M polymorphic_matcher) { static inline Matcher<T> Cast(M polymorphic_matcher_or_value) {
return Matcher<T>(polymorphic_matcher); return internal::MatcherCastImpl<T, M>::Cast(polymorphic_matcher_or_val
ue);
} }
// This overload handles monomorphic matchers. // This overload handles monomorphic matchers.
// //
// In general, if type T can be implicitly converted to type U, we can // In general, if type T can be implicitly converted to type U, we can
// safely convert a Matcher<U> to a Matcher<T> (i.e. Matcher is // safely convert a Matcher<U> to a Matcher<T> (i.e. Matcher is
// contravariant): just keep a copy of the original Matcher<U>, convert t he // contravariant): just keep a copy of the original Matcher<U>, convert t he
// argument from type T to U, and then pass it to the underlying Matcher< U>. // argument from type T to U, and then pass it to the underlying Matcher< U>.
// The only exception is when U is a reference and T is not, as the // The only exception is when U is a reference and T is not, as the
// underlying Matcher<U> may be interested in the argument's address, whi ch // underlying Matcher<U> may be interested in the argument's address, whi ch
skipping to change at line 459 skipping to change at line 654
// A<T>() returns a matcher that matches any value of type T. // A<T>() returns a matcher that matches any value of type T.
template <typename T> template <typename T>
Matcher<T> A(); Matcher<T> A();
// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION // Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION
// and MUST NOT BE USED IN USER CODE!!! // and MUST NOT BE USED IN USER CODE!!!
namespace internal { namespace internal {
// If the explanation is not empty, prints it to the ostream. // If the explanation is not empty, prints it to the ostream.
inline void PrintIfNotEmpty(const internal::string& explanation, inline void PrintIfNotEmpty(const internal::string& explanation,
std::ostream* os) { ::std::ostream* os) {
if (explanation != "" && os != NULL) { if (explanation != "" && os != NULL) {
*os << ", " << explanation; *os << ", " << explanation;
} }
} }
// Returns true if the given type name is easy to read by a human. // Returns true if the given type name is easy to read by a human.
// This is used to decide whether printing the type of a value might // This is used to decide whether printing the type of a value might
// be helpful. // be helpful.
inline bool IsReadableTypeName(const string& type_name) { inline bool IsReadableTypeName(const string& type_name) {
// We consider a type name readable if it's short or doesn't contain // We consider a type name readable if it's short or doesn't contain
skipping to change at line 603 skipping to change at line 798
// is no failure, nothing will be streamed to os. // is no failure, nothing will be streamed to os.
template <typename MatcherTuple, typename ValueTuple> template <typename MatcherTuple, typename ValueTuple>
void ExplainMatchFailureTupleTo(const MatcherTuple& matchers, void ExplainMatchFailureTupleTo(const MatcherTuple& matchers,
const ValueTuple& values, const ValueTuple& values,
::std::ostream* os) { ::std::ostream* os) {
using ::std::tr1::tuple_size; using ::std::tr1::tuple_size;
TuplePrefix<tuple_size<MatcherTuple>::value>::ExplainMatchFailuresTo( TuplePrefix<tuple_size<MatcherTuple>::value>::ExplainMatchFailuresTo(
matchers, values, os); matchers, values, os);
} }
// The MatcherCastImpl class template is a helper for implementing // TransformTupleValues and its helper.
// MatcherCast(). We need this helper in order to partially //
// specialize the implementation of MatcherCast() (C++ allows // TransformTupleValuesHelper hides the internal machinery that
// class/struct templates to be partially specialized, but not // TransformTupleValues uses to implement a tuple traversal.
// function templates.). template <typename Tuple, typename Func, typename OutIter>
class TransformTupleValuesHelper {
// This general version is used when MatcherCast()'s argument is a private:
// polymorphic matcher (i.e. something that can be converted to a typedef typename ::std::tr1::tuple_size<Tuple> TupleSize;
// Matcher but is not one yet; for example, Eq(value)).
template <typename T, typename M>
class MatcherCastImpl {
public:
static Matcher<T> Cast(M polymorphic_matcher) {
return Matcher<T>(polymorphic_matcher);
}
};
// This more specialized version is used when MatcherCast()'s argument
// is already a Matcher. This only compiles when type T can be
// statically converted to type U.
template <typename T, typename U>
class MatcherCastImpl<T, Matcher<U> > {
public: public:
static Matcher<T> Cast(const Matcher<U>& source_matcher) { // For each member of tuple 't', taken in order, evaluates '*out++ = f(t)
return Matcher<T>(new Impl(source_matcher)); '.
// Returns the final value of 'out' in case the caller needs it.
static OutIter Run(Func f, const Tuple& t, OutIter out) {
return IterateOverTuple<Tuple, TupleSize::value>()(f, t, out);
} }
private: private:
class Impl : public MatcherInterface<T> { template <typename Tup, size_t kRemainingSize>
public: struct IterateOverTuple {
explicit Impl(const Matcher<U>& source_matcher) OutIter operator() (Func f, const Tup& t, OutIter out) const {
: source_matcher_(source_matcher) {} *out++ = f(::std::tr1::get<TupleSize::value - kRemainingSize>(t));
return IterateOverTuple<Tup, kRemainingSize - 1>()(f, t, out);
// We delegate the matching logic to the source matcher.
virtual bool MatchAndExplain(T x, MatchResultListener* listener) const
{
return source_matcher_.MatchAndExplain(static_cast<U>(x), listener);
} }
};
virtual void DescribeTo(::std::ostream* os) const { template <typename Tup>
source_matcher_.DescribeTo(os); struct IterateOverTuple<Tup, 0> {
} OutIter operator() (Func /* f */, const Tup& /* t */, OutIter out) cons
t {
virtual void DescribeNegationTo(::std::ostream* os) const { return out;
source_matcher_.DescribeNegationTo(os);
} }
private:
const Matcher<U> source_matcher_;
GTEST_DISALLOW_ASSIGN_(Impl);
}; };
}; };
// This even more specialized version is used for efficiently casting // Successively invokes 'f(element)' on each element of the tuple 't',
// a matcher to its own type. // appending each result to the 'out' iterator. Returns the final value
template <typename T> // of 'out'.
class MatcherCastImpl<T, Matcher<T> > { template <typename Tuple, typename Func, typename OutIter>
public: OutIter TransformTupleValues(Func f, const Tuple& t, OutIter out) {
static Matcher<T> Cast(const Matcher<T>& matcher) { return matcher; } return TransformTupleValuesHelper<Tuple, Func, OutIter>::Run(f, t, out);
}; }
// Implements A<T>(). // Implements A<T>().
template <typename T> template <typename T>
class AnyMatcherImpl : public MatcherInterface<T> { class AnyMatcherImpl : public MatcherInterface<T> {
public: public:
virtual bool MatchAndExplain( virtual bool MatchAndExplain(
T /* x */, MatchResultListener* /* listener */) const { return true; } T /* x */, MatchResultListener* /* listener */) const { return true; }
virtual void DescribeTo(::std::ostream* os) const { *os << "is anything"; } virtual void DescribeTo(::std::ostream* os) const { *os << "is anything"; }
virtual void DescribeNegationTo(::std::ostream* os) const { virtual void DescribeNegationTo(::std::ostream* os) const {
// This is mostly for completeness' safe, as it's not very useful // This is mostly for completeness' safe, as it's not very useful
skipping to change at line 892 skipping to change at line 1066
// Are the tails equal? // Are the tails equal?
return CaseInsensitiveStringEquals(s1.substr(i1 + 1), s2.substr(i2 + 1)); return CaseInsensitiveStringEquals(s1.substr(i1 + 1), s2.substr(i2 + 1));
} }
// String matchers. // String matchers.
// Implements equality-based string matchers like StrEq, StrCaseNe, and etc . // Implements equality-based string matchers like StrEq, StrCaseNe, and etc .
template <typename StringType> template <typename StringType>
class StrEqualityMatcher { class StrEqualityMatcher {
public: public:
typedef typename StringType::const_pointer ConstCharPointer;
StrEqualityMatcher(const StringType& str, bool expect_eq, StrEqualityMatcher(const StringType& str, bool expect_eq,
bool case_sensitive) bool case_sensitive)
: string_(str), expect_eq_(expect_eq), case_sensitive_(case_sensitive ) {} : string_(str), expect_eq_(expect_eq), case_sensitive_(case_sensitive ) {}
// When expect_eq_ is true, returns true iff s is equal to string_; // Accepts pointer types, particularly:
// otherwise returns true iff s is not equal to string_. // const char*
bool MatchAndExplain(ConstCharPointer s, // char*
MatchResultListener* listener) const { // const wchar_t*
// wchar_t*
template <typename CharType>
bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
if (s == NULL) { if (s == NULL) {
return !expect_eq_; return !expect_eq_;
} }
return MatchAndExplain(StringType(s), listener); return MatchAndExplain(StringType(s), listener);
} }
bool MatchAndExplain(const StringType& s, // Matches anything that can convert to StringType.
//
// This is a template, not just a plain function with const StringType&,
// because StringPiece has some interfering non-explicit constructors.
template <typename MatcheeStringType>
bool MatchAndExplain(const MatcheeStringType& s,
MatchResultListener* /* listener */) const { MatchResultListener* /* listener */) const {
const bool eq = case_sensitive_ ? s == string_ : const StringType& s2(s);
CaseInsensitiveStringEquals(s, string_); const bool eq = case_sensitive_ ? s2 == string_ :
CaseInsensitiveStringEquals(s2, string_);
return expect_eq_ == eq; return expect_eq_ == eq;
} }
void DescribeTo(::std::ostream* os) const { void DescribeTo(::std::ostream* os) const {
DescribeToHelper(expect_eq_, os); DescribeToHelper(expect_eq_, os);
} }
void DescribeNegationTo(::std::ostream* os) const { void DescribeNegationTo(::std::ostream* os) const {
DescribeToHelper(!expect_eq_, os); DescribeToHelper(!expect_eq_, os);
} }
skipping to change at line 946 skipping to change at line 1127
GTEST_DISALLOW_ASSIGN_(StrEqualityMatcher); GTEST_DISALLOW_ASSIGN_(StrEqualityMatcher);
}; };
// Implements the polymorphic HasSubstr(substring) matcher, which // Implements the polymorphic HasSubstr(substring) matcher, which
// can be used as a Matcher<T> as long as T can be converted to a // can be used as a Matcher<T> as long as T can be converted to a
// string. // string.
template <typename StringType> template <typename StringType>
class HasSubstrMatcher { class HasSubstrMatcher {
public: public:
typedef typename StringType::const_pointer ConstCharPointer;
explicit HasSubstrMatcher(const StringType& substring) explicit HasSubstrMatcher(const StringType& substring)
: substring_(substring) {} : substring_(substring) {}
// These overloaded methods allow HasSubstr(substring) to be used as a // Accepts pointer types, particularly:
// Matcher<T> as long as T can be converted to string. Returns true // const char*
// iff s contains substring_ as a substring. // char*
bool MatchAndExplain(ConstCharPointer s, // const wchar_t*
MatchResultListener* listener) const { // wchar_t*
template <typename CharType>
bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
return s != NULL && MatchAndExplain(StringType(s), listener); return s != NULL && MatchAndExplain(StringType(s), listener);
} }
bool MatchAndExplain(const StringType& s, // Matches anything that can convert to StringType.
//
// This is a template, not just a plain function with const StringType&,
// because StringPiece has some interfering non-explicit constructors.
template <typename MatcheeStringType>
bool MatchAndExplain(const MatcheeStringType& s,
MatchResultListener* /* listener */) const { MatchResultListener* /* listener */) const {
return s.find(substring_) != StringType::npos; const StringType& s2(s);
return s2.find(substring_) != StringType::npos;
} }
// Describes what this matcher matches. // Describes what this matcher matches.
void DescribeTo(::std::ostream* os) const { void DescribeTo(::std::ostream* os) const {
*os << "has substring "; *os << "has substring ";
UniversalPrint(substring_, os); UniversalPrint(substring_, os);
} }
void DescribeNegationTo(::std::ostream* os) const { void DescribeNegationTo(::std::ostream* os) const {
*os << "has no substring "; *os << "has no substring ";
skipping to change at line 987 skipping to change at line 1174
GTEST_DISALLOW_ASSIGN_(HasSubstrMatcher); GTEST_DISALLOW_ASSIGN_(HasSubstrMatcher);
}; };
// Implements the polymorphic StartsWith(substring) matcher, which // Implements the polymorphic StartsWith(substring) matcher, which
// can be used as a Matcher<T> as long as T can be converted to a // can be used as a Matcher<T> as long as T can be converted to a
// string. // string.
template <typename StringType> template <typename StringType>
class StartsWithMatcher { class StartsWithMatcher {
public: public:
typedef typename StringType::const_pointer ConstCharPointer;
explicit StartsWithMatcher(const StringType& prefix) : prefix_(prefix) { explicit StartsWithMatcher(const StringType& prefix) : prefix_(prefix) {
} }
// These overloaded methods allow StartsWith(prefix) to be used as a // Accepts pointer types, particularly:
// Matcher<T> as long as T can be converted to string. Returns true // const char*
// iff s starts with prefix_. // char*
bool MatchAndExplain(ConstCharPointer s, // const wchar_t*
MatchResultListener* listener) const { // wchar_t*
template <typename CharType>
bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
return s != NULL && MatchAndExplain(StringType(s), listener); return s != NULL && MatchAndExplain(StringType(s), listener);
} }
bool MatchAndExplain(const StringType& s, // Matches anything that can convert to StringType.
//
// This is a template, not just a plain function with const StringType&,
// because StringPiece has some interfering non-explicit constructors.
template <typename MatcheeStringType>
bool MatchAndExplain(const MatcheeStringType& s,
MatchResultListener* /* listener */) const { MatchResultListener* /* listener */) const {
return s.length() >= prefix_.length() && const StringType& s2(s);
s.substr(0, prefix_.length()) == prefix_; return s2.length() >= prefix_.length() &&
s2.substr(0, prefix_.length()) == prefix_;
} }
void DescribeTo(::std::ostream* os) const { void DescribeTo(::std::ostream* os) const {
*os << "starts with "; *os << "starts with ";
UniversalPrint(prefix_, os); UniversalPrint(prefix_, os);
} }
void DescribeNegationTo(::std::ostream* os) const { void DescribeNegationTo(::std::ostream* os) const {
*os << "doesn't start with "; *os << "doesn't start with ";
UniversalPrint(prefix_, os); UniversalPrint(prefix_, os);
skipping to change at line 1028 skipping to change at line 1221
GTEST_DISALLOW_ASSIGN_(StartsWithMatcher); GTEST_DISALLOW_ASSIGN_(StartsWithMatcher);
}; };
// Implements the polymorphic EndsWith(substring) matcher, which // Implements the polymorphic EndsWith(substring) matcher, which
// can be used as a Matcher<T> as long as T can be converted to a // can be used as a Matcher<T> as long as T can be converted to a
// string. // string.
template <typename StringType> template <typename StringType>
class EndsWithMatcher { class EndsWithMatcher {
public: public:
typedef typename StringType::const_pointer ConstCharPointer;
explicit EndsWithMatcher(const StringType& suffix) : suffix_(suffix) {} explicit EndsWithMatcher(const StringType& suffix) : suffix_(suffix) {}
// These overloaded methods allow EndsWith(suffix) to be used as a // Accepts pointer types, particularly:
// Matcher<T> as long as T can be converted to string. Returns true // const char*
// iff s ends with suffix_. // char*
bool MatchAndExplain(ConstCharPointer s, // const wchar_t*
MatchResultListener* listener) const { // wchar_t*
template <typename CharType>
bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
return s != NULL && MatchAndExplain(StringType(s), listener); return s != NULL && MatchAndExplain(StringType(s), listener);
} }
bool MatchAndExplain(const StringType& s, // Matches anything that can convert to StringType.
//
// This is a template, not just a plain function with const StringType&,
// because StringPiece has some interfering non-explicit constructors.
template <typename MatcheeStringType>
bool MatchAndExplain(const MatcheeStringType& s,
MatchResultListener* /* listener */) const { MatchResultListener* /* listener */) const {
return s.length() >= suffix_.length() && const StringType& s2(s);
s.substr(s.length() - suffix_.length()) == suffix_; return s2.length() >= suffix_.length() &&
s2.substr(s2.length() - suffix_.length()) == suffix_;
} }
void DescribeTo(::std::ostream* os) const { void DescribeTo(::std::ostream* os) const {
*os << "ends with "; *os << "ends with ";
UniversalPrint(suffix_, os); UniversalPrint(suffix_, os);
} }
void DescribeNegationTo(::std::ostream* os) const { void DescribeNegationTo(::std::ostream* os) const {
*os << "doesn't end with "; *os << "doesn't end with ";
UniversalPrint(suffix_, os); UniversalPrint(suffix_, os);
skipping to change at line 1070 skipping to change at line 1269
}; };
// Implements polymorphic matchers MatchesRegex(regex) and // Implements polymorphic matchers MatchesRegex(regex) and
// ContainsRegex(regex), which can be used as a Matcher<T> as long as // ContainsRegex(regex), which can be used as a Matcher<T> as long as
// T can be converted to a string. // T can be converted to a string.
class MatchesRegexMatcher { class MatchesRegexMatcher {
public: public:
MatchesRegexMatcher(const RE* regex, bool full_match) MatchesRegexMatcher(const RE* regex, bool full_match)
: regex_(regex), full_match_(full_match) {} : regex_(regex), full_match_(full_match) {}
// These overloaded methods allow MatchesRegex(regex) to be used as // Accepts pointer types, particularly:
// a Matcher<T> as long as T can be converted to string. Returns // const char*
// true iff s matches regular expression regex. When full_match_ is // char*
// true, a full match is done; otherwise a partial match is done. // const wchar_t*
bool MatchAndExplain(const char* s, // wchar_t*
MatchResultListener* listener) const { template <typename CharType>
bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
return s != NULL && MatchAndExplain(internal::string(s), listener); return s != NULL && MatchAndExplain(internal::string(s), listener);
} }
bool MatchAndExplain(const internal::string& s, // Matches anything that can convert to internal::string.
//
// This is a template, not just a plain function with const internal::str
ing&,
// because StringPiece has some interfering non-explicit constructors.
template <class MatcheeStringType>
bool MatchAndExplain(const MatcheeStringType& s,
MatchResultListener* /* listener */) const { MatchResultListener* /* listener */) const {
return full_match_ ? RE::FullMatch(s, *regex_) : const internal::string& s2(s);
RE::PartialMatch(s, *regex_); return full_match_ ? RE::FullMatch(s2, *regex_) :
RE::PartialMatch(s2, *regex_);
} }
void DescribeTo(::std::ostream* os) const { void DescribeTo(::std::ostream* os) const {
*os << (full_match_ ? "matches" : "contains") *os << (full_match_ ? "matches" : "contains")
<< " regular expression "; << " regular expression ";
UniversalPrinter<internal::string>::Print(regex_->pattern(), os); UniversalPrinter<internal::string>::Print(regex_->pattern(), os);
} }
void DescribeNegationTo(::std::ostream* os) const { void DescribeNegationTo(::std::ostream* os) const {
*os << "doesn't " << (full_match_ ? "match" : "contain") *os << "doesn't " << (full_match_ ? "match" : "contain")
skipping to change at line 1269 skipping to change at line 1475
return true; return true;
} }
private: private:
const Matcher<T> matcher1_; const Matcher<T> matcher1_;
const Matcher<T> matcher2_; const Matcher<T> matcher2_;
GTEST_DISALLOW_ASSIGN_(BothOfMatcherImpl); GTEST_DISALLOW_ASSIGN_(BothOfMatcherImpl);
}; };
#if GTEST_LANG_CXX11
// MatcherList provides mechanisms for storing a variable number of matcher
s in
// a list structure (ListType) and creating a combining matcher from such a
// list.
// The template is defined recursively using the following template paramte
rs:
// * kSize is the length of the MatcherList.
// * Head is the type of the first matcher of the list.
// * Tail denotes the types of the remaining matchers of the list.
template <int kSize, typename Head, typename... Tail>
struct MatcherList {
typedef MatcherList<kSize - 1, Tail...> MatcherListTail;
typedef ::std::pair<Head, typename MatcherListTail::ListType> ListType;
// BuildList stores variadic type values in a nested pair structure.
// Example:
// MatcherList<3, int, string, float>::BuildList(5, "foo", 2.0) will retu
rn
// the corresponding result of type pair<int, pair<string, float>>.
static ListType BuildList(const Head& matcher, const Tail&... tail) {
return ListType(matcher, MatcherListTail::BuildList(tail...));
}
// CreateMatcher<T> creates a Matcher<T> from a given list of matchers (b
uilt
// by BuildList()). CombiningMatcher<T> is used to combine the matchers o
f the
// list. CombiningMatcher<T> must implement MatcherInterface<T> and have
a
// constructor taking two Matcher<T>s as input.
template <typename T, template <typename /* T */> class CombiningMatcher>
static Matcher<T> CreateMatcher(const ListType& matchers) {
return Matcher<T>(new CombiningMatcher<T>(
SafeMatcherCast<T>(matchers.first),
MatcherListTail::template CreateMatcher<T, CombiningMatcher>(
matchers.second)));
}
};
// The following defines the base case for the recursive definition of
// MatcherList.
template <typename Matcher1, typename Matcher2>
struct MatcherList<2, Matcher1, Matcher2> {
typedef ::std::pair<Matcher1, Matcher2> ListType;
static ListType BuildList(const Matcher1& matcher1,
const Matcher2& matcher2) {
return ::std::pair<Matcher1, Matcher2>(matcher1, matcher2);
}
template <typename T, template <typename /* T */> class CombiningMatcher>
static Matcher<T> CreateMatcher(const ListType& matchers) {
return Matcher<T>(new CombiningMatcher<T>(
SafeMatcherCast<T>(matchers.first),
SafeMatcherCast<T>(matchers.second)));
}
};
// VariadicMatcher is used for the variadic implementation of
// AllOf(m_1, m_2, ...) and AnyOf(m_1, m_2, ...).
// CombiningMatcher<T> is used to recursively combine the provided matchers
// (of type Args...).
template <template <typename T> class CombiningMatcher, typename... Args>
class VariadicMatcher {
public:
VariadicMatcher(const Args&... matchers) // NOLINT
: matchers_(MatcherListType::BuildList(matchers...)) {}
// This template type conversion operator allows an
// VariadicMatcher<Matcher1, Matcher2...> object to match any type that
// all of the provided matchers (Matcher1, Matcher2, ...) can match.
template <typename T>
operator Matcher<T>() const {
return MatcherListType::template CreateMatcher<T, CombiningMatcher>(
matchers_);
}
private:
typedef MatcherList<sizeof...(Args), Args...> MatcherListType;
const typename MatcherListType::ListType matchers_;
GTEST_DISALLOW_ASSIGN_(VariadicMatcher);
};
template <typename... Args>
using AllOfMatcher = VariadicMatcher<BothOfMatcherImpl, Args...>;
#endif // GTEST_LANG_CXX11
// Used for implementing the AllOf(m_1, ..., m_n) matcher, which // Used for implementing the AllOf(m_1, ..., m_n) matcher, which
// matches a value that matches all of the matchers m_1, ..., and m_n. // matches a value that matches all of the matchers m_1, ..., and m_n.
template <typename Matcher1, typename Matcher2> template <typename Matcher1, typename Matcher2>
class BothOfMatcher { class BothOfMatcher {
public: public:
BothOfMatcher(Matcher1 matcher1, Matcher2 matcher2) BothOfMatcher(Matcher1 matcher1, Matcher2 matcher2)
: matcher1_(matcher1), matcher2_(matcher2) {} : matcher1_(matcher1), matcher2_(matcher2) {}
// This template type conversion operator allows a // This template type conversion operator allows a
// BothOfMatcher<Matcher1, Matcher2> object to match any type that // BothOfMatcher<Matcher1, Matcher2> object to match any type that
skipping to change at line 1356 skipping to change at line 1647
return false; return false;
} }
private: private:
const Matcher<T> matcher1_; const Matcher<T> matcher1_;
const Matcher<T> matcher2_; const Matcher<T> matcher2_;
GTEST_DISALLOW_ASSIGN_(EitherOfMatcherImpl); GTEST_DISALLOW_ASSIGN_(EitherOfMatcherImpl);
}; };
#if GTEST_LANG_CXX11
// AnyOfMatcher is used for the variadic implementation of AnyOf(m_1, m_2,
...).
template <typename... Args>
using AnyOfMatcher = VariadicMatcher<EitherOfMatcherImpl, Args...>;
#endif // GTEST_LANG_CXX11
// Used for implementing the AnyOf(m_1, ..., m_n) matcher, which // Used for implementing the AnyOf(m_1, ..., m_n) matcher, which
// matches a value that matches at least one of the matchers m_1, ..., // matches a value that matches at least one of the matchers m_1, ...,
// and m_n. // and m_n.
template <typename Matcher1, typename Matcher2> template <typename Matcher1, typename Matcher2>
class EitherOfMatcher { class EitherOfMatcher {
public: public:
EitherOfMatcher(Matcher1 matcher1, Matcher2 matcher2) EitherOfMatcher(Matcher1 matcher1, Matcher2 matcher2)
: matcher1_(matcher1), matcher2_(matcher2) {} : matcher1_(matcher1), matcher2_(matcher2) {}
// This template type conversion operator allows a // This template type conversion operator allows a
skipping to change at line 1476 skipping to change at line 1774
// object to act as a predicate-formatter suitable for using with // object to act as a predicate-formatter suitable for using with
// Google Test's EXPECT_PRED_FORMAT1() macro. // Google Test's EXPECT_PRED_FORMAT1() macro.
template <typename T> template <typename T>
AssertionResult operator()(const char* value_text, const T& x) const { AssertionResult operator()(const char* value_text, const T& x) const {
// We convert matcher_ to a Matcher<const T&> *now* instead of // We convert matcher_ to a Matcher<const T&> *now* instead of
// when the PredicateFormatterFromMatcher object was constructed, // when the PredicateFormatterFromMatcher object was constructed,
// as matcher_ may be polymorphic (e.g. NotNull()) and we won't // as matcher_ may be polymorphic (e.g. NotNull()) and we won't
// know which type to instantiate it to until we actually see the // know which type to instantiate it to until we actually see the
// type of x here. // type of x here.
// //
// We write MatcherCast<const T&>(matcher_) instead of // We write SafeMatcherCast<const T&>(matcher_) instead of
// Matcher<const T&>(matcher_), as the latter won't compile when // Matcher<const T&>(matcher_), as the latter won't compile when
// matcher_ has type Matcher<T> (e.g. An<int>()). // matcher_ has type Matcher<T> (e.g. An<int>()).
const Matcher<const T&> matcher = MatcherCast<const T&>(matcher_); // We don't write MatcherCast<const T&> either, as that allows
// potentially unsafe downcasting of the matcher argument.
const Matcher<const T&> matcher = SafeMatcherCast<const T&>(matcher_);
StringMatchResultListener listener; StringMatchResultListener listener;
if (MatchPrintAndExplain(x, matcher, &listener)) if (MatchPrintAndExplain(x, matcher, &listener))
return AssertionSuccess(); return AssertionSuccess();
::std::stringstream ss; ::std::stringstream ss;
ss << "Value of: " << value_text << "\n" ss << "Value of: " << value_text << "\n"
<< "Expected: "; << "Expected: ";
matcher.DescribeTo(&ss); matcher.DescribeTo(&ss);
ss << "\n Actual: " << listener.str(); ss << "\n Actual: " << listener.str();
return AssertionFailure() << ss.str(); return AssertionFailure() << ss.str();
skipping to change at line 1507 skipping to change at line 1807
// A helper function for converting a matcher to a predicate-formatter // A helper function for converting a matcher to a predicate-formatter
// without the user needing to explicitly write the type. This is // without the user needing to explicitly write the type. This is
// used for implementing ASSERT_THAT() and EXPECT_THAT(). // used for implementing ASSERT_THAT() and EXPECT_THAT().
template <typename M> template <typename M>
inline PredicateFormatterFromMatcher<M> inline PredicateFormatterFromMatcher<M>
MakePredicateFormatterFromMatcher(const M& matcher) { MakePredicateFormatterFromMatcher(const M& matcher) {
return PredicateFormatterFromMatcher<M>(matcher); return PredicateFormatterFromMatcher<M>(matcher);
} }
// Implements the polymorphic floating point equality matcher, which // Implements the polymorphic floating point equality matcher, which matche
// matches two float values using ULP-based approximation. The s
// template is meant to be instantiated with FloatType being either // two float values using ULP-based approximation or, optionally, a
// float or double. // user-specified epsilon. The template is meant to be instantiated with
// FloatType being either float or double.
template <typename FloatType> template <typename FloatType>
class FloatingEqMatcher { class FloatingEqMatcher {
public: public:
// Constructor for FloatingEqMatcher. // Constructor for FloatingEqMatcher.
// The matcher's input will be compared with rhs. The matcher treats two // The matcher's input will be compared with rhs. The matcher treats two
// NANs as equal if nan_eq_nan is true. Otherwise, under IEEE standards, // NANs as equal if nan_eq_nan is true. Otherwise, under IEEE standards,
// equality comparisons between NANs will always return false. // equality comparisons between NANs will always return false. We specif
y a
// negative max_abs_error_ term to indicate that ULP-based approximation
will
// be used for comparison.
FloatingEqMatcher(FloatType rhs, bool nan_eq_nan) : FloatingEqMatcher(FloatType rhs, bool nan_eq_nan) :
rhs_(rhs), nan_eq_nan_(nan_eq_nan) {} rhs_(rhs), nan_eq_nan_(nan_eq_nan), max_abs_error_(-1) {
}
// Constructor that supports a user-specified max_abs_error that will be
used
// for comparison instead of ULP-based approximation. The max absolute
// should be non-negative.
FloatingEqMatcher(FloatType rhs, bool nan_eq_nan, FloatType max_abs_error
) :
rhs_(rhs), nan_eq_nan_(nan_eq_nan), max_abs_error_(max_abs_error) {
GTEST_CHECK_(max_abs_error >= 0)
<< ", where max_abs_error is" << max_abs_error;
}
// Implements floating point equality matcher as a Matcher<T>. // Implements floating point equality matcher as a Matcher<T>.
template <typename T> template <typename T>
class Impl : public MatcherInterface<T> { class Impl : public MatcherInterface<T> {
public: public:
Impl(FloatType rhs, bool nan_eq_nan) : Impl(FloatType rhs, bool nan_eq_nan, FloatType max_abs_error) :
rhs_(rhs), nan_eq_nan_(nan_eq_nan) {} rhs_(rhs), nan_eq_nan_(nan_eq_nan), max_abs_error_(max_abs_error) {}
virtual bool MatchAndExplain(T value, virtual bool MatchAndExplain(T value,
MatchResultListener* /* listener */) const { MatchResultListener* /* listener */) const {
const FloatingPoint<FloatType> lhs(value), rhs(rhs_); const FloatingPoint<FloatType> lhs(value), rhs(rhs_);
// Compares NaNs first, if nan_eq_nan_ is true. // Compares NaNs first, if nan_eq_nan_ is true.
if (nan_eq_nan_ && lhs.is_nan()) { if (lhs.is_nan() || rhs.is_nan()) {
return rhs.is_nan(); if (lhs.is_nan() && rhs.is_nan()) {
return nan_eq_nan_;
}
// One is nan; the other is not nan.
return false;
}
if (HasMaxAbsError()) {
// We perform an equality check so that inf will match inf, regardl
ess
// of error bounds. If the result of value - rhs_ would result in
// overflow or if either value is inf, the default result is infini
ty,
// which should only match if max_abs_error_ is also infinity.
return value == rhs_ || fabs(value - rhs_) <= max_abs_error_;
} else {
return lhs.AlmostEquals(rhs);
} }
return lhs.AlmostEquals(rhs);
} }
virtual void DescribeTo(::std::ostream* os) const { virtual void DescribeTo(::std::ostream* os) const {
// os->precision() returns the previously set precision, which we // os->precision() returns the previously set precision, which we
// store to restore the ostream to its original configuration // store to restore the ostream to its original configuration
// after outputting. // after outputting.
const ::std::streamsize old_precision = os->precision( const ::std::streamsize old_precision = os->precision(
::std::numeric_limits<FloatType>::digits10 + 2); ::std::numeric_limits<FloatType>::digits10 + 2);
if (FloatingPoint<FloatType>(rhs_).is_nan()) { if (FloatingPoint<FloatType>(rhs_).is_nan()) {
if (nan_eq_nan_) { if (nan_eq_nan_) {
*os << "is NaN"; *os << "is NaN";
} else { } else {
*os << "never matches"; *os << "never matches";
} }
} else { } else {
*os << "is approximately " << rhs_; *os << "is approximately " << rhs_;
if (HasMaxAbsError()) {
*os << " (absolute error <= " << max_abs_error_ << ")";
}
} }
os->precision(old_precision); os->precision(old_precision);
} }
virtual void DescribeNegationTo(::std::ostream* os) const { virtual void DescribeNegationTo(::std::ostream* os) const {
// As before, get original precision. // As before, get original precision.
const ::std::streamsize old_precision = os->precision( const ::std::streamsize old_precision = os->precision(
::std::numeric_limits<FloatType>::digits10 + 2); ::std::numeric_limits<FloatType>::digits10 + 2);
if (FloatingPoint<FloatType>(rhs_).is_nan()) { if (FloatingPoint<FloatType>(rhs_).is_nan()) {
if (nan_eq_nan_) { if (nan_eq_nan_) {
*os << "isn't NaN"; *os << "isn't NaN";
} else { } else {
*os << "is anything"; *os << "is anything";
} }
} else { } else {
*os << "isn't approximately " << rhs_; *os << "isn't approximately " << rhs_;
if (HasMaxAbsError()) {
*os << " (absolute error > " << max_abs_error_ << ")";
}
} }
// Restore original precision. // Restore original precision.
os->precision(old_precision); os->precision(old_precision);
} }
private: private:
bool HasMaxAbsError() const {
return max_abs_error_ >= 0;
}
const FloatType rhs_; const FloatType rhs_;
const bool nan_eq_nan_; const bool nan_eq_nan_;
// max_abs_error will be used for value comparison when >= 0.
const FloatType max_abs_error_;
GTEST_DISALLOW_ASSIGN_(Impl); GTEST_DISALLOW_ASSIGN_(Impl);
}; };
// The following 3 type conversion operators allow FloatEq(rhs) and // The following 3 type conversion operators allow FloatEq(rhs) and
// NanSensitiveFloatEq(rhs) to be used as a Matcher<float>, a // NanSensitiveFloatEq(rhs) to be used as a Matcher<float>, a
// Matcher<const float&>, or a Matcher<float&>, but nothing else. // Matcher<const float&>, or a Matcher<float&>, but nothing else.
// (While Google's C++ coding style doesn't allow arguments passed // (While Google's C++ coding style doesn't allow arguments passed
// by non-const reference, we may see them in code not conforming to // by non-const reference, we may see them in code not conforming to
// the style. Therefore Google Mock needs to support them.) // the style. Therefore Google Mock needs to support them.)
operator Matcher<FloatType>() const { operator Matcher<FloatType>() const {
return MakeMatcher(new Impl<FloatType>(rhs_, nan_eq_nan_)); return MakeMatcher(new Impl<FloatType>(rhs_, nan_eq_nan_, max_abs_error _));
} }
operator Matcher<const FloatType&>() const { operator Matcher<const FloatType&>() const {
return MakeMatcher(new Impl<const FloatType&>(rhs_, nan_eq_nan_)); return MakeMatcher(
new Impl<const FloatType&>(rhs_, nan_eq_nan_, max_abs_error_));
} }
operator Matcher<FloatType&>() const { operator Matcher<FloatType&>() const {
return MakeMatcher(new Impl<FloatType&>(rhs_, nan_eq_nan_)); return MakeMatcher(new Impl<FloatType&>(rhs_, nan_eq_nan_, max_abs_erro r_));
} }
private: private:
const FloatType rhs_; const FloatType rhs_;
const bool nan_eq_nan_; const bool nan_eq_nan_;
// max_abs_error will be used for value comparison when >= 0.
const FloatType max_abs_error_;
GTEST_DISALLOW_ASSIGN_(FloatingEqMatcher); GTEST_DISALLOW_ASSIGN_(FloatingEqMatcher);
}; };
// Implements the Pointee(m) matcher for matching a pointer whose // Implements the Pointee(m) matcher for matching a pointer whose
// pointee matches matcher m. The pointer can be either raw or smart. // pointee matches matcher m. The pointer can be either raw or smart.
template <typename InnerMatcher> template <typename InnerMatcher>
class PointeeMatcher { class PointeeMatcher {
public: public:
explicit PointeeMatcher(const InnerMatcher& matcher) : matcher_(matcher) {} explicit PointeeMatcher(const InnerMatcher& matcher) : matcher_(matcher) {}
skipping to change at line 1879 skipping to change at line 2218
GTEST_DISALLOW_ASSIGN_(Impl); GTEST_DISALLOW_ASSIGN_(Impl);
}; // class Impl }; // class Impl
const CallableStorageType callable_; const CallableStorageType callable_;
const Matcher<ResultType> matcher_; const Matcher<ResultType> matcher_;
GTEST_DISALLOW_ASSIGN_(ResultOfMatcher); GTEST_DISALLOW_ASSIGN_(ResultOfMatcher);
}; };
// Implements a matcher that checks the size of an STL-style container.
template <typename SizeMatcher>
class SizeIsMatcher {
public:
explicit SizeIsMatcher(const SizeMatcher& size_matcher)
: size_matcher_(size_matcher) {
}
template <typename Container>
operator Matcher<Container>() const {
return MakeMatcher(new Impl<Container>(size_matcher_));
}
template <typename Container>
class Impl : public MatcherInterface<Container> {
public:
typedef internal::StlContainerView<
GTEST_REMOVE_REFERENCE_AND_CONST_(Container)> ContainerView;
typedef typename ContainerView::type::size_type SizeType;
explicit Impl(const SizeMatcher& size_matcher)
: size_matcher_(MatcherCast<SizeType>(size_matcher)) {}
virtual void DescribeTo(::std::ostream* os) const {
*os << "size ";
size_matcher_.DescribeTo(os);
}
virtual void DescribeNegationTo(::std::ostream* os) const {
*os << "size ";
size_matcher_.DescribeNegationTo(os);
}
virtual bool MatchAndExplain(Container container,
MatchResultListener* listener) const {
SizeType size = container.size();
StringMatchResultListener size_listener;
const bool result = size_matcher_.MatchAndExplain(size, &size_listene
r);
*listener
<< "whose size " << size << (result ? " matches" : " doesn't matc
h");
PrintIfNotEmpty(size_listener.str(), listener->stream());
return result;
}
private:
const Matcher<SizeType> size_matcher_;
GTEST_DISALLOW_ASSIGN_(Impl);
};
private:
const SizeMatcher size_matcher_;
GTEST_DISALLOW_ASSIGN_(SizeIsMatcher);
};
// Implements an equality matcher for any STL-style container whose element s // Implements an equality matcher for any STL-style container whose element s
// support ==. This matcher is like Eq(), but its failure explanations prov ide // support ==. This matcher is like Eq(), but its failure explanations prov ide
// more detailed information that is useful when the container is used as a set. // more detailed information that is useful when the container is used as a set.
// The failure message reports elements that are in one of the operands but not // The failure message reports elements that are in one of the operands but not
// the other. The failure messages do not report duplicate or out-of-order // the other. The failure messages do not report duplicate or out-of-order
// elements in the containers (which don't properly matter to sets, but can // elements in the containers (which don't properly matter to sets, but can
// occur if the containers are vectors or lists, for example). // occur if the containers are vectors or lists, for example).
// //
// Uses the container's const_iterator, value_type, operator ==, // Uses the container's const_iterator, value_type, operator ==,
// begin(), and end(). // begin(), and end().
skipping to change at line 1973 skipping to change at line 2364
return false; return false;
} }
private: private:
const StlContainer rhs_; const StlContainer rhs_;
GTEST_DISALLOW_ASSIGN_(ContainerEqMatcher); GTEST_DISALLOW_ASSIGN_(ContainerEqMatcher);
}; };
// A comparator functor that uses the < operator to compare two values.
struct LessComparator {
template <typename T, typename U>
bool operator()(const T& lhs, const U& rhs) const { return lhs < rhs; }
};
// Implements WhenSortedBy(comparator, container_matcher).
template <typename Comparator, typename ContainerMatcher>
class WhenSortedByMatcher {
public:
WhenSortedByMatcher(const Comparator& comparator,
const ContainerMatcher& matcher)
: comparator_(comparator), matcher_(matcher) {}
template <typename LhsContainer>
operator Matcher<LhsContainer>() const {
return MakeMatcher(new Impl<LhsContainer>(comparator_, matcher_));
}
template <typename LhsContainer>
class Impl : public MatcherInterface<LhsContainer> {
public:
typedef internal::StlContainerView<
GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView;
typedef typename LhsView::type LhsStlContainer;
typedef typename LhsView::const_reference LhsStlContainerReference;
// Transforms std::pair<const Key, Value> into std::pair<Key, Value>
// so that we can match associative containers.
typedef typename RemoveConstFromKey<
typename LhsStlContainer::value_type>::type LhsValue;
Impl(const Comparator& comparator, const ContainerMatcher& matcher)
: comparator_(comparator), matcher_(matcher) {}
virtual void DescribeTo(::std::ostream* os) const {
*os << "(when sorted) ";
matcher_.DescribeTo(os);
}
virtual void DescribeNegationTo(::std::ostream* os) const {
*os << "(when sorted) ";
matcher_.DescribeNegationTo(os);
}
virtual bool MatchAndExplain(LhsContainer lhs,
MatchResultListener* listener) const {
LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(
lhs);
::std::vector<LhsValue> sorted_container(lhs_stl_container.begin(),
lhs_stl_container.end());
::std::sort(
sorted_container.begin(), sorted_container.end(), comparator_);
if (!listener->IsInterested()) {
// If the listener is not interested, we do not need to
// construct the inner explanation.
return matcher_.Matches(sorted_container);
}
*listener << "which is ";
UniversalPrint(sorted_container, listener->stream());
*listener << " when sorted";
StringMatchResultListener inner_listener;
const bool match = matcher_.MatchAndExplain(sorted_container,
&inner_listener);
PrintIfNotEmpty(inner_listener.str(), listener->stream());
return match;
}
private:
const Comparator comparator_;
const Matcher<const ::std::vector<LhsValue>&> matcher_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl);
};
private:
const Comparator comparator_;
const ContainerMatcher matcher_;
GTEST_DISALLOW_ASSIGN_(WhenSortedByMatcher);
};
// Implements Pointwise(tuple_matcher, rhs_container). tuple_matcher // Implements Pointwise(tuple_matcher, rhs_container). tuple_matcher
// must be able to be safely cast to Matcher<tuple<const T1&, const // must be able to be safely cast to Matcher<tuple<const T1&, const
// T2&> >, where T1 and T2 are the types of elements in the LHS // T2&> >, where T1 and T2 are the types of elements in the LHS
// container and the RHS container respectively. // container and the RHS container respectively.
template <typename TupleMatcher, typename RhsContainer> template <typename TupleMatcher, typename RhsContainer>
class PointwiseMatcher { class PointwiseMatcher {
public: public:
typedef internal::StlContainerView<RhsContainer> RhsView; typedef internal::StlContainerView<RhsContainer> RhsView;
typedef typename RhsView::type RhsStlContainer; typedef typename RhsView::type RhsStlContainer;
typedef typename RhsStlContainer::value_type RhsValue; typedef typename RhsStlContainer::value_type RhsValue;
skipping to change at line 2011 skipping to change at line 2485
public: public:
typedef internal::StlContainerView< typedef internal::StlContainerView<
GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView; GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView;
typedef typename LhsView::type LhsStlContainer; typedef typename LhsView::type LhsStlContainer;
typedef typename LhsView::const_reference LhsStlContainerReference; typedef typename LhsView::const_reference LhsStlContainerReference;
typedef typename LhsStlContainer::value_type LhsValue; typedef typename LhsStlContainer::value_type LhsValue;
// We pass the LHS value and the RHS value to the inner matcher by // We pass the LHS value and the RHS value to the inner matcher by
// reference, as they may be expensive to copy. We must use tuple // reference, as they may be expensive to copy. We must use tuple
// instead of pair here, as a pair cannot hold references (C++ 98, // instead of pair here, as a pair cannot hold references (C++ 98,
// 20.2.2 [lib.pairs]). // 20.2.2 [lib.pairs]).
typedef std::tr1::tuple<const LhsValue&, const RhsValue&> InnerMatcherA rg; typedef ::std::tr1::tuple<const LhsValue&, const RhsValue&> InnerMatche rArg;
Impl(const TupleMatcher& tuple_matcher, const RhsStlContainer& rhs) Impl(const TupleMatcher& tuple_matcher, const RhsStlContainer& rhs)
// mono_tuple_matcher_ holds a monomorphic version of the tuple mat cher. // mono_tuple_matcher_ holds a monomorphic version of the tuple mat cher.
: mono_tuple_matcher_(SafeMatcherCast<InnerMatcherArg>(tuple_matche r)), : mono_tuple_matcher_(SafeMatcherCast<InnerMatcherArg>(tuple_matche r)),
rhs_(rhs) {} rhs_(rhs) {}
virtual void DescribeTo(::std::ostream* os) const { virtual void DescribeTo(::std::ostream* os) const {
*os << "contains " << rhs_.size() *os << "contains " << rhs_.size()
<< " values, where each value and its corresponding value in "; << " values, where each value and its corresponding value in ";
UniversalPrinter<RhsStlContainer>::Print(rhs_, os); UniversalPrinter<RhsStlContainer>::Print(rhs_, os);
skipping to change at line 2404 skipping to change at line 2878
public: public:
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
typedef internal::StlContainerView<RawContainer> View; typedef internal::StlContainerView<RawContainer> View;
typedef typename View::type StlContainer; typedef typename View::type StlContainer;
typedef typename View::const_reference StlContainerReference; typedef typename View::const_reference StlContainerReference;
typedef typename StlContainer::value_type Element; typedef typename StlContainer::value_type Element;
// Constructs the matcher from a sequence of element values or // Constructs the matcher from a sequence of element values or
// element matchers. // element matchers.
template <typename InputIter> template <typename InputIter>
ElementsAreMatcherImpl(InputIter first, size_t a_count) { ElementsAreMatcherImpl(InputIter first, InputIter last) {
matchers_.reserve(a_count); while (first != last) {
InputIter it = first; matchers_.push_back(MatcherCast<const Element&>(*first++));
for (size_t i = 0; i != a_count; ++i, ++it) {
matchers_.push_back(MatcherCast<const Element&>(*it));
} }
} }
// Describes what this matcher does. // Describes what this matcher does.
virtual void DescribeTo(::std::ostream* os) const { virtual void DescribeTo(::std::ostream* os) const {
if (count() == 0) { if (count() == 0) {
*os << "is empty"; *os << "is empty";
} else if (count() == 1) { } else if (count() == 1) {
*os << "has 1 element that "; *os << "has 1 element that ";
matchers_[0].DescribeTo(os); matchers_[0].DescribeTo(os);
skipping to change at line 2450 skipping to change at line 2922
*os << "element #" << i << " "; *os << "element #" << i << " ";
matchers_[i].DescribeNegationTo(os); matchers_[i].DescribeNegationTo(os);
if (i + 1 < count()) { if (i + 1 < count()) {
*os << ", or\n"; *os << ", or\n";
} }
} }
} }
virtual bool MatchAndExplain(Container container, virtual bool MatchAndExplain(Container container,
MatchResultListener* listener) const { MatchResultListener* listener) const {
// To work with stream-like "containers", we must only walk
// through the elements in one pass.
const bool listener_interested = listener->IsInterested();
// explanations[i] is the explanation of the element at index i.
::std::vector<internal::string> explanations(count());
StlContainerReference stl_container = View::ConstReference(container); StlContainerReference stl_container = View::ConstReference(container);
const size_t actual_count = stl_container.size(); typename StlContainer::const_iterator it = stl_container.begin();
size_t exam_pos = 0;
bool mismatch_found = false; // Have we found a mismatched element yet
?
// Go through the elements and matchers in pairs, until we reach
// the end of either the elements or the matchers, or until we find a
// mismatch.
for (; it != stl_container.end() && exam_pos != count(); ++it, ++exam_p
os) {
bool match; // Does the current element match the current matcher?
if (listener_interested) {
StringMatchResultListener s;
match = matchers_[exam_pos].MatchAndExplain(*it, &s);
explanations[exam_pos] = s.str();
} else {
match = matchers_[exam_pos].Matches(*it);
}
if (!match) {
mismatch_found = true;
break;
}
}
// If mismatch_found is true, 'exam_pos' is the index of the mismatch.
// Find how many elements the actual container has. We avoid
// calling size() s.t. this code works for stream-like "containers"
// that don't define size().
size_t actual_count = exam_pos;
for (; it != stl_container.end(); ++it) {
++actual_count;
}
if (actual_count != count()) { if (actual_count != count()) {
// The element count doesn't match. If the container is empty, // The element count doesn't match. If the container is empty,
// there's no need to explain anything as Google Mock already // there's no need to explain anything as Google Mock already
// prints the empty container. Otherwise we just need to show // prints the empty container. Otherwise we just need to show
// how many elements there actually are. // how many elements there actually are.
if (actual_count != 0) { if (listener_interested && (actual_count != 0)) {
*listener << "which has " << Elements(actual_count); *listener << "which has " << Elements(actual_count);
} }
return false; return false;
} }
typename StlContainer::const_iterator it = stl_container.begin(); if (mismatch_found) {
// explanations[i] is the explanation of the element at index i. // The element count matches, but the exam_pos-th element doesn't mat
std::vector<internal::string> explanations(count()); ch.
for (size_t i = 0; i != count(); ++it, ++i) { if (listener_interested) {
StringMatchResultListener s; *listener << "whose element #" << exam_pos << " doesn't match";
if (matchers_[i].MatchAndExplain(*it, &s)) { PrintIfNotEmpty(explanations[exam_pos], listener->stream());
explanations[i] = s.str();
} else {
// The container has the right size but the i-th element
// doesn't match its expectation.
*listener << "whose element #" << i << " doesn't match";
PrintIfNotEmpty(s.str(), listener->stream());
return false;
} }
return false;
} }
// Every element matches its expectation. We need to explain why // Every element matches its expectation. We need to explain why
// (the obvious ones can be skipped). // (the obvious ones can be skipped).
bool reason_printed = false; if (listener_interested) {
for (size_t i = 0; i != count(); ++i) { bool reason_printed = false;
const internal::string& s = explanations[i]; for (size_t i = 0; i != count(); ++i) {
if (!s.empty()) { const internal::string& s = explanations[i];
if (reason_printed) { if (!s.empty()) {
*listener << ",\nand "; if (reason_printed) {
*listener << ",\nand ";
}
*listener << "whose element #" << i << " matches, " << s;
reason_printed = true;
} }
*listener << "whose element #" << i << " matches, " << s;
reason_printed = true;
} }
} }
return true; return true;
} }
private: private:
static Message Elements(size_t count) { static Message Elements(size_t count) {
return Message() << count << (count == 1 ? " element" : " elements"); return Message() << count << (count == 1 ? " element" : " elements");
} }
size_t count() const { return matchers_.size(); } size_t count() const { return matchers_.size(); }
std::vector<Matcher<const Element&> > matchers_;
::std::vector<Matcher<const Element&> > matchers_;
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcherImpl); GTEST_DISALLOW_ASSIGN_(ElementsAreMatcherImpl);
}; };
// Implements ElementsAre() of 0 arguments. // Connectivity matrix of (elements X matchers), in element-major order.
class ElementsAreMatcher0 { // Initially, there are no edges.
// Use NextGraph() to iterate over all possible edge configurations.
// Use Randomize() to generate a random edge configuration.
class GTEST_API_ MatchMatrix {
public:
MatchMatrix(size_t num_elements, size_t num_matchers)
: num_elements_(num_elements),
num_matchers_(num_matchers),
matched_(num_elements_* num_matchers_, 0) {
}
size_t LhsSize() const { return num_elements_; }
size_t RhsSize() const { return num_matchers_; }
bool HasEdge(size_t ilhs, size_t irhs) const {
return matched_[SpaceIndex(ilhs, irhs)] == 1;
}
void SetEdge(size_t ilhs, size_t irhs, bool b) {
matched_[SpaceIndex(ilhs, irhs)] = b ? 1 : 0;
}
// Treating the connectivity matrix as a (LhsSize()*RhsSize())-bit number
,
// adds 1 to that number; returns false if incrementing the graph left it
// empty.
bool NextGraph();
void Randomize();
string DebugString() const;
private:
size_t SpaceIndex(size_t ilhs, size_t irhs) const {
return ilhs * num_matchers_ + irhs;
}
size_t num_elements_;
size_t num_matchers_;
// Each element is a char interpreted as bool. They are stored as a
// flattened array in lhs-major order, use 'SpaceIndex()' to translate
// a (ilhs, irhs) matrix coordinate into an offset.
::std::vector<char> matched_;
};
typedef ::std::pair<size_t, size_t> ElementMatcherPair;
typedef ::std::vector<ElementMatcherPair> ElementMatcherPairs;
// Returns a maximum bipartite matching for the specified graph 'g'.
// The matching is represented as a vector of {element, matcher} pairs.
GTEST_API_ ElementMatcherPairs
FindMaxBipartiteMatching(const MatchMatrix& g);
GTEST_API_ bool FindPairing(const MatchMatrix& matrix,
MatchResultListener* listener);
// Untyped base class for implementing UnorderedElementsAre. By
// putting logic that's not specific to the element type here, we
// reduce binary bloat and increase compilation speed.
class GTEST_API_ UnorderedElementsAreMatcherImplBase {
protected:
// A vector of matcher describers, one for each element matcher.
// Does not own the describers (and thus can be used only when the
// element matchers are alive).
typedef ::std::vector<const MatcherDescriberInterface*> MatcherDescriberV
ec;
// Describes this UnorderedElementsAre matcher.
void DescribeToImpl(::std::ostream* os) const;
// Describes the negation of this UnorderedElementsAre matcher.
void DescribeNegationToImpl(::std::ostream* os) const;
bool VerifyAllElementsAndMatchersAreMatched(
const ::std::vector<string>& element_printouts,
const MatchMatrix& matrix,
MatchResultListener* listener) const;
MatcherDescriberVec& matcher_describers() {
return matcher_describers_;
}
static Message Elements(size_t n) {
return Message() << n << " element" << (n == 1 ? "" : "s");
}
private:
MatcherDescriberVec matcher_describers_;
GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcherImplBase);
};
// Implements unordered ElementsAre and unordered ElementsAreArray.
template <typename Container>
class UnorderedElementsAreMatcherImpl
: public MatcherInterface<Container>,
public UnorderedElementsAreMatcherImplBase {
public:
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
typedef internal::StlContainerView<RawContainer> View;
typedef typename View::type StlContainer;
typedef typename View::const_reference StlContainerReference;
typedef typename StlContainer::const_iterator StlContainerConstIterator;
typedef typename StlContainer::value_type Element;
// Constructs the matcher from a sequence of element values or
// element matchers.
template <typename InputIter>
UnorderedElementsAreMatcherImpl(InputIter first, InputIter last) {
for (; first != last; ++first) {
matchers_.push_back(MatcherCast<const Element&>(*first));
matcher_describers().push_back(matchers_.back().GetDescriber());
}
}
// Describes what this matcher does.
virtual void DescribeTo(::std::ostream* os) const {
return UnorderedElementsAreMatcherImplBase::DescribeToImpl(os);
}
// Describes what the negation of this matcher does.
virtual void DescribeNegationTo(::std::ostream* os) const {
return UnorderedElementsAreMatcherImplBase::DescribeNegationToImpl(os);
}
virtual bool MatchAndExplain(Container container,
MatchResultListener* listener) const {
StlContainerReference stl_container = View::ConstReference(container);
::std::vector<string> element_printouts;
MatchMatrix matrix = AnalyzeElements(stl_container.begin(),
stl_container.end(),
&element_printouts,
listener);
const size_t actual_count = matrix.LhsSize();
if (actual_count == 0 && matchers_.empty()) {
return true;
}
if (actual_count != matchers_.size()) {
// The element count doesn't match. If the container is empty,
// there's no need to explain anything as Google Mock already
// prints the empty container. Otherwise we just need to show
// how many elements there actually are.
if (actual_count != 0 && listener->IsInterested()) {
*listener << "which has " << Elements(actual_count);
}
return false;
}
return VerifyAllElementsAndMatchersAreMatched(element_printouts,
matrix, listener) &&
FindPairing(matrix, listener);
}
private:
typedef ::std::vector<Matcher<const Element&> > MatcherVec;
template <typename ElementIter>
MatchMatrix AnalyzeElements(ElementIter elem_first, ElementIter elem_last
,
::std::vector<string>* element_printouts,
MatchResultListener* listener) const {
element_printouts->clear();
::std::vector<char> did_match;
size_t num_elements = 0;
for (; elem_first != elem_last; ++num_elements, ++elem_first) {
if (listener->IsInterested()) {
element_printouts->push_back(PrintToString(*elem_first));
}
for (size_t irhs = 0; irhs != matchers_.size(); ++irhs) {
did_match.push_back(Matches(matchers_[irhs])(*elem_first));
}
}
MatchMatrix matrix(num_elements, matchers_.size());
::std::vector<char>::const_iterator did_match_iter = did_match.begin();
for (size_t ilhs = 0; ilhs != num_elements; ++ilhs) {
for (size_t irhs = 0; irhs != matchers_.size(); ++irhs) {
matrix.SetEdge(ilhs, irhs, *did_match_iter++ != 0);
}
}
return matrix;
}
MatcherVec matchers_;
GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcherImpl);
};
// Functor for use in TransformTuple.
// Performs MatcherCast<Target> on an input argument of any type.
template <typename Target>
struct CastAndAppendTransform {
template <typename Arg>
Matcher<Target> operator()(const Arg& a) const {
return MatcherCast<Target>(a);
}
};
// Implements UnorderedElementsAre.
template <typename MatcherTuple>
class UnorderedElementsAreMatcher {
public:
explicit UnorderedElementsAreMatcher(const MatcherTuple& args)
: matchers_(args) {}
template <typename Container>
operator Matcher<Container>() const {
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type View;
typedef typename View::value_type Element;
typedef ::std::vector<Matcher<const Element&> > MatcherVec;
MatcherVec matchers;
matchers.reserve(::std::tr1::tuple_size<MatcherTuple>::value);
TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers
_,
::std::back_inserter(matchers));
return MakeMatcher(new UnorderedElementsAreMatcherImpl<Container>(
matchers.begin(), matchers.end()));
}
private:
const MatcherTuple matchers_;
GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcher);
};
// Implements ElementsAre.
template <typename MatcherTuple>
class ElementsAreMatcher {
public: public:
ElementsAreMatcher0() {} explicit ElementsAreMatcher(const MatcherTuple& args) : matchers_(args) { }
template <typename Container> template <typename Container>
operator Matcher<Container>() const { operator Matcher<Container>() const {
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_ typedef typename internal::StlContainerView<RawContainer>::type View;
type typedef typename View::value_type Element;
Element; typedef ::std::vector<Matcher<const Element&> > MatcherVec;
MatcherVec matchers;
matchers.reserve(::std::tr1::tuple_size<MatcherTuple>::value);
TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers
_,
::std::back_inserter(matchers));
return MakeMatcher(new ElementsAreMatcherImpl<Container>(
matchers.begin(), matchers.end()));
}
private:
const MatcherTuple matchers_;
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher);
};
// Implements UnorderedElementsAreArray().
template <typename T>
class UnorderedElementsAreArrayMatcher {
public:
UnorderedElementsAreArrayMatcher() {}
template <typename Iter>
UnorderedElementsAreArrayMatcher(Iter first, Iter last)
: matchers_(first, last) {}
const Matcher<const Element&>* const matchers = NULL; template <typename Container>
return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 0)); operator Matcher<Container>() const {
return MakeMatcher(
new UnorderedElementsAreMatcherImpl<Container>(matchers_.begin(),
matchers_.end()));
} }
private:
::std::vector<T> matchers_;
GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreArrayMatcher);
}; };
// Implements ElementsAreArray(). // Implements ElementsAreArray().
template <typename T> template <typename T>
class ElementsAreArrayMatcher { class ElementsAreArrayMatcher {
public: public:
ElementsAreArrayMatcher(const T* first, size_t count) : template <typename Iter>
first_(first), count_(count) {} ElementsAreArrayMatcher(Iter first, Iter last) : matchers_(first, last) {
}
template <typename Container> template <typename Container>
operator Matcher<Container>() const { operator Matcher<Container>() const {
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; return MakeMatcher(new ElementsAreMatcherImpl<Container>(
typedef typename internal::StlContainerView<RawContainer>::type::value_ matchers_.begin(), matchers_.end()));
type
Element;
return MakeMatcher(new ElementsAreMatcherImpl<Container>(first_, count_
));
} }
private: private:
const T* const first_; const ::std::vector<T> matchers_;
const size_t count_;
GTEST_DISALLOW_ASSIGN_(ElementsAreArrayMatcher); GTEST_DISALLOW_ASSIGN_(ElementsAreArrayMatcher);
}; };
// Returns the description for a matcher defined using the MATCHER*() // Returns the description for a matcher defined using the MATCHER*()
// macro where the user-supplied description string is "", if // macro where the user-supplied description string is "", if
// 'negation' is false; otherwise returns the description of the // 'negation' is false; otherwise returns the description of the
// negation of the matcher. 'param_values' contains a list of strings // negation of the matcher. 'param_values' contains a list of strings
// that are the print-out of the matcher's parameters. // that are the print-out of the matcher's parameters.
string FormatMatcherDescription(bool negation, const char* matcher_name, GTEST_API_ string FormatMatcherDescription(bool negation,
const Strings& param_values); const char* matcher_name,
const Strings& param_values);
} // namespace internal } // namespace internal
// Implements MatcherCast(). // ElementsAreArray(first, last)
template <typename T, typename M> // ElementsAreArray(pointer, count)
inline Matcher<T> MatcherCast(M matcher) { // ElementsAreArray(array)
return internal::MatcherCastImpl<T, M>::Cast(matcher); // ElementsAreArray(vector)
// ElementsAreArray({ e1, e2, ..., en })
//
// The ElementsAreArray() functions are like ElementsAre(...), except
// that they are given a homogeneous sequence rather than taking each
// element as a function argument. The sequence can be specified as an
// array, a pointer and count, a vector, an initializer list, or an
// STL iterator range. In each of these cases, the underlying sequence
// can be either a sequence of values or a sequence of matchers.
//
// All forms of ElementsAreArray() make a copy of the input matcher sequenc
e.
template <typename Iter>
inline internal::ElementsAreArrayMatcher<
typename ::std::iterator_traits<Iter>::value_type>
ElementsAreArray(Iter first, Iter last) {
typedef typename ::std::iterator_traits<Iter>::value_type T;
return internal::ElementsAreArrayMatcher<T>(first, last);
}
template <typename T>
inline internal::ElementsAreArrayMatcher<T> ElementsAreArray(
const T* pointer, size_t count) {
return ElementsAreArray(pointer, pointer + count);
}
template <typename T, size_t N>
inline internal::ElementsAreArrayMatcher<T> ElementsAreArray(
const T (&array)[N]) {
return ElementsAreArray(array, N);
}
template <typename T, typename A>
inline internal::ElementsAreArrayMatcher<T> ElementsAreArray(
const ::std::vector<T, A>& vec) {
return ElementsAreArray(vec.begin(), vec.end());
}
#if GTEST_LANG_CXX11
template <typename T>
inline internal::ElementsAreArrayMatcher<T>
ElementsAreArray(::std::initializer_list<T> xs) {
return ElementsAreArray(xs.begin(), xs.end());
}
#endif
// UnorderedElementsAreArray(first, last)
// UnorderedElementsAreArray(pointer, count)
// UnorderedElementsAreArray(array)
// UnorderedElementsAreArray(vector)
// UnorderedElementsAreArray({ e1, e2, ..., en })
//
// The UnorderedElementsAreArray() functions are like
// ElementsAreArray(...), but allow matching the elements in any order.
template <typename Iter>
inline internal::UnorderedElementsAreArrayMatcher<
typename ::std::iterator_traits<Iter>::value_type>
UnorderedElementsAreArray(Iter first, Iter last) {
typedef typename ::std::iterator_traits<Iter>::value_type T;
return internal::UnorderedElementsAreArrayMatcher<T>(first, last);
}
template <typename T>
inline internal::UnorderedElementsAreArrayMatcher<T>
UnorderedElementsAreArray(const T* pointer, size_t count) {
return UnorderedElementsAreArray(pointer, pointer + count);
}
template <typename T, size_t N>
inline internal::UnorderedElementsAreArrayMatcher<T>
UnorderedElementsAreArray(const T (&array)[N]) {
return UnorderedElementsAreArray(array, N);
}
template <typename T, typename A>
inline internal::UnorderedElementsAreArrayMatcher<T>
UnorderedElementsAreArray(const ::std::vector<T, A>& vec) {
return UnorderedElementsAreArray(vec.begin(), vec.end());
}
#if GTEST_LANG_CXX11
template <typename T>
inline internal::UnorderedElementsAreArrayMatcher<T>
UnorderedElementsAreArray(::std::initializer_list<T> xs) {
return UnorderedElementsAreArray(xs.begin(), xs.end());
} }
#endif
// _ is a matcher that matches anything of any type. // _ is a matcher that matches anything of any type.
// //
// This definition is fine as: // This definition is fine as:
// //
// 1. The C++ standard permits using the name _ in a namespace that // 1. The C++ standard permits using the name _ in a namespace that
// is not the global namespace or ::std. // is not the global namespace or ::std.
// 2. The AnythingMatcher class has no data member or constructor, // 2. The AnythingMatcher class has no data member or constructor,
// so it's OK to create global variables of this type. // so it's OK to create global variables of this type.
// 3. c-style has approved of using _ in this case. // 3. c-style has approved of using _ in this case.
skipping to change at line 2667 skipping to change at line 3508
inline internal::FloatingEqMatcher<double> DoubleEq(double rhs) { inline internal::FloatingEqMatcher<double> DoubleEq(double rhs) {
return internal::FloatingEqMatcher<double>(rhs, false); return internal::FloatingEqMatcher<double>(rhs, false);
} }
// Creates a matcher that matches any double argument approximately // Creates a matcher that matches any double argument approximately
// equal to rhs, including NaN values when rhs is NaN. // equal to rhs, including NaN values when rhs is NaN.
inline internal::FloatingEqMatcher<double> NanSensitiveDoubleEq(double rhs) { inline internal::FloatingEqMatcher<double> NanSensitiveDoubleEq(double rhs) {
return internal::FloatingEqMatcher<double>(rhs, true); return internal::FloatingEqMatcher<double>(rhs, true);
} }
// Creates a matcher that matches any double argument approximately equal t
o
// rhs, up to the specified max absolute error bound, where two NANs are
// considered unequal. The max absolute error bound must be non-negative.
inline internal::FloatingEqMatcher<double> DoubleNear(
double rhs, double max_abs_error) {
return internal::FloatingEqMatcher<double>(rhs, false, max_abs_error);
}
// Creates a matcher that matches any double argument approximately equal t
o
// rhs, up to the specified max absolute error bound, including NaN values
when
// rhs is NaN. The max absolute error bound must be non-negative.
inline internal::FloatingEqMatcher<double> NanSensitiveDoubleNear(
double rhs, double max_abs_error) {
return internal::FloatingEqMatcher<double>(rhs, true, max_abs_error);
}
// Creates a matcher that matches any float argument approximately // Creates a matcher that matches any float argument approximately
// equal to rhs, where two NANs are considered unequal. // equal to rhs, where two NANs are considered unequal.
inline internal::FloatingEqMatcher<float> FloatEq(float rhs) { inline internal::FloatingEqMatcher<float> FloatEq(float rhs) {
return internal::FloatingEqMatcher<float>(rhs, false); return internal::FloatingEqMatcher<float>(rhs, false);
} }
// Creates a matcher that matches any double argument approximately // Creates a matcher that matches any float argument approximately
// equal to rhs, including NaN values when rhs is NaN. // equal to rhs, including NaN values when rhs is NaN.
inline internal::FloatingEqMatcher<float> NanSensitiveFloatEq(float rhs) { inline internal::FloatingEqMatcher<float> NanSensitiveFloatEq(float rhs) {
return internal::FloatingEqMatcher<float>(rhs, true); return internal::FloatingEqMatcher<float>(rhs, true);
} }
// Creates a matcher that matches any float argument approximately equal to
// rhs, up to the specified max absolute error bound, where two NANs are
// considered unequal. The max absolute error bound must be non-negative.
inline internal::FloatingEqMatcher<float> FloatNear(
float rhs, float max_abs_error) {
return internal::FloatingEqMatcher<float>(rhs, false, max_abs_error);
}
// Creates a matcher that matches any float argument approximately equal to
// rhs, up to the specified max absolute error bound, including NaN values
when
// rhs is NaN. The max absolute error bound must be non-negative.
inline internal::FloatingEqMatcher<float> NanSensitiveFloatNear(
float rhs, float max_abs_error) {
return internal::FloatingEqMatcher<float>(rhs, true, max_abs_error);
}
// Creates a matcher that matches a pointer (raw or smart) that points // Creates a matcher that matches a pointer (raw or smart) that points
// to a value that matches inner_matcher. // to a value that matches inner_matcher.
template <typename InnerMatcher> template <typename InnerMatcher>
inline internal::PointeeMatcher<InnerMatcher> Pointee( inline internal::PointeeMatcher<InnerMatcher> Pointee(
const InnerMatcher& inner_matcher) { const InnerMatcher& inner_matcher) {
return internal::PointeeMatcher<InnerMatcher>(inner_matcher); return internal::PointeeMatcher<InnerMatcher>(inner_matcher);
} }
// Creates a matcher that matches an object whose given field matches // Creates a matcher that matches an object whose given field matches
// 'matcher'. For example, // 'matcher'. For example,
skipping to change at line 2917 skipping to change at line 3790
// Returns a matcher that matches anything that satisfies the given // Returns a matcher that matches anything that satisfies the given
// predicate. The predicate can be any unary function or functor // predicate. The predicate can be any unary function or functor
// whose return type can be implicitly converted to bool. // whose return type can be implicitly converted to bool.
template <typename Predicate> template <typename Predicate>
inline PolymorphicMatcher<internal::TrulyMatcher<Predicate> > inline PolymorphicMatcher<internal::TrulyMatcher<Predicate> >
Truly(Predicate pred) { Truly(Predicate pred) {
return MakePolymorphicMatcher(internal::TrulyMatcher<Predicate>(pred)); return MakePolymorphicMatcher(internal::TrulyMatcher<Predicate>(pred));
} }
// Returns a matcher that matches the container size. The container must
// support both size() and size_type which all STL-like containers provide.
// Note that the parameter 'size' can be a value of type size_type as well
as
// matcher. For instance:
// EXPECT_THAT(container, SizeIs(2)); // Checks container has 2 eleme
nts.
// EXPECT_THAT(container, SizeIs(Le(2)); // Checks container has at most
2.
template <typename SizeMatcher>
inline internal::SizeIsMatcher<SizeMatcher>
SizeIs(const SizeMatcher& size_matcher) {
return internal::SizeIsMatcher<SizeMatcher>(size_matcher);
}
// Returns a matcher that matches an equal container. // Returns a matcher that matches an equal container.
// This matcher behaves like Eq(), but in the event of mismatch lists the // This matcher behaves like Eq(), but in the event of mismatch lists the
// values that are included in one container but not the other. (Duplicate // values that are included in one container but not the other. (Duplicate
// values and order differences are not explained.) // values and order differences are not explained.)
template <typename Container> template <typename Container>
inline PolymorphicMatcher<internal::ContainerEqMatcher< // NOLINT inline PolymorphicMatcher<internal::ContainerEqMatcher< // NOLINT
GTEST_REMOVE_CONST_(Container)> > GTEST_REMOVE_CONST_(Container)> >
ContainerEq(const Container& rhs) { ContainerEq(const Container& rhs) {
// This following line is for working around a bug in MSVC 8.0, // This following line is for working around a bug in MSVC 8.0,
// which causes Container to be a const type sometimes. // which causes Container to be a const type sometimes.
typedef GTEST_REMOVE_CONST_(Container) RawContainer; typedef GTEST_REMOVE_CONST_(Container) RawContainer;
return MakePolymorphicMatcher( return MakePolymorphicMatcher(
internal::ContainerEqMatcher<RawContainer>(rhs)); internal::ContainerEqMatcher<RawContainer>(rhs));
} }
// Returns a matcher that matches a container that, when sorted using
// the given comparator, matches container_matcher.
template <typename Comparator, typename ContainerMatcher>
inline internal::WhenSortedByMatcher<Comparator, ContainerMatcher>
WhenSortedBy(const Comparator& comparator,
const ContainerMatcher& container_matcher) {
return internal::WhenSortedByMatcher<Comparator, ContainerMatcher>(
comparator, container_matcher);
}
// Returns a matcher that matches a container that, when sorted using
// the < operator, matches container_matcher.
template <typename ContainerMatcher>
inline internal::WhenSortedByMatcher<internal::LessComparator, ContainerMat
cher>
WhenSorted(const ContainerMatcher& container_matcher) {
return
internal::WhenSortedByMatcher<internal::LessComparator, ContainerMatc
her>(
internal::LessComparator(), container_matcher);
}
// Matches an STL-style container or a native array that contains the // Matches an STL-style container or a native array that contains the
// same number of elements as in rhs, where its i-th element and rhs's // same number of elements as in rhs, where its i-th element and rhs's
// i-th element (as a pair) satisfy the given pair matcher, for all i. // i-th element (as a pair) satisfy the given pair matcher, for all i.
// TupleMatcher must be able to be safely cast to Matcher<tuple<const // TupleMatcher must be able to be safely cast to Matcher<tuple<const
// T1&, const T2&> >, where T1 and T2 are the types of elements in the // T1&, const T2&> >, where T1 and T2 are the types of elements in the
// LHS container and the RHS container respectively. // LHS container and the RHS container respectively.
template <typename TupleMatcher, typename Container> template <typename TupleMatcher, typename Container>
inline internal::PointwiseMatcher<TupleMatcher, inline internal::PointwiseMatcher<TupleMatcher,
GTEST_REMOVE_CONST_(Container)> GTEST_REMOVE_CONST_(Container)>
Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) { Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) {
skipping to change at line 3045 skipping to change at line 3950
} }
// Matches the value against the given matcher and explains the match // Matches the value against the given matcher and explains the match
// result to listener. // result to listener.
template <typename T, typename M> template <typename T, typename M>
inline bool ExplainMatchResult( inline bool ExplainMatchResult(
M matcher, const T& value, MatchResultListener* listener) { M matcher, const T& value, MatchResultListener* listener) {
return SafeMatcherCast<const T&>(matcher).MatchAndExplain(value, listener ); return SafeMatcherCast<const T&>(matcher).MatchAndExplain(value, listener );
} }
#if GTEST_LANG_CXX11
// Define variadic matcher versions. They are overloaded in
// gmock-generated-matchers.h for the cases supported by pre C++11 compiler
s.
template <typename... Args>
inline internal::AllOfMatcher<Args...> AllOf(const Args&... matchers) {
return internal::AllOfMatcher<Args...>(matchers...);
}
template <typename... Args>
inline internal::AnyOfMatcher<Args...> AnyOf(const Args&... matchers) {
return internal::AnyOfMatcher<Args...>(matchers...);
}
#endif // GTEST_LANG_CXX11
// AllArgs(m) is a synonym of m. This is useful in // AllArgs(m) is a synonym of m. This is useful in
// //
// EXPECT_CALL(foo, Bar(_, _)).With(AllArgs(Eq())); // EXPECT_CALL(foo, Bar(_, _)).With(AllArgs(Eq()));
// //
// which is easier to read than // which is easier to read than
// //
// EXPECT_CALL(foo, Bar(_, _)).With(Eq()); // EXPECT_CALL(foo, Bar(_, _)).With(Eq());
template <typename InnerMatcher> template <typename InnerMatcher>
inline InnerMatcher AllArgs(const InnerMatcher& matcher) { return matcher; } inline InnerMatcher AllArgs(const InnerMatcher& matcher) { return matcher; }
 End of changes. 93 change blocks. 
217 lines changed or deleted 1179 lines changed or added


 gmock-port.h   gmock-port.h 
skipping to change at line 64 skipping to change at line 64
// required to compile Google Mock. // required to compile Google Mock.
#if defined(_MSC_VER) && _MSC_VER < 1310 #if defined(_MSC_VER) && _MSC_VER < 1310
# error "At least Visual C++ 2003 (7.1) is required to compile Google Mock. " # error "At least Visual C++ 2003 (7.1) is required to compile Google Mock. "
#endif #endif
// Macro for referencing flags. This is public as we want the user to // Macro for referencing flags. This is public as we want the user to
// use this syntax to reference Google Mock flags. // use this syntax to reference Google Mock flags.
#define GMOCK_FLAG(name) FLAGS_gmock_##name #define GMOCK_FLAG(name) FLAGS_gmock_##name
// Macros for declaring flags. // Macros for declaring flags.
#define GMOCK_DECLARE_bool_(name) extern bool GMOCK_FLAG(name) #define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name)
#define GMOCK_DECLARE_int32_(name) \ #define GMOCK_DECLARE_int32_(name) \
extern ::testing::internal::Int32 GMOCK_FLAG(name) extern GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name)
#define GMOCK_DECLARE_string_(name) \ #define GMOCK_DECLARE_string_(name) \
extern ::testing::internal::String GMOCK_FLAG(name) extern GTEST_API_ ::std::string GMOCK_FLAG(name)
// Macros for defining flags. // Macros for defining flags.
#define GMOCK_DEFINE_bool_(name, default_val, doc) \ #define GMOCK_DEFINE_bool_(name, default_val, doc) \
bool GMOCK_FLAG(name) = (default_val) GTEST_API_ bool GMOCK_FLAG(name) = (default_val)
#define GMOCK_DEFINE_int32_(name, default_val, doc) \ #define GMOCK_DEFINE_int32_(name, default_val, doc) \
::testing::internal::Int32 GMOCK_FLAG(name) = (default_val) GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) = (default_val)
#define GMOCK_DEFINE_string_(name, default_val, doc) \ #define GMOCK_DEFINE_string_(name, default_val, doc) \
::testing::internal::String GMOCK_FLAG(name) = (default_val) GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val)
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 lines changed or added


 gmock-spec-builders.h   gmock-spec-builders.h 
skipping to change at line 69 skipping to change at line 69
#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_
#include <map> #include <map>
#include <set> #include <set>
#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"
#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"
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace testing { namespace testing {
// An abstract handle of an expectation. // An abstract handle of an expectation.
skipping to change at line 114 skipping to change at line 118
// mockers, and all expectations. // mockers, and all expectations.
// //
// The reason we don't use more fine-grained protection is: when a // The reason we don't use more fine-grained protection is: when a
// mock function Foo() is called, it needs to consult its expectations // mock function Foo() is called, it needs to consult its expectations
// to see which one should be picked. If another thread is allowed to // to see which one should be picked. If another thread is allowed to
// call a mock function (either Foo() or a different one) at the same // call a mock function (either Foo() or a different one) at the same
// time, it could affect the "retired" attributes of Foo()'s // time, it could affect the "retired" attributes of Foo()'s
// expectations when InSequence() is used, and thus affect which // expectations when InSequence() is used, and thus affect which
// expectation gets picked. Therefore, we sequence all mock function // expectation gets picked. Therefore, we sequence all mock function
// calls to ensure the integrity of the mock objects' states. // calls to ensure the integrity of the mock objects' states.
GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex); GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex);
// Untyped base class for ActionResultHolder<R>. // Untyped base class for ActionResultHolder<R>.
class UntypedActionResultHolderBase; class UntypedActionResultHolderBase;
// Abstract base class of FunctionMockerBase. This is the // Abstract base class of FunctionMockerBase. This is the
// type-agnostic part of the function mocker interface. Its pure // type-agnostic part of the function mocker interface. Its pure
// virtual methods are implemented by FunctionMockerBase. // virtual methods are implemented by FunctionMockerBase.
class UntypedFunctionMockerBase { class GTEST_API_ UntypedFunctionMockerBase {
public: public:
UntypedFunctionMockerBase(); UntypedFunctionMockerBase();
virtual ~UntypedFunctionMockerBase(); virtual ~UntypedFunctionMockerBase();
// Verifies that all expectations on this mock function have been // Verifies that all expectations on this mock function have been
// satisfied. Reports one or more Google Test non-fatal failures // satisfied. Reports one or more Google Test non-fatal failures
// and returns false if not. // and returns false if not.
// L >= g_gmock_mutex bool VerifyAndClearExpectationsLocked()
bool VerifyAndClearExpectationsLocked(); GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
// Clears the ON_CALL()s set on this mock function. // Clears the ON_CALL()s set on this mock function.
// L >= g_gmock_mutex virtual void ClearDefaultActionsLocked()
virtual void ClearDefaultActionsLocked() = 0; GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) = 0;
// In all of the following Untyped* functions, it's the caller's // In all of the following Untyped* functions, it's the caller's
// responsibility to guarantee the correctness of the arguments' // responsibility to guarantee the correctness of the arguments'
// types. // types.
// Performs the default action with the given arguments and returns // Performs the default action with the given arguments and returns
// the action's result. The call description string will be used in // the action's result. The call description string will be used in
// the error message to describe the call in the case the default // the error message to describe the call in the case the default
// action fails. // action fails.
// L = * // L = *
skipping to change at line 160 skipping to change at line 164
// 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,
const 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
// ostream. // ostream.
// L < g_gmock_mutex virtual void UntypedDescribeUninterestingCall(
virtual void UntypedDescribeUninterestingCall(const void* untyped_args, const void* untyped_args,
::std::ostream* os) const = ::std::ostream* os) const
0; GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0;
// Returns the expectation that matches the given function arguments // Returns the expectation that matches the given function arguments
// (or NULL is there's no match); when a match is found, // (or NULL is there's no match); when a match is found,
// untyped_action is set to point to the action that should be // untyped_action is set to point to the action that should be
// performed (or NULL if the action is "do default"), and // performed (or NULL if the action is "do default"), and
// is_excessive is modified to indicate whether the call exceeds the // is_excessive is modified to indicate whether the call exceeds the
// expected number. // expected number.
// L < g_gmock_mutex
virtual const ExpectationBase* UntypedFindMatchingExpectation( virtual const ExpectationBase* UntypedFindMatchingExpectation(
const void* untyped_args, const void* untyped_args,
const void** untyped_action, bool* is_excessive, const void** untyped_action, bool* is_excessive,
::std::ostream* what, ::std::ostream* why) = 0; ::std::ostream* what, ::std::ostream* why)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0;
// Prints the given function arguments to the ostream. // Prints the given function arguments to the ostream.
virtual void UntypedPrintArgs(const void* untyped_args, virtual void UntypedPrintArgs(const void* untyped_args,
::std::ostream* os) const = 0; ::std::ostream* os) const = 0;
// Sets the mock object this mock method belongs to, and registers // Sets the mock object this mock method belongs to, and registers
// 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(). // TODO(wan@google.com): rename to SetAndRegisterOwner().
// L < g_gmock_mutex void RegisterOwner(const void* mock_obj)
void RegisterOwner(const void* mock_obj); GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
// Sets the mock object this mock method belongs to, and sets the // Sets the mock object this mock method belongs to, and sets the
// name of the mock function. Will be called upon each invocation // name of the mock function. Will be called upon each invocation
// of this mock function. // of this mock function.
// L < g_gmock_mutex void SetOwnerAndName(const void* mock_obj, const char* name)
void SetOwnerAndName(const void* mock_obj, const char* name); GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
// Returns the mock object this mock method belongs to. Must be // Returns the mock object this mock method belongs to. Must be
// called after RegisterOwner() or SetOwnerAndName() has been // called after RegisterOwner() or SetOwnerAndName() has been
// called. // called.
// L < g_gmock_mutex const void* MockObject() const
const void* MockObject() const; GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
// Returns the name of this mock method. Must be called after // Returns the name of this mock method. Must be called after
// SetOwnerAndName() has been called. // SetOwnerAndName() has been called.
// L < g_gmock_mutex const char* Name() const
const char* Name() const; GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
// 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. The caller is responsible for deleting the // threads concurrently. The caller is responsible for deleting the
// result. // result.
// L < g_gmock_mutex
const UntypedActionResultHolderBase* UntypedInvokeWith( const UntypedActionResultHolderBase* UntypedInvokeWith(
const void* untyped_args); const void* untyped_args)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
protected: protected:
typedef std::vector<const void*> UntypedOnCallSpecs; typedef std::vector<const void*> UntypedOnCallSpecs;
typedef std::vector<internal::linked_ptr<ExpectationBase> > typedef std::vector<internal::linked_ptr<ExpectationBase> >
UntypedExpectations; UntypedExpectations;
// Returns an Expectation object that references and co-owns exp, // Returns an Expectation object that references and co-owns exp,
// which must be an expectation on this mock function. // which must be an expectation on this mock function.
Expectation GetHandleOf(ExpectationBase* exp); Expectation GetHandleOf(ExpectationBase* exp);
skipping to change at line 355 skipping to change at line 360
// source file that contains the statement => file_ // source file that contains the statement => file_
// line number of the statement => line_ // line number of the statement => line_
// matchers => matchers_ // matchers => matchers_
// multi-argument-matcher => extra_matcher_ // multi-argument-matcher => extra_matcher_
// action => action_ // action => action_
ArgumentMatcherTuple matchers_; ArgumentMatcherTuple matchers_;
Matcher<const ArgumentTuple&> extra_matcher_; Matcher<const ArgumentTuple&> extra_matcher_;
Action<F> action_; Action<F> action_;
}; // class OnCallSpec }; // class OnCallSpec
// Possible reactions on uninteresting calls. TODO(wan@google.com): // Possible reactions on uninteresting calls.
// rename the enum values to the kFoo style.
enum CallReaction { enum CallReaction {
ALLOW, kAllow,
WARN, kWarn,
FAIL kFail,
kDefault = kWarn // By default, warn about uninteresting calls.
}; };
} // namespace internal } // namespace internal
// Utilities for manipulating mock objects. // Utilities for manipulating mock objects.
class Mock { class GTEST_API_ Mock {
public: public:
// The following public methods can be called concurrently. // The following public methods can be called concurrently.
// Tells Google Mock to ignore mock_obj when checking for leaked // Tells Google Mock to ignore mock_obj when checking for leaked
// mock objects. // mock objects.
static void AllowLeak(const void* mock_obj); static void AllowLeak(const void* mock_obj)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Verifies and clears all expectations on the given mock object. // Verifies and clears all expectations on the given mock object.
// If the expectations aren't satisfied, generates one or more // If the expectations aren't satisfied, generates one or more
// Google Test non-fatal failures and returns false. // Google Test non-fatal failures and returns false.
static bool VerifyAndClearExpectations(void* mock_obj); static bool VerifyAndClearExpectations(void* mock_obj)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Verifies all expectations on the given mock object and clears its // Verifies all expectations on the given mock object and clears its
// default actions and expectations. Returns true iff the // default actions and expectations. Returns true iff the
// verification was successful. // verification was successful.
static bool VerifyAndClear(void* mock_obj); static bool VerifyAndClear(void* mock_obj)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
private: private:
friend class internal::UntypedFunctionMockerBase; friend class internal::UntypedFunctionMockerBase;
// Needed for a function mocker to register itself (so that we know // Needed for a function mocker to register itself (so that we know
// how to clear a mock object). // how to clear a mock object).
template <typename F> template <typename F>
friend class internal::FunctionMockerBase; friend class internal::FunctionMockerBase;
template <typename M> template <typename M>
friend class NiceMock; friend class NiceMock;
template <typename M> template <typename M>
friend class NaggyMock;
template <typename M>
friend class StrictMock; friend class StrictMock;
// Tells Google Mock to allow uninteresting calls on the given mock // Tells Google Mock to allow uninteresting calls on the given mock
// object. // object.
// L < g_gmock_mutex static void AllowUninterestingCalls(const void* mock_obj)
static void AllowUninterestingCalls(const void* mock_obj); GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Tells Google Mock to warn the user about uninteresting calls on // Tells Google Mock to warn the user about uninteresting calls on
// the given mock object. // the given mock object.
// L < g_gmock_mutex static void WarnUninterestingCalls(const void* mock_obj)
static void WarnUninterestingCalls(const void* mock_obj); GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Tells Google Mock to fail uninteresting calls on the given mock // Tells Google Mock to fail uninteresting calls on the given mock
// object. // object.
// L < g_gmock_mutex static void FailUninterestingCalls(const void* mock_obj)
static void FailUninterestingCalls(const void* mock_obj); GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Tells Google Mock the given mock object is being destroyed and // Tells Google Mock the given mock object is being destroyed and
// its entry in the call-reaction table should be removed. // its entry in the call-reaction table should be removed.
// L < g_gmock_mutex static void UnregisterCallReaction(const void* mock_obj)
static void UnregisterCallReaction(const void* mock_obj); GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Returns the reaction Google Mock will have on uninteresting calls // Returns the reaction Google Mock will have on uninteresting calls
// made on the given mock object. // made on the given mock object.
// L < g_gmock_mutex
static internal::CallReaction GetReactionOnUninterestingCalls( static internal::CallReaction GetReactionOnUninterestingCalls(
const void* mock_obj); const void* mock_obj)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Verifies that all expectations on the given mock object have been // Verifies that all expectations on the given mock object have been
// satisfied. Reports one or more Google Test non-fatal failures // satisfied. Reports one or more Google Test non-fatal failures
// and returns false if not. // and returns false if not.
// L >= g_gmock_mutex static bool VerifyAndClearExpectationsLocked(void* mock_obj)
static bool VerifyAndClearExpectationsLocked(void* mock_obj); GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
// Clears all ON_CALL()s set on the given mock object. // Clears all ON_CALL()s set on the given mock object.
// L >= g_gmock_mutex static void ClearDefaultActionsLocked(void* mock_obj)
static void ClearDefaultActionsLocked(void* mock_obj); GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
// Registers a mock object and a mock method it owns. // Registers a mock object and a mock method it owns.
// L < g_gmock_mutex static void Register(
static void Register(const void* mock_obj, const void* mock_obj,
internal::UntypedFunctionMockerBase* mocker); internal::UntypedFunctionMockerBase* mocker)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Tells Google Mock where in the source code mock_obj is used in an // Tells Google Mock where in the source code mock_obj is used in an
// ON_CALL or EXPECT_CALL. In case mock_obj is leaked, this // ON_CALL or EXPECT_CALL. In case mock_obj is leaked, this
// information helps the user identify which object it is. // information helps the user identify which object it is.
// L < g_gmock_mutex
static void RegisterUseByOnCallOrExpectCall( static void RegisterUseByOnCallOrExpectCall(
const void* mock_obj, const char* file, int line); const void* mock_obj, const char* file, int line)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Unregisters a mock method; removes the owning mock object from // Unregisters a mock method; removes the owning mock object from
// the registry when the last mock method associated with it has // the registry when the last mock method associated with it has
// been unregistered. This is called only in the destructor of // been unregistered. This is called only in the destructor of
// FunctionMockerBase. // FunctionMockerBase.
// L >= g_gmock_mutex static void UnregisterLocked(internal::UntypedFunctionMockerBase* mocker)
static void UnregisterLocked(internal::UntypedFunctionMockerBase* mocker) GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
;
}; // class Mock }; // class Mock
// An abstract handle of an expectation. Useful in the .After() // An abstract handle of an expectation. Useful in the .After()
// clause of EXPECT_CALL() for setting the (partial) order of // clause of EXPECT_CALL() for setting the (partial) order of
// expectations. The syntax: // expectations. The syntax:
// //
// Expectation e1 = EXPECT_CALL(...)...; // Expectation e1 = EXPECT_CALL(...)...;
// EXPECT_CALL(...).After(e1)...; // EXPECT_CALL(...).After(e1)...;
// //
// sets two expectations where the latter can only be matched after // sets two expectations where the latter can only be matched after
skipping to change at line 474 skipping to change at line 487
// - This class is copyable and has value semantics. // - This class is copyable and has value semantics.
// - Constness is shallow: a const Expectation object itself cannot // - Constness is shallow: a const Expectation object itself cannot
// be modified, but the mutable methods of the ExpectationBase // be modified, but the mutable methods of the ExpectationBase
// object it references can be called via expectation_base(). // object it references can be called via expectation_base().
// - The constructors and destructor are defined out-of-line because // - The constructors and destructor are defined out-of-line because
// the Symbian WINSCW compiler wants to otherwise instantiate them // the Symbian WINSCW compiler wants to otherwise instantiate them
// when it sees this class definition, at which point it doesn't have // when it sees this class definition, at which point it doesn't have
// ExpectationBase available yet, leading to incorrect destruction // ExpectationBase available yet, leading to incorrect destruction
// in the linked_ptr (or compilation errors if using a checking // in the linked_ptr (or compilation errors if using a checking
// linked_ptr). // linked_ptr).
class Expectation { class GTEST_API_ Expectation {
public: public:
// Constructs a null object that doesn't reference any expectation. // Constructs a null object that doesn't reference any expectation.
Expectation(); Expectation();
~Expectation(); ~Expectation();
// This single-argument ctor must not be explicit, in order to support th e // This single-argument ctor must not be explicit, in order to support th e
// Expectation e = EXPECT_CALL(...); // Expectation e = EXPECT_CALL(...);
// syntax. // syntax.
// //
skipping to change at line 605 skipping to change at line 618
const_iterator begin() const { return expectations_.begin(); } const_iterator begin() const { return expectations_.begin(); }
const_iterator end() const { return expectations_.end(); } const_iterator end() const { return expectations_.end(); }
private: private:
Expectation::Set expectations_; Expectation::Set expectations_;
}; };
// Sequence objects are used by a user to specify the relative order // Sequence objects are used by a user to specify the relative order
// in which the expectations should match. They are copyable (we rely // in which the expectations should match. They are copyable (we rely
// on the compiler-defined copy constructor and assignment operator). // on the compiler-defined copy constructor and assignment operator).
class Sequence { class GTEST_API_ Sequence {
public: public:
// Constructs an empty sequence. // Constructs an empty sequence.
Sequence() : last_expectation_(new Expectation) {} Sequence() : last_expectation_(new Expectation) {}
// Adds an expectation to this sequence. The caller must ensure // Adds an expectation to this sequence. The caller must ensure
// that no other thread is accessing this Sequence object. // that no other thread is accessing this Sequence object.
void AddExpectation(const Expectation& expectation) const; void AddExpectation(const Expectation& expectation) const;
private: private:
// The last expectation in this sequence. We use a linked_ptr here // The last expectation in this sequence. We use a linked_ptr here
skipping to change at line 646 skipping to change at line 659
// ... // ...
// EXPECT_CALL(b, Xyz())...; // EXPECT_CALL(b, Xyz())...;
// } // }
// //
// You can create InSequence objects in multiple threads, as long as // You can create InSequence objects in multiple threads, as long as
// they are used to affect different mock objects. The idea is that // they are used to affect different mock objects. The idea is that
// each thread can create and set up its own mocks as if it's the only // each thread can create and set up its own mocks as if it's the only
// thread. However, for clarity of your tests we recommend you to set // thread. However, for clarity of your tests we recommend you to set
// up mocks in the main thread unless you have a good reason not to do // up mocks in the main thread unless you have a good reason not to do
// so. // so.
class InSequence { class GTEST_API_ InSequence {
public: public:
InSequence(); InSequence();
~InSequence(); ~InSequence();
private: private:
bool sequence_created_; bool sequence_created_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(InSequence); // NOLINT GTEST_DISALLOW_COPY_AND_ASSIGN_(InSequence); // NOLINT
} GTEST_ATTRIBUTE_UNUSED_; } GTEST_ATTRIBUTE_UNUSED_;
namespace internal { namespace internal {
// Points to the implicit sequence introduced by a living InSequence // Points to the implicit sequence introduced by a living InSequence
// object (if any) in the current thread or NULL. // object (if any) in the current thread or NULL.
extern ThreadLocal<Sequence*> g_gmock_implicit_sequence; GTEST_API_ extern ThreadLocal<Sequence*> g_gmock_implicit_sequence;
// Base class for implementing expectations. // Base class for implementing expectations.
// //
// There are two reasons for having a type-agnostic base class for // There are two reasons for having a type-agnostic base class for
// Expectation: // Expectation:
// //
// 1. We need to store collections of expectations of different // 1. We need to store collections of expectations of different
// types (e.g. all pre-requisites of a particular expectation, all // types (e.g. all pre-requisites of a particular expectation, all
// expectations in a sequence). Therefore these expectation objects // expectations in a sequence). Therefore these expectation objects
// must share a common base class. // must share a common base class.
// //
// 2. We can avoid binary code bloat by moving methods not depending // 2. We can avoid binary code bloat by moving methods not depending
// on the template argument of Expectation to the base class. // on the template argument of Expectation to the base class.
// //
// This class is internal and mustn't be used by user code directly. // This class is internal and mustn't be used by user code directly.
class ExpectationBase { class GTEST_API_ ExpectationBase {
public: public:
// source_text is the EXPECT_CALL(...) source that created this Expectati on. // source_text is the EXPECT_CALL(...) source that created this Expectati on.
ExpectationBase(const char* file, int line, const string& source_text); ExpectationBase(const char* file, int line, const string& source_text);
virtual ~ExpectationBase(); virtual ~ExpectationBase();
// Where in the source file was the expectation spec defined? // Where in the source file was the expectation spec defined?
const char* file() const { return file_; } const char* file() const { return file_; }
int line() const { return line_; } int line() const { return line_; }
const char* source_text() const { return source_text_.c_str(); } const char* source_text() const { return source_text_.c_str(); }
// Returns the cardinality specified in the expectation spec. // Returns the cardinality specified in the expectation spec.
const Cardinality& cardinality() const { return cardinality_; } const Cardinality& cardinality() const { return cardinality_; }
// Describes the source file location of this expectation. // Describes the source file location of this expectation.
void DescribeLocationTo(::std::ostream* os) const { void DescribeLocationTo(::std::ostream* os) const {
*os << FormatFileLocation(file(), line()) << " "; *os << FormatFileLocation(file(), line()) << " ";
} }
// Describes how many times a function call matching this // Describes how many times a function call matching this
// expectation has occurred. // expectation has occurred.
// L >= g_gmock_mutex void DescribeCallCountTo(::std::ostream* os) const
void DescribeCallCountTo(::std::ostream* os) const; GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
// If this mock method has an extra matcher (i.e. .With(matcher)), // If this mock method has an extra matcher (i.e. .With(matcher)),
// describes it to the ostream. // describes it to the ostream.
virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) = 0; virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) = 0;
protected: protected:
friend class ::testing::Expectation; friend class ::testing::Expectation;
friend class UntypedFunctionMockerBase; friend class UntypedFunctionMockerBase;
enum Clause { enum Clause {
skipping to change at line 754 skipping to change at line 767
// Sets the cardinality of this expectation spec. // Sets the cardinality of this expectation spec.
void set_cardinality(const Cardinality& a_cardinality) { void set_cardinality(const Cardinality& a_cardinality) {
cardinality_ = a_cardinality; cardinality_ = a_cardinality;
} }
// The following group of methods should only be called after the // The following group of methods should only be called after the
// EXPECT_CALL() statement, and only when g_gmock_mutex is held by // EXPECT_CALL() statement, and only when g_gmock_mutex is held by
// the current thread. // the current thread.
// Retires all pre-requisites of this expectation. // Retires all pre-requisites of this expectation.
// L >= g_gmock_mutex void RetireAllPreRequisites()
void RetireAllPreRequisites(); GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
// Returns true iff this expectation is retired. // Returns true iff this expectation is retired.
// L >= g_gmock_mutex bool is_retired() const
bool is_retired() const { GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
return retired_; return retired_;
} }
// Retires this expectation. // Retires this expectation.
// L >= g_gmock_mutex void Retire()
void Retire() { GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
retired_ = true; retired_ = true;
} }
// Returns true iff this expectation is satisfied. // Returns true iff this expectation is satisfied.
// L >= g_gmock_mutex bool IsSatisfied() const
bool IsSatisfied() const { GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
return cardinality().IsSatisfiedByCallCount(call_count_); return cardinality().IsSatisfiedByCallCount(call_count_);
} }
// Returns true iff this expectation is saturated. // Returns true iff this expectation is saturated.
// L >= g_gmock_mutex bool IsSaturated() const
bool IsSaturated() const { GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
return cardinality().IsSaturatedByCallCount(call_count_); return cardinality().IsSaturatedByCallCount(call_count_);
} }
// Returns true iff this expectation is over-saturated. // Returns true iff this expectation is over-saturated.
// L >= g_gmock_mutex bool IsOverSaturated() const
bool IsOverSaturated() const { GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
return cardinality().IsOverSaturatedByCallCount(call_count_); return cardinality().IsOverSaturatedByCallCount(call_count_);
} }
// Returns true iff all pre-requisites of this expectation are satisfied. // Returns true iff all pre-requisites of this expectation are satisfied.
// L >= g_gmock_mutex bool AllPrerequisitesAreSatisfied() const
bool AllPrerequisitesAreSatisfied() const; GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
// Adds unsatisfied pre-requisites of this expectation to 'result'. // Adds unsatisfied pre-requisites of this expectation to 'result'.
// L >= g_gmock_mutex void FindUnsatisfiedPrerequisites(ExpectationSet* result) const
void FindUnsatisfiedPrerequisites(ExpectationSet* result) const; GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
// Returns the number this expectation has been invoked. // Returns the number this expectation has been invoked.
// L >= g_gmock_mutex int call_count() const
int call_count() const { GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
return call_count_; return call_count_;
} }
// Increments the number this expectation has been invoked. // Increments the number this expectation has been invoked.
// L >= g_gmock_mutex void IncrementCallCount()
void IncrementCallCount() { GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
call_count_++; call_count_++;
} }
// Checks the action count (i.e. the number of WillOnce() and // Checks the action count (i.e. the number of WillOnce() and
// WillRepeatedly() clauses) against the cardinality if this hasn't // WillRepeatedly() clauses) against the cardinality if this hasn't
// been done before. Prints a warning if there are too many or too // been done before. Prints a warning if there are too many or too
// few actions. // few actions.
// L < mutex_ void CheckActionCountIfNotDone() const
void CheckActionCountIfNotDone() const; GTEST_LOCK_EXCLUDED_(mutex_);
friend class ::testing::Sequence; friend class ::testing::Sequence;
friend class ::testing::internal::ExpectationTester; friend class ::testing::internal::ExpectationTester;
template <typename Function> template <typename Function>
friend class TypedExpectation; friend class TypedExpectation;
// Implements the .Times() clause. // Implements the .Times() clause.
void UntypedTimes(const Cardinality& a_cardinality); void UntypedTimes(const Cardinality& a_cardinality);
skipping to change at line 1071 skipping to change at line 1084
// expectation. // expectation.
virtual Expectation GetHandle() { virtual Expectation GetHandle() {
return owner_->GetHandleOf(this); return owner_->GetHandleOf(this);
} }
// The following methods will be called only after the EXPECT_CALL() // The following methods will be called only after the EXPECT_CALL()
// statement finishes and when the current thread holds // statement finishes and when the current thread holds
// g_gmock_mutex. // g_gmock_mutex.
// Returns true iff this expectation matches the given arguments. // Returns true iff this expectation matches the given arguments.
// L >= g_gmock_mutex bool Matches(const ArgumentTuple& args) const
bool Matches(const ArgumentTuple& args) const { GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
return TupleMatches(matchers_, args) && extra_matcher_.Matches(args); return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
} }
// Returns true iff this expectation should handle the given arguments. // Returns true iff this expectation should handle the given arguments.
// L >= g_gmock_mutex bool ShouldHandleArguments(const ArgumentTuple& args) const
bool ShouldHandleArguments(const ArgumentTuple& args) const { GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
// In case the action count wasn't checked when the expectation // In case the action count wasn't checked when the expectation
// was defined (e.g. if this expectation has no WillRepeatedly() // was defined (e.g. if this expectation has no WillRepeatedly()
// or RetiresOnSaturation() clause), we check it when the // or RetiresOnSaturation() clause), we check it when the
// expectation is used for the first time. // expectation is used for the first time.
CheckActionCountIfNotDone(); CheckActionCountIfNotDone();
return !is_retired() && AllPrerequisitesAreSatisfied() && Matches(args) ; return !is_retired() && AllPrerequisitesAreSatisfied() && Matches(args) ;
} }
// Describes the result of matching the arguments against this // Describes the result of matching the arguments against this
// expectation to the given ostream. // expectation to the given ostream.
// L >= g_gmock_mutex void ExplainMatchResultTo(
void ExplainMatchResultTo(const ArgumentTuple& args, const ArgumentTuple& args,
::std::ostream* os) const { ::std::ostream* os) const
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
if (is_retired()) { if (is_retired()) {
*os << " Expected: the expectation is active\n" *os << " Expected: the expectation is active\n"
<< " Actual: it is retired\n"; << " Actual: it is retired\n";
} else if (!Matches(args)) { } else if (!Matches(args)) {
if (!TupleMatches(matchers_, args)) { if (!TupleMatches(matchers_, args)) {
ExplainMatchFailureTupleTo(matchers_, args, os); ExplainMatchFailureTupleTo(matchers_, args, os);
} }
StringMatchResultListener listener; StringMatchResultListener listener;
skipping to change at line 1136 skipping to change at line 1150
} else { } else {
// This line is here just for completeness' sake. It will never // This line is here just for completeness' sake. It will never
// be executed as currently the ExplainMatchResultTo() function // be executed as currently the ExplainMatchResultTo() function
// is called only when the mock function call does NOT match the // is called only when the mock function call does NOT match the
// expectation. // expectation.
*os << "The call matches the expectation.\n"; *os << "The call matches the expectation.\n";
} }
} }
// Returns the action that should be taken for the current invocation. // Returns the action that should be taken for the current invocation.
// L >= g_gmock_mutex const Action<F>& GetCurrentAction(
const Action<F>& GetCurrentAction(const FunctionMockerBase<F>* mocker, const FunctionMockerBase<F>* mocker,
const ArgumentTuple& args) const { const ArgumentTuple& args) const
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
const int count = call_count(); const int count = call_count();
Assert(count >= 1, __FILE__, __LINE__, Assert(count >= 1, __FILE__, __LINE__,
"call_count() is <= 0 when GetCurrentAction() is " "call_count() is <= 0 when GetCurrentAction() is "
"called - this should never happen."); "called - this should never happen.");
const int action_count = static_cast<int>(untyped_actions_.size()); const int action_count = static_cast<int>(untyped_actions_.size());
if (action_count > 0 && !repeated_action_specified_ && if (action_count > 0 && !repeated_action_specified_ &&
count > action_count) { count > action_count) {
// If there is at least one WillOnce() and no WillRepeatedly(), // If there is at least one WillOnce() and no WillRepeatedly(),
// we warn the user when the WillOnce() clauses ran out. // we warn the user when the WillOnce() clauses ran out.
::std::stringstream ss; ::std::stringstream ss;
DescribeLocationTo(&ss); DescribeLocationTo(&ss);
ss << "Actions ran out in " << source_text() << "...\n" ss << "Actions ran out in " << source_text() << "...\n"
<< "Called " << count << " times, but only " << "Called " << count << " times, but only "
<< action_count << " WillOnce()" << action_count << " WillOnce()"
<< (action_count == 1 ? " is" : "s are") << " specified - "; << (action_count == 1 ? " is" : "s are") << " specified - ";
mocker->DescribeDefaultActionTo(args, &ss); mocker->DescribeDefaultActionTo(args, &ss);
Log(WARNING, ss.str(), 1); Log(kWarning, ss.str(), 1);
} }
return count <= action_count ? return count <= action_count ?
*static_cast<const Action<F>*>(untyped_actions_[count - 1]) : *static_cast<const Action<F>*>(untyped_actions_[count - 1]) :
repeated_action(); repeated_action();
} }
// Given the arguments of a mock function call, if the call will // Given the arguments of a mock function call, if the call will
// over-saturate this expectation, returns the default action; // over-saturate this expectation, returns the default action;
// otherwise, returns the next action in this expectation. Also // otherwise, returns the next action in this expectation. Also
// describes *what* happened to 'what', and explains *why* Google // describes *what* happened to 'what', and explains *why* Google
// Mock does it to 'why'. This method is not const as it calls // Mock does it to 'why'. This method is not const as it calls
// IncrementCallCount(). A return value of NULL means the default // IncrementCallCount(). A return value of NULL means the default
// action. // action.
// L >= g_gmock_mutex const Action<F>* GetActionForArguments(
const Action<F>* GetActionForArguments(const FunctionMockerBase<F>* mocke const FunctionMockerBase<F>* mocker,
r, const ArgumentTuple& args,
const ArgumentTuple& args, ::std::ostream* what,
::std::ostream* what, ::std::ostream* why)
::std::ostream* why) { GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
if (IsSaturated()) { if (IsSaturated()) {
// We have an excessive call. // We have an excessive call.
IncrementCallCount(); IncrementCallCount();
*what << "Mock function called more times than expected - "; *what << "Mock function called more times than expected - ";
mocker->DescribeDefaultActionTo(args, what); mocker->DescribeDefaultActionTo(args, what);
DescribeCallCountTo(why); DescribeCallCountTo(why);
// TODO(wan@google.com): allow the user to control whether // TODO(wan@google.com): allow the user to control whether
// unexpected calls should fail immediately or continue using a // unexpected calls should fail immediately or continue using a
skipping to change at line 1224 skipping to change at line 1240
// specifying the default behavior of, or expectation on, a mock // specifying the default behavior of, or expectation on, a mock
// function. // function.
// Note: class MockSpec really belongs to the ::testing namespace. // Note: class MockSpec really belongs to the ::testing namespace.
// However if we define it in ::testing, MSVC will complain when // However if we define it in ::testing, MSVC will complain when
// classes in ::testing::internal declare it as a friend class // classes in ::testing::internal declare it as a friend class
// template. To workaround this compiler bug, we define MockSpec in // template. To workaround this compiler bug, we define MockSpec in
// ::testing::internal and import it into ::testing. // ::testing::internal and import it into ::testing.
// Logs a message including file and line number information. // Logs a message including file and line number information.
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 string& message);
template <typename F> template <typename F>
class MockSpec { class MockSpec {
public: public:
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
typedef typename internal::Function<F>::ArgumentMatcherTuple typedef typename internal::Function<F>::ArgumentMatcherTuple
ArgumentMatcherTuple; ArgumentMatcherTuple;
// 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) explicit MockSpec(internal::FunctionMockerBase<F>* function_mocker)
: function_mocker_(function_mocker) {} : function_mocker_(function_mocker) {}
// 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::INFO, file, line, LogWithLocation(internal::kInfo, file, line,
string("ON_CALL(") + obj + ", " + call + ") invoked"); string("ON_CALL(") + obj + ", " + call + ") invoked");
return function_mocker_->AddNewOnCallSpec(file, line, matchers_); return function_mocker_->AddNewOnCallSpec(file, line, matchers_);
} }
// Adds a new expectation spec to the function mocker and returns // Adds a new expectation spec to the function mocker and returns
// 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 string source_text(string("EXPECT_CALL(") + obj + ", " + call + " )");
LogWithLocation(internal::INFO, 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_);
} }
private: private:
template <typename Function> template <typename Function>
friend class internal::FunctionMocker; friend class internal::FunctionMocker;
void SetMatchers(const ArgumentMatcherTuple& matchers) { void SetMatchers(const ArgumentMatcherTuple& matchers) {
matchers_ = matchers; matchers_ = matchers;
skipping to change at line 1395 skipping to change at line 1411
public: public:
typedef typename Function<F>::Result Result; typedef typename Function<F>::Result Result;
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() : current_spec_(this) {}
// 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
// non-fatal failures for the violations. // non-fatal failures for the violations.
// L < g_gmock_mutex virtual ~FunctionMockerBase()
virtual ~FunctionMockerBase() { GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
MutexLock l(&g_gmock_mutex); MutexLock l(&g_gmock_mutex);
VerifyAndClearExpectationsLocked(); VerifyAndClearExpectationsLocked();
Mock::UnregisterLocked(this); Mock::UnregisterLocked(this);
ClearDefaultActionsLocked(); ClearDefaultActionsLocked();
} }
// Returns the ON_CALL spec that matches this mock function with the // Returns the ON_CALL spec that matches this mock function with the
// given arguments; returns NULL if no matching ON_CALL is found. // given arguments; returns NULL if no matching ON_CALL is found.
// L = * // L = *
const OnCallSpec<F>* FindOnCallSpec( const OnCallSpec<F>* FindOnCallSpec(
skipping to change at line 1419 skipping to change at line 1435
= untyped_on_call_specs_.rbegin(); = untyped_on_call_specs_.rbegin();
it != untyped_on_call_specs_.rend(); ++it) { it != untyped_on_call_specs_.rend(); ++it) {
const OnCallSpec<F>* spec = static_cast<const OnCallSpec<F>*>(*it); const OnCallSpec<F>* spec = static_cast<const OnCallSpec<F>*>(*it);
if (spec->Matches(args)) if (spec->Matches(args))
return spec; return spec;
} }
return NULL; return NULL;
} }
// Performs the default action of this mock function on the given argumen // Performs the default action of this mock function on the given
ts // arguments and returns the result. Asserts (or throws if
// and returns the result. Asserts with a helpful call descrption if ther // exceptions are enabled) with a helpful call descrption if there
e is // is no valid return value. This method doesn't depend on the
// no valid return value. This method doesn't depend on the mutable state // mutable state of this object, and thus can be called concurrently
of // without locking.
// this object, and thus can be called concurrently without locking.
// L = * // L = *
Result PerformDefaultAction(const ArgumentTuple& args, Result PerformDefaultAction(const ArgumentTuple& args,
const string& call_description) const { const 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(args);
} }
Assert(DefaultValue<Result>::Exists(), "", -1, const string message = call_description +
call_description + "\n The mock function has no default actio "\n The mock function has no default action "
n " "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 (!DefaultValue<Result>::Exists()) {
throw std::runtime_error(message);
}
#else
Assert(DefaultValue<Result>::Exists(), "", -1, message);
#endif
return DefaultValue<Result>::Get(); return DefaultValue<Result>::Get();
} }
// Performs the default action with the given arguments and returns // Performs the default action with the given arguments and returns
// the action's result. The call description string will be used in // the action's result. The call description string will be used in
// the error message to describe the call in the case the default // the error message to describe the call in the case the default
// 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 const void* untyped_args, // must point to an ArgumentTuple
skipping to change at line 1466 skipping to change at line 1491
// 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 = const ArgumentTuple& args =
*static_cast<const ArgumentTuple*>(untyped_args); *static_cast<const ArgumentTuple*>(untyped_args);
return ResultHolder::PerformAction(action, args); return ResultHolder::PerformAction(action, args);
} }
// Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked(): // Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked():
// clears the ON_CALL()s set on this mock function. // clears the ON_CALL()s set on this mock function.
// L >= g_gmock_mutex virtual void ClearDefaultActionsLocked()
virtual void ClearDefaultActionsLocked() { GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
// Deleting our default actions may trigger other mock objects to be
// deleted, for example if an action contains a reference counted smart
// pointer to that mock object, and that is the last reference. So if w
e
// delete our actions within the context of the global mutex we may dea
dlock
// when this method is called again. Instead, make a copy of the set of
// actions to delete, clear our set within the mutex, and then delete t
he
// actions outside of the mutex.
UntypedOnCallSpecs specs_to_delete;
untyped_on_call_specs_.swap(specs_to_delete);
g_gmock_mutex.Unlock();
for (UntypedOnCallSpecs::const_iterator it = for (UntypedOnCallSpecs::const_iterator it =
untyped_on_call_specs_.begin(); specs_to_delete.begin();
it != untyped_on_call_specs_.end(); ++it) { it != specs_to_delete.end(); ++it) {
delete static_cast<const OnCallSpec<F>*>(*it); delete static_cast<const OnCallSpec<F>*>(*it);
} }
untyped_on_call_specs_.clear();
// Lock the mutex again, since the caller expects it to be locked when
we
// return.
g_gmock_mutex.Lock();
} }
protected: protected:
template <typename Function> template <typename Function>
friend class MockSpec; friend class MockSpec;
typedef ActionResultHolder<Result> ResultHolder; typedef ActionResultHolder<Result> ResultHolder;
// 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.
// L < g_gmock_mutex Result InvokeWith(const ArgumentTuple& args)
Result InvokeWith(const ArgumentTuple& args) { GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
return static_cast<const ResultHolder*>( return static_cast<const ResultHolder*>(
this->UntypedInvokeWith(&args))->GetValueAndDelete(); this->UntypedInvokeWith(&args))->GetValueAndDelete();
} }
// Adds and returns a default action spec for this mock function. // Adds and returns a default action spec for this mock function.
// L < g_gmock_mutex
OnCallSpec<F>& AddNewOnCallSpec( OnCallSpec<F>& AddNewOnCallSpec(
const char* file, int line, const char* file, int line,
const ArgumentMatcherTuple& m) { const ArgumentMatcherTuple& m)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line); Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
OnCallSpec<F>* const on_call_spec = new OnCallSpec<F>(file, line, m); OnCallSpec<F>* const on_call_spec = new OnCallSpec<F>(file, line, m);
untyped_on_call_specs_.push_back(on_call_spec); untyped_on_call_specs_.push_back(on_call_spec);
return *on_call_spec; return *on_call_spec;
} }
// Adds and returns an expectation spec for this mock function. // Adds and returns an expectation spec for this mock function.
// L < g_gmock_mutex
TypedExpectation<F>& AddNewExpectation( TypedExpectation<F>& AddNewExpectation(
const char* file, const char* file,
int line, int line,
const string& source_text, const string& source_text,
const ArgumentMatcherTuple& m) { const ArgumentMatcherTuple& m)
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);
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.
Sequence* const implicit_sequence = g_gmock_implicit_sequence.get(); Sequence* const implicit_sequence = g_gmock_implicit_sequence.get();
if (implicit_sequence != NULL) { if (implicit_sequence != NULL) {
implicit_sequence->AddExpectation(Expectation(untyped_expectation)); implicit_sequence->AddExpectation(Expectation(untyped_expectation));
skipping to change at line 1554 skipping to change at line 1594
"returning default value.\n"); "returning default value.\n");
} else { } else {
*os << "taking default action specified at:\n" *os << "taking default action specified at:\n"
<< FormatFileLocation(spec->file(), spec->line()) << "\n"; << FormatFileLocation(spec->file(), spec->line()) << "\n";
} }
} }
// 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
// ostream. // ostream.
// L < g_gmock_mutex virtual void UntypedDescribeUninterestingCall(
virtual void UntypedDescribeUninterestingCall(const void* untyped_args, const void* untyped_args,
::std::ostream* os) const { ::std::ostream* os) const
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
const ArgumentTuple& args = const ArgumentTuple& args =
*static_cast<const ArgumentTuple*>(untyped_args); *static_cast<const ArgumentTuple*>(untyped_args);
*os << "Uninteresting mock function call - "; *os << "Uninteresting mock function call - ";
DescribeDefaultActionTo(args, os); DescribeDefaultActionTo(args, os);
*os << " Function call: " << Name(); *os << " Function call: " << Name();
UniversalPrint(args, os); UniversalPrint(args, os);
} }
// Returns the expectation that matches the given function arguments // Returns the expectation that matches the given function arguments
// (or NULL is there's no match); when a match is found, // (or NULL is there's no match); when a match is found,
skipping to change at line 1581 skipping to change at line 1622
// //
// Critical section: We must find the matching expectation and the // Critical section: We must find the matching expectation and the
// corresponding action that needs to be taken in an ATOMIC // corresponding action that needs to be taken in an ATOMIC
// transaction. Otherwise another thread may call this mock // transaction. Otherwise another thread may call this mock
// method in the middle and mess up the state. // method in the middle and mess up the state.
// //
// However, performing the action has to be left out of the critical // However, performing the action has to be left out of the critical
// section. The reason is that we have no control on what the // section. The reason is that we have no control on what the
// action does (it can invoke an arbitrary user function or even a // action does (it can invoke an arbitrary user function or even a
// mock function) and excessive locking could cause a dead lock. // mock function) and excessive locking could cause a dead lock.
// L < g_gmock_mutex
virtual const ExpectationBase* UntypedFindMatchingExpectation( virtual const ExpectationBase* UntypedFindMatchingExpectation(
const void* untyped_args, const void* untyped_args,
const void** untyped_action, bool* is_excessive, const void** untyped_action, bool* is_excessive,
::std::ostream* what, ::std::ostream* why) { ::std::ostream* what, ::std::ostream* why)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
const ArgumentTuple& args = const ArgumentTuple& args =
*static_cast<const ArgumentTuple*>(untyped_args); *static_cast<const ArgumentTuple*>(untyped_args);
MutexLock l(&g_gmock_mutex); MutexLock l(&g_gmock_mutex);
TypedExpectation<F>* exp = this->FindMatchingExpectationLocked(args); TypedExpectation<F>* exp = this->FindMatchingExpectationLocked(args);
if (exp == NULL) { // A match wasn't found. if (exp == NULL) { // A match wasn't found.
this->FormatUnexpectedCallMessageLocked(args, what, why); this->FormatUnexpectedCallMessageLocked(args, what, why);
return NULL; return NULL;
} }
// This line must be done before calling GetActionForArguments(), // This line must be done before calling GetActionForArguments(),
skipping to change at line 1616 skipping to change at line 1657
// Prints the given function arguments to the ostream. // Prints the given function arguments to the ostream.
virtual void UntypedPrintArgs(const void* untyped_args, virtual void UntypedPrintArgs(const void* untyped_args,
::std::ostream* os) const { ::std::ostream* os) const {
const ArgumentTuple& args = const ArgumentTuple& args =
*static_cast<const ArgumentTuple*>(untyped_args); *static_cast<const ArgumentTuple*>(untyped_args);
UniversalPrint(args, os); UniversalPrint(args, os);
} }
// Returns the expectation that matches the arguments, or NULL if no // Returns the expectation that matches the arguments, or NULL if no
// expectation matches them. // expectation matches them.
// L >= g_gmock_mutex
TypedExpectation<F>* FindMatchingExpectationLocked( TypedExpectation<F>* FindMatchingExpectationLocked(
const ArgumentTuple& args) const { const ArgumentTuple& args) const
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
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) {
TypedExpectation<F>* const exp = TypedExpectation<F>* const exp =
static_cast<TypedExpectation<F>*>(it->get()); static_cast<TypedExpectation<F>*>(it->get());
if (exp->ShouldHandleArguments(args)) { if (exp->ShouldHandleArguments(args)) {
return exp; return exp;
} }
} }
return NULL; return NULL;
} }
// Returns a message that the arguments don't match any expectation. // Returns a message that the arguments don't match any expectation.
// L >= g_gmock_mutex void FormatUnexpectedCallMessageLocked(
void FormatUnexpectedCallMessageLocked(const ArgumentTuple& args, const ArgumentTuple& args,
::std::ostream* os, ::std::ostream* os,
::std::ostream* why) const { ::std::ostream* why) const
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
*os << "\nUnexpected mock function call - "; *os << "\nUnexpected mock function call - ";
DescribeDefaultActionTo(args, os); DescribeDefaultActionTo(args, os);
PrintTriedExpectationsLocked(args, why); PrintTriedExpectationsLocked(args, why);
} }
// Prints a list of expectations that have been tried against the // Prints a list of expectations that have been tried against the
// current mock function call. // current mock function call.
// L >= g_gmock_mutex void PrintTriedExpectationsLocked(
void PrintTriedExpectationsLocked(const ArgumentTuple& args, const ArgumentTuple& args,
::std::ostream* why) const { ::std::ostream* why) const
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
const int count = static_cast<int>(untyped_expectations_.size()); const int count = static_cast<int>(untyped_expectations_.size());
*why << "Google Mock tried the following " << count << " " *why << "Google Mock tried the following " << count << " "
<< (count == 1 ? "expectation, but it didn't match" : << (count == 1 ? "expectation, but it didn't match" :
"expectations, but none matched") "expectations, but none matched")
<< ":\n"; << ":\n";
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
TypedExpectation<F>* const expectation = TypedExpectation<F>* const expectation =
static_cast<TypedExpectation<F>*>(untyped_expectations_[i].get()) ; static_cast<TypedExpectation<F>*>(untyped_expectations_[i].get()) ;
*why << "\n"; *why << "\n";
skipping to change at line 1696 skipping to change at line 1739
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning(pop) // Restores the warning state. # pragma warning(pop) // Restores the warning state.
#endif // _MSV_VER #endif // _MSV_VER
// Implements methods of FunctionMockerBase. // Implements methods of FunctionMockerBase.
// Verifies that all expectations on this mock function have been // Verifies that all expectations on this mock function have been
// satisfied. Reports one or more Google Test non-fatal failures and // satisfied. Reports one or more Google Test non-fatal failures and
// returns false if not. // returns false if not.
// L >= g_gmock_mutex
// 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 string& msg);
} // namespace internal } // namespace internal
// The style guide prohibits "using" statements in a namespace scope // The style guide prohibits "using" statements in a namespace scope
// inside a header file. However, the MockSpec class template is // inside a header file. However, the MockSpec class template is
// meant to be defined in the ::testing namespace. The following line // meant to be defined in the ::testing namespace. The following line
 End of changes. 79 change blocks. 
143 lines changed or deleted 182 lines changed or added


 gmock.h   gmock.h 
skipping to change at line 62 skipping to change at line 62
// .WillOnce(...) * // .WillOnce(...) *
// .WillRepeatedly(...) ? // .WillRepeatedly(...) ?
// .RetiresOnSaturation() ? ; // .RetiresOnSaturation() ? ;
// //
// where all clauses are optional and WillOnce() can be repeated. // where all clauses are optional and WillOnce() can be repeated.
#include "gmock/gmock-actions.h" #include "gmock/gmock-actions.h"
#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-matchers.h"
#include "gmock/gmock-more-actions.h"
#include "gmock/gmock-generated-nice-strict.h" #include "gmock/gmock-generated-nice-strict.h"
#include "gmock/gmock-generated-matchers.h"
#include "gmock/gmock-matchers.h" #include "gmock/gmock-matchers.h"
#include "gmock/gmock-more-actions.h"
#include "gmock/gmock-more-matchers.h"
#include "gmock/internal/gmock-internal-utils.h" #include "gmock/internal/gmock-internal-utils.h"
namespace testing { 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);
// 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
// that Google Mock recognizes. Whenever a Google Mock flag is seen, // that Google Mock recognizes. Whenever a Google Mock flag is seen,
// it is removed from argv, and *argc is decremented. // it is removed from argv, and *argc is decremented.
// //
// No value is returned. Instead, the Google Mock flag variables are // No value is returned. Instead, the Google Mock flag variables are
// updated. // updated.
// //
// Since Google Test is needed for Google Mock to work, this function // Since Google Test is needed for Google Mock to work, this function
// also initializes Google Test and parses its flags, if that hasn't // also initializes Google Test and parses its flags, if that hasn't
// been done. // been done.
void InitGoogleMock(int* argc, char** argv); GTEST_API_ void InitGoogleMock(int* argc, char** argv);
// This overloaded version can be used in Windows programs compiled in // This overloaded version can be used in Windows programs compiled in
// UNICODE mode. // UNICODE mode.
void InitGoogleMock(int* argc, wchar_t** argv); GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv);
} // namespace testing } // namespace testing
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_H_ #endif // GMOCK_INCLUDE_GMOCK_GMOCK_H_
 End of changes. 5 change blocks. 
4 lines changed or deleted 5 lines changed or added


 gtest-death-test-internal.h   gtest-death-test-internal.h 
skipping to change at line 130 skipping to change at line 130
// be combined. // be combined.
virtual bool Passed(bool exit_status_ok) = 0; virtual bool Passed(bool exit_status_ok) = 0;
// Signals that the death test did not die as expected. // Signals that the death test did not die as expected.
virtual void Abort(AbortReason reason) = 0; virtual void Abort(AbortReason reason) = 0;
// Returns a human-readable outcome message regarding the outcome of // Returns a human-readable outcome message regarding the outcome of
// the last death test. // the last death test.
static const char* LastMessage(); static const char* LastMessage();
static void set_last_death_test_message(const String& message); static void set_last_death_test_message(const std::string& message);
private: private:
// A string containing a description of the outcome of the last death tes t. // A string containing a description of the outcome of the last death tes t.
static String last_death_test_message_; static std::string last_death_test_message_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest); GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
}; };
// 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:
virtual ~DeathTestFactory() { } virtual ~DeathTestFactory() { }
virtual bool Create(const char* statement, const RE* regex, virtual bool Create(const char* statement, const RE* regex,
const char* file, int line, DeathTest** test) = 0; const char* file, int line, DeathTest** test) = 0;
skipping to change at line 220 skipping to change at line 220
default: \ default: \
break; \ break; \
} \ } \
} \ } \
} else \ } else \
GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \ GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \
fail(::testing::internal::DeathTest::LastMessage()) fail(::testing::internal::DeathTest::LastMessage())
// The symbol "fail" here expands to something into which a message // The symbol "fail" here expands to something into which a message
// can be streamed. // can be streamed.
// This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled i
n
// NDEBUG mode. In this case we need the statements to be executed, the reg
ex is
// ignored, and the macro must accept a streamed message even though the me
ssage
// is never printed.
# define GTEST_EXECUTE_STATEMENT_(statement, regex) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::testing::internal::AlwaysTrue()) { \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} else \
::testing::Message()
// A class representing the parsed contents of the // A class representing the parsed contents of the
// --gtest_internal_run_death_test flag, as it existed when // --gtest_internal_run_death_test flag, as it existed when
// RUN_ALL_TESTS was called. // RUN_ALL_TESTS was called.
class InternalRunDeathTestFlag { class InternalRunDeathTestFlag {
public: public:
InternalRunDeathTestFlag(const String& a_file, InternalRunDeathTestFlag(const std::string& a_file,
int a_line, int a_line,
int an_index, int an_index,
int a_write_fd) int a_write_fd)
: file_(a_file), line_(a_line), index_(an_index), : file_(a_file), line_(a_line), index_(an_index),
write_fd_(a_write_fd) {} write_fd_(a_write_fd) {}
~InternalRunDeathTestFlag() { ~InternalRunDeathTestFlag() {
if (write_fd_ >= 0) if (write_fd_ >= 0)
posix::Close(write_fd_); posix::Close(write_fd_);
} }
String file() const { return file_; } const std::string& file() const { return file_; }
int line() const { return line_; } int line() const { return line_; }
int index() const { return index_; } int index() const { return index_; }
int write_fd() const { return write_fd_; } int write_fd() const { return write_fd_; }
private: private:
String file_; std::string file_;
int line_; int line_;
int index_; int index_;
int write_fd_; int write_fd_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag); GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
}; };
// Returns a newly created InternalRunDeathTestFlag object with fields // Returns a newly created InternalRunDeathTestFlag object with fields
// initialized from the GTEST_FLAG(internal_run_death_test) flag if // initialized from the GTEST_FLAG(internal_run_death_test) flag if
// the flag is specified; otherwise returns NULL. // the flag is specified; otherwise returns NULL.
 End of changes. 6 change blocks. 
5 lines changed or deleted 19 lines changed or added


 gtest-death-test.h   gtest-death-test.h 
skipping to change at line 54 skipping to change at line 54
// This flag controls the style of death tests. Valid values are "threadsa fe", // This flag controls the style of death tests. Valid values are "threadsa fe",
// meaning that the death test child process will re-execute the test binar y // meaning that the death test child process will re-execute the test binar y
// from the start, running only a single death test, or "fast", // from the start, running only a single death test, or "fast",
// meaning that the child process will execute the test logic immediately // meaning that the child process will execute the test logic immediately
// after forking. // after forking.
GTEST_DECLARE_string_(death_test_style); GTEST_DECLARE_string_(death_test_style);
#if GTEST_HAS_DEATH_TEST #if GTEST_HAS_DEATH_TEST
namespace internal {
// Returns a Boolean value indicating whether the caller is currently
// executing in the context of the death test child process. Tools such as
// Valgrind heap checkers may need this to modify their behavior in death
// tests. IMPORTANT: This is an internal utility. Using it may break the
// implementation of death tests. User code MUST NOT use it.
GTEST_API_ bool InDeathTestChild();
} // namespace internal
// The following macros are useful for writing death tests. // The following macros are useful for writing death tests.
// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is // Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
// executed: // executed:
// //
// 1. It generates a warning if there is more than one active // 1. It generates a warning if there is more than one active
// thread. This is because it's safe to fork() or clone() only // thread. This is because it's safe to fork() or clone() only
// when there is a single thread. // when there is a single thread.
// //
// 2. The parent process clone()s a sub-process and runs the death // 2. The parent process clone()s a sub-process and runs the death
skipping to change at line 78 skipping to change at line 89
// //
// 4. The parent process checks the exit code and error message of // 4. The parent process checks the exit code and error message of
// the sub-process. // the sub-process.
// //
// Examples: // Examples:
// //
// ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number"); // ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
// for (int i = 0; i < 5; i++) { // for (int i = 0; i < 5; i++) {
// EXPECT_DEATH(server.ProcessRequest(i), // EXPECT_DEATH(server.ProcessRequest(i),
// "Invalid request .* in ProcessRequest()") // "Invalid request .* in ProcessRequest()")
// << "Failed to die on request " << i); // << "Failed to die on request " << i;
// } // }
// //
// ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting") ; // ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting") ;
// //
// bool KilledBySIGHUP(int exit_code) { // bool KilledBySIGHUP(int exit_code) {
// return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP; // return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
// } // }
// //
// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!"); // ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
// //
skipping to change at line 248 skipping to change at line 259
// //
// EXPECT_DEBUG_DEATH({ // EXPECT_DEBUG_DEATH({
// // Side-effects here will have an effect after this statement in // // Side-effects here will have an effect after this statement in
// // opt mode, but none in debug mode. // // opt mode, but none in debug mode.
// EXPECT_EQ(12, DieInDebugOr12(&sideeffect)); // EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
// }, "death"); // }, "death");
// //
# ifdef NDEBUG # ifdef NDEBUG
# define EXPECT_DEBUG_DEATH(statement, regex) \ # define EXPECT_DEBUG_DEATH(statement, regex) \
do { statement; } while (::testing::internal::AlwaysFalse()) GTEST_EXECUTE_STATEMENT_(statement, regex)
# define ASSERT_DEBUG_DEATH(statement, regex) \ # define ASSERT_DEBUG_DEATH(statement, regex) \
do { statement; } while (::testing::internal::AlwaysFalse()) GTEST_EXECUTE_STATEMENT_(statement, regex)
# else # else
# define EXPECT_DEBUG_DEATH(statement, regex) \ # define EXPECT_DEBUG_DEATH(statement, regex) \
EXPECT_DEATH(statement, regex) EXPECT_DEATH(statement, regex)
# define ASSERT_DEBUG_DEATH(statement, regex) \ # define ASSERT_DEBUG_DEATH(statement, regex) \
ASSERT_DEATH(statement, regex) ASSERT_DEATH(statement, regex)
# endif // NDEBUG for EXPECT_DEBUG_DEATH # endif // NDEBUG for EXPECT_DEBUG_DEATH
 End of changes. 4 change blocks. 
3 lines changed or deleted 14 lines changed or added


 gtest-filepath.h   gtest-filepath.h 
skipping to change at line 64 skipping to change at line 64
// a directory, otherwise it is assumed to represent a file. In either case , // a directory, otherwise it is assumed to represent a file. In either case ,
// it may or may not represent an actual file or directory in the file syst em. // it may or may not represent an actual file or directory in the file syst em.
// Names are NOT checked for syntax correctness -- no checking for illegal // Names are NOT checked for syntax correctness -- no checking for illegal
// characters, malformed paths, etc. // characters, malformed paths, etc.
class GTEST_API_ FilePath { class GTEST_API_ FilePath {
public: public:
FilePath() : pathname_("") { } FilePath() : pathname_("") { }
FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { } FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
explicit FilePath(const char* pathname) : pathname_(pathname) { explicit FilePath(const std::string& pathname) : pathname_(pathname) {
Normalize();
}
explicit FilePath(const String& pathname) : pathname_(pathname) {
Normalize(); Normalize();
} }
FilePath& operator=(const FilePath& rhs) { FilePath& operator=(const FilePath& rhs) {
Set(rhs); Set(rhs);
return *this; return *this;
} }
void Set(const FilePath& rhs) { void Set(const FilePath& rhs) {
pathname_ = rhs.pathname_; pathname_ = rhs.pathname_;
} }
String ToString() const { return pathname_; } const std::string& string() const { return pathname_; }
const char* c_str() const { return pathname_.c_str(); } const char* c_str() const { return pathname_.c_str(); }
// Returns the current working directory, or "" if unsuccessful. // Returns the current working directory, or "" if unsuccessful.
static FilePath GetCurrentDir(); static FilePath GetCurrentDir();
// Given directory = "dir", base_name = "test", number = 0, // Given directory = "dir", base_name = "test", number = 0,
// extension = "xml", returns "dir/test.xml". If number is greater // extension = "xml", returns "dir/test.xml". If number is greater
// than zero (e.g., 12), returns "dir/test_12.xml". // than zero (e.g., 12), returns "dir/test_12.xml".
// On Windows platform, uses \ as the separator rather than /. // On Windows platform, uses \ as the separator rather than /.
static FilePath MakeFileName(const FilePath& directory, static FilePath MakeFileName(const FilePath& directory,
skipping to change at line 114 skipping to change at line 110
// directory/base_name_<number>.extension if directory/base_name.extensio n // directory/base_name_<number>.extension if directory/base_name.extensio n
// already exists. The number will be incremented until a pathname is fou nd // already exists. The number will be incremented until a pathname is fou nd
// that does not already exist. // that does not already exist.
// Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'. // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
// There could be a race condition if two or more processes are calling t his // There could be a race condition if two or more processes are calling t his
// function at the same time -- they could both pick the same filename. // function at the same time -- they could both pick the same filename.
static FilePath GenerateUniqueFileName(const FilePath& directory, static FilePath GenerateUniqueFileName(const FilePath& directory,
const FilePath& base_name, const FilePath& base_name,
const char* extension); const char* extension);
// Returns true iff the path is NULL or "". // Returns true iff the path is "".
bool IsEmpty() const { return c_str() == NULL || *c_str() == '\0'; } bool IsEmpty() const { return pathname_.empty(); }
// If input name has a trailing separator character, removes it and retur ns // If input name has a trailing separator character, removes it and retur ns
// the name, otherwise return the name string unmodified. // the name, otherwise return the name string unmodified.
// On Windows platform, uses \ as the separator, other platforms use /. // On Windows platform, uses \ as the separator, other platforms use /.
FilePath RemoveTrailingPathSeparator() const; FilePath RemoveTrailingPathSeparator() const;
// Returns a copy of the FilePath with the directory part removed. // Returns a copy of the FilePath with the directory part removed.
// Example: FilePath("path/to/file").RemoveDirectoryName() returns // Example: FilePath("path/to/file").RemoveDirectoryName() returns
// FilePath("file"). If there is no directory part ("just_a_file"), it re turns // FilePath("file"). If there is no directory part ("just_a_file"), it re turns
// the FilePath unmodified. If there is no file part ("just_a_dir/") it // the FilePath unmodified. If there is no file part ("just_a_dir/") it
skipping to change at line 204 skipping to change at line 200
// the primary path separator '\\', so that for example "bar\\/\\foo" bec omes // the primary path separator '\\', so that for example "bar\\/\\foo" bec omes
// "bar\\foo". // "bar\\foo".
void Normalize(); void Normalize();
// Returns a pointer to the last occurence of a valid path separator in // Returns a pointer to the last occurence of a valid path separator in
// the FilePath. On Windows, for example, both '/' and '\' are valid path // the FilePath. On Windows, for example, both '/' and '\' are valid path
// separators. Returns NULL if no path separator was found. // separators. Returns NULL if no path separator was found.
const char* FindLastPathSeparator() const; const char* FindLastPathSeparator() const;
String pathname_; std::string pathname_;
}; // class FilePath }; // class FilePath
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
 End of changes. 4 change blocks. 
9 lines changed or deleted 5 lines changed or added


 gtest-internal.h   gtest-internal.h 
skipping to change at line 49 skipping to change at line 49
#include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-port.h"
#if GTEST_OS_LINUX #if GTEST_OS_LINUX
# include <stdlib.h> # include <stdlib.h>
# include <sys/types.h> # include <sys/types.h>
# include <sys/wait.h> # include <sys/wait.h>
# include <unistd.h> # include <unistd.h>
#endif // GTEST_OS_LINUX #endif // GTEST_OS_LINUX
#if GTEST_HAS_EXCEPTIONS
# include <stdexcept>
#endif
#include <ctype.h> #include <ctype.h>
#include <float.h>
#include <string.h> #include <string.h>
#include <iomanip> #include <iomanip>
#include <limits> #include <limits>
#include <set> #include <set>
#include "gtest/gtest-message.h"
#include "gtest/internal/gtest-string.h" #include "gtest/internal/gtest-string.h"
#include "gtest/internal/gtest-filepath.h" #include "gtest/internal/gtest-filepath.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
// concatenate two tokens when one of them is __LINE__. Writing // concatenate two tokens when one of them is __LINE__. Writing
// //
// foo ## __LINE__ // foo ## __LINE__
// //
// will result in the token foo__LINE__, instead of foo followed by // will result in the token foo__LINE__, instead of foo followed by
// the current line number. For more details, see // the current line number. For more details, see
// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39. 6 // http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39. 6
#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
// Google Test defines the testing::Message class to allow construction of
// test messages via the << operator. The idea is that anything
// streamable to std::ostream can be streamed to a testing::Message.
// This allows a user to use his own types in Google Test assertions by
// overloading the << operator.
//
// util/gtl/stl_logging-inl.h overloads << for STL containers. These
// overloads cannot be defined in the std namespace, as that will be
// undefined behavior. Therefore, they are defined in the global
// namespace instead.
//
// C++'s symbol lookup rule (i.e. Koenig lookup) says that these
// overloads are visible in either the std namespace or the global
// namespace, but not other namespaces, including the testing
// namespace which Google Test's Message class is in.
//
// To allow STL containers (and other types that has a << operator
// defined in the global namespace) to be used in Google Test assertions,
// testing::Message must access the custom << operator from the global
// namespace. Hence this helper function.
//
// Note: Jeffrey Yasskin suggested an alternative fix by "using
// ::operator<<;" in the definition of Message's operator<<. That fix
// doesn't require a helper function, but unfortunately doesn't
// compile with MSVC.
template <typename T>
inline void GTestStreamToHelper(std::ostream* os, const T& val) {
*os << val;
}
class ProtocolMessage; class ProtocolMessage;
namespace proto2 { class Message; } namespace proto2 { class Message; }
namespace testing { namespace testing {
// Forward declarations. // Forward declarations.
class AssertionResult; // Result of an assertion. class AssertionResult; // Result of an assertion.
class Message; // Represents a failure message. class Message; // Represents a failure message.
class Test; // Represents a test. class Test; // Represents a test.
skipping to change at line 125 skipping to change at line 101
::std::string PrintToString(const T& value); ::std::string PrintToString(const T& value);
namespace internal { namespace internal {
struct TraceInfo; // Information about a trace point. struct TraceInfo; // Information about a trace point.
class ScopedTrace; // Implements scoped trace. 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
// How many times InitGoogleTest() has been called. // How many times InitGoogleTest() has been called.
extern int g_init_gtest_count; GTEST_API_ extern int g_init_gtest_count;
// The text used in failure messages to indicate the start of the // The text used in failure messages to indicate the start of the
// stack trace. // stack trace.
GTEST_API_ extern const char kStackTraceMarker[]; GTEST_API_ extern const char kStackTraceMarker[];
// A secret type that Google Test users don't know about. It has no
// definition on purpose. Therefore it's impossible to create a
// Secret object, which is what we want.
class Secret;
// Two overloaded helpers for checking at compile time whether an // Two overloaded helpers for checking at compile time whether an
// expression is a null pointer literal (i.e. NULL or any 0-valued // expression is a null pointer literal (i.e. NULL or any 0-valued
// compile-time integral constant). Their return values have // compile-time integral constant). Their return values have
// different sizes, so we can use sizeof() to test which version is // different sizes, so we can use sizeof() to test which version is
// picked by the compiler. These helpers have no implementations, as // picked by the compiler. These helpers have no implementations, as
// we only need their signatures. // we only need their signatures.
// //
// Given IsNullLiteralHelper(x), the compiler will pick the first // Given IsNullLiteralHelper(x), the compiler will pick the first
// version if x can be implicitly converted to Secret*, and pick the // version if x can be implicitly converted to Secret*, and pick the
// second version otherwise. Since Secret is a secret and incomplete // second version otherwise. Since Secret is a secret and incomplete
skipping to change at line 166 skipping to change at line 137
#ifdef GTEST_ELLIPSIS_NEEDS_POD_ #ifdef GTEST_ELLIPSIS_NEEDS_POD_
// 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_IS_NULL_LITERAL_(x) false # define GTEST_IS_NULL_LITERAL_(x) false
#else #else
# define GTEST_IS_NULL_LITERAL_(x) \ # define GTEST_IS_NULL_LITERAL_(x) \
(sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1) (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
#endif // GTEST_ELLIPSIS_NEEDS_POD_ #endif // GTEST_ELLIPSIS_NEEDS_POD_
// Appends the user-supplied message to the Google-Test-generated message. // Appends the user-supplied message to the Google-Test-generated message.
GTEST_API_ String AppendUserMessage(const String& gtest_msg, GTEST_API_ std::string AppendUserMessage(
const Message& user_msg); const std::string& gtest_msg, const Message& user_msg);
#if GTEST_HAS_EXCEPTIONS
// This exception is thrown by (and only by) a failed Google Test
// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
// are enabled). We derive it from std::runtime_error, which is for
// errors presumably detectable only at run time. Since
// std::runtime_error inherits from std::exception, many testing
// frameworks know how to extract and print the message inside it.
class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
public:
explicit GoogleTestFailureException(const TestPartResult& failure);
};
#endif // GTEST_HAS_EXCEPTIONS
// A helper class for creating scoped traces in user programs. // A helper class for creating scoped traces in user programs.
class GTEST_API_ ScopedTrace { class GTEST_API_ ScopedTrace {
public: public:
// The c'tor pushes the given source file location and message onto // The c'tor pushes the given source file location and message onto
// a trace stack maintained by Google Test. // a trace stack maintained by Google Test.
ScopedTrace(const char* file, int line, const Message& message); ScopedTrace(const char* file, int line, const Message& message);
// The d'tor pops the info pushed by the c'tor. // The d'tor pops the info pushed by the c'tor.
// //
// Note that the d'tor is not virtual in order to be efficient. // Note that the d'tor is not virtual in order to be efficient.
// Don't inherit from ScopedTrace! // Don't inherit from ScopedTrace!
~ScopedTrace(); ~ScopedTrace();
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace); GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its } GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
// c'tor and d'tor. Therefore it doesn't // c'tor and d'tor. Therefore it doesn't
// need to be used otherwise. // need to be used otherwise.
// Converts a streamable value to a String. A NULL pointer is
// converted to "(null)". When the input value is a ::string,
// ::std::string, ::wstring, or ::std::wstring object, each NUL
// character in it is replaced with "\\0".
// Declared here but defined in gtest.h, so that it has access
// to the definition of the Message class, required by the ARM
// compiler.
template <typename T>
String StreamableToString(const T& streamable);
// The Symbian compiler has a bug that prevents it from selecting the
// correct overload of FormatForComparisonFailureMessage (see below)
// unless we pass the first argument by reference. If we do that,
// however, Visual Age C++ 10.1 generates a compiler error. Therefore
// we only apply the work-around for Symbian.
#if defined(__SYMBIAN32__)
# define GTEST_CREF_WORKAROUND_ const&
#else
# define GTEST_CREF_WORKAROUND_
#endif
// When this operand is a const char* or char*, if the other operand
// is a ::std::string or ::string, we print this operand as a C string
// rather than a pointer (we do the same for wide strings); otherwise
// we print it as a pointer to be safe.
// This internal macro is used to avoid duplicated code.
#define GTEST_FORMAT_IMPL_(operand2_type, operand1_printer)\
inline String FormatForComparisonFailureMessage(\
operand2_type::value_type* GTEST_CREF_WORKAROUND_ str, \
const operand2_type& /*operand2*/) {\
return operand1_printer(str);\
}\
inline String FormatForComparisonFailureMessage(\
const operand2_type::value_type* GTEST_CREF_WORKAROUND_ str, \
const operand2_type& /*operand2*/) {\
return operand1_printer(str);\
}
GTEST_FORMAT_IMPL_(::std::string, String::ShowCStringQuoted)
#if GTEST_HAS_STD_WSTRING
GTEST_FORMAT_IMPL_(::std::wstring, String::ShowWideCStringQuoted)
#endif // GTEST_HAS_STD_WSTRING
#if GTEST_HAS_GLOBAL_STRING
GTEST_FORMAT_IMPL_(::string, String::ShowCStringQuoted)
#endif // GTEST_HAS_GLOBAL_STRING
#if GTEST_HAS_GLOBAL_WSTRING
GTEST_FORMAT_IMPL_(::wstring, String::ShowWideCStringQuoted)
#endif // GTEST_HAS_GLOBAL_WSTRING
#undef GTEST_FORMAT_IMPL_
// The next four overloads handle the case where the operand being
// printed is a char/wchar_t pointer and the other operand is not a
// string/wstring object. In such cases, we just print the operand as
// a pointer to be safe.
#define GTEST_FORMAT_CHAR_PTR_IMPL_(CharType) \
template <typename T> \
String FormatForComparisonFailureMessage(CharType* GTEST_CREF_WORKAROUND_
p, \
const T&) { \
return PrintToString(static_cast<const void*>(p)); \
}
GTEST_FORMAT_CHAR_PTR_IMPL_(char)
GTEST_FORMAT_CHAR_PTR_IMPL_(const char)
GTEST_FORMAT_CHAR_PTR_IMPL_(wchar_t)
GTEST_FORMAT_CHAR_PTR_IMPL_(const wchar_t)
#undef GTEST_FORMAT_CHAR_PTR_IMPL_
// Constructs and returns the message for an equality assertion // Constructs and returns the message for an equality assertion
// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure. // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
// //
// The first four parameters are the expressions used in the assertion // The first four parameters are the expressions used in the assertion
// and their values, as strings. For example, for ASSERT_EQ(foo, bar) // and their values, as strings. For example, for ASSERT_EQ(foo, bar)
// where foo is 5 and bar is 6, we have: // where foo is 5 and bar is 6, we have:
// //
// expected_expression: "foo" // expected_expression: "foo"
// actual_expression: "bar" // actual_expression: "bar"
// expected_value: "5" // expected_value: "5"
// actual_value: "6" // actual_value: "6"
// //
// The ignoring_case parameter is true iff the assertion is a // The ignoring_case parameter is true iff the assertion is a
// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will // *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
// be inserted into the message. // be inserted into the message.
GTEST_API_ AssertionResult EqFailure(const char* expected_expression, GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
const char* actual_expression, const char* actual_expression,
const String& expected_value, const std::string& expected_value,
const String& actual_value, const std::string& actual_value,
bool ignoring_case); bool ignoring_case);
// Constructs a failure message for Boolean assertions such as EXPECT_TRUE. // Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
GTEST_API_ String GetBoolAssertionFailureMessage( GTEST_API_ std::string GetBoolAssertionFailureMessage(
const AssertionResult& assertion_result, const AssertionResult& assertion_result,
const char* expression_text, const char* expression_text,
const char* actual_predicate_value, const char* actual_predicate_value,
const char* expected_predicate_value); const char* expected_predicate_value);
// This template class represents an IEEE floating-point number // This template class represents an IEEE floating-point number
// (either single-precision or double-precision, depending on the // (either single-precision or double-precision, depending on the
// template parameters). // template parameters).
// //
// The purpose of this class is to do more sophisticated number // The purpose of this class is to do more sophisticated number
skipping to change at line 356 skipping to change at line 271
// comparing two numbers. The larger the value, the more error we // comparing two numbers. The larger the value, the more error we
// allow. A 0 value means that two numbers must be exactly the same // allow. A 0 value means that two numbers must be exactly the same
// to be considered equal. // to be considered equal.
// //
// The maximum error of a single floating-point operation is 0.5 // The maximum error of a single floating-point operation is 0.5
// units in the last place. On Intel CPU's, all floating-point // units in the last place. On Intel CPU's, all floating-point
// calculations are done with 80-bit precision, while double has 64 // calculations are done with 80-bit precision, while double has 64
// bits. Therefore, 4 should be enough for ordinary use. // bits. Therefore, 4 should be enough for ordinary use.
// //
// See the following article for more details on ULP: // See the following article for more details on ULP:
// http://www.cygnus-software.com/papers/comparingfloats/comparingfloats. htm. // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-n umbers-2012-edition/
static const size_t kMaxUlps = 4; static const size_t kMaxUlps = 4;
// Constructs a FloatingPoint from a raw floating-point number. // Constructs a FloatingPoint from a raw floating-point number.
// //
// On an Intel CPU, passing a non-normalized NAN (Not a Number) // On an Intel CPU, passing a non-normalized NAN (Not a Number)
// around may change its bits, although the new value is guaranteed // around may change its bits, although the new value is guaranteed
// to be also a NAN. Therefore, don't expect this constructor to // to be also a NAN. Therefore, don't expect this constructor to
// preserve the bits in x when x is a NAN. // preserve the bits in x when x is a NAN.
explicit FloatingPoint(const RawType& x) { u_.value_ = x; } explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
skipping to change at line 383 skipping to change at line 298
FloatingPoint fp(0); FloatingPoint fp(0);
fp.u_.bits_ = bits; fp.u_.bits_ = bits;
return fp.u_.value_; return fp.u_.value_;
} }
// Returns the floating-point number that represent positive infinity. // Returns the floating-point number that represent positive infinity.
static RawType Infinity() { static RawType Infinity() {
return ReinterpretBits(kExponentBitMask); return ReinterpretBits(kExponentBitMask);
} }
// Returns the maximum representable finite floating-point number.
static RawType Max();
// Non-static methods // Non-static methods
// Returns the bits that represents this number. // Returns the bits that represents this number.
const Bits &bits() const { return u_.bits_; } const Bits &bits() const { return u_.bits_; }
// Returns the exponent bits of this number. // Returns the exponent bits of this number.
Bits exponent_bits() const { return kExponentBitMask & u_.bits_; } Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
// Returns the fraction bits of this number. // Returns the fraction bits of this number.
Bits fraction_bits() const { return kFractionBitMask & u_.bits_; } Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
skipping to change at line 463 skipping to change at line 381
static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1, static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
const Bits &sam2) { const Bits &sam2) {
const Bits biased1 = SignAndMagnitudeToBiased(sam1); const Bits biased1 = SignAndMagnitudeToBiased(sam1);
const Bits biased2 = SignAndMagnitudeToBiased(sam2); const Bits biased2 = SignAndMagnitudeToBiased(sam2);
return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1) ; return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1) ;
} }
FloatingPointUnion u_; FloatingPointUnion u_;
}; };
// We cannot use std::numeric_limits<T>::max() as it clashes with the max()
// macro defined by <windows.h>.
template <>
inline float FloatingPoint<float>::Max() { return FLT_MAX; }
template <>
inline double FloatingPoint<double>::Max() { return DBL_MAX; }
// Typedefs the instances of the FloatingPoint template class that we // Typedefs the instances of the FloatingPoint template class that we
// care to use. // care to use.
typedef FloatingPoint<float> Float; typedef FloatingPoint<float> Float;
typedef FloatingPoint<double> Double; typedef FloatingPoint<double> Double;
// In order to catch the mistake of putting tests that use different // In order to catch the mistake of putting tests that use different
// test fixture classes in the same test case, we need to assign // test fixture classes in the same test case, we need to assign
// unique IDs to fixture classes and compare them. The TypeId type is // unique IDs to fixture classes and compare them. The TypeId type is
// used to hold such IDs. The user should treat TypeId as an opaque // used to hold such IDs. The user should treat TypeId as an opaque
// type: the only operation allowed on TypeId values is to compare // type: the only operation allowed on TypeId values is to compare
skipping to change at line 557 skipping to change at line 482
typedef void (*TearDownTestCaseFunc)(); typedef void (*TearDownTestCaseFunc)();
// Creates a new TestInfo object and registers it with Google Test; // Creates a new TestInfo object and registers it with Google Test;
// returns the created object. // returns the created object.
// //
// Arguments: // Arguments:
// //
// test_case_name: name of the test case // test_case_name: name of the test case
// name: name of the test // name: name of the test
// type_param the name of the test's type parameter, or NULL if // type_param the name of the test's type parameter, or NULL if
// this is not a typed or a type-parameterized test. // this is not a typed or a type-parameterized test.
// value_param text representation of the test's value parameter, // value_param text representation of the test's value parameter,
// or NULL if this is not a type-parameterized test. // or NULL if this is not a type-parameterized test.
// fixture_class_id: ID of the test fixture class // fixture_class_id: ID of the test fixture class
// set_up_tc: pointer to the function that sets up the test case // set_up_tc: pointer to the function that sets up the test case
// tear_down_tc: pointer to the function that tears down the test cas e // tear_down_tc: pointer to the function that tears down the test cas e
// factory: pointer to the factory that creates a test object. // factory: pointer to the factory that creates a test object.
// The newly created TestInfo instance will assume // The newly created TestInfo instance will assume
// ownership of the factory object. // ownership of the factory object.
GTEST_API_ TestInfo* MakeAndRegisterTestInfo( GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
const char* test_case_name, const char* name, const char* test_case_name,
const char* name,
const char* type_param, const char* type_param,
const char* value_param, const char* value_param,
TypeId fixture_class_id, TypeId fixture_class_id,
SetUpTestCaseFunc set_up_tc, SetUpTestCaseFunc set_up_tc,
TearDownTestCaseFunc tear_down_tc, TearDownTestCaseFunc tear_down_tc,
TestFactoryBase* factory); TestFactoryBase* factory);
// If *pstr starts with the given prefix, modifies *pstr to be right // If *pstr starts with the given prefix, modifies *pstr to be right
// past the prefix and returns true; otherwise leaves *pstr unchanged // past the prefix and returns true; otherwise leaves *pstr unchanged
// and returns false. None of pstr, *pstr, and prefix can be NULL. // and returns false. None of pstr, *pstr, and prefix can be NULL.
skipping to change at line 627 skipping to change at line 553
const char* comma = strchr(str, ','); const char* comma = strchr(str, ',');
if (comma == NULL) { if (comma == NULL) {
return NULL; return NULL;
} }
while (IsSpace(*(++comma))) {} while (IsSpace(*(++comma))) {}
return comma; return comma;
} }
// Returns the prefix of 'str' before the first comma in it; returns // Returns the prefix of 'str' before the first comma in it; returns
// the entire string if it contains no comma. // the entire string if it contains no comma.
inline String GetPrefixUntilComma(const char* str) { inline std::string GetPrefixUntilComma(const char* str) {
const char* comma = strchr(str, ','); const char* comma = strchr(str, ',');
return comma == NULL ? String(str) : String(str, comma - str); return comma == NULL ? str : std::string(str, comma);
} }
// 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
// such that we can call this function in a namespace scope. // such that we can call this function in a namespace scope.
// //
// Implementation note: The GTEST_TEMPLATE_ macro declares a template // Implementation note: The GTEST_TEMPLATE_ macro declares a template
// template parameter. It's defined in gtest-type-util.h. // template parameter. It's defined in gtest-type-util.h.
template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types> template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
skipping to change at line 655 skipping to change at line 581
// length of Types. // length of Types.
static bool Register(const char* prefix, const char* case_name, static bool Register(const char* prefix, const char* case_name,
const char* test_names, int index) { const char* test_names, int index) {
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;
// First, registers the first type-parameterized test in the type // First, registers the first type-parameterized test in the type
// list. // list.
MakeAndRegisterTestInfo( MakeAndRegisterTestInfo(
String::Format("%s%s%s/%d", prefix, prefix[0] == '\0' ? "" : "/", (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name +
case_name, index).c_str(), "/"
+ StreamableToString(index)).c_str(),
GetPrefixUntilComma(test_names).c_str(), GetPrefixUntilComma(test_names).c_str(),
GetTypeName<Type>().c_str(), GetTypeName<Type>().c_str(),
NULL, // No value parameter. NULL, // No value parameter.
GetTypeId<FixtureClass>(), GetTypeId<FixtureClass>(),
TestClass::SetUpTestCase, TestClass::SetUpTestCase,
TestClass::TearDownTestCase, TestClass::TearDownTestCase,
new TestFactoryImpl<TestClass>); 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, typename Types::Tail>
skipping to change at line 714 skipping to change at line 640
class TypeParameterizedTestCase<Fixture, Templates0, Types> { class TypeParameterizedTestCase<Fixture, Templates0, Types> {
public: public:
static bool Register(const char* /*prefix*/, const char* /*case_name*/, static bool Register(const char* /*prefix*/, const char* /*case_name*/,
const char* /*test_names*/) { const char* /*test_names*/) {
return true; return true;
} }
}; };
#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P #endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
// Returns the current OS stack trace as a String. // Returns the current OS stack trace as an std::string.
// //
// The maximum number of stack frames to be included is specified by // The maximum number of stack frames to be included is specified by
// the gtest_stack_trace_depth flag. The skip_count parameter // the gtest_stack_trace_depth flag. The skip_count parameter
// specifies the number of top frames to be skipped, which doesn't // specifies the number of top frames to be skipped, which doesn't
// count against the number of frames to be included. // count against the number of frames to be included.
// //
// For example, if Foo() calls Bar(), which in turn calls // For example, if Foo() calls Bar(), which in turn calls
// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't. // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
GTEST_API_ String GetCurrentOsStackTraceExceptTop(UnitTest* unit_test, GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(
int skip_count); UnitTest* unit_test, int skip_count);
// Helpers for suppressing warnings on unreachable code or constant // Helpers for suppressing warnings on unreachable code or constant
// condition. // condition.
// Always returns true. // Always returns true.
GTEST_API_ bool AlwaysTrue(); GTEST_API_ bool AlwaysTrue();
// Always returns false. // Always returns false.
inline bool AlwaysFalse() { return !AlwaysTrue(); } inline bool AlwaysFalse() { return !AlwaysTrue(); }
skipping to change at line 800 skipping to change at line 726
// it unchanged. This is the same as tr1::remove_const, which is not // it unchanged. This is the same as tr1::remove_const, which is not
// widely available yet. // widely available yet.
template <typename T> template <typename T>
struct RemoveConst { typedef T type; }; // NOLINT struct RemoveConst { typedef T type; }; // NOLINT
template <typename T> template <typename T>
struct RemoveConst<const T> { typedef T type; }; // NOLINT struct RemoveConst<const T> { typedef T type; }; // NOLINT
// MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above // MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above
// definition to fail to remove the const in 'const int[3]' and 'const // definition to fail to remove the const in 'const int[3]' and 'const
// char[3][4]'. The following specialization works around the bug. // char[3][4]'. The following specialization works around the bug.
// However, it causes trouble with GCC and thus needs to be
// conditionally compiled.
#if defined(_MSC_VER) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
template <typename T, size_t N> template <typename T, size_t N>
struct RemoveConst<const T[N]> { struct RemoveConst<const T[N]> {
typedef typename RemoveConst<T>::type type[N]; typedef typename RemoveConst<T>::type type[N];
}; };
#if defined(_MSC_VER) && _MSC_VER < 1400
// This is the only specialization that allows VC++ 7.1 to remove const in
// 'const int[3] and 'const int[3][4]'. However, it causes trouble with GC
C
// and thus needs to be conditionally compiled.
template <typename T, size_t N>
struct RemoveConst<T[N]> {
typedef typename RemoveConst<T>::type type[N];
};
#endif #endif
// A handy wrapper around RemoveConst that works when the argument // A handy wrapper around RemoveConst that works when the argument
// T depends on template parameters. // T depends on template parameters.
#define GTEST_REMOVE_CONST_(T) \ #define GTEST_REMOVE_CONST_(T) \
typename ::testing::internal::RemoveConst<T>::type typename ::testing::internal::RemoveConst<T>::type
// Turns const U&, U&, const U, and U all into U. // Turns const U&, U&, const U, and U all into U.
#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))
 End of changes. 22 change blocks. 
126 lines changed or deleted 59 lines changed or added


 gtest-linked_ptr.h   gtest-linked_ptr.h 
skipping to change at line 108 skipping to change at line 108
// to prevent two such operations from occurring concurrently. // to prevent two such operations from occurring concurrently.
// //
// Note that different types of linked_ptr objects can coexist in a // Note that different types of linked_ptr objects can coexist in a
// circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and // circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and
// linked_ptr<Derived2>). Therefore we must use a single mutex to // linked_ptr<Derived2>). Therefore we must use a single mutex to
// protect all linked_ptr objects. This can create serious // protect all linked_ptr objects. This can create serious
// contention in production code, but is acceptable in a testing // contention in production code, but is acceptable in a testing
// framework. // framework.
// Join an existing circle. // Join an existing circle.
// L < g_linked_ptr_mutex void join(linked_ptr_internal const* ptr)
void join(linked_ptr_internal const* ptr) { GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
MutexLock lock(&g_linked_ptr_mutex); MutexLock lock(&g_linked_ptr_mutex);
linked_ptr_internal const* p = ptr; linked_ptr_internal const* p = ptr;
while (p->next_ != ptr) p = p->next_; while (p->next_ != ptr) p = p->next_;
p->next_ = this; p->next_ = this;
next_ = ptr; next_ = ptr;
} }
// Leave whatever circle we're part of. Returns true if we were the // Leave whatever circle we're part of. Returns true if we were the
// last member of the circle. Once this is done, you can join() another. // last member of the circle. Once this is done, you can join() another.
// L < g_linked_ptr_mutex bool depart()
bool depart() { GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
MutexLock lock(&g_linked_ptr_mutex); MutexLock lock(&g_linked_ptr_mutex);
if (next_ == this) return true; if (next_ == this) return true;
linked_ptr_internal const* p = next_; linked_ptr_internal const* p = next_;
while (p->next_ != this) p = p->next_; while (p->next_ != this) p = p->next_;
p->next_ = next_; p->next_ = next_;
return false; return false;
} }
private: private:
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 gtest-message.h   gtest-message.h 
skipping to change at line 51 skipping to change at line 51
// //
// Such code is NOT meant to be used by a user directly, and is subject // Such code is NOT meant to be used by a user directly, and is subject
// 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!
#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_
#include <limits> #include <limits>
#include "gtest/internal/gtest-string.h" #include "gtest/internal/gtest-port.h"
#include "gtest/internal/gtest-internal.h"
// Ensures that there is at least one operator<< in the global namespace.
// See Message& operator<<(...) below for why.
void operator<<(const testing::internal::Secret&, int);
namespace testing { namespace testing {
// The Message class works like an ostream repeater. // The Message class works like an ostream repeater.
// //
// Typical usage: // Typical usage:
// //
// 1. You stream a bunch of values to a Message object. // 1. You stream a bunch of values to a Message object.
// It will remember the text in a stringstream. // It will remember the text in a stringstream.
// 2. Then you stream the Message object to an ostream. // 2. Then you stream the Message object to an ostream.
skipping to change at line 90 skipping to change at line 93
// class hides this difference by treating a NULL char pointer as // class hides this difference by treating a NULL char pointer as
// "(null)". // "(null)".
class GTEST_API_ Message { class GTEST_API_ Message {
private: private:
// The type of basic IO manipulators (endl, ends, and flush) for // The type of basic IO manipulators (endl, ends, and flush) for
// narrow streams. // narrow streams.
typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&); typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
public: public:
// Constructs an empty Message. // Constructs an empty Message.
// We allocate the stringstream separately because otherwise each use of Message();
// ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's
// stack frame leading to huge stack frames in some cases; gcc does not r
euse
// the stack space.
Message() : ss_(new ::std::stringstream) {
// By default, we want there to be enough precision when printing
// a double to a Message.
*ss_ << std::setprecision(std::numeric_limits<double>::digits10 + 2);
}
// Copy constructor. // Copy constructor.
Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT
*ss_ << msg.GetString(); *ss_ << msg.GetString();
} }
// Constructs a Message from a C-string. // Constructs a Message from a C-string.
explicit Message(const char* str) : ss_(new ::std::stringstream) { explicit Message(const char* str) : ss_(new ::std::stringstream) {
*ss_ << str; *ss_ << str;
} }
skipping to change at line 121 skipping to change at line 116
// Streams a value (either a pointer or not) to this object. // Streams a value (either a pointer or not) to this object.
template <typename T> template <typename T>
inline Message& operator <<(const T& value) { inline Message& operator <<(const T& value) {
StreamHelper(typename internal::is_pointer<T>::type(), value); StreamHelper(typename internal::is_pointer<T>::type(), value);
return *this; return *this;
} }
#else #else
// Streams a non-pointer value to this object. // Streams a non-pointer value to this object.
template <typename T> template <typename T>
inline Message& operator <<(const T& val) { inline Message& operator <<(const T& val) {
::GTestStreamToHelper(ss_.get(), val); // Some libraries overload << for STL containers. These
// overloads are defined in the global namespace instead of ::std.
//
// C++'s symbol lookup rule (i.e. Koenig lookup) says that these
// overloads are visible in either the std namespace or the global
// namespace, but not other namespaces, including the testing
// namespace which Google Test's Message class is in.
//
// To allow STL containers (and other types that has a << operator
// defined in the global namespace) to be used in Google Test
// assertions, testing::Message must access the custom << operator
// from the global namespace. With this using declaration,
// overloads of << defined in the global namespace and those
// visible via Koenig lookup are both exposed in this function.
using ::operator <<;
*ss_ << val;
return *this; return *this;
} }
// Streams a pointer value to this object. // Streams a pointer value to this object.
// //
// This function is an overload of the previous one. When you // This function is an overload of the previous one. When you
// stream a pointer to a Message, this definition will be used as it // stream a pointer to a Message, this definition will be used as it
// is more specialized. (The C++ Standard, section // is more specialized. (The C++ Standard, section
// [temp.func.order].) If you stream a non-pointer, then the // [temp.func.order].) If you stream a non-pointer, then the
// previous definition will be used. // previous definition will be used.
skipping to change at line 143 skipping to change at line 153
// The reason for this overload is that streaming a NULL pointer to // The reason for this overload is that streaming a NULL pointer to
// ostream is undefined behavior. Depending on the compiler, you // ostream is undefined behavior. Depending on the compiler, you
// may get "0", "(nil)", "(null)", or an access violation. To // may get "0", "(nil)", "(null)", or an access violation. To
// ensure consistent result across compilers, we always treat NULL // ensure consistent result across compilers, we always treat NULL
// as "(null)". // as "(null)".
template <typename T> template <typename T>
inline Message& operator <<(T* const& pointer) { // NOLINT inline Message& operator <<(T* const& pointer) { // NOLINT
if (pointer == NULL) { if (pointer == NULL) {
*ss_ << "(null)"; *ss_ << "(null)";
} else { } else {
::GTestStreamToHelper(ss_.get(), pointer); *ss_ << pointer;
} }
return *this; return *this;
} }
#endif // GTEST_OS_SYMBIAN #endif // GTEST_OS_SYMBIAN
// Since the basic IO manipulators are overloaded for both narrow // Since the basic IO manipulators are overloaded for both narrow
// and wide streams, we have to provide this specialized definition // and wide streams, we have to provide this specialized definition
// of operator <<, even though its body is the same as the // of operator <<, even though its body is the same as the
// templatized version above. Without this definition, streaming // templatized version above. Without this definition, streaming
// endl or other basic IO manipulators to Message will confuse the // endl or other basic IO manipulators to Message will confuse the
skipping to change at line 167 skipping to change at line 177
return *this; return *this;
} }
// Instead of 1/0, we want to see true/false for bool values. // Instead of 1/0, we want to see true/false for bool values.
Message& operator <<(bool b) { Message& operator <<(bool b) {
return *this << (b ? "true" : "false"); return *this << (b ? "true" : "false");
} }
// These two overloads allow streaming a wide C string to a Message // These two overloads allow streaming a wide C string to a Message
// using the UTF-8 encoding. // using the UTF-8 encoding.
Message& operator <<(const wchar_t* wide_c_str) { Message& operator <<(const wchar_t* wide_c_str);
return *this << internal::String::ShowWideCString(wide_c_str); Message& operator <<(wchar_t* wide_c_str);
}
Message& operator <<(wchar_t* wide_c_str) {
return *this << internal::String::ShowWideCString(wide_c_str);
}
#if GTEST_HAS_STD_WSTRING #if GTEST_HAS_STD_WSTRING
// Converts the given wide string to a narrow string using the UTF-8 // Converts the given wide string to a narrow string using the UTF-8
// encoding, and streams the result to this Message object. // encoding, and streams the result to this Message object.
Message& operator <<(const ::std::wstring& wstr); Message& operator <<(const ::std::wstring& wstr);
#endif // GTEST_HAS_STD_WSTRING #endif // GTEST_HAS_STD_WSTRING
#if GTEST_HAS_GLOBAL_WSTRING #if GTEST_HAS_GLOBAL_WSTRING
// Converts the given wide string to a narrow string using the UTF-8 // Converts the given wide string to a narrow string using the UTF-8
// encoding, and streams the result to this Message object. // encoding, and streams the result to this Message object.
Message& operator <<(const ::wstring& wstr); Message& operator <<(const ::wstring& wstr);
#endif // GTEST_HAS_GLOBAL_WSTRING #endif // GTEST_HAS_GLOBAL_WSTRING
// Gets the text streamed to this object so far as a String. // Gets the text streamed to this object so far as an std::string.
// Each '\0' character in the buffer is replaced with "\\0". // Each '\0' character in the buffer is replaced with "\\0".
// //
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
internal::String GetString() const { std::string GetString() const;
return internal::StringStreamToString(ss_.get());
}
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_
// decide between class template specializations for T and T*, so a // decide between class template specializations for T and T*, so a
// tr1::type_traits-like is_pointer works, and we can overload on that. // tr1::type_traits-like is_pointer works, and we can overload on that.
template <typename T> template <typename T>
inline void StreamHelper(internal::true_type /*dummy*/, T* pointer) { inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) {
if (pointer == NULL) { if (pointer == NULL) {
*ss_ << "(null)"; *ss_ << "(null)";
} else { } else {
::GTestStreamToHelper(ss_.get(), pointer); *ss_ << pointer;
} }
} }
template <typename T> template <typename T>
inline void StreamHelper(internal::false_type /*dummy*/, const T& value) inline void StreamHelper(internal::false_type /*is_pointer*/,
{ const T& value) {
::GTestStreamToHelper(ss_.get(), value); // See the comments in Message& operator <<(const T&) above for why
// we need this using statement.
using ::operator <<;
*ss_ << value;
} }
#endif // GTEST_OS_SYMBIAN #endif // GTEST_OS_SYMBIAN
// We'll hold the text streamed to this object here. // We'll hold the text streamed to this object here.
const internal::scoped_ptr< ::std::stringstream> ss_; const internal::scoped_ptr< ::std::stringstream> ss_;
// We declare (but don't implement) this to prevent the compiler // We declare (but don't implement) this to prevent the compiler
// from implementing the assignment operator. // from implementing the assignment operator.
void operator=(const Message&); void operator=(const Message&);
}; };
// Streams a Message to an ostream. // Streams a Message to an ostream.
inline std::ostream& operator <<(std::ostream& os, const Message& sb) { inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
return os << sb.GetString(); return os << sb.GetString();
} }
namespace internal {
// Converts a streamable value to an std::string. A NULL pointer is
// converted to "(null)". When the input value is a ::string,
// ::std::string, ::wstring, or ::std::wstring object, each NUL
// character in it is replaced with "\\0".
template <typename T>
std::string StreamableToString(const T& streamable) {
return (Message() << streamable).GetString();
}
} // namespace internal
} // namespace testing } // namespace testing
#endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
 End of changes. 11 change blocks. 
29 lines changed or deleted 47 lines changed or added


 gtest-param-test.h   gtest-param-test.h 
skipping to change at line 1259 skipping to change at line 1259
// TEST_P(AnimalTest, AnimalLooksNice) {...} // TEST_P(AnimalTest, AnimalLooksNice) {...}
// //
// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest, // INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
// Combine(Values("cat", "dog"), // Combine(Values("cat", "dog"),
// Values(BLACK, WHITE))); // Values(BLACK, WHITE)));
// //
// This will instantiate tests in FlagDependentTest with all variations of two // This will instantiate tests in FlagDependentTest with all variations of two
// Boolean flags: // Boolean flags:
// //
// class FlagDependentTest // class FlagDependentTest
// : public testing::TestWithParam<tuple(bool, bool)> > { // : public testing::TestWithParam<tuple<bool, bool> > {
// virtual void SetUp() { // virtual void SetUp() {
// // Assigns external_flag_1 and external_flag_2 values from the tuple . // // Assigns external_flag_1 and external_flag_2 values from the tuple .
// tie(external_flag_1, external_flag_2) = GetParam(); // tie(external_flag_1, external_flag_2) = GetParam();
// } // }
// }; // };
// //
// TEST_P(FlagDependentTest, TestFeature1) { // TEST_P(FlagDependentTest, TestFeature1) {
// // Test your code using external_flag_1 and external_flag_2 here. // // Test your code using external_flag_1 and external_flag_2 here.
// } // }
// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest, // INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 gtest-param-test.h.pump   gtest-param-test.h.pump 
skipping to change at line 416 skipping to change at line 416
// TEST_P(AnimalTest, AnimalLooksNice) {...} // TEST_P(AnimalTest, AnimalLooksNice) {...}
// //
// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest, // INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
// Combine(Values("cat", "dog"), // Combine(Values("cat", "dog"),
// Values(BLACK, WHITE))); // Values(BLACK, WHITE)));
// //
// This will instantiate tests in FlagDependentTest with all variations of two // This will instantiate tests in FlagDependentTest with all variations of two
// Boolean flags: // Boolean flags:
// //
// class FlagDependentTest // class FlagDependentTest
// : public testing::TestWithParam<tuple(bool, bool)> > { // : public testing::TestWithParam<tuple<bool, bool> > {
// virtual void SetUp() { // virtual void SetUp() {
// // Assigns external_flag_1 and external_flag_2 values from the tuple . // // Assigns external_flag_1 and external_flag_2 values from the tuple .
// tie(external_flag_1, external_flag_2) = GetParam(); // tie(external_flag_1, external_flag_2) = GetParam();
// } // }
// }; // };
// //
// TEST_P(FlagDependentTest, TestFeature1) { // TEST_P(FlagDependentTest, TestFeature1) {
// // Test your code using external_flag_1 and external_flag_2 here. // // Test your code using external_flag_1 and external_flag_2 here.
// } // }
// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest, // INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 gtest-param-util-generated.h   gtest-param-util-generated.h 
skipping to change at line 98 skipping to change at line 98
const T1 v1_; const T1 v1_;
}; };
template <typename T1, typename T2> template <typename T1, typename T2>
class ValueArray2 { class ValueArray2 {
public: public:
ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {} ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_}; const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray2& other); void operator=(const ValueArray2& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
}; };
template <typename T1, typename T2, typename T3> template <typename T1, typename T2, typename T3>
class ValueArray3 { class ValueArray3 {
public: public:
ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {} ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_}; const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
static_cast<T>(v3_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray3& other); void operator=(const ValueArray3& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
}; };
template <typename T1, typename T2, typename T3, typename T4> template <typename T1, typename T2, typename T3, typename T4>
class ValueArray4 { class ValueArray4 {
public: public:
ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3), ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3),
v4_(v4) {} v4_(v4) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_}; const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
static_cast<T>(v3_), static_cast<T>(v4_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray4& other); void operator=(const ValueArray4& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 160 skipping to change at line 162
}; };
template <typename T1, typename T2, typename T3, typename T4, typename T5> template <typename T1, typename T2, typename T3, typename T4, typename T5>
class ValueArray5 { class ValueArray5 {
public: public:
ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3 ), ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3 ),
v4_(v4), v5_(v5) {} v4_(v4), v5_(v5) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_}; const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray5& other); void operator=(const ValueArray5& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 184 skipping to change at line 187
template <typename T1, typename T2, typename T3, typename T4, typename T5, template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6> typename T6>
class ValueArray6 { class ValueArray6 {
public: public:
ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2), ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2),
v3_(v3), v4_(v4), v5_(v5), v6_(v6) {} v3_(v3), v4_(v4), v5_(v5), v6_(v6) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_}; const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
static_cast<T>(v6_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray6& other); void operator=(const ValueArray6& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 209 skipping to change at line 214
template <typename T1, typename T2, typename T3, typename T4, typename T5, template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7> typename T6, typename T7>
class ValueArray7 { class ValueArray7 {
public: public:
ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1), ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1),
v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {} v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_}; const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
static_cast<T>(v6_), static_cast<T>(v7_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray7& other); void operator=(const ValueArray7& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 236 skipping to change at line 243
template <typename T1, typename T2, typename T3, typename T4, typename T5, template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8> typename T6, typename T7, typename T8>
class ValueArray8 { class ValueArray8 {
public: public:
ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7 ), T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7 ),
v8_(v8) {} v8_(v8) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_}; const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray8& other); void operator=(const ValueArray8& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 264 skipping to change at line 273
template <typename T1, typename T2, typename T3, typename T4, typename T5, template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9> typename T6, typename T7, typename T8, typename T9>
class ValueArray9 { class ValueArray9 {
public: public:
ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7 ), T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7 ),
v8_(v8), v9_(v9) {} v8_(v8), v9_(v9) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_}; const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
static_cast<T>(v9_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray9& other); void operator=(const ValueArray9& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 293 skipping to change at line 305
template <typename T1, typename T2, typename T3, typename T4, typename T5, template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10> typename T6, typename T7, typename T8, typename T9, typename T10>
class ValueArray10 { class ValueArray10 {
public: public:
ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7), T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7),
v8_(v8), v9_(v9), v10_(v10) {} v8_(v8), v9_(v9), v10_(v10) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_}; const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
static_cast<T>(v9_), static_cast<T>(v10_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray10& other); void operator=(const ValueArray10& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 324 skipping to change at line 339
typename T6, typename T7, typename T8, typename T9, typename T10, typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11> typename T11>
class ValueArray11 { class ValueArray11 {
public: public:
ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_( v6), T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_( v6),
v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {} v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_}; static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray11& other); void operator=(const ValueArray11& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 356 skipping to change at line 374
typename T6, typename T7, typename T8, typename T9, typename T10, typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12> typename T11, typename T12>
class ValueArray12 { class ValueArray12 {
public: public:
ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_( v5), T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_( v5),
v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) { } v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) { }
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_}; static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
static_cast<T>(v12_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray12& other); void operator=(const ValueArray12& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 391 skipping to change at line 412
typename T11, typename T12, typename T13> typename T11, typename T12, typename T13>
class ValueArray13 { class ValueArray13 {
public: public:
ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_( v4), T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_( v4),
v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
v12_(v12), v13_(v13) {} v12_(v12), v13_(v13) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_}; static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
static_cast<T>(v12_), static_cast<T>(v13_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray13& other); void operator=(const ValueArray13& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 427 skipping to change at line 451
typename T11, typename T12, typename T13, typename T14> typename T11, typename T12, typename T13, typename T14>
class ValueArray14 { class ValueArray14 {
public: public:
ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_( v3), T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_( v3),
v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
v11_(v11), v12_(v12), v13_(v13), v14_(v14) {} v11_(v11), v12_(v12), v13_(v13), v14_(v14) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_}; static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray14& other); void operator=(const ValueArray14& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 464 skipping to change at line 491
typename T11, typename T12, typename T13, typename T14, typename T15> typename T11, typename T12, typename T13, typename T14, typename T15>
class ValueArray15 { class ValueArray15 {
public: public:
ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_( v2), T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_( v2),
v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v 10), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v 10),
v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {} v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_}; static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray15& other); void operator=(const ValueArray15& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 504 skipping to change at line 535
class ValueArray16 { class ValueArray16 {
public: public:
ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_( v1), T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_( v1),
v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9 ), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9 ),
v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
v16_(v16) {} v16_(v16) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_}; static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray16& other); void operator=(const ValueArray16& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 545 skipping to change at line 580
class ValueArray17 { class ValueArray17 {
public: public:
ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7), T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7),
v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4),
v15_(v15), v16_(v16), v17_(v17) {} v15_(v15), v16_(v16), v17_(v17) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_}; static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray17& other); void operator=(const ValueArray17& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 587 skipping to change at line 626
class ValueArray18 { class ValueArray18 {
public: public:
ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7,
T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7), T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7),
v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4),
v15_(v15), v16_(v16), v17_(v17), v18_(v18) {} v15_(v15), v16_(v16), v17_(v17), v18_(v18) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_}; static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray18& other); void operator=(const ValueArray18& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 630 skipping to change at line 674
class ValueArray19 { class ValueArray19 {
public: public:
ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7,
T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_( v6), T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_( v6),
v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13) , v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13) ,
v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {} v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_}; static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray19& other); void operator=(const ValueArray19& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 675 skipping to change at line 724
public: public:
ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7,
T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_( v5), T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_( v5),
v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
v19_(v19), v20_(v20) {} v19_(v19), v20_(v20) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_}; static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray20& other); void operator=(const ValueArray20& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 722 skipping to change at line 776
public: public:
ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7,
T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_( v4), T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_( v4),
v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
v18_(v18), v19_(v19), v20_(v20), v21_(v21) {} v18_(v18), v19_(v19), v20_(v20), v21_(v21) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_}; static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray21& other); void operator=(const ValueArray21& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 770 skipping to change at line 830
public: public:
ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_( v3), T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_( v3),
v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {} v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_}; static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray22& other); void operator=(const ValueArray22& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 820 skipping to change at line 886
ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_( v2), T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_( v2),
v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v 10), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v 10),
v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
v23_(v23) {} v23_(v23) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
v23_}; static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray23& other); void operator=(const ValueArray23& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 872 skipping to change at line 943
ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_( v1), T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_( v1),
v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9 ), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9 ),
v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
v22_(v22), v23_(v23), v24_(v24) {} v22_(v22), v23_(v23), v24_(v24) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_}; static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray24& other); void operator=(const ValueArray24& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 925 skipping to change at line 1002
ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7), T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7),
v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4),
v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {} v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_}; static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray25& other); void operator=(const ValueArray25& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 980 skipping to change at line 1063
ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9, ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v 9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v2 5, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v2 5,
T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7), T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7),
v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4),
v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {} v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_}; static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray26& other); void operator=(const ValueArray26& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1037 skipping to change at line 1126
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v2 5, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v2 5,
T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_( v6), T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_( v6),
v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13) , v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13) ,
v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
v26_(v26), v27_(v27) {} v26_(v26), v27_(v27) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_}; static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray27& other); void operator=(const ValueArray27& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1095 skipping to change at line 1191
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v2 5, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v2 5,
T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_( v5), T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_( v5),
v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
v25_(v25), v26_(v26), v27_(v27), v28_(v28) {} v25_(v25), v26_(v26), v27_(v27), v28_(v28) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_}; static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray28& other); void operator=(const ValueArray28& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1154 skipping to change at line 1257
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v1 7,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v2 5, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v2 5,
T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_( v4), T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_( v4),
v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {} v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_}; static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray29& other); void operator=(const ValueArray29& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1215 skipping to change at line 1325
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v2 5, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v2 5,
T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_( v3), T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_( v3),
v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
v29_(v29), v30_(v30) {} v29_(v29), v30_(v30) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_}; static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray30& other); void operator=(const ValueArray30& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1278 skipping to change at line 1396
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v2 5, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v2 5,
T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_( v2), T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_( v2),
v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v 10), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v 10),
v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
v29_(v29), v30_(v30), v31_(v31) {} v29_(v29), v30_(v30), v31_(v31) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_}; static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray31& other); void operator=(const ValueArray31& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1342 skipping to change at line 1468
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v2 5, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v2 5,
T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_( v1), T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_( v1),
v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9 ), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9 ),
v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {} v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_}; static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray32& other); void operator=(const ValueArray32& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1408 skipping to change at line 1542
T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7), T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7),
v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4),
v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
v33_(v33) {} v33_(v33) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_}; static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray33& other); void operator=(const ValueArray33& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1475 skipping to change at line 1618
T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v3 3, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v3 3,
T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7), T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7),
v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4),
v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
v33_(v33), v34_(v34) {} v33_(v33), v34_(v34) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_}; static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray34& other); void operator=(const ValueArray34& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1543 skipping to change at line 1695
T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v3 3, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v3 3,
T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_( v6), T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_( v6),
v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13) , v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13) ,
v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
v32_(v32), v33_(v33), v34_(v34), v35_(v35) {} v32_(v32), v33_(v33), v34_(v34), v35_(v35) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
v35_}; static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray35& other); void operator=(const ValueArray35& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1614 skipping to change at line 1774
T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v3 3, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v3 3,
T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_( v5), T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_( v5),
v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {} v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_}; static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray36& other); void operator=(const ValueArray36& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1687 skipping to change at line 1856
T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_( v4), T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_( v4),
v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
v36_(v36), v37_(v37) {} v36_(v36), v37_(v37) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_, v37_}; static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_), static_cast<T>(v37_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray37& other); void operator=(const ValueArray37& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1761 skipping to change at line 1939
T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_( v3), T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_( v3),
v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
v35_(v35), v36_(v36), v37_(v37), v38_(v38) {} v35_(v35), v36_(v36), v37_(v37), v38_(v38) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_, v37_, v38_}; static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray38& other); void operator=(const ValueArray38& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1836 skipping to change at line 2023
T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_( v2), T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_( v2),
v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v 10), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v 10),
v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {} v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_, v37_, v38_, v39_}; static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
static_cast<T>(v39_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray39& other); void operator=(const ValueArray39& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1913 skipping to change at line 2110
v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9 ), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9 ),
v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
v40_(v40) {} v40_(v40) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_, v37_, v38_, v39_, v40_}; static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
static_cast<T>(v39_), static_cast<T>(v40_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray40& other); void operator=(const ValueArray40& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 1992 skipping to change at line 2199
T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7), T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7),
v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4),
v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
v39_(v39), v40_(v40), v41_(v41) {} v39_(v39), v40_(v40), v41_(v41) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_, v37_, v38_, v39_, v40_, v41_}; static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray41& other); void operator=(const ValueArray41& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 2072 skipping to change at line 2289
T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7), T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_( v7),
v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4),
v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
v39_(v39), v40_(v40), v41_(v41), v42_(v42) {} v39_(v39), v40_(v40), v41_(v41), v42_(v42) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_, v37_, v38_, v39_, v40_, v41_, v42_}; static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
static_cast<T>(v42_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray42& other); void operator=(const ValueArray42& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 2153 skipping to change at line 2381
T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_( v6), T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_( v6),
v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13) , v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13) ,
v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37),
v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {} v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_}; static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
static_cast<T>(v42_), static_cast<T>(v43_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray43& other); void operator=(const ValueArray43& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 2236 skipping to change at line 2475
v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36),
v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42),
v43_(v43), v44_(v44) {} v43_(v43), v44_(v44) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_}; static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray44& other); void operator=(const ValueArray44& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 2320 skipping to change at line 2570
v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41),
v42_(v42), v43_(v43), v44_(v44), v45_(v45) {} v42_(v42), v43_(v43), v44_(v44), v45_(v45) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_}; static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
static_cast<T>(v45_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray45& other); void operator=(const ValueArray45& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 2406 skipping to change at line 2668
v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {} v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_}; static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
static_cast<T>(v45_), static_cast<T>(v46_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray46& other); void operator=(const ValueArray46& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 2494 skipping to change at line 2768
v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46),
v47_(v47) {} v47_(v47) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
v47_}; static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray47& other); void operator=(const ValueArray47& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 2584 skipping to change at line 2869
v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45),
v46_(v46), v47_(v47), v48_(v48) {} v46_(v46), v47_(v47), v48_(v48) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
47_, static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
v48_}; static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
static_cast<T>(v48_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray48& other); void operator=(const ValueArray48& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 2675 skipping to change at line 2972
v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4),
v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {} v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
47_, static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
v48_, v49_}; static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
static_cast<T>(v48_), static_cast<T>(v49_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray49& other); void operator=(const ValueArray49& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
skipping to change at line 2767 skipping to change at line 3076
v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v1 4),
v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {} v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11_, static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
23_, static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
35_, static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
47_, static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
v48_, v49_, v50_}; static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
static_cast<T>(v48_), static_cast<T>(v49_), static_cast<T>(v50_)};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray50& other); void operator=(const ValueArray50& other);
const T1 v1_; const T1 v1_;
const T2 v2_; const T2 v2_;
const T3 v3_; const T3 v3_;
 End of changes. 49 change blocks. 
221 lines changed or deleted 457 lines changed or added


 gtest-param-util-generated.h.pump   gtest-param-util-generated.h.pump 
skipping to change at line 101 skipping to change at line 101
$for i [[ $for i [[
$range j 1..i $range j 1..i
template <$for j, [[typename T$j]]> template <$for j, [[typename T$j]]>
class ValueArray$i { class ValueArray$i {
public: public:
ValueArray$i($for j, [[T$j v$j]]) : $for j, [[v$(j)_(v$j)]] {} ValueArray$i($for j, [[T$j v$j]]) : $for j, [[v$(j)_(v$j)]] {}
template <typename T> template <typename T>
operator ParamGenerator<T>() const { operator ParamGenerator<T>() const {
const T array[] = {$for j, [[v$(j)_]]}; const T array[] = {$for j, [[static_cast<T>(v$(j)_)]]};
return ValuesIn(array); return ValuesIn(array);
} }
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const ValueArray$i& other); void operator=(const ValueArray$i& other);
$for j [[ $for j [[
const T$j v$(j)_; const T$j v$(j)_;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 gtest-param-util.h   gtest-param-util.h 
skipping to change at line 496 skipping to change at line 496
virtual void RegisterTests() { virtual void RegisterTests() {
for (typename TestInfoContainer::iterator test_it = tests_.begin(); for (typename TestInfoContainer::iterator test_it = tests_.begin();
test_it != tests_.end(); ++test_it) { test_it != tests_.end(); ++test_it) {
linked_ptr<TestInfo> test_info = *test_it; linked_ptr<TestInfo> test_info = *test_it;
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->first; const string& instantiation_name = gen_it->first;
ParamGenerator<ParamType> generator((*gen_it->second)()); ParamGenerator<ParamType> generator((*gen_it->second)());
Message test_case_name_stream; string test_case_name;
if ( !instantiation_name.empty() ) if ( !instantiation_name.empty() )
test_case_name_stream << instantiation_name << "/"; test_case_name = instantiation_name + "/";
test_case_name_stream << test_info->test_case_base_name; test_case_name += test_info->test_case_base_name;
int i = 0; int i = 0;
for (typename ParamGenerator<ParamType>::iterator param_it = for (typename ParamGenerator<ParamType>::iterator param_it =
generator.begin(); generator.begin();
param_it != generator.end(); ++param_it, ++i) { param_it != generator.end(); ++param_it, ++i) {
Message test_name_stream; Message test_name_stream;
test_name_stream << test_info->test_base_name << "/" << i; test_name_stream << test_info->test_base_name << "/" << i;
MakeAndRegisterTestInfo( MakeAndRegisterTestInfo(
test_case_name_stream.GetString().c_str(), test_case_name.c_str(),
test_name_stream.GetString().c_str(), test_name_stream.GetString().c_str(),
NULL, // No type parameter. NULL, // No type parameter.
PrintToString(*param_it).c_str(), PrintToString(*param_it).c_str(),
GetTestCaseTypeId(), GetTestCaseTypeId(),
TestCase::SetUpTestCase, TestCase::SetUpTestCase,
TestCase::TearDownTestCase, TestCase::TearDownTestCase,
test_info->test_meta_factory->CreateTestFactory(*param_it)); test_info->test_meta_factory->CreateTestFactory(*param_it));
} // for param_it } // for param_it
} // for gen_it } // for gen_it
} // for test_it } // for test_it
 End of changes. 3 change blocks. 
4 lines changed or deleted 4 lines changed or added


 gtest-port.h   gtest-port.h 
skipping to change at line 35 skipping to change at line 35
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// 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.
// //
// Authors: wan@google.com (Zhanyong Wan) // 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. They are subject to change without notice. DO NOT USE // platforms. They are subject to change without notice. DO NOT USE
// THEM IN USER CODE. // THEM IN USER CODE.
//
// This file is fundamental to Google Test. All other Google Test source
// files are expected to #include this. Therefore, it cannot #include
// any other Google Test header.
#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_
// The user can define the following macros in the build script to // The user can define the following macros in the build script to
// control Google Test's behavior. If the user doesn't define a macro // control Google Test's behavior. If the user doesn't define a macro
// in this list, Google Test will define it. // in this list, Google Test will define it.
// //
// GTEST_HAS_CLONE - Define it to 1/0 to indicate that clone(2) // GTEST_HAS_CLONE - Define it to 1/0 to indicate that clone(2)
// is/isn't available. // is/isn't available.
skipping to change at line 75 skipping to change at line 79
// compiler supports Microsoft's "Structured // compiler supports Microsoft's "Structured
// Exception Handling". // Exception Handling".
// GTEST_HAS_STREAM_REDIRECTION // GTEST_HAS_STREAM_REDIRECTION
// - Define it to 1/0 to indicate whether the // - Define it to 1/0 to indicate whether the
// platform supports I/O stream redirection us ing // platform supports I/O stream redirection us ing
// dup() and dup2(). // dup() and dup2().
// GTEST_USE_OWN_TR1_TUPLE - Define it to 1/0 to indicate whether Google // GTEST_USE_OWN_TR1_TUPLE - Define it to 1/0 to indicate whether Google
// Test's own tr1 tuple implementation should be // Test's own tr1 tuple implementation should be
// used. Unused when the user sets // used. Unused when the user sets
// GTEST_HAS_TR1_TUPLE to 0. // GTEST_HAS_TR1_TUPLE to 0.
// GTEST_LANG_CXX11 - Define it to 1/0 to indicate that Google Te
st
// is building in C++11/C++98 mode.
// GTEST_LINKED_AS_SHARED_LIBRARY // GTEST_LINKED_AS_SHARED_LIBRARY
// - Define to 1 when compiling tests that use // - Define to 1 when compiling tests that use
// Google Test as a shared library (known as // Google Test as a shared library (known as
// DLL on Windows). // DLL on Windows).
// GTEST_CREATE_SHARED_LIBRARY // GTEST_CREATE_SHARED_LIBRARY
// - Define to 1 when compiling Google Test itse lf // - Define to 1 when compiling Google Test itse lf
// as a shared library. // as a shared library.
// This header defines the following utilities: // This header defines the following utilities:
// //
// Macros indicating the current platform (defined to 1 if compiled on // Macros indicating the current platform (defined to 1 if compiled on
// the given platform; otherwise undefined): // the given platform; otherwise undefined):
// GTEST_OS_AIX - IBM AIX // GTEST_OS_AIX - IBM AIX
// GTEST_OS_CYGWIN - Cygwin // GTEST_OS_CYGWIN - Cygwin
// 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_SIMULATOR - iOS simulator
// GTEST_OS_NACL - Google Native Client (NaCl) // GTEST_OS_NACL - Google Native Client (NaCl)
// GTEST_OS_OPENBSD - OpenBSD
// GTEST_OS_QNX - QNX
// GTEST_OS_SOLARIS - Sun Solaris // GTEST_OS_SOLARIS - Sun Solaris
// GTEST_OS_SYMBIAN - Symbian // GTEST_OS_SYMBIAN - Symbian
// GTEST_OS_WINDOWS - Windows (Desktop, MinGW, or Mobile) // GTEST_OS_WINDOWS - Windows (Desktop, MinGW, or Mobile)
// GTEST_OS_WINDOWS_DESKTOP - Windows Desktop // GTEST_OS_WINDOWS_DESKTOP - Windows Desktop
// GTEST_OS_WINDOWS_MINGW - MinGW // GTEST_OS_WINDOWS_MINGW - MinGW
// GTEST_OS_WINDOWS_MOBILE - Windows Mobile // GTEST_OS_WINDOWS_MOBILE - Windows Mobile
// GTEST_OS_ZOS - z/OS // GTEST_OS_ZOS - z/OS
// //
// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the // Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
// most stable support. Since core members of the Google Test project // most stable support. Since core members of the Google Test project
skipping to change at line 178 skipping to change at line 188
// Integer types: // Integer types:
// TypeWithSize - maps an integer to a int type. // TypeWithSize - maps an integer to a int type.
// Int32, UInt32, Int64, UInt64, TimeInMillis // Int32, UInt32, Int64, UInt64, TimeInMillis
// - integers of known sizes. // - integers of known sizes.
// BiggestInt - the biggest signed integer type. // BiggestInt - the biggest signed integer type.
// //
// Command-line utilities: // Command-line utilities:
// GTEST_FLAG() - references a flag. // GTEST_FLAG() - references a flag.
// GTEST_DECLARE_*() - declares a flag. // GTEST_DECLARE_*() - declares a flag.
// GTEST_DEFINE_*() - defines a flag. // GTEST_DEFINE_*() - defines a flag.
// GetArgvs() - returns the command line as a vector of strings. // GetInjectableArgvs() - returns the command line as a vector of strings .
// //
// Environment variable utilities: // Environment variable utilities:
// GetEnv() - gets the value of an environment variable. // GetEnv() - gets the value of an environment variable.
// BoolFromGTestEnv() - parses a bool environment variable. // BoolFromGTestEnv() - parses a bool environment variable.
// Int32FromGTestEnv() - parses an Int32 environment variable. // Int32FromGTestEnv() - parses an Int32 environment variable.
// StringFromGTestEnv() - parses a string environment variable. // StringFromGTestEnv() - parses a string environment variable.
#include <ctype.h> // for isspace, etc #include <ctype.h> // for isspace, etc
#include <stddef.h> // for ptrdiff_t #include <stddef.h> // for ptrdiff_t
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifndef _WIN32_WCE #ifndef _WIN32_WCE
# include <sys/types.h> # include <sys/types.h>
# include <sys/stat.h> # include <sys/stat.h>
#endif // !_WIN32_WCE #endif // !_WIN32_WCE
#if defined __APPLE__
# include <AvailabilityMacros.h>
# include <TargetConditionals.h>
#endif
#include <iostream> // NOLINT #include <iostream> // NOLINT
#include <sstream> // NOLINT #include <sstream> // NOLINT
#include <string> // NOLINT #include <string> // NOLINT
#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com" #define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
#define GTEST_FLAG_PREFIX_ "gtest_" #define GTEST_FLAG_PREFIX_ "gtest_"
#define GTEST_FLAG_PREFIX_DASH_ "gtest-" #define GTEST_FLAG_PREFIX_DASH_ "gtest-"
#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_" #define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
#define GTEST_NAME_ "Google Test" #define GTEST_NAME_ "Google Test"
#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/" #define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
skipping to change at line 230 skipping to change at line 245
# define GTEST_OS_WINDOWS 1 # define GTEST_OS_WINDOWS 1
# ifdef _WIN32_WCE # ifdef _WIN32_WCE
# define GTEST_OS_WINDOWS_MOBILE 1 # define GTEST_OS_WINDOWS_MOBILE 1
# elif defined(__MINGW__) || defined(__MINGW32__) # elif defined(__MINGW__) || defined(__MINGW32__)
# define GTEST_OS_WINDOWS_MINGW 1 # define GTEST_OS_WINDOWS_MINGW 1
# else # else
# define GTEST_OS_WINDOWS_DESKTOP 1 # define GTEST_OS_WINDOWS_DESKTOP 1
# endif // _WIN32_WCE # endif // _WIN32_WCE
#elif defined __APPLE__ #elif defined __APPLE__
# define GTEST_OS_MAC 1 # define GTEST_OS_MAC 1
# if TARGET_OS_IPHONE
# define GTEST_OS_IOS 1
# if TARGET_IPHONE_SIMULATOR
# define GTEST_OS_IOS_SIMULATOR 1
# endif
# endif
#elif defined __linux__ #elif defined __linux__
# define GTEST_OS_LINUX 1 # define GTEST_OS_LINUX 1
# ifdef ANDROID # if defined __ANDROID__
# define GTEST_OS_LINUX_ANDROID 1 # define GTEST_OS_LINUX_ANDROID 1
# endif // ANDROID # endif
#elif defined __MVS__ #elif defined __MVS__
# define GTEST_OS_ZOS 1 # define GTEST_OS_ZOS 1
#elif defined(__sun) && defined(__SVR4) #elif defined(__sun) && defined(__SVR4)
# define GTEST_OS_SOLARIS 1 # define GTEST_OS_SOLARIS 1
#elif defined(_AIX) #elif defined(_AIX)
# define GTEST_OS_AIX 1 # define GTEST_OS_AIX 1
#elif defined(__hpux) #elif defined(__hpux)
# 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 __OpenBSD__
# define GTEST_OS_OPENBSD 1
#elif defined __QNX__
# define GTEST_OS_QNX 1
#endif // __CYGWIN__ #endif // __CYGWIN__
#ifndef GTEST_LANG_CXX11
// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
// -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a
// value for __cplusplus, and recent versions of clang, gcc, and
// probably other compilers set that too in C++11 mode.
# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
// Compiling in at least C++11 mode.
# define GTEST_LANG_CXX11 1
# else
# define GTEST_LANG_CXX11 0
# endif
#endif
// Brings in definitions for functions used in the testing::internal::posix // Brings in definitions for functions used in the testing::internal::posix
// namespace (read, write, close, chdir, isatty, stat). We do not currently // namespace (read, write, close, chdir, isatty, stat). We do not currently
// use them on Windows Mobile. // use them on Windows Mobile.
#if !GTEST_OS_WINDOWS #if !GTEST_OS_WINDOWS
// 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
// mentioned above. // mentioned above.
# include <unistd.h> # include <unistd.h>
# if !GTEST_OS_NACL # include <strings.h>
// TODO(vladl@google.com): Remove this condition when Native Client SDK add
s
// strings.h (tracked in
// http://code.google.com/p/nativeclient/issues/detail?id=1175).
# include <strings.h> // Native Client doesn't provide strings.h.
# endif
#elif !GTEST_OS_WINDOWS_MOBILE #elif !GTEST_OS_WINDOWS_MOBILE
# include <direct.h> # include <direct.h>
# include <io.h> # include <io.h>
#endif #endif
#if GTEST_OS_LINUX_ANDROID
// Used to define __ANDROID_API__ matching the target NDK API level.
# include <android/api-level.h> // NOLINT
#endif
// Defines this to true iff Google Test can use POSIX regular expressions. // Defines this to true iff Google Test can use POSIX regular expressions.
#ifndef GTEST_HAS_POSIX_RE #ifndef GTEST_HAS_POSIX_RE
# define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS) # if GTEST_OS_LINUX_ANDROID
// On Android, <regex.h> is only available starting with Gingerbread.
# define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
# else
# define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
# endif
#endif #endif
#if GTEST_HAS_POSIX_RE #if GTEST_HAS_POSIX_RE
// On some platforms, <regex.h> needs someone to define size_t, and // On some platforms, <regex.h> needs someone to define size_t, and
// won't compile otherwise. We can #include it here as we already // won't compile otherwise. We can #include it here as we already
// included <stdlib.h>, which is guaranteed to define size_t through // included <stdlib.h>, which is guaranteed to define size_t through
// <stddef.h>. // <stddef.h>.
# include <regex.h> // NOLINT # include <regex.h> // NOLINT
skipping to change at line 383 skipping to change at line 426
# ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled. # ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled.
# define GTEST_HAS_RTTI 1 # define GTEST_HAS_RTTI 1
# else # else
# define GTEST_HAS_RTTI 0 # define GTEST_HAS_RTTI 0
# endif # endif
// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled. // Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302) # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
# ifdef __GXX_RTTI # ifdef __GXX_RTTI
# define GTEST_HAS_RTTI 1 // When building against STLport with the Android NDK and with
// -frtti -fno-exceptions, the build fails at link time with undefined
// references to __cxa_bad_typeid. Note sure if STL or toolchain bug,
// so disable RTTI when detected.
# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \
!defined(__EXCEPTIONS)
# define GTEST_HAS_RTTI 0
# else
# define GTEST_HAS_RTTI 1
# endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS
# else # else
# define GTEST_HAS_RTTI 0 # define GTEST_HAS_RTTI 0
# endif // __GXX_RTTI # endif // __GXX_RTTI
// Clang defines __GXX_RTTI starting with version 3.0, but its manual recom
mends
// using has_feature instead. has_feature(cxx_rtti) is supported since 2.7,
the
// first version with C++ support.
# elif defined(__clang__)
# define GTEST_HAS_RTTI __has_feature(cxx_rtti)
// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if // Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
// both the typeid and dynamic_cast features are present. // both the typeid and dynamic_cast features are present.
# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900) # elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
# ifdef __RTTI_ALL__ # ifdef __RTTI_ALL__
# define GTEST_HAS_RTTI 1 # define GTEST_HAS_RTTI 1
# else # else
# define GTEST_HAS_RTTI 0 # define GTEST_HAS_RTTI 0
# endif # endif
skipping to change at line 420 skipping to change at line 479
# include <typeinfo> # include <typeinfo>
#endif #endif
// Determines whether Google Test can use the pthreads library. // Determines whether Google Test can use the pthreads library.
#ifndef GTEST_HAS_PTHREAD #ifndef GTEST_HAS_PTHREAD
// The user didn't tell us explicitly, so we assume pthreads support is // The user didn't tell us explicitly, so we assume pthreads support is
// available on Linux and Mac. // available on Linux and Mac.
// //
// 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_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX
) \
|| GTEST_OS_QNX)
#endif // GTEST_HAS_PTHREAD #endif // GTEST_HAS_PTHREAD
#if GTEST_HAS_PTHREAD #if GTEST_HAS_PTHREAD
// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD i s // gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD i s
// true. // true.
# include <pthread.h> // NOLINT # include <pthread.h> // NOLINT
// For timespec and nanosleep, used below. // For timespec and nanosleep, used below.
# include <time.h> // NOLINT # include <time.h> // NOLINT
#endif #endif
// Determines whether Google Test can use tr1/tuple. You can define // Determines whether Google Test can use tr1/tuple. You can define
// this macro to 0 to prevent Google Test from using tuple (any // this macro to 0 to prevent Google Test from using tuple (any
// feature depending on tuple with be disabled in this mode). // feature depending on tuple with be disabled in this mode).
#ifndef GTEST_HAS_TR1_TUPLE #ifndef GTEST_HAS_TR1_TUPLE
# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR)
// STLport, provided with the Android NDK, has neither <tr1/tuple> or <tupl
e>.
# define GTEST_HAS_TR1_TUPLE 0
# 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
# endif
#endif // GTEST_HAS_TR1_TUPLE #endif // GTEST_HAS_TR1_TUPLE
// 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
// 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
// implementation of it already. At this time, GCC 4.0.0+ and MSVC // implementation of it already. At this time, libstdc++ 4.0.0+ and
// 2010 are the only mainstream compilers that come with a TR1 tuple // MSVC 2010 are the only mainstream standard libraries that come
// implementation. NVIDIA's CUDA NVCC compiler pretends to be GCC by // with a TR1 tuple implementation. NVIDIA's CUDA NVCC compiler
// defining __GNUC__ and friends, but cannot compile GCC's tuple // pretends to be GCC by defining __GNUC__ and friends, but cannot
// implementation. MSVC 2008 (9.0) provides TR1 tuple in a 323 MB // compile GCC's tuple implementation. MSVC 2008 (9.0) provides TR1
// Feature Pack download, which we cannot assume the user has. // tuple in a 323 MB Feature Pack download, which we cannot assume the
# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000 // user has. QNX's QCC compiler is a modified GCC but it doesn't
)) \ // support TR1 tuple. libc++ only provides std::tuple, in C++11 mode,
|| _MSC_VER >= 1600 // and it can be used with some compilers that define __GNUC__.
# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000
) \
&& !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600
# define GTEST_ENV_HAS_TR1_TUPLE_ 1
# endif
// C++11 specifies that <tuple> provides std::tuple. Use that if gtest is u
sed
// in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6
// can build with clang but need to use gcc4.2's libstdc++).
# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
# define GTEST_ENV_HAS_STD_TUPLE_ 1
# endif
# if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_
# define GTEST_USE_OWN_TR1_TUPLE 0 # define GTEST_USE_OWN_TR1_TUPLE 0
# else # else
# define GTEST_USE_OWN_TR1_TUPLE 1 # define GTEST_USE_OWN_TR1_TUPLE 1
# endif # endif
#endif // GTEST_USE_OWN_TR1_TUPLE #endif // GTEST_USE_OWN_TR1_TUPLE
// To avoid conditional compilation everywhere, we make it // To avoid conditional compilation everywhere, we make it
// gtest-port.h's responsibility to #include the header implementing // gtest-port.h's responsibility to #include the header implementing
// tr1/tuple. // tr1/tuple.
#if GTEST_HAS_TR1_TUPLE #if GTEST_HAS_TR1_TUPLE
# if GTEST_USE_OWN_TR1_TUPLE # if GTEST_USE_OWN_TR1_TUPLE
# include "gtest/internal/gtest-tuple.h" # include "gtest/internal/gtest-tuple.h"
# 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
// use STLport's tuple implementation, which unfortunately doesn't // use STLport's tuple implementation, which unfortunately doesn't
// work as the copy of STLport distributed with Symbian is incomplete. // work as the copy of STLport distributed with Symbian is incomplete.
// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to // By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
// use its own tuple implementation. // use its own tuple implementation.
# ifdef BOOST_HAS_TR1_TUPLE # ifdef BOOST_HAS_TR1_TUPLE
# undef BOOST_HAS_TR1_TUPLE # undef BOOST_HAS_TR1_TUPLE
# endif // BOOST_HAS_TR1_TUPLE # endif // BOOST_HAS_TR1_TUPLE
skipping to change at line 518 skipping to change at line 613
#endif // GTEST_HAS_TR1_TUPLE #endif // GTEST_HAS_TR1_TUPLE
// Determines whether clone(2) is supported. // Determines whether clone(2) is supported.
// Usually it will only be available on Linux, excluding // Usually it will only be available on Linux, excluding
// Linux on the Itanium architecture. // Linux on the Itanium architecture.
// Also see http://linux.die.net/man/2/clone. // Also see http://linux.die.net/man/2/clone.
#ifndef GTEST_HAS_CLONE #ifndef GTEST_HAS_CLONE
// 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.
# if GTEST_OS_LINUX && !defined(__ia64__) # if GTEST_OS_LINUX && !defined(__ia64__)
# define GTEST_HAS_CLONE 1 # if GTEST_OS_LINUX_ANDROID
// On Android, clone() is only available on ARM starting with Gingerbread.
# if defined(__arm__) && __ANDROID_API__ >= 9
# define GTEST_HAS_CLONE 1
# else
# define GTEST_HAS_CLONE 0
# endif
# else
# define GTEST_HAS_CLONE 1
# endif
# else # else
# define GTEST_HAS_CLONE 0 # define GTEST_HAS_CLONE 0
# endif // GTEST_OS_LINUX && !defined(__ia64__) # endif // GTEST_OS_LINUX && !defined(__ia64__)
#endif // GTEST_HAS_CLONE #endif // GTEST_HAS_CLONE
// Determines whether to support stream redirection. This is used to test // Determines whether to support stream redirection. This is used to test
// output correctness and to implement death tests. // output correctness and to implement death tests.
#ifndef GTEST_HAS_STREAM_REDIRECTION #ifndef GTEST_HAS_STREAM_REDIRECTION
// By default, we assume that stream redirection is supported on all // By default, we assume that stream redirection is supported on all
skipping to change at line 541 skipping to change at line 645
# define GTEST_HAS_STREAM_REDIRECTION 0 # define GTEST_HAS_STREAM_REDIRECTION 0
# else # else
# define GTEST_HAS_STREAM_REDIRECTION 1 # define GTEST_HAS_STREAM_REDIRECTION 1
# endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN # endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN
#endif // GTEST_HAS_STREAM_REDIRECTION #endif // GTEST_HAS_STREAM_REDIRECTION
// Determines whether to support death tests. // Determines whether to support death tests.
// Google Test does not support death tests for VC 7.1 and earlier as // Google Test does not support death tests for VC 7.1 and earlier as
// abort() in a VC 7.1 application compiled as GUI in debug config // abort() in a VC 7.1 application compiled as GUI in debug config
// pops up a dialog window that cannot be suppressed programmatically. // pops up a dialog window that cannot be suppressed programmatically.
#if (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS #if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
|| \ (GTEST_OS_MAC && !GTEST_OS_IOS) || GTEST_OS_IOS_SIMULATOR || \
(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)
# define GTEST_HAS_DEATH_TEST 1 # define GTEST_HAS_DEATH_TEST 1
# include <vector> // NOLINT # include <vector> // NOLINT
#endif #endif
// We don't support MSVC 7.1 with exceptions disabled now. Therefore // We don't support MSVC 7.1 with exceptions disabled now. Therefore
// all the compilers we care about are adequate for supporting // all the compilers we care about are adequate for supporting
// value-parameterized tests. // value-parameterized tests.
#define GTEST_HAS_PARAM_TEST 1 #define GTEST_HAS_PARAM_TEST 1
// Determines whether to support type-driven tests. // Determines whether to support type-driven tests.
skipping to change at line 672 skipping to change at line 778
# define GTEST_API_ # define GTEST_API_
#endif #endif
#ifdef __GNUC__ #ifdef __GNUC__
// Ask the compiler to never inline a given function. // Ask the compiler to never inline a given function.
# define GTEST_NO_INLINE_ __attribute__((noinline)) # define GTEST_NO_INLINE_ __attribute__((noinline))
#else #else
# define GTEST_NO_INLINE_ # define GTEST_NO_INLINE_
#endif #endif
// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
#if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)
# define GTEST_HAS_CXXABI_H_ 1
#else
# define GTEST_HAS_CXXABI_H_ 0
#endif
namespace testing { namespace testing {
class Message; class Message;
namespace internal { namespace internal {
class String; // A secret type that Google Test users don't know about. It has no
// definition on purpose. Therefore it's impossible to create a
// Secret object, which is what we want.
class Secret;
// The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile tim e // The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile tim e
// expression is true. For example, you could use it to verify the // expression is true. For example, you could use it to verify the
// size of a static array: // size of a static array:
// //
// GTEST_COMPILE_ASSERT_(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYP ES, // GTEST_COMPILE_ASSERT_(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYP ES,
// content_type_names_incorrect_size); // content_type_names_incorrect_size);
// //
// or to make sure a struct is smaller than a certain size: // or to make sure a struct is smaller than a certain size:
// //
skipping to change at line 700 skipping to change at line 816
// //
// The second argument to the macro is the name of the variable. If // The second argument to the macro is the name of the variable. If
// the expression is false, most compilers will issue a warning/error // the expression is false, most compilers will issue a warning/error
// containing the name of the variable. // containing the name of the variable.
template <bool> template <bool>
struct CompileAssert { struct CompileAssert {
}; };
#define GTEST_COMPILE_ASSERT_(expr, msg) \ #define GTEST_COMPILE_ASSERT_(expr, msg) \
typedef ::testing::internal::CompileAssert<(bool(expr))> \ typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
msg[bool(expr) ? 1 : -1] msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
// Implementation details of GTEST_COMPILE_ASSERT_: // Implementation details of GTEST_COMPILE_ASSERT_:
// //
// - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1 // - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1
// elements (and thus is invalid) when the expression is false. // elements (and thus is invalid) when the expression is false.
// //
// - The simpler definition // - The simpler definition
// //
// #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1] // #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]
// //
skipping to change at line 799 skipping to change at line 915
} }
void reset(T* p = NULL) { void reset(T* p = NULL) {
if (p != ptr_) { if (p != ptr_) {
if (IsTrue(sizeof(T) > 0)) { // Makes sure T is a complete type. if (IsTrue(sizeof(T) > 0)) { // Makes sure T is a complete type.
delete ptr_; delete ptr_;
} }
ptr_ = p; ptr_ = p;
} }
} }
private: private:
T* ptr_; T* ptr_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr); GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
}; };
// Defines RE. // Defines 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.
skipping to change at line 861 skipping to change at line 978
} }
#endif // GTEST_HAS_GLOBAL_STRING #endif // GTEST_HAS_GLOBAL_STRING
static bool FullMatch(const char* str, const RE& re); static bool FullMatch(const char* str, const RE& re);
static bool PartialMatch(const char* str, const RE& re); static bool PartialMatch(const char* str, const RE& re);
private: private:
void Init(const char* regex); void Init(const char* regex);
// We use a const char* instead of a string, as Google Test may be used // We use a const char* instead of an std::string, as Google Test used to
// where string is not available. We also do not use Google Test's own be
// String type here, in order to simplify dependencies between the // used where std::string is not available. TODO(wan@google.com): change
// files. to
// std::string.
const char* pattern_; const char* pattern_;
bool is_valid_; bool is_valid_;
#if GTEST_USES_POSIX_RE #if GTEST_USES_POSIX_RE
regex_t full_regex_; // For FullMatch(). regex_t full_regex_; // For FullMatch().
regex_t partial_regex_; // For PartialMatch(). regex_t partial_regex_; // For PartialMatch().
#else // GTEST_USES_SIMPLE_RE #else // GTEST_USES_SIMPLE_RE
skipping to change at line 1047 skipping to change at line 1163
#if GTEST_HAS_STREAM_REDIRECTION #if GTEST_HAS_STREAM_REDIRECTION
// Defines the stderr capturer: // Defines the stderr capturer:
// CaptureStdout - starts capturing stdout. // CaptureStdout - starts capturing stdout.
// GetCapturedStdout - stops capturing stdout and returns the captured st ring. // GetCapturedStdout - stops capturing stdout and returns the captured st ring.
// CaptureStderr - starts capturing stderr. // CaptureStderr - starts capturing stderr.
// GetCapturedStderr - stops capturing stderr and returns the captured st ring. // GetCapturedStderr - stops capturing stderr and returns the captured st ring.
// //
GTEST_API_ void CaptureStdout(); GTEST_API_ void CaptureStdout();
GTEST_API_ String GetCapturedStdout(); GTEST_API_ std::string GetCapturedStdout();
GTEST_API_ void CaptureStderr(); GTEST_API_ void CaptureStderr();
GTEST_API_ String GetCapturedStderr(); GTEST_API_ std::string GetCapturedStderr();
#endif // GTEST_HAS_STREAM_REDIRECTION #endif // GTEST_HAS_STREAM_REDIRECTION
#if GTEST_HAS_DEATH_TEST #if GTEST_HAS_DEATH_TEST
// A copy of all command line arguments. Set by InitGoogleTest(). const ::std::vector<testing::internal::string>& GetInjectableArgvs();
extern ::std::vector<String> g_argvs; void SetInjectableArgvs(const ::std::vector<testing::internal::string>*
new_argvs);
// GTEST_HAS_DEATH_TEST implies we have ::std::string. // A copy of all command line arguments. Set by InitGoogleTest().
const ::std::vector<String>& GetArgvs(); extern ::std::vector<testing::internal::string> g_argvs;
#endif // GTEST_HAS_DEATH_TEST #endif // GTEST_HAS_DEATH_TEST
// Defines synchronization primitives. // Defines synchronization primitives.
#if GTEST_HAS_PTHREAD #if GTEST_HAS_PTHREAD
// Sleeps for (roughly) n milli-seconds. This function is only for // Sleeps for (roughly) n milli-seconds. This function is only for
// testing Google Test's own constructs. Don't use it in user tests, // testing Google Test's own constructs. Don't use it in user tests,
// either directly or indirectly. // either directly or indirectly.
skipping to change at line 1086 skipping to change at line 1203
} }
// Allows a controller thread to pause execution of newly created // Allows a controller thread to pause execution of newly created
// threads until notified. Instances of this class must be created // threads until notified. Instances of this class must be created
// and destroyed in the controller thread. // and destroyed in the controller thread.
// //
// This class is only for testing Google Test's own constructs. Do not // This class is only for testing Google Test's own constructs. Do not
// use it in user tests, either directly or indirectly. // use it in user tests, either directly or indirectly.
class Notification { class Notification {
public: public:
Notification() : notified_(false) {} Notification() : notified_(false) {
GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
}
~Notification() {
pthread_mutex_destroy(&mutex_);
}
// Notifies all threads created with this notification to start. Must // Notifies all threads created with this notification to start. Must
// be called from the controller thread. // be called from the controller thread.
void Notify() { notified_ = true; } void Notify() {
pthread_mutex_lock(&mutex_);
notified_ = true;
pthread_mutex_unlock(&mutex_);
}
// Blocks until the controller thread notifies. Must be called from a tes t // Blocks until the controller thread notifies. Must be called from a tes t
// thread. // thread.
void WaitForNotification() { void WaitForNotification() {
while(!notified_) { for (;;) {
pthread_mutex_lock(&mutex_);
const bool notified = notified_;
pthread_mutex_unlock(&mutex_);
if (notified)
break;
SleepMilliseconds(10); SleepMilliseconds(10);
} }
} }
private: private:
volatile bool notified_; pthread_mutex_t mutex_;
bool notified_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification); GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
}; };
// As a C-function, ThreadFuncWithCLinkage cannot be templated itself. // As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
// Consequently, it cannot select a correct instantiation of ThreadWithPara m // Consequently, it cannot select a correct instantiation of ThreadWithPara m
// in order to call its Run(). Introducing ThreadWithParamBase as a // in order to call its Run(). Introducing ThreadWithParamBase as a
// non-templated base class for ThreadWithParam allows us to bypass this // non-templated base class for ThreadWithParam allows us to bypass this
// problem. // problem.
class ThreadWithParamBase { class ThreadWithParamBase {
skipping to change at line 1209 skipping to change at line 1341
// //
// GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex); // GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
// //
// To create a dynamic mutex, just define an object of type Mutex. // To create a dynamic mutex, just define an object of type Mutex.
class MutexBase { class MutexBase {
public: public:
// Acquires this mutex. // Acquires this mutex.
void Lock() { void Lock() {
GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_)); GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
owner_ = pthread_self(); owner_ = pthread_self();
has_owner_ = true;
} }
// Releases this mutex. // Releases this mutex.
void Unlock() { void Unlock() {
// We don't protect writing to owner_ here, as it's the caller's // Since the lock is being released the owner_ field should no longer b
// responsibility to ensure that the current thread holds the e
// considered valid. We don't protect writing to has_owner_ here, as it
's
// the caller's responsibility to ensure that the current thread holds
the
// mutex when this is called. // mutex when this is called.
owner_ = 0; has_owner_ = false;
GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_)); GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
} }
// Does nothing if the current thread holds the mutex. Otherwise, crashes // Does nothing if the current thread holds the mutex. Otherwise, crashes
// with high probability. // with high probability.
void AssertHeld() const { void AssertHeld() const {
GTEST_CHECK_(owner_ == pthread_self()) GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
<< "The current thread is not holding the mutex @" << this; << "The current thread is not holding the mutex @" << this;
} }
// A static mutex may be used before main() is entered. It may even // A static mutex may be used before main() is entered. It may even
// be used before the dynamic initialization stage. Therefore we // be used before the dynamic initialization stage. Therefore we
// must be able to initialize a static mutex object at link time. // must be able to initialize a static mutex object at link time.
// This means MutexBase has to be a POD and its member variables // This means MutexBase has to be a POD and its member variables
// have to be public. // have to be public.
public: public:
pthread_mutex_t mutex_; // The underlying pthread mutex. pthread_mutex_t mutex_; // The underlying pthread mutex.
pthread_t owner_; // The thread holding the mutex; 0 means no one holds // has_owner_ indicates whether the owner_ field below contains a valid t
it. hread
// ID and is therefore safe to inspect (e.g., to use in pthread_equal()).
All
// accesses to the owner_ field should be protected by a check of this fi
eld.
// An alternative might be to memset() owner_ to all zeros, but there's n
o
// guarantee that a zero'd pthread_t is necessarily invalid or even diffe
rent
// from pthread_self().
bool has_owner_;
pthread_t owner_; // The thread holding the mutex.
}; };
// Forward-declares a static mutex. // Forward-declares a static mutex.
# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
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 stru
ct.
// 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, 0 } ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, fal se }
// 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.
class Mutex : public MutexBase { class Mutex : public MutexBase {
public: public:
Mutex() { Mutex() {
GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL)); GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
owner_ = 0; has_owner_ = false;
} }
~Mutex() { ~Mutex() {
GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_)); GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
} }
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex); GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
}; };
// We cannot name this class MutexLock as the ctor declaration would // We cannot name this class MutexLock as the ctor declaration would
skipping to change at line 1401 skipping to change at line 1547
#else // GTEST_HAS_PTHREAD #else // GTEST_HAS_PTHREAD
// A dummy implementation of synchronization primitives (mutex, lock, // A dummy implementation of synchronization primitives (mutex, lock,
// and thread-local variable). Necessary for compiling Google Test where // and thread-local variable). Necessary for compiling Google Test where
// mutex is not supported - using Google Test in multiple threads is not // mutex is not supported - using Google Test in multiple threads is not
// supported on such platforms. // supported on such platforms.
class Mutex { class Mutex {
public: public:
Mutex() {} Mutex() {}
void Lock() {}
void Unlock() {}
void AssertHeld() const {} void AssertHeld() const {}
}; };
# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
extern ::testing::internal::Mutex mutex extern ::testing::internal::Mutex mutex
# define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex # define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
class GTestMutexLock { class GTestMutexLock {
public: public:
skipping to change at line 1531 skipping to change at line 1679
} }
inline bool IsSpace(char ch) { inline bool IsSpace(char ch) {
return isspace(static_cast<unsigned char>(ch)) != 0; return isspace(static_cast<unsigned char>(ch)) != 0;
} }
inline bool IsUpper(char ch) { inline bool IsUpper(char ch) {
return isupper(static_cast<unsigned char>(ch)) != 0; return isupper(static_cast<unsigned char>(ch)) != 0;
} }
inline bool IsXDigit(char ch) { inline bool IsXDigit(char ch) {
return isxdigit(static_cast<unsigned char>(ch)) != 0; return isxdigit(static_cast<unsigned char>(ch)) != 0;
} }
inline bool IsXDigit(wchar_t ch) {
const unsigned char low_byte = static_cast<unsigned char>(ch);
return ch == low_byte && isxdigit(low_byte) != 0;
}
inline char ToLower(char ch) { inline char ToLower(char ch) {
return static_cast<char>(tolower(static_cast<unsigned char>(ch))); return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
} }
inline char ToUpper(char ch) { inline char ToUpper(char ch) {
return static_cast<char>(toupper(static_cast<unsigned char>(ch))); return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
} }
// The testing::internal::posix namespace holds wrappers for common // The testing::internal::posix namespace holds wrappers for common
// POSIX functions. These wrappers hide the differences between // POSIX functions. These wrappers hide the differences between
skipping to change at line 1668 skipping to change at line 1820
// Windows CE has no C library. The abort() function is used in // Windows CE has no C library. The abort() function is used in
// several places in Google Test. This implementation provides a reasonable // several places in Google Test. This implementation provides a reasonable
// imitation of standard behaviour. // imitation of standard behaviour.
void Abort(); void Abort();
#else #else
inline void Abort() { abort(); } inline void Abort() { abort(); }
#endif // GTEST_OS_WINDOWS_MOBILE #endif // GTEST_OS_WINDOWS_MOBILE
} // namespace posix } // namespace posix
// MSVC "deprecates" snprintf and issues warnings wherever it is used. In
// order to avoid these warnings, we need to use _snprintf or _snprintf_s o
n
// MSVC-based platforms. We map the GTEST_SNPRINTF_ macro to the appropria
te
// function in order to achieve that. We use macro definition here because
// snprintf is a variadic function.
#if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
// MSVC 2005 and above support variadic macros.
# define GTEST_SNPRINTF_(buffer, size, format, ...) \
_snprintf_s(buffer, size, size, format, __VA_ARGS__)
#elif defined(_MSC_VER)
// Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't
// complain about _snprintf.
# define GTEST_SNPRINTF_ _snprintf
#else
# define GTEST_SNPRINTF_ snprintf
#endif
// The maximum number a BiggestInt can represent. This definition // The maximum number a BiggestInt can represent. This definition
// works no matter BiggestInt is represented in one's complement or // works no matter BiggestInt is represented in one's complement or
// two's complement. // two's complement.
// //
// We cannot rely on numeric_limits in STL, as __int64 and long long // We cannot rely on numeric_limits in STL, as __int64 and long long
// are not part of standard C++ and numeric_limits doesn't need to be // are not part of standard C++ and numeric_limits doesn't need to be
// defined for them. // defined for them.
const BiggestInt kMaxBiggestInt = const BiggestInt kMaxBiggestInt =
~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1)); ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));
skipping to change at line 1720 skipping to change at line 1889
// As base/basictypes.h doesn't compile on Windows, we cannot use // As base/basictypes.h doesn't compile on Windows, we cannot use
// uint32, uint64, and etc here. // uint32, uint64, and etc here.
typedef int Int; typedef int Int;
typedef unsigned int UInt; typedef unsigned int UInt;
}; };
// The specialization for size 8. // The specialization for size 8.
template <> template <>
class TypeWithSize<8> { class TypeWithSize<8> {
public: public:
#if GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
typedef __int64 Int; typedef __int64 Int;
typedef unsigned __int64 UInt; typedef unsigned __int64 UInt;
#else #else
typedef long long Int; // NOLINT typedef long long Int; // NOLINT
typedef unsigned long long UInt; // NOLINT typedef unsigned long long UInt; // NOLINT
#endif // GTEST_OS_WINDOWS #endif // GTEST_OS_WINDOWS
}; };
// Integer types of known sizes. // Integer types of known sizes.
skipping to change at line 1747 skipping to change at line 1915
// Utilities for command line flags and environment variables. // Utilities for command line flags and environment variables.
// Macro for referencing flags. // Macro for referencing flags.
#define GTEST_FLAG(name) FLAGS_gtest_##name #define GTEST_FLAG(name) FLAGS_gtest_##name
// Macros for declaring flags. // Macros for declaring flags.
#define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name) #define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
#define GTEST_DECLARE_int32_(name) \ #define GTEST_DECLARE_int32_(name) \
GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name) GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
#define GTEST_DECLARE_string_(name) \ #define GTEST_DECLARE_string_(name) \
GTEST_API_ extern ::testing::internal::String GTEST_FLAG(name) GTEST_API_ extern ::std::string GTEST_FLAG(name)
// Macros for defining flags. // Macros for defining flags.
#define GTEST_DEFINE_bool_(name, default_val, doc) \ #define GTEST_DEFINE_bool_(name, default_val, doc) \
GTEST_API_ bool GTEST_FLAG(name) = (default_val) GTEST_API_ bool GTEST_FLAG(name) = (default_val)
#define GTEST_DEFINE_int32_(name, default_val, doc) \ #define GTEST_DEFINE_int32_(name, default_val, doc) \
GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val) GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
#define GTEST_DEFINE_string_(name, default_val, doc) \ #define GTEST_DEFINE_string_(name, default_val, doc) \
GTEST_API_ ::testing::internal::String GTEST_FLAG(name) = (default_val) GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
// Thread annotations
#define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
#define GTEST_LOCK_EXCLUDED_(locks)
// Parses 'str' for a 32-bit signed integer. If successful, writes the res ult // Parses 'str' for a 32-bit signed integer. If successful, writes the res ult
// to *value and returns true; otherwise leaves *value unchanged and return s // to *value and returns true; otherwise leaves *value unchanged and return s
// false. // false.
// TODO(chandlerc): Find a better way to refactor flag and environment pars ing // TODO(chandlerc): Find a better way to refactor flag and environment pars ing
// 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);
// Parses a bool/Int32/string from the environment variable // Parses a bool/Int32/string from the environment variable
 End of changes. 51 change blocks. 
56 lines changed or deleted 245 lines changed or added


 gtest-printers.h   gtest-printers.h 
skipping to change at line 633 skipping to change at line 633
PrintRawArrayTo(begin, len, os); PrintRawArrayTo(begin, len, os);
} else { } else {
PrintRawArrayTo(begin, kChunkSize, os); PrintRawArrayTo(begin, kChunkSize, os);
*os << ", ..., "; *os << ", ..., ";
PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os); PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
} }
*os << " }"; *os << " }";
} }
} }
// This overload prints a (const) char array compactly. // This overload prints a (const) char array compactly.
GTEST_API_ void UniversalPrintArray(const char* begin, GTEST_API_ void UniversalPrintArray(
size_t len, const char* begin, size_t len, ::std::ostream* os);
::std::ostream* os);
// This overload prints a (const) wchar_t array compactly.
GTEST_API_ void UniversalPrintArray(
const wchar_t* begin, size_t len, ::std::ostream* os);
// Implements printing an array type T[N]. // Implements printing an array type T[N].
template <typename T, size_t N> template <typename T, size_t N>
class UniversalPrinter<T[N]> { class UniversalPrinter<T[N]> {
public: public:
// Prints the given array, omitting some elements when there are too // Prints the given array, omitting some elements when there are too
// many. // many.
static void Print(const T (&a)[N], ::std::ostream* os) { static void Print(const T (&a)[N], ::std::ostream* os) {
UniversalPrintArray(a, N, os); UniversalPrintArray(a, N, os);
} }
skipping to change at line 676 skipping to change at line 679
} }
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning(pop) // Restores the warning state. # pragma warning(pop) // Restores the warning state.
#endif // _MSC_VER #endif // _MSC_VER
}; };
// Prints a value tersely: for a reference type, the referenced value // Prints a value tersely: for a reference type, the referenced value
// (but not the address) is printed; for a (const) char pointer, the // (but not the address) is printed; for a (const) char pointer, the
// NUL-terminated string (but not the pointer) is printed. // NUL-terminated string (but not the pointer) is printed.
template <typename T> template <typename T>
void UniversalTersePrint(const T& value, ::std::ostream* os) { class UniversalTersePrinter {
UniversalPrint(value, os); public:
} static void Print(const T& value, ::std::ostream* os) {
inline void UniversalTersePrint(const char* str, ::std::ostream* os) { UniversalPrint(value, os);
if (str == NULL) {
*os << "NULL";
} else {
UniversalPrint(string(str), os);
} }
} };
inline void UniversalTersePrint(char* str, ::std::ostream* os) { template <typename T>
UniversalTersePrint(static_cast<const char*>(str), os); class UniversalTersePrinter<T&> {
public:
static void Print(const T& value, ::std::ostream* os) {
UniversalPrint(value, os);
}
};
template <typename T, size_t N>
class UniversalTersePrinter<T[N]> {
public:
static void Print(const T (&value)[N], ::std::ostream* os) {
UniversalPrinter<T[N]>::Print(value, os);
}
};
template <>
class UniversalTersePrinter<const char*> {
public:
static void Print(const char* str, ::std::ostream* os) {
if (str == NULL) {
*os << "NULL";
} else {
UniversalPrint(string(str), os);
}
}
};
template <>
class UniversalTersePrinter<char*> {
public:
static void Print(char* str, ::std::ostream* os) {
UniversalTersePrinter<const char*>::Print(str, os);
}
};
#if GTEST_HAS_STD_WSTRING
template <>
class UniversalTersePrinter<const wchar_t*> {
public:
static void Print(const wchar_t* str, ::std::ostream* os) {
if (str == NULL) {
*os << "NULL";
} else {
UniversalPrint(::std::wstring(str), os);
}
}
};
#endif
template <>
class UniversalTersePrinter<wchar_t*> {
public:
static void Print(wchar_t* str, ::std::ostream* os) {
UniversalTersePrinter<const wchar_t*>::Print(str, os);
}
};
template <typename T>
void UniversalTersePrint(const T& value, ::std::ostream* os) {
UniversalTersePrinter<T>::Print(value, os);
} }
// Prints a value using the type inferred by the compiler. The // Prints a value using the type inferred by the compiler. The
// difference between this and UniversalTersePrint() is that for a // difference between this and UniversalTersePrint() is that for a
// (const) char pointer, this prints both the pointer and the // (const) char pointer, this prints both the pointer and the
// NUL-terminated string. // NUL-terminated string.
template <typename T> template <typename T>
void UniversalPrint(const T& value, ::std::ostream* os) { void UniversalPrint(const T& value, ::std::ostream* os) {
UniversalPrinter<T>::Print(value, os); // A workarond for the bug in VC++ 7.1 that prevents us from instantiatin
g
// UniversalPrinter with T directly.
typedef T T1;
UniversalPrinter<T1>::Print(value, os);
} }
#if GTEST_HAS_TR1_TUPLE #if GTEST_HAS_TR1_TUPLE
typedef ::std::vector<string> Strings; typedef ::std::vector<string> Strings;
// This helper template allows PrintTo() for tuples and // This helper template allows PrintTo() for tuples and
// UniversalTersePrintTupleFieldsToStrings() to be defined by // UniversalTersePrintTupleFieldsToStrings() to be defined by
// induction on the number of tuple fields. The idea is that // induction on the number of tuple fields. The idea is that
// TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N // TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N
// fields in tuple t, and can be defined in terms of // fields in tuple t, and can be defined in terms of
skipping to change at line 790 skipping to change at line 849
TersePrintPrefixToStrings(value, &result); TersePrintPrefixToStrings(value, &result);
return result; return result;
} }
#endif // GTEST_HAS_TR1_TUPLE #endif // GTEST_HAS_TR1_TUPLE
} // namespace internal } // namespace internal
template <typename T> template <typename T>
::std::string PrintToString(const T& value) { ::std::string PrintToString(const T& value) {
::std::stringstream ss; ::std::stringstream ss;
internal::UniversalTersePrint(value, &ss); internal::UniversalTersePrinter<T>::Print(value, &ss);
return ss.str(); return ss.str();
} }
} // namespace testing } // namespace testing
#endif // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
 End of changes. 6 change blocks. 
16 lines changed or deleted 76 lines changed or added


 gtest-spi.h   gtest-spi.h 
skipping to change at line 226 skipping to change at line 226
} while (::testing::internal::AlwaysFalse()) } while (::testing::internal::AlwaysFalse())
#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ #define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
do {\ do {\
::testing::TestPartResultArray gtest_failures;\ ::testing::TestPartResultArray gtest_failures;\
::testing::internal::SingleFailureChecker gtest_checker(\ ::testing::internal::SingleFailureChecker gtest_checker(\
&gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \ &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \
(substr));\ (substr));\
{\ {\
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREAD S,\ ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREAD S, \
&gtest_failures);\ &gtest_failures);\
if (::testing::internal::AlwaysTrue()) { statement; }\ if (::testing::internal::AlwaysTrue()) { statement; }\
}\ }\
} while (::testing::internal::AlwaysFalse()) } while (::testing::internal::AlwaysFalse())
#endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 gtest-string.h   gtest-string.h 
skipping to change at line 50 skipping to change at line 50
#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_
#ifdef __BORLANDC__ #ifdef __BORLANDC__
// string.h is not guaranteed to provide strcpy on C++ Builder. // string.h is not guaranteed to provide strcpy on C++ Builder.
# include <mem.h> # include <mem.h>
#endif #endif
#include <string.h> #include <string.h>
#include "gtest/internal/gtest-port.h"
#include <string> #include <string>
#include "gtest/internal/gtest-port.h"
namespace testing { namespace testing {
namespace internal { namespace internal {
// String - a UTF-8 string class. // String - an abstract class holding static string utilities.
//
// For historic reasons, we don't use std::string.
//
// TODO(wan@google.com): replace this class with std::string or
// implement it in terms of the latter.
//
// Note that String can represent both NULL and the empty string,
// while std::string cannot represent NULL.
//
// NULL and the empty string are considered different. NULL is less
// than anything (including the empty string) except itself.
//
// This class only provides minimum functionality necessary for
// implementing Google Test. We do not intend to implement a full-fledged
// string class here.
//
// Since the purpose of this class is to provide a substitute for
// std::string on platforms where it cannot be used, we define a copy
// constructor and assignment operators such that we don't need
// conditional compilation in a lot of places.
//
// In order to make the representation efficient, the d'tor of String
// is not virtual. Therefore DO NOT INHERIT FROM String.
class GTEST_API_ String { class GTEST_API_ String {
public: public:
// Static utility methods // Static utility methods
// Returns the input enclosed in double quotes if it's not NULL;
// otherwise returns "(null)". For example, "\"Hello\"" is returned
// for input "Hello".
//
// This is useful for printing a C string in the syntax of a literal.
//
// Known issue: escape sequences are not handled yet.
static String ShowCStringQuoted(const char* c_str);
// Clones a 0-terminated C string, allocating memory using new. The // Clones a 0-terminated C string, allocating memory using new. The
// caller is responsible for deleting the return value using // caller is responsible for deleting the return value using
// delete[]. Returns the cloned string, or NULL if the input is // delete[]. Returns the cloned string, or NULL if the input is
// NULL. // NULL.
// //
// This is different from strdup() in string.h, which allocates // This is different from strdup() in string.h, which allocates
// memory using malloc(). // memory using malloc().
static const char* CloneCString(const char* c_str); static const char* CloneCString(const char* c_str);
#if GTEST_OS_WINDOWS_MOBILE #if GTEST_OS_WINDOWS_MOBILE
skipping to change at line 140 skipping to change at line 108
// //
// Unlike strcmp(), this function can handle NULL argument(s). A // Unlike strcmp(), this function can handle NULL argument(s). A
// NULL C string is considered different to any non-NULL C string, // NULL C string is considered different to any non-NULL C string,
// including the empty string. // including the empty string.
static bool CStringEquals(const char* lhs, const char* rhs); static bool CStringEquals(const char* lhs, const char* rhs);
// Converts a wide C string to a String using the UTF-8 encoding. // Converts a wide C string to a String using the UTF-8 encoding.
// NULL will be converted to "(null)". If an error occurred during // NULL will be converted to "(null)". If an error occurred during
// the conversion, "(failed to convert from wide string)" is // the conversion, "(failed to convert from wide string)" is
// returned. // returned.
static String ShowWideCString(const wchar_t* wide_c_str); static std::string ShowWideCString(const wchar_t* wide_c_str);
// Similar to ShowWideCString(), except that this function encloses
// the converted string in double quotes.
static String ShowWideCStringQuoted(const wchar_t* wide_c_str);
// Compares two wide C strings. Returns true iff they have the same // Compares two wide C strings. Returns true iff they have the same
// content. // content.
// //
// Unlike wcscmp(), this function can handle NULL argument(s). A // Unlike wcscmp(), this function can handle NULL argument(s). A
// NULL C string is considered different to any non-NULL C string, // NULL C string is considered different to any non-NULL C string,
// including the empty string. // including the empty string.
static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs); static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
// Compares two C strings, ignoring case. Returns true iff they // Compares two C strings, ignoring case. Returns true iff they
skipping to change at line 178 skipping to change at line 142
// including the empty string. // including the empty string.
// NB: The implementations on different platforms slightly differ. // NB: The implementations on different platforms slightly differ.
// On windows, this method uses _wcsicmp which compares according to LC_C TYPE // On windows, this method uses _wcsicmp which compares according to LC_C TYPE
// environment variable. On GNU platform this method uses wcscasecmp // environment variable. On GNU platform this method uses wcscasecmp
// which compares according to LC_CTYPE category of the current locale. // which compares according to LC_CTYPE category of the current locale.
// On MacOS X, it uses towlower, which also uses LC_CTYPE category of the // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
// current locale. // current locale.
static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs, static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
const wchar_t* rhs); const wchar_t* rhs);
// Formats a list of arguments to a String, using the same format // Returns true iff the given string ends with the given suffix, ignoring
// spec string as for printf. // case. Any string is considered to end with an empty suffix.
// static bool EndsWithCaseInsensitive(
// We do not use the StringPrintf class as it is not universally const std::string& str, const std::string& suffix);
// available.
//
// The result is limited to 4096 characters (including the tailing
// 0). If 4096 characters are not enough to format the input,
// "<buffer exceeded>" is returned.
static String Format(const char* format, ...);
// C'tors
// The default c'tor constructs a NULL string.
String() : c_str_(NULL), length_(0) {}
// Constructs a String by cloning a 0-terminated C string.
String(const char* a_c_str) { // NOLINT
if (a_c_str == NULL) {
c_str_ = NULL;
length_ = 0;
} else {
ConstructNonNull(a_c_str, strlen(a_c_str));
}
}
// Constructs a String by copying a given number of chars from a
// buffer. E.g. String("hello", 3) creates the string "hel",
// String("a\0bcd", 4) creates "a\0bc", String(NULL, 0) creates "",
// and String(NULL, 1) results in access violation.
String(const char* buffer, size_t a_length) {
ConstructNonNull(buffer, a_length);
}
// The copy c'tor creates a new copy of the string. The two
// String objects do not share content.
String(const String& str) : c_str_(NULL), length_(0) { *this = str; }
// D'tor. String is intended to be a final class, so the d'tor
// doesn't need to be virtual.
~String() { delete[] c_str_; }
// Allows a String to be implicitly converted to an ::std::string or
// ::string, and vice versa. Converting a String containing a NULL
// pointer to ::std::string or ::string is undefined behavior.
// Converting a ::std::string or ::string containing an embedded NUL
// character to a String will result in the prefix up to the first
// NUL character.
String(const ::std::string& str) {
ConstructNonNull(str.c_str(), str.length());
}
operator ::std::string() const { return ::std::string(c_str(), length());
}
#if GTEST_HAS_GLOBAL_STRING
String(const ::string& str) {
ConstructNonNull(str.c_str(), str.length());
}
operator ::string() const { return ::string(c_str(), length()); }
#endif // GTEST_HAS_GLOBAL_STRING
// Returns true iff this is an empty string (i.e. "").
bool empty() const { return (c_str() != NULL) && (length() == 0); }
// Compares this with another String.
// Returns < 0 if this is less than rhs, 0 if this is equal to rhs, or >
0
// if this is greater than rhs.
int Compare(const String& rhs) const;
// Returns true iff this String equals the given C string. A NULL
// string and a non-NULL string are considered not equal.
bool operator==(const char* a_c_str) const { return Compare(a_c_str) == 0
; }
// Returns true iff this String is less than the given String. A
// NULL string is considered less than "".
bool operator<(const String& rhs) const { return Compare(rhs) < 0; }
// Returns true iff this String doesn't equal the given C string. A NULL
// string and a non-NULL string are considered not equal.
bool operator!=(const char* a_c_str) const { return !(*this == a_c_str);
}
// Returns true iff this String ends with the given suffix. *Any*
// String is considered to end with a NULL or empty suffix.
bool EndsWith(const char* suffix) const;
// Returns true iff this String ends with the given suffix, not consideri
ng
// case. Any String is considered to end with a NULL or empty suffix.
bool EndsWithCaseInsensitive(const char* suffix) const;
// Returns the length of the encapsulated string, or 0 if the
// string is NULL.
size_t length() const { return length_; }
// Gets the 0-terminated C string this String object represents.
// The String object still owns the string. Therefore the caller
// should NOT delete the return value.
const char* c_str() const { return c_str_; }
// Assigns a C string to this object. Self-assignment works.
const String& operator=(const char* a_c_str) {
return *this = String(a_c_str);
}
// Assigns a String object to this object. Self-assignment works.
const String& operator=(const String& rhs) {
if (this != &rhs) {
delete[] c_str_;
if (rhs.c_str() == NULL) {
c_str_ = NULL;
length_ = 0;
} else {
ConstructNonNull(rhs.c_str(), rhs.length());
}
}
return *this; // Formats an int value as "%02d".
} static std::string FormatIntWidth2(int value); // "%02d" for width == 2
private: // Formats an int value as "%X".
// Constructs a non-NULL String from the given content. This static std::string FormatHexInt(int value);
// function can only be called when c_str_ has not been allocated.
// ConstructNonNull(NULL, 0) results in an empty string ("").
// ConstructNonNull(NULL, non_zero) is undefined behavior.
void ConstructNonNull(const char* buffer, size_t a_length) {
char* const str = new char[a_length + 1];
memcpy(str, buffer, a_length);
str[a_length] = '\0';
c_str_ = str;
length_ = a_length;
}
const char* c_str_; // Formats a byte as "%02X".
size_t length_; static std::string FormatByte(unsigned char value);
}; // class String
// Streams a String to an ostream. Each '\0' character in the String private:
// is replaced with "\\0". String(); // Not meant to be instantiated.
inline ::std::ostream& operator<<(::std::ostream& os, const String& str) { }; // class String
if (str.c_str() == NULL) {
os << "(null)";
} else {
const char* const c_str = str.c_str();
for (size_t i = 0; i != str.length(); i++) {
if (c_str[i] == '\0') {
os << "\\0";
} else {
os << c_str[i];
}
}
}
return os;
}
// Gets the content of the stringstream's buffer as a String. Each '\0' // Gets the content of the stringstream's buffer as an std::string. Each ' \0'
// character in the buffer is replaced with "\\0". // character in the buffer is replaced with "\\0".
GTEST_API_ String StringStreamToString(::std::stringstream* stream); GTEST_API_ std::string StringStreamToString(::std::stringstream* stream);
// Converts a streamable value to a String. A NULL pointer is
// converted to "(null)". When the input value is a ::string,
// ::std::string, ::wstring, or ::std::wstring object, each NUL
// character in it is replaced with "\\0".
// Declared here but defined in gtest.h, so that it has access
// to the definition of the Message class, required by the ARM
// compiler.
template <typename T>
String StreamableToString(const T& streamable);
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
 End of changes. 12 change blocks. 
207 lines changed or deleted 19 lines changed or added


 gtest-test-part.h   gtest-test-part.h 
skipping to change at line 65 skipping to change at line 65
}; };
// C'tor. TestPartResult does NOT have a default constructor. // C'tor. TestPartResult does NOT have a default constructor.
// Always use this constructor (with parameters) to create a // Always use this constructor (with parameters) to create a
// TestPartResult object. // TestPartResult object.
TestPartResult(Type a_type, TestPartResult(Type a_type,
const char* a_file_name, const char* a_file_name,
int a_line_number, int a_line_number,
const char* a_message) const char* a_message)
: type_(a_type), : type_(a_type),
file_name_(a_file_name), file_name_(a_file_name == NULL ? "" : a_file_name),
line_number_(a_line_number), line_number_(a_line_number),
summary_(ExtractSummary(a_message)), summary_(ExtractSummary(a_message)),
message_(a_message) { message_(a_message) {
} }
// Gets the outcome of the test part. // Gets the outcome of the test part.
Type type() const { return type_; } Type type() const { return type_; }
// Gets the name of the source file where the test part took place, or // Gets the name of the source file where the test part took place, or
// NULL if it's unknown. // NULL if it's unknown.
const char* file_name() const { return file_name_.c_str(); } const char* file_name() const {
return file_name_.empty() ? NULL : file_name_.c_str();
}
// Gets the line in the source file where the test part took place, // Gets the line in the source file where the test part took place,
// or -1 if it's unknown. // or -1 if it's unknown.
int line_number() const { return line_number_; } int line_number() const { return line_number_; }
// Gets the summary of the failure message. // Gets the summary of the failure message.
const char* summary() const { return summary_.c_str(); } const char* summary() const { return summary_.c_str(); }
// Gets the message associated with the test part. // Gets the message associated with the test part.
const char* message() const { return message_.c_str(); } const char* message() const { return message_.c_str(); }
skipping to change at line 99 skipping to change at line 101
bool passed() const { return type_ == kSuccess; } bool passed() const { return type_ == kSuccess; }
// Returns true iff the test part failed. // Returns true iff the test part failed.
bool failed() const { return type_ != kSuccess; } bool failed() const { return type_ != kSuccess; }
// Returns true iff the test part non-fatally failed. // Returns true iff the test part non-fatally failed.
bool nonfatally_failed() const { return type_ == kNonFatalFailure; } bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
// Returns true iff the test part fatally failed. // Returns true iff the test part fatally failed.
bool fatally_failed() const { return type_ == kFatalFailure; } bool fatally_failed() const { return type_ == kFatalFailure; }
private: private:
Type type_; Type type_;
// Gets the summary of the failure message by omitting the stack // Gets the summary of the failure message by omitting the stack
// trace in it. // trace in it.
static internal::String ExtractSummary(const char* message); static std::string ExtractSummary(const char* message);
// The name of the source file where the test part took place, or // The name of the source file where the test part took place, or
// NULL if the source file is unknown. // "" if the source file is unknown.
internal::String file_name_; std::string file_name_;
// The line in the source file where the test part took place, or -1 // The line in the source file where the test part took place, or -1
// if the line number is unknown. // if the line number is unknown.
int line_number_; int line_number_;
internal::String summary_; // The test failure summary. std::string summary_; // The test failure summary.
internal::String message_; // The test failure message. std::string message_; // The test failure message.
}; };
// Prints a TestPartResult object. // Prints a TestPartResult object.
std::ostream& operator<<(std::ostream& os, const TestPartResult& result); std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
// An array of TestPartResult objects. // An array of TestPartResult objects.
// //
// Don't inherit from TestPartResultArray as its destructor is not // Don't inherit from TestPartResultArray as its destructor is not
// virtual. // virtual.
class GTEST_API_ TestPartResultArray { class GTEST_API_ TestPartResultArray {
 End of changes. 6 change blocks. 
7 lines changed or deleted 10 lines changed or added


 gtest-tuple.h   gtest-tuple.h 
// This file was GENERATED by a script. DO NOT EDIT BY HAND!!! // This file was GENERATED by command:
// pump.py gtest-tuple.h.pump
// DO NOT EDIT BY HAND!!!
// Copyright 2009 Google Inc. // Copyright 2009 Google Inc.
// All Rights Reserved. // All Rights Reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
// //
// * Redistributions of source code must retain the above copyright // * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer. // notice, this list of conditions and the following disclaimer.
skipping to change at line 143 skipping to change at line 145
// A helper for implementing get<k>(). // A helper for implementing get<k>().
template <int k> class Get; template <int k> class Get;
// A helper for implementing tuple_element<k, T>. kIndexValid is true // A helper for implementing tuple_element<k, T>. kIndexValid is true
// iff k < the number of fields in tuple type T. // iff k < the number of fields in tuple type T.
template <bool kIndexValid, int kIndex, class Tuple> template <bool kIndexValid, int kIndex, class Tuple>
struct TupleElement; struct TupleElement;
template <GTEST_10_TYPENAMES_(T)> template <GTEST_10_TYPENAMES_(T)>
struct TupleElement<true, 0, GTEST_10_TUPLE_(T)> { typedef T0 type; }; struct TupleElement<true, 0, GTEST_10_TUPLE_(T) > {
typedef T0 type;
};
template <GTEST_10_TYPENAMES_(T)> template <GTEST_10_TYPENAMES_(T)>
struct TupleElement<true, 1, GTEST_10_TUPLE_(T)> { typedef T1 type; }; struct TupleElement<true, 1, GTEST_10_TUPLE_(T) > {
typedef T1 type;
};
template <GTEST_10_TYPENAMES_(T)> template <GTEST_10_TYPENAMES_(T)>
struct TupleElement<true, 2, GTEST_10_TUPLE_(T)> { typedef T2 type; }; struct TupleElement<true, 2, GTEST_10_TUPLE_(T) > {
typedef T2 type;
};
template <GTEST_10_TYPENAMES_(T)> template <GTEST_10_TYPENAMES_(T)>
struct TupleElement<true, 3, GTEST_10_TUPLE_(T)> { typedef T3 type; }; struct TupleElement<true, 3, GTEST_10_TUPLE_(T) > {
typedef T3 type;
};
template <GTEST_10_TYPENAMES_(T)> template <GTEST_10_TYPENAMES_(T)>
struct TupleElement<true, 4, GTEST_10_TUPLE_(T)> { typedef T4 type; }; struct TupleElement<true, 4, GTEST_10_TUPLE_(T) > {
typedef T4 type;
};
template <GTEST_10_TYPENAMES_(T)> template <GTEST_10_TYPENAMES_(T)>
struct TupleElement<true, 5, GTEST_10_TUPLE_(T)> { typedef T5 type; }; struct TupleElement<true, 5, GTEST_10_TUPLE_(T) > {
typedef T5 type;
};
template <GTEST_10_TYPENAMES_(T)> template <GTEST_10_TYPENAMES_(T)>
struct TupleElement<true, 6, GTEST_10_TUPLE_(T)> { typedef T6 type; }; struct TupleElement<true, 6, GTEST_10_TUPLE_(T) > {
typedef T6 type;
};
template <GTEST_10_TYPENAMES_(T)> template <GTEST_10_TYPENAMES_(T)>
struct TupleElement<true, 7, GTEST_10_TUPLE_(T)> { typedef T7 type; }; struct TupleElement<true, 7, GTEST_10_TUPLE_(T) > {
typedef T7 type;
};
template <GTEST_10_TYPENAMES_(T)> template <GTEST_10_TYPENAMES_(T)>
struct TupleElement<true, 8, GTEST_10_TUPLE_(T)> { typedef T8 type; }; struct TupleElement<true, 8, GTEST_10_TUPLE_(T) > {
typedef T8 type;
};
template <GTEST_10_TYPENAMES_(T)> template <GTEST_10_TYPENAMES_(T)>
struct TupleElement<true, 9, GTEST_10_TUPLE_(T)> { typedef T9 type; }; struct TupleElement<true, 9, GTEST_10_TUPLE_(T) > {
typedef T9 type;
};
} // namespace gtest_internal } // namespace gtest_internal
template <> template <>
class tuple<> { class tuple<> {
public: public:
tuple() {} tuple() {}
tuple(const tuple& /* t */) {} tuple(const tuple& /* t */) {}
tuple& operator=(const tuple& /* t */) { return *this; } tuple& operator=(const tuple& /* t */) { return *this; }
}; };
skipping to change at line 711 skipping to change at line 733
const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7, const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
const T8& f8, const T9& f9) { const T8& f8, const T9& f9) {
return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9); return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
} }
// 6.1.3.3 Tuple helper classes. // 6.1.3.3 Tuple helper classes.
template <typename Tuple> struct tuple_size; template <typename Tuple> struct tuple_size;
template <GTEST_0_TYPENAMES_(T)> template <GTEST_0_TYPENAMES_(T)>
struct tuple_size<GTEST_0_TUPLE_(T)> { static const int value = 0; }; struct tuple_size<GTEST_0_TUPLE_(T) > {
static const int value = 0;
};
template <GTEST_1_TYPENAMES_(T)> template <GTEST_1_TYPENAMES_(T)>
struct tuple_size<GTEST_1_TUPLE_(T)> { static const int value = 1; }; struct tuple_size<GTEST_1_TUPLE_(T) > {
static const int value = 1;
};
template <GTEST_2_TYPENAMES_(T)> template <GTEST_2_TYPENAMES_(T)>
struct tuple_size<GTEST_2_TUPLE_(T)> { static const int value = 2; }; struct tuple_size<GTEST_2_TUPLE_(T) > {
static const int value = 2;
};
template <GTEST_3_TYPENAMES_(T)> template <GTEST_3_TYPENAMES_(T)>
struct tuple_size<GTEST_3_TUPLE_(T)> { static const int value = 3; }; struct tuple_size<GTEST_3_TUPLE_(T) > {
static const int value = 3;
};
template <GTEST_4_TYPENAMES_(T)> template <GTEST_4_TYPENAMES_(T)>
struct tuple_size<GTEST_4_TUPLE_(T)> { static const int value = 4; }; struct tuple_size<GTEST_4_TUPLE_(T) > {
static const int value = 4;
};
template <GTEST_5_TYPENAMES_(T)> template <GTEST_5_TYPENAMES_(T)>
struct tuple_size<GTEST_5_TUPLE_(T)> { static const int value = 5; }; struct tuple_size<GTEST_5_TUPLE_(T) > {
static const int value = 5;
};
template <GTEST_6_TYPENAMES_(T)> template <GTEST_6_TYPENAMES_(T)>
struct tuple_size<GTEST_6_TUPLE_(T)> { static const int value = 6; }; struct tuple_size<GTEST_6_TUPLE_(T) > {
static const int value = 6;
};
template <GTEST_7_TYPENAMES_(T)> template <GTEST_7_TYPENAMES_(T)>
struct tuple_size<GTEST_7_TUPLE_(T)> { static const int value = 7; }; struct tuple_size<GTEST_7_TUPLE_(T) > {
static const int value = 7;
};
template <GTEST_8_TYPENAMES_(T)> template <GTEST_8_TYPENAMES_(T)>
struct tuple_size<GTEST_8_TUPLE_(T)> { static const int value = 8; }; struct tuple_size<GTEST_8_TUPLE_(T) > {
static const int value = 8;
};
template <GTEST_9_TYPENAMES_(T)> template <GTEST_9_TYPENAMES_(T)>
struct tuple_size<GTEST_9_TUPLE_(T)> { static const int value = 9; }; struct tuple_size<GTEST_9_TUPLE_(T) > {
static const int value = 9;
};
template <GTEST_10_TYPENAMES_(T)> template <GTEST_10_TYPENAMES_(T)>
struct tuple_size<GTEST_10_TUPLE_(T)> { static const int value = 10; }; struct tuple_size<GTEST_10_TUPLE_(T) > {
static const int value = 10;
};
template <int k, class Tuple> template <int k, class Tuple>
struct tuple_element { struct tuple_element {
typedef typename gtest_internal::TupleElement< typedef typename gtest_internal::TupleElement<
k < (tuple_size<Tuple>::value), k, Tuple>::type type; k < (tuple_size<Tuple>::value), k, Tuple>::type type;
}; };
#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::t ype #define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::t ype
// 6.1.3.4 Element access. // 6.1.3.4 Element access.
skipping to change at line 925 skipping to change at line 969
::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2); ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
} }
}; };
} // namespace gtest_internal } // namespace gtest_internal
template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)> template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
inline bool operator==(const GTEST_10_TUPLE_(T)& t, inline bool operator==(const GTEST_10_TUPLE_(T)& t,
const GTEST_10_TUPLE_(U)& u) { const GTEST_10_TUPLE_(U)& u) {
return gtest_internal::SameSizeTuplePrefixComparator< return gtest_internal::SameSizeTuplePrefixComparator<
tuple_size<GTEST_10_TUPLE_(T)>::value, tuple_size<GTEST_10_TUPLE_(T) >::value,
tuple_size<GTEST_10_TUPLE_(U)>::value>::Eq(t, u); tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u);
} }
template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)> template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
inline bool operator!=(const GTEST_10_TUPLE_(T)& t, inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
const GTEST_10_TUPLE_(U)& u) { return !(t == u); } const GTEST_10_TUPLE_(U)& u) { return !(t == u); }
// 6.1.4 Pairs. // 6.1.4 Pairs.
// Unimplemented. // Unimplemented.
} // namespace tr1 } // namespace tr1
 End of changes. 23 change blocks. 
24 lines changed or deleted 68 lines changed or added


 gtest-tuple.h.pump   gtest-tuple.h.pump 
skipping to change at line 118 skipping to change at line 118
// A helper for implementing get<k>(). // A helper for implementing get<k>().
template <int k> class Get; template <int k> class Get;
// A helper for implementing tuple_element<k, T>. kIndexValid is true // A helper for implementing tuple_element<k, T>. kIndexValid is true
// iff k < the number of fields in tuple type T. // iff k < the number of fields in tuple type T.
template <bool kIndexValid, int kIndex, class Tuple> template <bool kIndexValid, int kIndex, class Tuple>
struct TupleElement; struct TupleElement;
$for i [[ $for i [[
template <GTEST_$(n)_TYPENAMES_(T)> template <GTEST_$(n)_TYPENAMES_(T)>
struct TupleElement<true, $i, GTEST_$(n)_TUPLE_(T)> [[]] struct TupleElement<true, $i, GTEST_$(n)_TUPLE_(T) > {
{ typedef T$i type; }; typedef T$i type;
};
]] ]]
} // namespace gtest_internal } // namespace gtest_internal
template <> template <>
class tuple<> { class tuple<> {
public: public:
tuple() {} tuple() {}
tuple(const tuple& /* t */) {} tuple(const tuple& /* t */) {}
tuple& operator=(const tuple& /* t */) { return *this; } tuple& operator=(const tuple& /* t */) { return *this; }
skipping to change at line 215 skipping to change at line 216
} }
]] ]]
// 6.1.3.3 Tuple helper classes. // 6.1.3.3 Tuple helper classes.
template <typename Tuple> struct tuple_size; template <typename Tuple> struct tuple_size;
$for j [[ $for j [[
template <GTEST_$(j)_TYPENAMES_(T)> template <GTEST_$(j)_TYPENAMES_(T)>
struct tuple_size<GTEST_$(j)_TUPLE_(T)> { static const int value = $j; }; struct tuple_size<GTEST_$(j)_TUPLE_(T) > {
static const int value = $j;
};
]] ]]
template <int k, class Tuple> template <int k, class Tuple>
struct tuple_element { struct tuple_element {
typedef typename gtest_internal::TupleElement< typedef typename gtest_internal::TupleElement<
k < (tuple_size<Tuple>::value), k, Tuple>::type type; k < (tuple_size<Tuple>::value), k, Tuple>::type type;
}; };
#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::t ype #define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::t ype
skipping to change at line 294 skipping to change at line 297
::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2); ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
} }
}; };
} // namespace gtest_internal } // namespace gtest_internal
template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)> template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>
inline bool operator==(const GTEST_$(n)_TUPLE_(T)& t, inline bool operator==(const GTEST_$(n)_TUPLE_(T)& t,
const GTEST_$(n)_TUPLE_(U)& u) { const GTEST_$(n)_TUPLE_(U)& u) {
return gtest_internal::SameSizeTuplePrefixComparator< return gtest_internal::SameSizeTuplePrefixComparator<
tuple_size<GTEST_$(n)_TUPLE_(T)>::value, tuple_size<GTEST_$(n)_TUPLE_(T) >::value,
tuple_size<GTEST_$(n)_TUPLE_(U)>::value>::Eq(t, u); tuple_size<GTEST_$(n)_TUPLE_(U) >::value>::Eq(t, u);
} }
template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)> template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>
inline bool operator!=(const GTEST_$(n)_TUPLE_(T)& t, inline bool operator!=(const GTEST_$(n)_TUPLE_(T)& t,
const GTEST_$(n)_TUPLE_(U)& u) { return !(t == u); } const GTEST_$(n)_TUPLE_(U)& u) { return !(t == u); }
// 6.1.4 Pairs. // 6.1.4 Pairs.
// Unimplemented. // Unimplemented.
} // namespace tr1 } // namespace tr1
 End of changes. 3 change blocks. 
5 lines changed or deleted 8 lines changed or added


 gtest-type-util.h   gtest-type-util.h 
skipping to change at line 48 skipping to change at line 48
// //
// Currently we support at most 50 types in a list, and at most 50 // Currently we support at most 50 types in a list, and at most 50
// type-parameterized tests in one type-parameterized test case. // type-parameterized tests in one type-parameterized test case.
// Please contact googletestframework@googlegroups.com if you need // Please contact googletestframework@googlegroups.com if you need
// more. // more.
#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_
#include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-port.h"
#include "gtest/internal/gtest-string.h"
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using // #ifdef __GNUC__ is too general here. It is possible to use gcc without using
// libstdc++ (which is where cxxabi.h comes from). // libstdc++ (which is where cxxabi.h comes from).
# ifdef __GLIBCXX__ # if GTEST_HAS_CXXABI_H_
# include <cxxabi.h> # include <cxxabi.h>
# elif defined(__HP_aCC) # elif defined(__HP_aCC)
# include <acxx_demangle.h> # include <acxx_demangle.h>
# endif // __GLIBCXX__ # endif // GTEST_HASH_CXXABI_H_
namespace testing { namespace testing {
namespace internal { namespace internal {
// 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 o f // NB: This function is also used in Google Mock, so don't move it inside o f
// the typed-test-only section below. // the typed-test-only section below.
template <typename T> template <typename T>
String GetTypeName() { std::string GetTypeName() {
# if GTEST_HAS_RTTI # if GTEST_HAS_RTTI
const char* const name = typeid(T).name(); const char* const name = typeid(T).name();
# if defined(__GLIBCXX__) || defined(__HP_aCC) # if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
int status = 0; int status = 0;
// gcc's implementation of typeid(T).name() mangles the type name, // gcc's implementation of typeid(T).name() mangles the type name,
// so we have to demangle it. // so we have to demangle it.
# ifdef __GLIBCXX__ # if GTEST_HAS_CXXABI_H_
using abi::__cxa_demangle; using abi::__cxa_demangle;
# endif // __GLIBCXX__ # endif // GTEST_HAS_CXXABI_H_
char* const readable_name = __cxa_demangle(name, 0, 0, &status); char* const readable_name = __cxa_demangle(name, 0, 0, &status);
const 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 name_str;
# else # else
return name; return name;
# endif // __GLIBCXX__ || __HP_aCC # endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
# else # else
return "<type>"; return "<type>";
# endif // GTEST_HAS_RTTI # endif // GTEST_HAS_RTTI
} }
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
skipping to change at line 3301 skipping to change at line 3300
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
T42, T43, T44, T45, T46, T47, T48, T49> type; T42, T43, T44, T45, T46, T47, T48, T49> type;
}; };
// The TypeList template makes it possible to use either a single type // The TypeList template makes it possible to use either a single type
// or a Types<...> list in TYPED_TEST_CASE() and // or a Types<...> list in TYPED_TEST_CASE() and
// INSTANTIATE_TYPED_TEST_CASE_P(). // INSTANTIATE_TYPED_TEST_CASE_P().
template <typename T> template <typename T>
struct TypeList { typedef Types1<T> type; }; struct TypeList {
typedef Types1<T> type;
};
template <typename T1, typename T2, typename T3, typename T4, typename T5, template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15, typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20, typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25, typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30, typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35, typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37, typename T38, typename T39, typename T40, typename T36, typename T37, typename T38, typename T39, typename T40,
typename T41, typename T42, typename T43, typename T44, typename T45, typename T41, typename T42, typename T43, typename T44, typename T45,
 End of changes. 10 change blocks. 
10 lines changed or deleted 11 lines changed or added


 gtest-type-util.h.pump   gtest-type-util.h.pump 
skipping to change at line 46 skipping to change at line 46
// //
// Currently we support at most $n types in a list, and at most $n // Currently we support at most $n types in a list, and at most $n
// type-parameterized tests in one type-parameterized test case. // type-parameterized tests in one type-parameterized test case.
// Please contact googletestframework@googlegroups.com if you need // Please contact googletestframework@googlegroups.com if you need
// more. // more.
#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_
#include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-port.h"
#include "gtest/internal/gtest-string.h"
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using // #ifdef __GNUC__ is too general here. It is possible to use gcc without using
// libstdc++ (which is where cxxabi.h comes from). // libstdc++ (which is where cxxabi.h comes from).
# ifdef __GLIBCXX__ # if GTEST_HAS_CXXABI_H_
# include <cxxabi.h> # include <cxxabi.h>
# elif defined(__HP_aCC) # elif defined(__HP_aCC)
# include <acxx_demangle.h> # include <acxx_demangle.h>
# endif // __GLIBCXX__ # endif // GTEST_HASH_CXXABI_H_
namespace testing { namespace testing {
namespace internal { namespace internal {
// 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 o f // NB: This function is also used in Google Mock, so don't move it inside o f
// the typed-test-only section below. // the typed-test-only section below.
template <typename T> template <typename T>
String GetTypeName() { std::string GetTypeName() {
# if GTEST_HAS_RTTI # if GTEST_HAS_RTTI
const char* const name = typeid(T).name(); const char* const name = typeid(T).name();
# if defined(__GLIBCXX__) || defined(__HP_aCC) # if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
int status = 0; int status = 0;
// gcc's implementation of typeid(T).name() mangles the type name, // gcc's implementation of typeid(T).name() mangles the type name,
// so we have to demangle it. // so we have to demangle it.
# ifdef __GLIBCXX__ # if GTEST_HAS_CXXABI_H_
using abi::__cxa_demangle; using abi::__cxa_demangle;
# endif // __GLIBCXX__ # endif // GTEST_HAS_CXXABI_H_
char* const readable_name = __cxa_demangle(name, 0, 0, &status); char* const readable_name = __cxa_demangle(name, 0, 0, &status);
const 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 name_str;
# else # else
return name; return name;
# endif // __GLIBCXX__ || __HP_aCC # endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
# else # else
return "<type>"; return "<type>";
# endif // GTEST_HAS_RTTI # endif // GTEST_HAS_RTTI
} }
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
skipping to change at line 280 skipping to change at line 279
typedef Templates$i<$for j, [[T$j]]> type; typedef Templates$i<$for j, [[T$j]]> type;
}; };
]] ]]
// The TypeList template makes it possible to use either a single type // The TypeList template makes it possible to use either a single type
// or a Types<...> list in TYPED_TEST_CASE() and // or a Types<...> list in TYPED_TEST_CASE() and
// INSTANTIATE_TYPED_TEST_CASE_P(). // INSTANTIATE_TYPED_TEST_CASE_P().
template <typename T> template <typename T>
struct TypeList { typedef Types1<T> type; }; struct TypeList {
typedef Types1<T> type;
};
$range i 1..n $range i 1..n
template <$for i, [[typename T$i]]> template <$for i, [[typename T$i]]>
struct TypeList<Types<$for i, [[T$i]]> > { struct TypeList<Types<$for i, [[T$i]]> > {
typedef typename Types<$for i, [[T$i]]>::type type; typedef typename Types<$for i, [[T$i]]>::type type;
}; };
#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P #endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
} // namespace internal } // namespace internal
 End of changes. 10 change blocks. 
10 lines changed or deleted 11 lines changed or added


 gtest.h   gtest.h 
skipping to change at line 55 skipping to change at line 55
// program! // program!
// //
// Acknowledgment: Google Test borrowed the idea of automatic test // Acknowledgment: Google Test borrowed the idea of automatic test
// registration from Barthelemy Dagenais' (barthelemy@prologique.com) // registration from Barthelemy Dagenais' (barthelemy@prologique.com)
// easyUnit framework. // easyUnit framework.
#ifndef GTEST_INCLUDE_GTEST_GTEST_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_H_
#define GTEST_INCLUDE_GTEST_GTEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_H_
#include <limits> #include <limits>
#include <ostream>
#include <vector> #include <vector>
#include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-string.h" #include "gtest/internal/gtest-string.h"
#include "gtest/gtest-death-test.h" #include "gtest/gtest-death-test.h"
#include "gtest/gtest-message.h" #include "gtest/gtest-message.h"
#include "gtest/gtest-param-test.h" #include "gtest/gtest-param-test.h"
#include "gtest/gtest-printers.h" #include "gtest/gtest-printers.h"
#include "gtest/gtest_prod.h" #include "gtest/gtest_prod.h"
#include "gtest/gtest-test-part.h" #include "gtest/gtest-test-part.h"
skipping to change at line 156 skipping to change at line 157
const int kMaxStackTraceDepth = 100; const int kMaxStackTraceDepth = 100;
namespace internal { namespace internal {
class AssertHelper; class AssertHelper;
class DefaultGlobalTestPartResultReporter; class DefaultGlobalTestPartResultReporter;
class ExecDeathTest; class ExecDeathTest;
class NoExecDeathTest; class NoExecDeathTest;
class FinalSuccessChecker; class FinalSuccessChecker;
class GTestFlagSaver; class GTestFlagSaver;
class StreamingListenerTest;
class TestResultAccessor; class TestResultAccessor;
class TestEventListenersAccessor; class TestEventListenersAccessor;
class TestEventRepeater; class TestEventRepeater;
class UnitTestRecordPropertyTestHelper;
class WindowsDeathTest; class WindowsDeathTest;
class UnitTestImpl* GetUnitTestImpl(); class UnitTestImpl* GetUnitTestImpl();
void ReportFailureInUnknownLocation(TestPartResult::Type result_type, void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
const String& message); const std::string& message);
// Converts a streamable value to a String. A NULL pointer is
// converted to "(null)". When the input value is a ::string,
// ::std::string, ::wstring, or ::std::wstring object, each NUL
// character in it is replaced with "\\0".
// Declared in gtest-internal.h but defined here, so that it has access
// to the definition of the Message class, required by the ARM
// compiler.
template <typename T>
String StreamableToString(const T& streamable) {
return (Message() << streamable).GetString();
}
} // namespace internal } // namespace internal
// The friend relationship of some of these classes is cyclic. // The friend relationship of some of these classes is cyclic.
// If we don't forward declare them the compiler might confuse the classes // If we don't forward declare them the compiler might confuse the classes
// in friendship clauses with same named classes on the scope. // in friendship clauses with same named classes on the scope.
class Test; class Test;
class TestCase; class TestCase;
class TestInfo; class TestInfo;
class UnitTest; class UnitTest;
skipping to change at line 394 skipping to change at line 385
// Returns true iff the current test has a fatal failure. // Returns true iff the current test has a fatal failure.
static bool HasFatalFailure(); static bool HasFatalFailure();
// Returns true iff the current test has a non-fatal failure. // Returns true iff the current test has a non-fatal failure.
static bool HasNonfatalFailure(); static bool HasNonfatalFailure();
// Returns true iff the current test has a (either fatal or // Returns true iff the current test has a (either fatal or
// non-fatal) failure. // non-fatal) failure.
static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure (); } static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure (); }
// Logs a property for the current test. Only the last value for a given // Logs a property for the current test, test case, or for the entire
// key is remembered. // invocation of the test program when used outside of the context of a
// These are public static so they can be called from utility functions // test case. Only the last value for a given key is remembered. These
// that are not members of the test fixture. // are public static so they can be called from utility functions that ar
// The arguments are const char* instead strings, as Google Test is used e
// on platforms where string doesn't compile. // not members of the test fixture. Calls to RecordProperty made during
// // lifespan of the test (from the moment its constructor starts to the
// Note that a driving consideration for these RecordProperty methods // moment its destructor finishes) will be output in XML as attributes of
// was to produce xml output suited to the Greenspan charting utility, // the <testcase> element. Properties recorded from fixture's
// which at present will only chart values that fit in a 32-bit int. It // SetUpTestCase or TearDownTestCase are logged as attributes of the
// is the user's responsibility to restrict their values to 32-bit ints // corresponding <testsuite> element. Calls to RecordProperty made in th
// if they intend them to be used with Greenspan. e
static void RecordProperty(const char* key, const char* value); // global context (before or after invocation of RUN_ALL_TESTS and from
static void RecordProperty(const char* key, int value); // SetUp/TearDown method of Environment objects registered with Google
// Test) will be output as attributes of the <testsuites> element.
static void RecordProperty(const std::string& key, const std::string& val
ue);
static void RecordProperty(const std::string& key, int value);
protected: protected:
// Creates a Test object. // Creates a Test object.
Test(); Test();
// Sets up the test fixture. // Sets up the test fixture.
virtual void SetUp(); virtual void SetUp();
// Tears down the test fixture. // Tears down the test fixture.
virtual void TearDown(); virtual void TearDown();
skipping to change at line 476 skipping to change at line 468
// A copyable object representing a user specified test property which can be // A copyable object representing a user specified test property which can be
// output as a key/value string pair. // output as a key/value string pair.
// //
// Don't inherit from TestProperty as its destructor is not virtual. // Don't inherit from TestProperty as its destructor is not virtual.
class TestProperty { class TestProperty {
public: public:
// C'tor. TestProperty does NOT have a default constructor. // C'tor. TestProperty does NOT have a default constructor.
// Always use this constructor (with parameters) to create a // Always use this constructor (with parameters) to create a
// TestProperty object. // TestProperty object.
TestProperty(const char* a_key, const char* a_value) : TestProperty(const std::string& a_key, const std::string& a_value) :
key_(a_key), value_(a_value) { key_(a_key), value_(a_value) {
} }
// Gets the user supplied key. // Gets the user supplied key.
const char* key() const { const char* key() const {
return key_.c_str(); return key_.c_str();
} }
// Gets the user supplied value. // Gets the user supplied value.
const char* value() const { const char* value() const {
return value_.c_str(); return value_.c_str();
} }
// Sets a new value, overriding the one supplied in the constructor. // Sets a new value, overriding the one supplied in the constructor.
void SetValue(const char* new_value) { void SetValue(const std::string& new_value) {
value_ = new_value; value_ = new_value;
} }
private: private:
// The key supplied by the user. // The key supplied by the user.
internal::String key_; std::string key_;
// The value supplied by the user. // The value supplied by the user.
internal::String value_; std::string value_;
}; };
// The result of a single Test. This includes a list of // The result of a single Test. This includes a list of
// TestPartResults, a list of TestProperties, a count of how many // TestPartResults, a list of TestProperties, a count of how many
// death tests there are in the Test, and how much time it took to run // death tests there are in the Test, and how much time it took to run
// the Test. // the Test.
// //
// TestResult is not copyable. // TestResult is not copyable.
class GTEST_API_ TestResult { class GTEST_API_ TestResult {
public: public:
skipping to change at line 550 skipping to change at line 542
// 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
// test_property_count() - 1. If i is not in that range, aborts the // test_property_count() - 1. If i is not in that range, aborts the
// program. // program.
const TestProperty& GetTestProperty(int i) const; const TestProperty& GetTestProperty(int i) const;
private: private:
friend class TestInfo; friend class TestInfo;
friend class TestCase;
friend class UnitTest; friend class UnitTest;
friend class internal::DefaultGlobalTestPartResultReporter; friend class internal::DefaultGlobalTestPartResultReporter;
friend class internal::ExecDeathTest; friend class internal::ExecDeathTest;
friend class internal::TestResultAccessor; friend class internal::TestResultAccessor;
friend class internal::UnitTestImpl; friend class internal::UnitTestImpl;
friend class internal::WindowsDeathTest; friend class internal::WindowsDeathTest;
// 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 {
return test_part_results_; return test_part_results_;
skipping to change at line 574 skipping to change at line 567
return test_properties_; return test_properties_;
} }
// Sets the elapsed time. // Sets the elapsed time.
void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; } void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
// Adds a test property to the list. The property is validated and may ad d // Adds a test property to the list. The property is validated and may ad d
// a non-fatal failure if invalid (e.g., if it conflicts with reserved // a non-fatal failure if invalid (e.g., if it conflicts with reserved
// key names). If a property is already recorded for the same key, the // key names). If a property is already recorded for the same key, the
// value will be updated, rather than storing multiple values for the sam e // value will be updated, rather than storing multiple values for the sam e
// key. // key. xml_element specifies the element for which the property is bein
void RecordProperty(const TestProperty& test_property); g
// recorded and is used for validation.
void RecordProperty(const std::string& xml_element,
const TestProperty& test_property);
// 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. // TODO(russr): Validate attribute names are legal and human readable.
static bool ValidateTestProperty(const TestProperty& test_property); static bool ValidateTestProperty(const std::string& xml_element,
const TestProperty& test_property);
// Adds a test part result to the list. // Adds a test part result to the list.
void AddTestPartResult(const TestPartResult& test_part_result); void AddTestPartResult(const TestPartResult& test_part_result);
// Returns the death test count. // Returns the death test count.
int death_test_count() const { return death_test_count_; } int death_test_count() const { return death_test_count_; }
// Increments the death test count, returning the new count. // Increments the death test count, returning the new count.
int increment_death_test_count() { return ++death_test_count_; } int increment_death_test_count() { return ++death_test_count_; }
skipping to change at line 653 skipping to change at line 649
} }
// Returns the text representation of the value parameter, or NULL if thi s // Returns the text representation of the value parameter, or NULL if thi s
// is not a value-parameterized test. // is not a value-parameterized test.
const char* value_param() const { const char* value_param() const {
if (value_param_.get() != NULL) if (value_param_.get() != NULL)
return value_param_->c_str(); return value_param_->c_str();
return NULL; return NULL;
} }
// Returns true if this test should run, that is if the test is not disab // Returns true if this test should run, that is if the test is not
led // disabled (or it is disabled but the also_run_disabled_tests flag has
// (or it is disabled but the also_run_disabled_tests flag has been speci // been specified) and its full name matches the user-specified filter.
fied)
// and its full name matches the user-specified filter.
// //
// Google Test allows the user to filter the tests by their full names. // Google Test allows the user to filter the tests by their full names.
// The full name of a test Bar in test case Foo is defined as // The full name of a test Bar in test case Foo is defined as
// "Foo.Bar". Only the tests that match the filter will run. // "Foo.Bar". Only the tests that match the filter will run.
// //
// A filter is a colon-separated list of glob (not regex) patterns, // A filter is a colon-separated list of glob (not regex) patterns,
// optionally followed by a '-' and a colon-separated list of // optionally followed by a '-' and a colon-separated list of
// negative patterns (tests to exclude). A test is run if it // negative patterns (tests to exclude). A test is run if it
// matches one of the positive patterns and does not match any of // matches one of the positive patterns and does not match any of
// the negative patterns. // the negative patterns.
// //
// For example, *A*:Foo.* is a filter that matches any string that // For example, *A*:Foo.* is a filter that matches any string that
// contains the character 'A' or starts with "Foo.". // contains the character 'A' or starts with "Foo.".
bool should_run() const { return should_run_; } bool should_run() const { return should_run_; }
// Returns true iff this test will appear in the XML report.
bool is_reportable() const {
// For now, the XML report includes all tests matching the filter.
// In the future, we may trim tests that are excluded because of
// sharding.
return matches_filter_;
}
// Returns the result of the test. // Returns the result of the test.
const TestResult* result() const { return &result_; } const TestResult* result() const { return &result_; }
private: private:
#if GTEST_HAS_DEATH_TEST #if GTEST_HAS_DEATH_TEST
friend class internal::DefaultDeathTestFactory; friend class internal::DefaultDeathTestFactory;
#endif // GTEST_HAS_DEATH_TEST #endif // GTEST_HAS_DEATH_TEST
friend class Test; friend class Test;
friend class TestCase; friend class TestCase;
friend class internal::UnitTestImpl; friend class internal::UnitTestImpl;
friend class internal::StreamingListenerTest;
friend TestInfo* internal::MakeAndRegisterTestInfo( friend TestInfo* internal::MakeAndRegisterTestInfo(
const char* test_case_name, const char* name, const char* test_case_name,
const char* name,
const char* type_param, const char* type_param,
const char* value_param, const char* value_param,
internal::TypeId fixture_class_id, internal::TypeId fixture_class_id,
Test::SetUpTestCaseFunc set_up_tc, Test::SetUpTestCaseFunc set_up_tc,
Test::TearDownTestCaseFunc tear_down_tc, Test::TearDownTestCaseFunc tear_down_tc,
internal::TestFactoryBase* factory); internal::TestFactoryBase* factory);
// Constructs a TestInfo object. The newly constructed instance assumes // Constructs a TestInfo object. The newly constructed instance assumes
// ownership of the factory object. // ownership of the factory object.
TestInfo(const char* test_case_name, const char* name, TestInfo(const std::string& test_case_name,
const char* a_type_param, const std::string& name,
const char* a_value_param, const char* a_type_param, // NULL if not a type-parameterized
test
const char* a_value_param, // NULL if not a value-parameterized
test
internal::TypeId fixture_class_id, internal::TypeId fixture_class_id,
internal::TestFactoryBase* factory); internal::TestFactoryBase* factory);
// Increments the number of death tests encountered in this test so // Increments the number of death tests encountered in this test so
// far. // far.
int increment_death_test_count() { int increment_death_test_count() {
return result_.increment_death_test_count(); return result_.increment_death_test_count();
} }
// Creates the test object, runs it, records its result, and then // Creates the test object, runs it, records its result, and then
skipping to change at line 781 skipping to change at line 787
// Returns true if any test in this test case should run. // Returns true if any test in this test case should run.
bool should_run() const { return should_run_; } bool should_run() const { return should_run_; }
// Gets the number of successful tests in this test case. // Gets the number of successful tests in this test case.
int successful_test_count() const; int successful_test_count() const;
// Gets the number of failed tests in this test case. // Gets the number of failed tests in this test case.
int failed_test_count() const; int failed_test_count() const;
// Gets the number of disabled tests that will be reported in the XML rep
ort.
int reportable_disabled_test_count() const;
// Gets the number of disabled tests in this test case. // Gets the number of disabled tests in this test case.
int disabled_test_count() const; int disabled_test_count() const;
// Gets the number of tests to be printed in the XML report.
int reportable_test_count() const;
// Get the number of tests in this test case that should run. // Get the number of tests in this test case that should run.
int test_to_run_count() const; int test_to_run_count() const;
// Gets the number of all tests in this test case. // Gets the number of all tests in this test case.
int total_test_count() const; int total_test_count() const;
// Returns true iff the test case passed. // Returns true iff the test case passed.
bool Passed() const { return !Failed(); } bool Passed() const { return !Failed(); }
// Returns true iff the test case failed. // Returns true iff the test case failed.
bool Failed() const { return failed_test_count() > 0; } bool Failed() const { return failed_test_count() > 0; }
// 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 among all the tests. i can range from 0 to // Returns the i-th test among all the tests. i can range from 0 to
// total_test_count() - 1. If i is not in that range, returns NULL. // total_test_count() - 1. If i is not in that range, returns NULL.
const TestInfo* GetTestInfo(int i) const; const TestInfo* GetTestInfo(int i) const;
// Returns the TestResult that holds test properties recorded during
// execution of SetUpTestCase and TearDownTestCase.
const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_
; }
private: private:
friend class Test; friend class Test;
friend class internal::UnitTestImpl; friend class internal::UnitTestImpl;
// Gets the (mutable) vector of TestInfos in this TestCase. // Gets the (mutable) vector of TestInfos in this TestCase.
std::vector<TestInfo*>& test_info_list() { return test_info_list_; } std::vector<TestInfo*>& test_info_list() { return test_info_list_; }
// Gets the (immutable) vector of TestInfos in this TestCase. // Gets the (immutable) vector of TestInfos in this TestCase.
const std::vector<TestInfo*>& test_info_list() const { const std::vector<TestInfo*>& test_info_list() const {
return test_info_list_; return test_info_list_;
skipping to change at line 855 skipping to change at line 871
// Returns true iff test passed. // Returns true iff test passed.
static bool TestPassed(const TestInfo* test_info) { static bool TestPassed(const TestInfo* test_info) {
return test_info->should_run() && test_info->result()->Passed(); return test_info->should_run() && test_info->result()->Passed();
} }
// Returns true iff test failed. // Returns true iff test failed.
static bool TestFailed(const TestInfo* test_info) { static bool TestFailed(const TestInfo* test_info) {
return test_info->should_run() && test_info->result()->Failed(); return test_info->should_run() && test_info->result()->Failed();
} }
// Returns true iff the test is disabled and will be reported in the XML
// report.
static bool TestReportableDisabled(const TestInfo* test_info) {
return test_info->is_reportable() && test_info->is_disabled_;
}
// Returns true iff test is disabled. // Returns true iff test is disabled.
static bool TestDisabled(const TestInfo* test_info) { static bool TestDisabled(const TestInfo* test_info) {
return test_info->is_disabled_; return test_info->is_disabled_;
} }
// Returns true iff this test will appear in the XML report.
static bool TestReportable(const TestInfo* test_info) {
return test_info->is_reportable();
}
// Returns true if the given test should run. // Returns true if the given test should run.
static bool ShouldRunTest(const TestInfo* test_info) { static bool ShouldRunTest(const TestInfo* test_info) {
return test_info->should_run(); return test_info->should_run();
} }
// Shuffles the tests in this test case. // Shuffles the tests in this test case.
void ShuffleTests(internal::Random* random); void ShuffleTests(internal::Random* random);
// Restores the test order to before the first shuffle. // Restores the test order to before the first shuffle.
void UnshuffleTests(); void UnshuffleTests();
// Name of the test case. // Name of the test case.
internal::String name_; std::string name_;
// Name of the parameter type, or NULL if this is not a typed or a // Name of the parameter type, or NULL if this is not a typed or a
// type-parameterized test. // type-parameterized test.
const internal::scoped_ptr<const ::std::string> type_param_; const internal::scoped_ptr<const ::std::string> type_param_;
// The vector of TestInfos in their original order. It owns the // The vector of TestInfos in their original order. It owns the
// elements in the vector. // elements in the vector.
std::vector<TestInfo*> test_info_list_; std::vector<TestInfo*> test_info_list_;
// Provides a level of indirection for the test list to allow easy // Provides a level of indirection for the test list to allow easy
// shuffling and restoring the test order. The i-th element in this // shuffling and restoring the test order. The i-th element in this
// vector is the index of the i-th test in the shuffled test list. // vector is the index of the i-th test in the shuffled test list.
std::vector<int> test_indices_; std::vector<int> test_indices_;
// Pointer to the function that sets up the test case. // Pointer to the function that sets up the test case.
Test::SetUpTestCaseFunc set_up_tc_; Test::SetUpTestCaseFunc set_up_tc_;
// Pointer to the function that tears down the test case. // Pointer to the function that tears down the test case.
Test::TearDownTestCaseFunc tear_down_tc_; Test::TearDownTestCaseFunc tear_down_tc_;
// True iff any test in this test case should run. // True iff any test in this test case should run.
bool should_run_; bool should_run_;
// Elapsed time, in milliseconds. // Elapsed time, in milliseconds.
TimeInMillis elapsed_time_; TimeInMillis elapsed_time_;
// Holds test properties recorded during execution of SetUpTestCase and
// TearDownTestCase.
TestResult ad_hoc_test_result_;
// We disallow copying TestCases. // We disallow copying TestCases.
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase); GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);
}; };
// An Environment object is capable of setting up and tearing down an // An Environment object is capable of setting up and tearing down an
// environment. The user should subclass this to define his own // environment. The user should subclass this to define his own
// environment(s). // environment(s).
// //
// An Environment object does the set-up and tear-down in virtual // An Environment object does the set-up and tear-down in virtual
skipping to change at line 1110 skipping to change at line 1140
// //
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
int Run() GTEST_MUST_USE_RESULT_; int Run() GTEST_MUST_USE_RESULT_;
// Returns the working directory when the first TEST() or TEST_F() // Returns the working directory when the first TEST() or TEST_F()
// was executed. The UnitTest object owns the string. // was executed. The UnitTest object owns the string.
const char* original_working_dir() const; const char* original_working_dir() const;
// Returns the TestCase object for the test that's currently running, // Returns the TestCase object for the test that's currently running,
// or NULL if no test is running. // or NULL if no test is running.
const TestCase* current_test_case() const; const TestCase* current_test_case() const
GTEST_LOCK_EXCLUDED_(mutex_);
// Returns the TestInfo object for the test that's currently running, // Returns the TestInfo object for the test that's currently running,
// or NULL if no test is running. // or NULL if no test is running.
const TestInfo* current_test_info() const; const TestInfo* current_test_info() const
GTEST_LOCK_EXCLUDED_(mutex_);
// 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 #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_);
#endif // GTEST_HAS_PARAM_TEST #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;
// Gets the number of failed test cases. // Gets the number of failed test cases.
int failed_test_case_count() const; int failed_test_case_count() const;
// Gets the number of all test cases. // Gets the number of all test cases.
int total_test_case_count() const; int total_test_case_count() const;
skipping to change at line 1146 skipping to change at line 1179
// Gets the number of all test cases that contain at least one test // Gets the number of all test cases that contain at least one test
// that should run. // that should run.
int test_case_to_run_count() const; int test_case_to_run_count() const;
// Gets the number of successful tests. // Gets the number of successful tests.
int successful_test_count() const; int successful_test_count() const;
// Gets the number of failed tests. // Gets the number of failed tests.
int failed_test_count() const; int failed_test_count() const;
// Gets the number of disabled tests that will be reported in the XML rep
ort.
int reportable_disabled_test_count() const;
// Gets the number of disabled tests. // Gets the number of disabled tests.
int disabled_test_count() const; int disabled_test_count() const;
// Gets the number of tests to be printed in the XML report.
int reportable_test_count() const;
// Gets the number of all tests. // Gets the number of all tests.
int total_test_count() const; int total_test_count() const;
// Gets the number of tests that should run. // Gets the number of tests that should run.
int test_to_run_count() const; int test_to_run_count() const;
// Gets the time of the test program start, in ms from the start of the
// UNIX epoch.
TimeInMillis start_timestamp() const;
// Gets the elapsed time, in milliseconds. // Gets the elapsed time, in milliseconds.
TimeInMillis elapsed_time() const; TimeInMillis elapsed_time() const;
// Returns true iff the unit test passed (i.e. all test cases passed). // Returns true iff the unit test passed (i.e. all test cases passed).
bool Passed() const; bool Passed() const;
// Returns true iff the unit test failed (i.e. some test case failed // Returns true iff the unit test failed (i.e. some test case failed
// or something outside of all tests failed). // or something outside of all tests failed).
bool Failed() const; bool Failed() const;
// Gets the i-th test case among all the test cases. i can range from 0 t o // Gets the i-th test case among all the test cases. i can range from 0 t o
// total_test_case_count() - 1. If i is not in that range, returns NULL. // total_test_case_count() - 1. If i is not in that range, returns NULL.
const TestCase* GetTestCase(int i) const; const TestCase* GetTestCase(int i) const;
// Returns the TestResult containing information on test failures and
// properties logged outside of individual test cases.
const TestResult& ad_hoc_test_result() const;
// Returns the list of event listeners that can be used to track events // Returns the list of event listeners that can be used to track events
// inside Google Test. // inside Google Test.
TestEventListeners& listeners(); TestEventListeners& listeners();
private: private:
// Registers and returns a global test environment. When a test // Registers and returns a global test environment. When a test
// program is run, all global test environments will be set-up in // program is run, all global test environments will be set-up in
// the order they were registered. After all tests in the program // the order they were registered. After all tests in the program
// have finished, all global test environments will be torn-down in // have finished, all global test environments will be torn-down in
// the *reverse* order they were registered. // the *reverse* order they were registered.
skipping to change at line 1192 skipping to change at line 1239
// This method can only be called from the main thread. // This method can only be called from the main thread.
Environment* AddEnvironment(Environment* env); Environment* AddEnvironment(Environment* env);
// Adds a TestPartResult to the current TestResult object. All // Adds a TestPartResult to the current TestResult object. All
// Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
// eventually call this to report their results. The user code // eventually call this to report their results. The user code
// should use the assertion macros instead of calling this directly. // should use the assertion macros instead of calling this directly.
void AddTestPartResult(TestPartResult::Type result_type, void AddTestPartResult(TestPartResult::Type result_type,
const char* file_name, const char* file_name,
int line_number, int line_number,
const internal::String& message, const std::string& message,
const internal::String& os_stack_trace); const std::string& os_stack_trace)
GTEST_LOCK_EXCLUDED_(mutex_);
// Adds a TestProperty to the current TestResult object. If the result al
ready // Adds a TestProperty to the current TestResult object when invoked from
// contains a property with the same key, the value will be updated. // inside a test, to current TestCase's ad_hoc_test_result_ when invoked
void RecordPropertyForCurrentTest(const char* key, const char* value); // from SetUpTestCase or TearDownTestCase, or to the global property set
// when invoked elsewhere. If the result already contains a property wit
h
// the same key, the value will be updated.
void RecordProperty(const std::string& key, const std::string& value);
// Gets the i-th test case among all the test cases. i can range from 0 t o // Gets the i-th test case among all the test cases. i can range from 0 t o
// total_test_case_count() - 1. If i is not in that range, returns NULL. // total_test_case_count() - 1. If i is not in that range, returns NULL.
TestCase* GetMutableTestCase(int i); TestCase* GetMutableTestCase(int i);
// Accessors for the implementation object. // Accessors for the implementation object.
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 funcions are friends as they need to access private
// members of UnitTest. // members of UnitTest.
friend class Test; friend class Test;
friend class internal::AssertHelper; friend class internal::AssertHelper;
friend class internal::ScopedTrace; friend class internal::ScopedTrace;
friend class internal::StreamingListenerTest;
friend class internal::UnitTestRecordPropertyTestHelper;
friend Environment* AddGlobalTestEnvironment(Environment* env); friend Environment* AddGlobalTestEnvironment(Environment* env);
friend internal::UnitTestImpl* internal::GetUnitTestImpl(); friend internal::UnitTestImpl* internal::GetUnitTestImpl();
friend void internal::ReportFailureInUnknownLocation( friend void internal::ReportFailureInUnknownLocation(
TestPartResult::Type result_type, TestPartResult::Type result_type,
const internal::String& message); const std::string& message);
// Creates an empty UnitTest. // Creates an empty UnitTest.
UnitTest(); UnitTest();
// D'tor // D'tor
virtual ~UnitTest(); virtual ~UnitTest();
// Pushes a trace defined by SCOPED_TRACE() on to the per-thread // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
// Google Test trace stack. // Google Test trace stack.
void PushGTestTrace(const internal::TraceInfo& trace); void PushGTestTrace(const internal::TraceInfo& trace)
GTEST_LOCK_EXCLUDED_(mutex_);
// Pops a trace from the per-thread Google Test trace stack. // Pops a trace from the per-thread Google Test trace stack.
void PopGTestTrace(); void PopGTestTrace()
GTEST_LOCK_EXCLUDED_(mutex_);
// Protects mutable state in *impl_. This is mutable as some const // Protects mutable state in *impl_. This is mutable as some const
// methods need to lock it too. // methods need to lock it too.
mutable internal::Mutex mutex_; mutable internal::Mutex mutex_;
// Opaque implementation object. This field is never changed once // Opaque implementation object. This field is never changed once
// the object is constructed. We don't mark it as const here, as // the object is constructed. We don't mark it as const here, as
// doing so will cause a warning in the constructor of UnitTest. // doing so will cause a warning in the constructor of UnitTest.
// Mutable state in *impl_ is protected by mutex_. // Mutable state in *impl_ is protected by mutex_.
internal::UnitTestImpl* impl_; internal::UnitTestImpl* impl_;
skipping to change at line 1284 skipping to change at line 1339
// //
// Calling the function for the second time has no user-visible effect. // Calling the function for the second time has no user-visible effect.
GTEST_API_ void InitGoogleTest(int* argc, char** argv); GTEST_API_ void InitGoogleTest(int* argc, char** argv);
// This overloaded version can be used in Windows programs compiled in // This overloaded version can be used in Windows programs compiled in
// UNICODE mode. // UNICODE mode.
GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv); GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
namespace internal { namespace internal {
// FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a
// value of type ToPrint that is an operand of a comparison assertion
// (e.g. ASSERT_EQ). OtherOperand is the type of the other operand in
// the comparison, and is used to help determine the best way to
// format the value. In particular, when the value is a C string
// (char pointer) and the other operand is an STL string object, we
// want to format the C string as a string, since we know it is
// compared by value with the string object. If the value is a char
// pointer but the other operand is not an STL string object, we don't
// know whether the pointer is supposed to point to a NUL-terminated
// string, and thus want to print it as a pointer to be safe.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
// The default case.
template <typename ToPrint, typename OtherOperand>
class FormatForComparison {
public:
static ::std::string Format(const ToPrint& value) {
return ::testing::PrintToString(value);
}
};
// Array.
template <typename ToPrint, size_t N, typename OtherOperand>
class FormatForComparison<ToPrint[N], OtherOperand> {
public:
static ::std::string Format(const ToPrint* value) {
return FormatForComparison<const ToPrint*, OtherOperand>::Format(value)
;
}
};
// By default, print C string as pointers to be safe, as we don't know
// whether they actually point to a NUL-terminated string.
#define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType) \
template <typename OtherOperand> \
class FormatForComparison<CharType*, OtherOperand> { \
public: \
static ::std::string Format(CharType* value) { \
return ::testing::PrintToString(static_cast<const void*>(value)); \
} \
}
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
#undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
// If a C string is compared with an STL string object, we know it's meant
// to point to a NUL-terminated string, and thus can print it as a string.
#define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
template <> \
class FormatForComparison<CharType*, OtherStringType> { \
public: \
static ::std::string Format(CharType* value) { \
return ::testing::PrintToString(value); \
} \
}
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);
#if GTEST_HAS_GLOBAL_STRING
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string);
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string);
#endif
#if GTEST_HAS_GLOBAL_WSTRING
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring);
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring);
#endif
#if GTEST_HAS_STD_WSTRING
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);
#endif
#undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_
// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc) // Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
// operand to be used in a failure message. The type (but not value) // operand to be used in a failure message. The type (but not value)
// of the other operand may affect the format. This allows us to // of the other operand may affect the format. This allows us to
// print a char* as a raw pointer when it is compared against another // print a char* as a raw pointer when it is compared against another
// char*, and print it as a C string when it is compared against an // char* or void*, and print it as a C string when it is compared
// std::string object, for example. // against an std::string object, for example.
//
// The default implementation ignores the type of the other operand.
// Some specialized versions are used to handle formatting wide or
// narrow C strings.
// //
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
template <typename T1, typename T2> template <typename T1, typename T2>
String FormatForComparisonFailureMessage(const T1& value, std::string FormatForComparisonFailureMessage(
const T2& /* other_operand */) { const T1& value, const T2& /* other_operand */) {
// C++Builder compiles this incorrectly if the namespace isn't explicitly return FormatForComparison<T1, T2>::Format(value);
// given.
return ::testing::PrintToString(value);
} }
// The helper function for {ASSERT|EXPECT}_EQ. // The helper function for {ASSERT|EXPECT}_EQ.
template <typename T1, typename T2> template <typename T1, typename T2>
AssertionResult CmpHelperEQ(const char* expected_expression, AssertionResult CmpHelperEQ(const char* expected_expression,
const char* actual_expression, const char* actual_expression,
const T1& expected, const T1& expected,
const T2& actual) { const T2& actual) {
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning(push) // Saves the current warning state. # pragma warning(push) // Saves the current warning state.
# pragma warning(disable:4389) // Temporarily disables warning on # pragma warning(disable:4389) // Temporarily disables warning on
// signed/unsigned mismatch. // signed/unsigned mismatch.
#endif #endif
if (expected == actual) { if (expected == actual) {
return AssertionSuccess(); return AssertionSuccess();
} }
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning(pop) // Restores the warning state. # pragma warning(pop) // Restores the warning state.
#endif #endif
skipping to change at line 1449 skipping to change at line 1581
GTEST_API_ AssertionResult CmpHelper##op_name(\ GTEST_API_ AssertionResult CmpHelper##op_name(\
const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2) const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
// Implements the helper function for {ASSERT|EXPECT}_NE // Implements the helper function for {ASSERT|EXPECT}_NE
GTEST_IMPL_CMP_HELPER_(NE, !=); GTEST_IMPL_CMP_HELPER_(NE, !=);
// Implements the helper function for {ASSERT|EXPECT}_LE // Implements the helper function for {ASSERT|EXPECT}_LE
GTEST_IMPL_CMP_HELPER_(LE, <=); GTEST_IMPL_CMP_HELPER_(LE, <=);
// Implements the helper function for {ASSERT|EXPECT}_LT // Implements the helper function for {ASSERT|EXPECT}_LT
GTEST_IMPL_CMP_HELPER_(LT, < ); GTEST_IMPL_CMP_HELPER_(LT, <);
// Implements the helper function for {ASSERT|EXPECT}_GE // Implements the helper function for {ASSERT|EXPECT}_GE
GTEST_IMPL_CMP_HELPER_(GE, >=); GTEST_IMPL_CMP_HELPER_(GE, >=);
// Implements the helper function for {ASSERT|EXPECT}_GT // Implements the helper function for {ASSERT|EXPECT}_GT
GTEST_IMPL_CMP_HELPER_(GT, > ); GTEST_IMPL_CMP_HELPER_(GT, >);
#undef GTEST_IMPL_CMP_HELPER_ #undef GTEST_IMPL_CMP_HELPER_
// The helper function for {ASSERT|EXPECT}_STREQ. // The helper function for {ASSERT|EXPECT}_STREQ.
// //
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression, GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
const char* actual_expression, const char* actual_expression,
const char* expected, const char* expected,
const char* actual); const char* actual);
skipping to change at line 1616 skipping to change at line 1748
// re-using stack space even for temporary variables, so every EXPECT_EQ // re-using stack space even for temporary variables, so every EXPECT_EQ
// reserves stack space for another AssertHelper. // reserves stack space for another AssertHelper.
struct AssertHelperData { struct AssertHelperData {
AssertHelperData(TestPartResult::Type t, AssertHelperData(TestPartResult::Type t,
const char* srcfile, const char* srcfile,
int line_num, int line_num,
const char* msg) const char* msg)
: type(t), file(srcfile), line(line_num), message(msg) { } : type(t), file(srcfile), line(line_num), message(msg) { }
TestPartResult::Type const type; TestPartResult::Type const type;
const char* const file; const char* const file;
int const line; int const line;
String const message; std::string const message;
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData); GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
}; };
AssertHelperData* const data_; AssertHelperData* const data_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper); GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
}; };
skipping to change at line 1677 skipping to change at line 1809
class WithParamInterface { class WithParamInterface {
public: public:
typedef T ParamType; typedef T ParamType;
virtual ~WithParamInterface() {} virtual ~WithParamInterface() {}
// The current parameter value. Is also available in the test fixture's // The current parameter value. Is also available in the test fixture's
// constructor. This member function is non-static, even though it only // constructor. This member function is non-static, even though it only
// references static data, to reduce the opportunity for incorrect uses // references static data, to reduce the opportunity for incorrect uses
// like writing 'WithParamInterface<bool>::GetParam()' for a test that // like writing 'WithParamInterface<bool>::GetParam()' for a test that
// uses a fixture whose parameter type is int. // uses a fixture whose parameter type is int.
const ParamType& GetParam() const { return *parameter_; } const ParamType& GetParam() const {
GTEST_CHECK_(parameter_ != NULL)
<< "GetParam() can only be called inside a value-parameterized test
"
<< "-- did you intend to write TEST_P instead of TEST_F?";
return *parameter_;
}
private: private:
// Sets parameter value. The caller is responsible for making sure the va lue // Sets parameter value. The caller is responsible for making sure the va lue
// remains alive and unchanged throughout the current test. // remains alive and unchanged throughout the current test.
static void SetParam(const ParamType* parameter) { static void SetParam(const ParamType* parameter) {
parameter_ = parameter; parameter_ = parameter;
} }
// Static value used for accessing parameter during a test lifetime. // Static value used for accessing parameter during a test lifetime.
static const ParamType* parameter_; static const ParamType* parameter_;
skipping to change at line 1723 skipping to change at line 1860
// it behaves like ADD_FAILURE. In particular: // it behaves like ADD_FAILURE. In particular:
// //
// EXPECT_TRUE verifies that a Boolean condition is true. // EXPECT_TRUE verifies that a Boolean condition is true.
// EXPECT_FALSE verifies that a Boolean condition is false. // EXPECT_FALSE verifies that a Boolean condition is false.
// //
// FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except // FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
// that they will also abort the current function on failure. People // that they will also abort the current function on failure. People
// usually want the fail-fast behavior of FAIL and ASSERT_*, but those // usually want the fail-fast behavior of FAIL and ASSERT_*, but those
// writing data-driven tests often find themselves using ADD_FAILURE // writing data-driven tests often find themselves using ADD_FAILURE
// and EXPECT_* more. // and EXPECT_* more.
//
// Examples:
//
// EXPECT_TRUE(server.StatusIsOK());
// ASSERT_FALSE(server.HasPendingRequest(port))
// << "There are still pending requests " << "on port " << port;
// Generates a nonfatal failure with a generic message. // Generates a nonfatal failure with a generic message.
#define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed") #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
// Generates a nonfatal failure at the given source file location with // Generates a nonfatal failure at the given source file location with
// a generic message. // a generic message.
#define ADD_FAILURE_AT(file, line) \ #define ADD_FAILURE_AT(file, line) \
GTEST_MESSAGE_AT_(file, line, "Failed", \ GTEST_MESSAGE_AT_(file, line, "Failed", \
::testing::TestPartResult::kNonFatalFailure) ::testing::TestPartResult::kNonFatalFailure)
skipping to change at line 1902 skipping to change at line 2033
#endif #endif
#if !GTEST_DONT_DEFINE_ASSERT_GE #if !GTEST_DONT_DEFINE_ASSERT_GE
# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2) # define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
#endif #endif
#if !GTEST_DONT_DEFINE_ASSERT_GT #if !GTEST_DONT_DEFINE_ASSERT_GT
# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2) # define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
#endif #endif
// C String Comparisons. All tests treat NULL and any non-NULL string // C-string Comparisons. All tests treat NULL and any non-NULL string
// as different. Two NULLs are equal. // as different. Two NULLs are equal.
// //
// * {ASSERT|EXPECT}_STREQ(s1, s2): Tests that s1 == s2 // * {ASSERT|EXPECT}_STREQ(s1, s2): Tests that s1 == s2
// * {ASSERT|EXPECT}_STRNE(s1, s2): Tests that s1 != s2 // * {ASSERT|EXPECT}_STRNE(s1, s2): Tests that s1 != s2
// * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring ca se // * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring ca se
// * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring ca se // * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring ca se
// //
// For wide or narrow string objects, you can use the // For wide or narrow string objects, you can use the
// {ASSERT|EXPECT}_??() macros. // {ASSERT|EXPECT}_??() macros.
// //
skipping to change at line 2142 skipping to change at line 2273
// //
// TEST_F(FooTest, ReturnsElementCountCorrectly) { // TEST_F(FooTest, ReturnsElementCountCorrectly) {
// EXPECT_EQ(0, a_.size()); // EXPECT_EQ(0, a_.size());
// EXPECT_EQ(1, b_.size()); // EXPECT_EQ(1, b_.size());
// } // }
#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>())
// Use this macro in main() to run all tests. It returns 0 if all } // namespace testing
// Use this function in main() to run all tests. It returns 0 if all
// tests are successful, or 1 otherwise. // tests are successful, or 1 otherwise.
// //
// RUN_ALL_TESTS() should be invoked after the command line has been // RUN_ALL_TESTS() should be invoked after the command line has been
// parsed by InitGoogleTest(). // parsed by InitGoogleTest().
//
// This function was formerly a macro; thus, it is in the global
// namespace and has an all-caps name.
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;
#define RUN_ALL_TESTS()\ inline int RUN_ALL_TESTS() {
(::testing::UnitTest::GetInstance()->Run()) return ::testing::UnitTest::GetInstance()->Run();
}
} // namespace testing
#endif // GTEST_INCLUDE_GTEST_GTEST_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_H_
 End of changes. 50 change blocks. 
88 lines changed or deleted 233 lines changed or added


 gtest_pred_impl.h   gtest_pred_impl.h 
skipping to change at line 30 skipping to change at line 30
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// 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.
// This file is AUTOMATICALLY GENERATED on 09/24/2010 by command // This file is AUTOMATICALLY GENERATED on 10/31/2011 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.
#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. // Makes sure this header is not included before gtest.h.
#ifndef GTEST_INCLUDE_GTEST_GTEST_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_H_
# error Do not include gtest_pred_impl.h directly. Include gtest.h instead . # error Do not include gtest_pred_impl.h directly. Include gtest.h instead .
skipping to change at line 100 skipping to change at line 100
if (pred(v1)) return AssertionSuccess(); if (pred(v1)) return AssertionSuccess();
return AssertionFailure() << pred_text << "(" return AssertionFailure() << pred_text << "("
<< e1 << ") evaluates to false, where" << e1 << ") evaluates to false, where"
<< "\n" << e1 << " evaluates to " << v1; << "\n" << e1 << " evaluates to " << v1;
} }
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1. // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
// Don't use this in your code. // Don't use this in your code.
#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\ #define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
GTEST_ASSERT_(pred_format(#v1, v1),\ GTEST_ASSERT_(pred_format(#v1, v1), \
on_failure) on_failure)
// Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use // Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use
// this in your code. // this in your code.
#define GTEST_PRED1_(pred, v1, on_failure)\ #define GTEST_PRED1_(pred, v1, on_failure)\
GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \ GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
#v1, \ #v1, \
pred, \ pred, \
v1), on_failure) v1), on_failure)
skipping to change at line 144 skipping to change at line 144
return AssertionFailure() << pred_text << "(" return AssertionFailure() << pred_text << "("
<< e1 << ", " << e1 << ", "
<< e2 << ") evaluates to false, where" << e2 << ") evaluates to false, where"
<< "\n" << e1 << " evaluates to " << v1 << "\n" << e1 << " evaluates to " << v1
<< "\n" << e2 << " evaluates to " << v2; << "\n" << e2 << " evaluates to " << v2;
} }
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2. // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
// Don't use this in your code. // Don't use this in your code.
#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\ #define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2),\ GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
on_failure) on_failure)
// Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use // Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use
// this in your code. // this in your code.
#define GTEST_PRED2_(pred, v1, v2, on_failure)\ #define GTEST_PRED2_(pred, v1, v2, on_failure)\
GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \ GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
#v1, \ #v1, \
#v2, \ #v2, \
pred, \ pred, \
v1, \ v1, \
skipping to change at line 195 skipping to change at line 195
<< e2 << ", " << e2 << ", "
<< e3 << ") evaluates to false, where" << e3 << ") evaluates to false, where"
<< "\n" << e1 << " evaluates to " << v1 << "\n" << e1 << " evaluates to " << v1
<< "\n" << e2 << " evaluates to " << v2 << "\n" << e2 << " evaluates to " << v2
<< "\n" << e3 << " evaluates to " << v3; << "\n" << e3 << " evaluates to " << v3;
} }
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3. // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
// Don't use this in your code. // Don't use this in your code.
#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\ #define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3),\ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
on_failure) on_failure)
// Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use // Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use
// this in your code. // this in your code.
#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\ #define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \ GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
#v1, \ #v1, \
#v2, \ #v2, \
#v3, \ #v3, \
pred, \ pred, \
skipping to change at line 253 skipping to change at line 253
<< e4 << ") evaluates to false, where" << e4 << ") evaluates to false, where"
<< "\n" << e1 << " evaluates to " << v1 << "\n" << e1 << " evaluates to " << v1
<< "\n" << e2 << " evaluates to " << v2 << "\n" << e2 << " evaluates to " << v2
<< "\n" << e3 << " evaluates to " << v3 << "\n" << e3 << " evaluates to " << v3
<< "\n" << e4 << " evaluates to " << v4; << "\n" << e4 << " evaluates to " << v4;
} }
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4. // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
// Don't use this in your code. // Don't use this in your code.
#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\ #define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4),\ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
on_failure) on_failure)
// Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use // Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use
// this in your code. // this in your code.
#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\ #define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \ GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
#v1, \ #v1, \
#v2, \ #v2, \
#v3, \ #v3, \
#v4, \ #v4, \
skipping to change at line 318 skipping to change at line 318
<< "\n" << e1 << " evaluates to " << v1 << "\n" << e1 << " evaluates to " << v1
<< "\n" << e2 << " evaluates to " << v2 << "\n" << e2 << " evaluates to " << v2
<< "\n" << e3 << " evaluates to " << v3 << "\n" << e3 << " evaluates to " << v3
<< "\n" << e4 << " evaluates to " << v4 << "\n" << e4 << " evaluates to " << v4
<< "\n" << e5 << " evaluates to " << v5; << "\n" << e5 << " evaluates to " << v5;
} }
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5. // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
// Don't use this in your code. // Don't use this in your code.
#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\ #define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5),\ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
on_failure) on_failure)
// Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use // Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use
// this in your code. // this in your code.
#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\ #define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \ GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
#v1, \ #v1, \
#v2, \ #v2, \
#v3, \ #v3, \
#v4, \ #v4, \
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/