Fixes a slew of compiler warnings and turns on "warning as error" in the scons build.
This commit is contained in:
parent
284b54d304
commit
32de5f5376
|
@ -268,6 +268,7 @@ class ActionInterface {
|
||||||
|
|
||||||
// Returns true iff this is the DoDefault() action.
|
// Returns true iff this is the DoDefault() action.
|
||||||
bool IsDoDefault() const { return is_do_default_; }
|
bool IsDoDefault() const { return is_do_default_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
friend class internal::MonomorphicDoDefaultActionImpl;
|
friend class internal::MonomorphicDoDefaultActionImpl;
|
||||||
|
@ -279,6 +280,8 @@ class ActionInterface {
|
||||||
|
|
||||||
// True iff this action is DoDefault().
|
// True iff this action is DoDefault().
|
||||||
const bool is_do_default_;
|
const bool is_do_default_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionInterface);
|
||||||
};
|
};
|
||||||
|
|
||||||
// An Action<F> is a copyable and IMMUTABLE (except by assignment)
|
// An Action<F> is a copyable and IMMUTABLE (except by assignment)
|
||||||
|
@ -325,6 +328,7 @@ class Action {
|
||||||
Result Perform(const ArgumentTuple& args) const {
|
Result Perform(const ArgumentTuple& args) const {
|
||||||
return impl_->Perform(args);
|
return impl_->Perform(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename F1, typename F2>
|
template <typename F1, typename F2>
|
||||||
friend class internal::ActionAdaptor;
|
friend class internal::ActionAdaptor;
|
||||||
|
@ -362,6 +366,7 @@ class PolymorphicAction {
|
||||||
operator Action<F>() const {
|
operator Action<F>() const {
|
||||||
return Action<F>(new MonomorphicImpl<F>(impl_));
|
return Action<F>(new MonomorphicImpl<F>(impl_));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename F>
|
template <typename F>
|
||||||
class MonomorphicImpl : public ActionInterface<F> {
|
class MonomorphicImpl : public ActionInterface<F> {
|
||||||
|
@ -377,9 +382,13 @@ class PolymorphicAction {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Impl impl_;
|
Impl impl_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(MonomorphicImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
Impl impl_;
|
Impl impl_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(PolymorphicAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Creates an Action from its implementation and returns it. The
|
// Creates an Action from its implementation and returns it. The
|
||||||
|
@ -416,8 +425,11 @@ class ActionAdaptor : public ActionInterface<F1> {
|
||||||
virtual Result Perform(const ArgumentTuple& args) {
|
virtual Result Perform(const ArgumentTuple& args) {
|
||||||
return impl_->Perform(args);
|
return impl_->Perform(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const internal::linked_ptr<ActionInterface<F2> > impl_;
|
const internal::linked_ptr<ActionInterface<F2> > impl_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ActionAdaptor);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the polymorphic Return(x) action, which can be used in
|
// Implements the polymorphic Return(x) action, which can be used in
|
||||||
|
@ -470,6 +482,7 @@ class ReturnAction {
|
||||||
use_ReturnRef_instead_of_Return_to_return_a_reference);
|
use_ReturnRef_instead_of_Return_to_return_a_reference);
|
||||||
return Action<F>(new Impl<F>(value_));
|
return Action<F>(new Impl<F>(value_));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Implements the Return(x) action for a particular function type F.
|
// Implements the Return(x) action for a particular function type F.
|
||||||
template <typename F>
|
template <typename F>
|
||||||
|
@ -494,9 +507,13 @@ class ReturnAction {
|
||||||
GMOCK_COMPILE_ASSERT_(!internal::is_reference<Result>::value,
|
GMOCK_COMPILE_ASSERT_(!internal::is_reference<Result>::value,
|
||||||
Result_cannot_be_a_reference_type);
|
Result_cannot_be_a_reference_type);
|
||||||
Result value_;
|
Result value_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(Impl);
|
||||||
};
|
};
|
||||||
|
|
||||||
R value_;
|
R value_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ReturnAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the ReturnNull() action.
|
// Implements the ReturnNull() action.
|
||||||
|
@ -542,6 +559,7 @@ class ReturnRefAction {
|
||||||
use_Return_instead_of_ReturnRef_to_return_a_value);
|
use_Return_instead_of_ReturnRef_to_return_a_value);
|
||||||
return Action<F>(new Impl<F>(ref_));
|
return Action<F>(new Impl<F>(ref_));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Implements the ReturnRef(x) action for a particular function type F.
|
// Implements the ReturnRef(x) action for a particular function type F.
|
||||||
template <typename F>
|
template <typename F>
|
||||||
|
@ -555,11 +573,16 @@ class ReturnRefAction {
|
||||||
virtual Result Perform(const ArgumentTuple&) {
|
virtual Result Perform(const ArgumentTuple&) {
|
||||||
return ref_;
|
return ref_;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T& ref_;
|
T& ref_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(Impl);
|
||||||
};
|
};
|
||||||
|
|
||||||
T& ref_;
|
T& ref_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ReturnRefAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the DoDefault() action for a particular function type F.
|
// Implements the DoDefault() action for a particular function type F.
|
||||||
|
@ -611,9 +634,12 @@ class AssignAction {
|
||||||
void Perform(const ArgumentTuple& /* args */) const {
|
void Perform(const ArgumentTuple& /* args */) const {
|
||||||
*ptr_ = value_;
|
*ptr_ = value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T1* const ptr_;
|
T1* const ptr_;
|
||||||
const T2 value_;
|
const T2 value_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(AssignAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !GTEST_OS_WINDOWS_MOBILE
|
#if !GTEST_OS_WINDOWS_MOBILE
|
||||||
|
@ -631,9 +657,12 @@ class SetErrnoAndReturnAction {
|
||||||
errno = errno_;
|
errno = errno_;
|
||||||
return result_;
|
return result_;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int errno_;
|
const int errno_;
|
||||||
const T result_;
|
const T result_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(SetErrnoAndReturnAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !GTEST_OS_WINDOWS_MOBILE
|
#endif // !GTEST_OS_WINDOWS_MOBILE
|
||||||
|
@ -657,6 +686,8 @@ class SetArgumentPointeeAction {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const A value_;
|
const A value_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t N, typename Proto>
|
template <size_t N, typename Proto>
|
||||||
|
@ -675,8 +706,11 @@ class SetArgumentPointeeAction<N, Proto, true> {
|
||||||
CompileAssertTypesEqual<void, Result>();
|
CompileAssertTypesEqual<void, Result>();
|
||||||
::std::tr1::get<N>(args)->CopyFrom(*proto_);
|
::std::tr1::get<N>(args)->CopyFrom(*proto_);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const internal::linked_ptr<Proto> proto_;
|
const internal::linked_ptr<Proto> proto_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the InvokeWithoutArgs(f) action. The template argument
|
// Implements the InvokeWithoutArgs(f) action. The template argument
|
||||||
|
@ -696,8 +730,11 @@ class InvokeWithoutArgsAction {
|
||||||
// compatible with f.
|
// compatible with f.
|
||||||
template <typename Result, typename ArgumentTuple>
|
template <typename Result, typename ArgumentTuple>
|
||||||
Result Perform(const ArgumentTuple&) { return function_impl_(); }
|
Result Perform(const ArgumentTuple&) { return function_impl_(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FunctionImpl function_impl_;
|
FunctionImpl function_impl_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(InvokeWithoutArgsAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the InvokeWithoutArgs(object_ptr, &Class::Method) action.
|
// Implements the InvokeWithoutArgs(object_ptr, &Class::Method) action.
|
||||||
|
@ -711,9 +748,12 @@ class InvokeMethodWithoutArgsAction {
|
||||||
Result Perform(const ArgumentTuple&) const {
|
Result Perform(const ArgumentTuple&) const {
|
||||||
return (obj_ptr_->*method_ptr_)();
|
return (obj_ptr_->*method_ptr_)();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Class* const obj_ptr_;
|
Class* const obj_ptr_;
|
||||||
const MethodPtr method_ptr_;
|
const MethodPtr method_ptr_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(InvokeMethodWithoutArgsAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the IgnoreResult(action) action.
|
// Implements the IgnoreResult(action) action.
|
||||||
|
@ -739,6 +779,7 @@ class IgnoreResultAction {
|
||||||
|
|
||||||
return Action<F>(new Impl<F>(action_));
|
return Action<F>(new Impl<F>(action_));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename F>
|
template <typename F>
|
||||||
class Impl : public ActionInterface<F> {
|
class Impl : public ActionInterface<F> {
|
||||||
|
@ -760,9 +801,13 @@ class IgnoreResultAction {
|
||||||
OriginalFunction;
|
OriginalFunction;
|
||||||
|
|
||||||
const Action<OriginalFunction> action_;
|
const Action<OriginalFunction> action_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(Impl);
|
||||||
};
|
};
|
||||||
|
|
||||||
const A action_;
|
const A action_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(IgnoreResultAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
// A ReferenceWrapper<T> object represents a reference to type T,
|
// A ReferenceWrapper<T> object represents a reference to type T,
|
||||||
|
@ -827,10 +872,14 @@ class DoBothAction {
|
||||||
private:
|
private:
|
||||||
const Action<VoidResult> action1_;
|
const Action<VoidResult> action1_;
|
||||||
const Action<F> action2_;
|
const Action<F> action2_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(Impl);
|
||||||
};
|
};
|
||||||
|
|
||||||
Action1 action1_;
|
Action1 action1_;
|
||||||
Action2 action2_;
|
Action2 action2_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(DoBothAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
|
@ -615,6 +615,8 @@ class WithArgsAction {
|
||||||
};
|
};
|
||||||
|
|
||||||
const InnerAction action_;
|
const InnerAction action_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(WithArgsAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
// A macro from the ACTION* family (defined later in this file)
|
// A macro from the ACTION* family (defined later in this file)
|
||||||
|
@ -1406,12 +1408,16 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
|
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
|
||||||
arg9_type arg9) const;\
|
arg9_type arg9) const;\
|
||||||
GMOCK_INTERNAL_DEFN_##value_params\
|
GMOCK_INTERNAL_DEFN_##value_params\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
|
||||||
};\
|
};\
|
||||||
template <typename F> operator ::testing::Action<F>() const {\
|
template <typename F> operator ::testing::Action<F>() const {\
|
||||||
return ::testing::Action<F>(\
|
return ::testing::Action<F>(\
|
||||||
new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
|
new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
|
||||||
}\
|
}\
|
||||||
GMOCK_INTERNAL_DEFN_##value_params\
|
GMOCK_INTERNAL_DEFN_##value_params\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, 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>\
|
||||||
|
@ -1462,10 +1468,14 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
|
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
|
||||||
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
|
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
|
||||||
arg9_type arg9) const;\
|
arg9_type arg9) const;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
|
||||||
};\
|
};\
|
||||||
template <typename F> operator ::testing::Action<F>() const {\
|
template <typename F> operator ::testing::Action<F>() const {\
|
||||||
return ::testing::Action<F>(new gmock_Impl<F>());\
|
return ::testing::Action<F>(new gmock_Impl<F>());\
|
||||||
}\
|
}\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##Action);\
|
||||||
};\
|
};\
|
||||||
inline name##Action name() {\
|
inline name##Action name() {\
|
||||||
return name##Action();\
|
return name##Action();\
|
||||||
|
@ -1505,11 +1515,15 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
|
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
|
||||||
arg9_type arg9) const;\
|
arg9_type arg9) const;\
|
||||||
p0##_type p0;\
|
p0##_type p0;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
|
||||||
};\
|
};\
|
||||||
template <typename F> operator ::testing::Action<F>() const {\
|
template <typename F> operator ::testing::Action<F>() const {\
|
||||||
return ::testing::Action<F>(new gmock_Impl<F>(p0));\
|
return ::testing::Action<F>(new gmock_Impl<F>(p0));\
|
||||||
}\
|
}\
|
||||||
p0##_type p0;\
|
p0##_type p0;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##ActionP);\
|
||||||
};\
|
};\
|
||||||
template <typename p0##_type>\
|
template <typename p0##_type>\
|
||||||
inline name##ActionP<p0##_type> name(p0##_type p0) {\
|
inline name##ActionP<p0##_type> name(p0##_type p0) {\
|
||||||
|
@ -1554,12 +1568,16 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
arg9_type arg9) const;\
|
arg9_type arg9) const;\
|
||||||
p0##_type p0;\
|
p0##_type p0;\
|
||||||
p1##_type p1;\
|
p1##_type p1;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
|
||||||
};\
|
};\
|
||||||
template <typename F> operator ::testing::Action<F>() const {\
|
template <typename F> operator ::testing::Action<F>() const {\
|
||||||
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\
|
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\
|
||||||
}\
|
}\
|
||||||
p0##_type p0;\
|
p0##_type p0;\
|
||||||
p1##_type p1;\
|
p1##_type p1;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##ActionP2);\
|
||||||
};\
|
};\
|
||||||
template <typename p0##_type, typename p1##_type>\
|
template <typename p0##_type, typename p1##_type>\
|
||||||
inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \
|
inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \
|
||||||
|
@ -1606,6 +1624,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p0##_type p0;\
|
p0##_type p0;\
|
||||||
p1##_type p1;\
|
p1##_type p1;\
|
||||||
p2##_type p2;\
|
p2##_type p2;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
|
||||||
};\
|
};\
|
||||||
template <typename F> operator ::testing::Action<F>() const {\
|
template <typename F> operator ::testing::Action<F>() const {\
|
||||||
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\
|
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\
|
||||||
|
@ -1613,6 +1633,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p0##_type p0;\
|
p0##_type p0;\
|
||||||
p1##_type p1;\
|
p1##_type p1;\
|
||||||
p2##_type p2;\
|
p2##_type p2;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##ActionP3);\
|
||||||
};\
|
};\
|
||||||
template <typename p0##_type, typename p1##_type, typename p2##_type>\
|
template <typename p0##_type, typename p1##_type, typename p2##_type>\
|
||||||
inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
|
inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
|
||||||
|
@ -1664,6 +1686,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p1##_type p1;\
|
p1##_type p1;\
|
||||||
p2##_type p2;\
|
p2##_type p2;\
|
||||||
p3##_type p3;\
|
p3##_type p3;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
|
||||||
};\
|
};\
|
||||||
template <typename F> operator ::testing::Action<F>() const {\
|
template <typename F> operator ::testing::Action<F>() const {\
|
||||||
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\
|
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\
|
||||||
|
@ -1672,6 +1696,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p1##_type p1;\
|
p1##_type p1;\
|
||||||
p2##_type p2;\
|
p2##_type p2;\
|
||||||
p3##_type p3;\
|
p3##_type p3;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##ActionP4);\
|
||||||
};\
|
};\
|
||||||
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>\
|
||||||
|
@ -1729,6 +1755,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p2##_type p2;\
|
p2##_type p2;\
|
||||||
p3##_type p3;\
|
p3##_type p3;\
|
||||||
p4##_type p4;\
|
p4##_type p4;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
|
||||||
};\
|
};\
|
||||||
template <typename F> operator ::testing::Action<F>() const {\
|
template <typename F> operator ::testing::Action<F>() const {\
|
||||||
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\
|
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\
|
||||||
|
@ -1738,6 +1766,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p2##_type p2;\
|
p2##_type p2;\
|
||||||
p3##_type p3;\
|
p3##_type p3;\
|
||||||
p4##_type p4;\
|
p4##_type p4;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##ActionP5);\
|
||||||
};\
|
};\
|
||||||
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>\
|
||||||
|
@ -1797,6 +1827,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p3##_type p3;\
|
p3##_type p3;\
|
||||||
p4##_type p4;\
|
p4##_type p4;\
|
||||||
p5##_type p5;\
|
p5##_type p5;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
|
||||||
};\
|
};\
|
||||||
template <typename F> operator ::testing::Action<F>() const {\
|
template <typename F> operator ::testing::Action<F>() const {\
|
||||||
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\
|
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\
|
||||||
|
@ -1807,6 +1839,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p3##_type p3;\
|
p3##_type p3;\
|
||||||
p4##_type p4;\
|
p4##_type p4;\
|
||||||
p5##_type p5;\
|
p5##_type p5;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##ActionP6);\
|
||||||
};\
|
};\
|
||||||
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>\
|
||||||
|
@ -1869,6 +1903,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p4##_type p4;\
|
p4##_type p4;\
|
||||||
p5##_type p5;\
|
p5##_type p5;\
|
||||||
p6##_type p6;\
|
p6##_type p6;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
|
||||||
};\
|
};\
|
||||||
template <typename F> operator ::testing::Action<F>() const {\
|
template <typename F> operator ::testing::Action<F>() const {\
|
||||||
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
|
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
|
||||||
|
@ -1881,6 +1917,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p4##_type p4;\
|
p4##_type p4;\
|
||||||
p5##_type p5;\
|
p5##_type p5;\
|
||||||
p6##_type p6;\
|
p6##_type p6;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##ActionP7);\
|
||||||
};\
|
};\
|
||||||
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, \
|
||||||
|
@ -1949,6 +1987,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p5##_type p5;\
|
p5##_type p5;\
|
||||||
p6##_type p6;\
|
p6##_type p6;\
|
||||||
p7##_type p7;\
|
p7##_type p7;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
|
||||||
};\
|
};\
|
||||||
template <typename F> operator ::testing::Action<F>() const {\
|
template <typename F> operator ::testing::Action<F>() const {\
|
||||||
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
|
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
|
||||||
|
@ -1962,6 +2002,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p5##_type p5;\
|
p5##_type p5;\
|
||||||
p6##_type p6;\
|
p6##_type p6;\
|
||||||
p7##_type p7;\
|
p7##_type p7;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##ActionP8);\
|
||||||
};\
|
};\
|
||||||
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, \
|
||||||
|
@ -2034,6 +2076,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p6##_type p6;\
|
p6##_type p6;\
|
||||||
p7##_type p7;\
|
p7##_type p7;\
|
||||||
p8##_type p8;\
|
p8##_type p8;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
|
||||||
};\
|
};\
|
||||||
template <typename F> operator ::testing::Action<F>() const {\
|
template <typename F> operator ::testing::Action<F>() const {\
|
||||||
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
|
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
|
||||||
|
@ -2048,6 +2092,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p6##_type p6;\
|
p6##_type p6;\
|
||||||
p7##_type p7;\
|
p7##_type p7;\
|
||||||
p8##_type p8;\
|
p8##_type p8;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##ActionP9);\
|
||||||
};\
|
};\
|
||||||
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, \
|
||||||
|
@ -2123,6 +2169,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p7##_type p7;\
|
p7##_type p7;\
|
||||||
p8##_type p8;\
|
p8##_type p8;\
|
||||||
p9##_type p9;\
|
p9##_type p9;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
|
||||||
};\
|
};\
|
||||||
template <typename F> operator ::testing::Action<F>() const {\
|
template <typename F> operator ::testing::Action<F>() const {\
|
||||||
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
|
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
|
||||||
|
@ -2138,6 +2186,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
p7##_type p7;\
|
p7##_type p7;\
|
||||||
p8##_type p8;\
|
p8##_type p8;\
|
||||||
p9##_type p9;\
|
p9##_type p9;\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##ActionP10);\
|
||||||
};\
|
};\
|
||||||
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
||||||
typename p3##_type, typename p4##_type, typename p5##_type, \
|
typename p3##_type, typename p4##_type, typename p5##_type, \
|
||||||
|
@ -2172,6 +2222,16 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
|
||||||
// updated.
|
// updated.
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
|
// The ACTION*() macros trigger warning C4100 (unreferenced formal
|
||||||
|
// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
|
||||||
|
// the macro definition, as the warnings are generated when the macro
|
||||||
|
// is expanded and macro expansion cannot contain #pragma. Therefore
|
||||||
|
// we suppress them here.
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4100)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Various overloads for InvokeArgument<N>().
|
// Various overloads for InvokeArgument<N>().
|
||||||
//
|
//
|
||||||
// The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th
|
// The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th
|
||||||
|
@ -2350,6 +2410,10 @@ ACTION_TEMPLATE(ReturnNew,
|
||||||
return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
|
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
|
||||||
|
|
|
@ -228,6 +228,8 @@ class WithArgsAction {
|
||||||
};
|
};
|
||||||
|
|
||||||
const InnerAction action_;
|
const InnerAction action_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(WithArgsAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
// A macro from the ACTION* family (defined later in this file)
|
// A macro from the ACTION* family (defined later in this file)
|
||||||
|
@ -630,12 +632,16 @@ $range k 0..n-1
|
||||||
return_type gmock_PerformImpl(const args_type& args[[]]
|
return_type gmock_PerformImpl(const args_type& args[[]]
|
||||||
$for k [[, arg$k[[]]_type arg$k]]) const;\
|
$for k [[, arg$k[[]]_type arg$k]]) const;\
|
||||||
GMOCK_INTERNAL_DEFN_##value_params\
|
GMOCK_INTERNAL_DEFN_##value_params\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
|
||||||
};\
|
};\
|
||||||
template <typename F> operator ::testing::Action<F>() const {\
|
template <typename F> operator ::testing::Action<F>() const {\
|
||||||
return ::testing::Action<F>(\
|
return ::testing::Action<F>(\
|
||||||
new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
|
new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
|
||||||
}\
|
}\
|
||||||
GMOCK_INTERNAL_DEFN_##value_params\
|
GMOCK_INTERNAL_DEFN_##value_params\
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, 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>\
|
||||||
|
@ -712,10 +718,14 @@ $var macro_name = [[$if i==0 [[ACTION]] $elif i==1 [[ACTION_P]]
|
||||||
template <$typename_arg_types>\
|
template <$typename_arg_types>\
|
||||||
return_type gmock_PerformImpl(const args_type& args, [[]]
|
return_type gmock_PerformImpl(const args_type& args, [[]]
|
||||||
$arg_types_and_names) const;\$param_field_decls
|
$arg_types_and_names) const;\$param_field_decls
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
|
||||||
};\
|
};\
|
||||||
template <typename F> operator ::testing::Action<F>() const {\
|
template <typename F> operator ::testing::Action<F>() const {\
|
||||||
return ::testing::Action<F>(new gmock_Impl<F>($params));\
|
return ::testing::Action<F>(new gmock_Impl<F>($params));\
|
||||||
}\$param_field_decls2
|
}\$param_field_decls2
|
||||||
|
private:\
|
||||||
|
GTEST_DISALLOW_ASSIGN_($class_name);\
|
||||||
};\$template
|
};\$template
|
||||||
inline $class_name$param_types name($param_types_and_names) {\
|
inline $class_name$param_types name($param_types_and_names) {\
|
||||||
return $class_name$param_types($params);\
|
return $class_name$param_types($params);\
|
||||||
|
@ -735,6 +745,16 @@ $$ // show up in the generated code.
|
||||||
// updated.
|
// updated.
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
|
// The ACTION*() macros trigger warning C4100 (unreferenced formal
|
||||||
|
// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
|
||||||
|
// the macro definition, as the warnings are generated when the macro
|
||||||
|
// is expanded and macro expansion cannot contain #pragma. Therefore
|
||||||
|
// we suppress them here.
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4100)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Various overloads for InvokeArgument<N>().
|
// Various overloads for InvokeArgument<N>().
|
||||||
//
|
//
|
||||||
// The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th
|
// The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th
|
||||||
|
@ -796,6 +816,10 @@ ACTION_TEMPLATE(ReturnNew,
|
||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
|
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
|
||||||
|
|
|
@ -794,66 +794,116 @@ class MockFunction;
|
||||||
template <typename R>
|
template <typename R>
|
||||||
class MockFunction<R()> {
|
class MockFunction<R()> {
|
||||||
public:
|
public:
|
||||||
|
MockFunction() {}
|
||||||
|
|
||||||
MOCK_METHOD0_T(Call, R());
|
MOCK_METHOD0_T(Call, R());
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename A0>
|
template <typename R, typename A0>
|
||||||
class MockFunction<R(A0)> {
|
class MockFunction<R(A0)> {
|
||||||
public:
|
public:
|
||||||
|
MockFunction() {}
|
||||||
|
|
||||||
MOCK_METHOD1_T(Call, R(A0));
|
MOCK_METHOD1_T(Call, R(A0));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename A0, typename A1>
|
template <typename R, typename A0, typename A1>
|
||||||
class MockFunction<R(A0, A1)> {
|
class MockFunction<R(A0, A1)> {
|
||||||
public:
|
public:
|
||||||
|
MockFunction() {}
|
||||||
|
|
||||||
MOCK_METHOD2_T(Call, R(A0, A1));
|
MOCK_METHOD2_T(Call, R(A0, A1));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename A0, typename A1, typename A2>
|
template <typename R, typename A0, typename A1, typename A2>
|
||||||
class MockFunction<R(A0, A1, A2)> {
|
class MockFunction<R(A0, A1, A2)> {
|
||||||
public:
|
public:
|
||||||
|
MockFunction() {}
|
||||||
|
|
||||||
MOCK_METHOD3_T(Call, R(A0, A1, A2));
|
MOCK_METHOD3_T(Call, R(A0, A1, A2));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename A0, typename A1, typename A2, typename A3>
|
template <typename R, typename A0, typename A1, typename A2, typename A3>
|
||||||
class MockFunction<R(A0, A1, A2, A3)> {
|
class MockFunction<R(A0, A1, A2, A3)> {
|
||||||
public:
|
public:
|
||||||
|
MockFunction() {}
|
||||||
|
|
||||||
MOCK_METHOD4_T(Call, R(A0, A1, A2, A3));
|
MOCK_METHOD4_T(Call, R(A0, A1, A2, A3));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename A0, typename A1, typename A2, typename A3,
|
template <typename R, typename A0, typename A1, typename A2, typename A3,
|
||||||
typename A4>
|
typename A4>
|
||||||
class MockFunction<R(A0, A1, A2, A3, A4)> {
|
class MockFunction<R(A0, A1, A2, A3, A4)> {
|
||||||
public:
|
public:
|
||||||
|
MockFunction() {}
|
||||||
|
|
||||||
MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4));
|
MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename A0, typename A1, typename A2, typename A3,
|
template <typename R, typename A0, typename A1, typename A2, typename A3,
|
||||||
typename A4, typename A5>
|
typename A4, typename A5>
|
||||||
class MockFunction<R(A0, A1, A2, A3, A4, A5)> {
|
class MockFunction<R(A0, A1, A2, A3, A4, A5)> {
|
||||||
public:
|
public:
|
||||||
|
MockFunction() {}
|
||||||
|
|
||||||
MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5));
|
MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename A0, typename A1, typename A2, typename A3,
|
template <typename R, typename A0, typename A1, typename A2, typename A3,
|
||||||
typename A4, typename A5, typename A6>
|
typename A4, typename A5, typename A6>
|
||||||
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> {
|
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> {
|
||||||
public:
|
public:
|
||||||
|
MockFunction() {}
|
||||||
|
|
||||||
MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6));
|
MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename A0, typename A1, typename A2, typename A3,
|
template <typename R, typename A0, typename A1, typename A2, typename A3,
|
||||||
typename A4, typename A5, typename A6, typename A7>
|
typename A4, typename A5, typename A6, typename A7>
|
||||||
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> {
|
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> {
|
||||||
public:
|
public:
|
||||||
|
MockFunction() {}
|
||||||
|
|
||||||
MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7));
|
MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename A0, typename A1, typename A2, typename A3,
|
template <typename R, typename A0, 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>
|
||||||
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> {
|
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> {
|
||||||
public:
|
public:
|
||||||
|
MockFunction() {}
|
||||||
|
|
||||||
MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8));
|
MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename A0, typename A1, typename A2, typename A3,
|
template <typename R, typename A0, typename A1, typename A2, typename A3,
|
||||||
|
@ -861,7 +911,12 @@ template <typename R, typename A0, typename A1, typename A2, typename A3,
|
||||||
typename A9>
|
typename A9>
|
||||||
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
|
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
|
||||||
public:
|
public:
|
||||||
|
MockFunction() {}
|
||||||
|
|
||||||
MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9));
|
MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
|
@ -242,7 +242,12 @@ $range j 0..i-1
|
||||||
template <typename R$for j [[, typename A$j]]>
|
template <typename R$for j [[, typename A$j]]>
|
||||||
class MockFunction<R($for j, [[A$j]])> {
|
class MockFunction<R($for j, [[A$j]])> {
|
||||||
public:
|
public:
|
||||||
|
MockFunction() {}
|
||||||
|
|
||||||
MOCK_METHOD$i[[]]_T(Call, R($for j, [[A$j]]));
|
MOCK_METHOD$i[[]]_T(Call, R($for j, [[A$j]]));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ template <class Tuple>
|
||||||
class TupleFields<Tuple, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
|
class TupleFields<Tuple, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
|
||||||
public:
|
public:
|
||||||
typedef ::std::tr1::tuple<> type;
|
typedef ::std::tr1::tuple<> type;
|
||||||
static type GetSelectedFields(const Tuple& t) {
|
static type GetSelectedFields(const Tuple& /* t */) {
|
||||||
using ::std::tr1::get;
|
using ::std::tr1::get;
|
||||||
return type();
|
return type();
|
||||||
}
|
}
|
||||||
|
@ -271,6 +271,8 @@ class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const MonomorphicInnerMatcher inner_matcher_;
|
const MonomorphicInnerMatcher inner_matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ArgsMatcherImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class InnerMatcher, int k0 = -1, int k1 = -1, int k2 = -1,
|
template <class InnerMatcher, int k0 = -1, int k1 = -1, int k2 = -1,
|
||||||
|
@ -287,7 +289,10 @@ class ArgsMatcher {
|
||||||
k6, k7, k8, k9>(inner_matcher_));
|
k6, k7, k8, k9>(inner_matcher_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
const InnerMatcher inner_matcher_;
|
const InnerMatcher inner_matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ArgsMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements ElementsAre() of 1-10 arguments.
|
// Implements ElementsAre() of 1-10 arguments.
|
||||||
|
@ -317,6 +322,8 @@ class ElementsAreMatcher1 {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const T1& e1_;
|
const T1& e1_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher1);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T1, typename T2>
|
template <typename T1, typename T2>
|
||||||
|
@ -342,6 +349,8 @@ class ElementsAreMatcher2 {
|
||||||
private:
|
private:
|
||||||
const T1& e1_;
|
const T1& e1_;
|
||||||
const T2& e2_;
|
const T2& e2_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher2);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T1, typename T2, typename T3>
|
template <typename T1, typename T2, typename T3>
|
||||||
|
@ -370,6 +379,8 @@ class ElementsAreMatcher3 {
|
||||||
const T1& e1_;
|
const T1& e1_;
|
||||||
const T2& e2_;
|
const T2& e2_;
|
||||||
const T3& e3_;
|
const T3& e3_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher3);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T1, typename T2, typename T3, typename T4>
|
template <typename T1, typename T2, typename T3, typename T4>
|
||||||
|
@ -400,6 +411,8 @@ class ElementsAreMatcher4 {
|
||||||
const T2& e2_;
|
const T2& e2_;
|
||||||
const T3& e3_;
|
const T3& e3_;
|
||||||
const T4& e4_;
|
const T4& e4_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher4);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T1, typename T2, typename T3, typename T4, typename T5>
|
template <typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||||
|
@ -432,6 +445,8 @@ class ElementsAreMatcher5 {
|
||||||
const T3& e3_;
|
const T3& e3_;
|
||||||
const T4& e4_;
|
const T4& e4_;
|
||||||
const T5& e5_;
|
const T5& e5_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher5);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
||||||
|
@ -468,6 +483,8 @@ class ElementsAreMatcher6 {
|
||||||
const T4& e4_;
|
const T4& e4_;
|
||||||
const T5& e5_;
|
const T5& e5_;
|
||||||
const T6& e6_;
|
const T6& e6_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher6);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
||||||
|
@ -506,6 +523,8 @@ class ElementsAreMatcher7 {
|
||||||
const T5& e5_;
|
const T5& e5_;
|
||||||
const T6& e6_;
|
const T6& e6_;
|
||||||
const T7& e7_;
|
const T7& e7_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher7);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
||||||
|
@ -546,6 +565,8 @@ class ElementsAreMatcher8 {
|
||||||
const T6& e6_;
|
const T6& e6_;
|
||||||
const T7& e7_;
|
const T7& e7_;
|
||||||
const T8& e8_;
|
const T8& e8_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher8);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
||||||
|
@ -589,6 +610,8 @@ class ElementsAreMatcher9 {
|
||||||
const T7& e7_;
|
const T7& e7_;
|
||||||
const T8& e8_;
|
const T8& e8_;
|
||||||
const T9& e9_;
|
const T9& e9_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher9);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
||||||
|
@ -634,6 +657,8 @@ class ElementsAreMatcher10 {
|
||||||
const T8& e8_;
|
const T8& e8_;
|
||||||
const T9& e9_;
|
const T9& e9_;
|
||||||
const T10& e10_;
|
const T10& e10_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher10);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
@ -1012,6 +1037,8 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
#name, description, gmock_interp_, gmock_printed_params);\
|
#name, description, gmock_interp_, gmock_printed_params);\
|
||||||
}\
|
}\
|
||||||
const ::testing::internal::Interpolations gmock_interp_;\
|
const ::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
private:\
|
||||||
|
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 {\
|
||||||
|
@ -1023,7 +1050,9 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
|
gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
|
||||||
gmock_param_names, ("" description ""));\
|
gmock_param_names, ("" description ""));\
|
||||||
}\
|
}\
|
||||||
|
private:\
|
||||||
::testing::internal::Interpolations gmock_interp_;\
|
::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##Matcher);\
|
||||||
};\
|
};\
|
||||||
inline name##Matcher name() {\
|
inline name##Matcher name() {\
|
||||||
return name##Matcher();\
|
return name##Matcher();\
|
||||||
|
@ -1052,6 +1081,8 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
}\
|
}\
|
||||||
p0##_type p0;\
|
p0##_type p0;\
|
||||||
const ::testing::internal::Interpolations gmock_interp_;\
|
const ::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
private:\
|
||||||
|
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 {\
|
||||||
|
@ -1064,7 +1095,9 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
gmock_param_names, ("" description ""));\
|
gmock_param_names, ("" description ""));\
|
||||||
}\
|
}\
|
||||||
p0##_type p0;\
|
p0##_type p0;\
|
||||||
|
private:\
|
||||||
::testing::internal::Interpolations gmock_interp_;\
|
::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
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) {\
|
||||||
|
@ -1096,6 +1129,8 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p0##_type p0;\
|
p0##_type p0;\
|
||||||
p1##_type p1;\
|
p1##_type p1;\
|
||||||
const ::testing::internal::Interpolations gmock_interp_;\
|
const ::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
private:\
|
||||||
|
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 {\
|
||||||
|
@ -1110,7 +1145,9 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
}\
|
}\
|
||||||
p0##_type p0;\
|
p0##_type p0;\
|
||||||
p1##_type p1;\
|
p1##_type p1;\
|
||||||
|
private:\
|
||||||
::testing::internal::Interpolations gmock_interp_;\
|
::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##MatcherP2);\
|
||||||
};\
|
};\
|
||||||
template <typename p0##_type, typename p1##_type>\
|
template <typename p0##_type, typename p1##_type>\
|
||||||
inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \
|
inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \
|
||||||
|
@ -1146,6 +1183,8 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p1##_type p1;\
|
p1##_type p1;\
|
||||||
p2##_type p2;\
|
p2##_type p2;\
|
||||||
const ::testing::internal::Interpolations gmock_interp_;\
|
const ::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
private:\
|
||||||
|
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 {\
|
||||||
|
@ -1161,7 +1200,9 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p0##_type p0;\
|
p0##_type p0;\
|
||||||
p1##_type p1;\
|
p1##_type p1;\
|
||||||
p2##_type p2;\
|
p2##_type p2;\
|
||||||
|
private:\
|
||||||
::testing::internal::Interpolations gmock_interp_;\
|
::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##MatcherP3);\
|
||||||
};\
|
};\
|
||||||
template <typename p0##_type, typename p1##_type, typename p2##_type>\
|
template <typename p0##_type, typename p1##_type, typename p2##_type>\
|
||||||
inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
|
inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
|
||||||
|
@ -1200,6 +1241,8 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p2##_type p2;\
|
p2##_type p2;\
|
||||||
p3##_type p3;\
|
p3##_type p3;\
|
||||||
const ::testing::internal::Interpolations gmock_interp_;\
|
const ::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
private:\
|
||||||
|
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 {\
|
||||||
|
@ -1217,7 +1260,9 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p1##_type p1;\
|
p1##_type p1;\
|
||||||
p2##_type p2;\
|
p2##_type p2;\
|
||||||
p3##_type p3;\
|
p3##_type p3;\
|
||||||
|
private:\
|
||||||
::testing::internal::Interpolations gmock_interp_;\
|
::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##MatcherP4);\
|
||||||
};\
|
};\
|
||||||
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
||||||
typename p3##_type>\
|
typename p3##_type>\
|
||||||
|
@ -1261,6 +1306,8 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p3##_type p3;\
|
p3##_type p3;\
|
||||||
p4##_type p4;\
|
p4##_type p4;\
|
||||||
const ::testing::internal::Interpolations gmock_interp_;\
|
const ::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
private:\
|
||||||
|
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 {\
|
||||||
|
@ -1280,7 +1327,9 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p2##_type p2;\
|
p2##_type p2;\
|
||||||
p3##_type p3;\
|
p3##_type p3;\
|
||||||
p4##_type p4;\
|
p4##_type p4;\
|
||||||
|
private:\
|
||||||
::testing::internal::Interpolations gmock_interp_;\
|
::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##MatcherP5);\
|
||||||
};\
|
};\
|
||||||
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
||||||
typename p3##_type, typename p4##_type>\
|
typename p3##_type, typename p4##_type>\
|
||||||
|
@ -1325,6 +1374,8 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p4##_type p4;\
|
p4##_type p4;\
|
||||||
p5##_type p5;\
|
p5##_type p5;\
|
||||||
const ::testing::internal::Interpolations gmock_interp_;\
|
const ::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
private:\
|
||||||
|
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 {\
|
||||||
|
@ -1345,7 +1396,9 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p3##_type p3;\
|
p3##_type p3;\
|
||||||
p4##_type p4;\
|
p4##_type p4;\
|
||||||
p5##_type p5;\
|
p5##_type p5;\
|
||||||
|
private:\
|
||||||
::testing::internal::Interpolations gmock_interp_;\
|
::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##MatcherP6);\
|
||||||
};\
|
};\
|
||||||
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
||||||
typename p3##_type, typename p4##_type, typename p5##_type>\
|
typename p3##_type, typename p4##_type, typename p5##_type>\
|
||||||
|
@ -1396,6 +1449,8 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p5##_type p5;\
|
p5##_type p5;\
|
||||||
p6##_type p6;\
|
p6##_type p6;\
|
||||||
const ::testing::internal::Interpolations gmock_interp_;\
|
const ::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
private:\
|
||||||
|
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 {\
|
||||||
|
@ -1419,7 +1474,9 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p4##_type p4;\
|
p4##_type p4;\
|
||||||
p5##_type p5;\
|
p5##_type p5;\
|
||||||
p6##_type p6;\
|
p6##_type p6;\
|
||||||
|
private:\
|
||||||
::testing::internal::Interpolations gmock_interp_;\
|
::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##MatcherP7);\
|
||||||
};\
|
};\
|
||||||
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
||||||
typename p3##_type, typename p4##_type, typename p5##_type, \
|
typename p3##_type, typename p4##_type, typename p5##_type, \
|
||||||
|
@ -1474,6 +1531,8 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p6##_type p6;\
|
p6##_type p6;\
|
||||||
p7##_type p7;\
|
p7##_type p7;\
|
||||||
const ::testing::internal::Interpolations gmock_interp_;\
|
const ::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
private:\
|
||||||
|
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 {\
|
||||||
|
@ -1500,7 +1559,9 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p5##_type p5;\
|
p5##_type p5;\
|
||||||
p6##_type p6;\
|
p6##_type p6;\
|
||||||
p7##_type p7;\
|
p7##_type p7;\
|
||||||
|
private:\
|
||||||
::testing::internal::Interpolations gmock_interp_;\
|
::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##MatcherP8);\
|
||||||
};\
|
};\
|
||||||
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
||||||
typename p3##_type, typename p4##_type, typename p5##_type, \
|
typename p3##_type, typename p4##_type, typename p5##_type, \
|
||||||
|
@ -1557,6 +1618,8 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p7##_type p7;\
|
p7##_type p7;\
|
||||||
p8##_type p8;\
|
p8##_type p8;\
|
||||||
const ::testing::internal::Interpolations gmock_interp_;\
|
const ::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
private:\
|
||||||
|
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 {\
|
||||||
|
@ -1584,7 +1647,9 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p6##_type p6;\
|
p6##_type p6;\
|
||||||
p7##_type p7;\
|
p7##_type p7;\
|
||||||
p8##_type p8;\
|
p8##_type p8;\
|
||||||
|
private:\
|
||||||
::testing::internal::Interpolations gmock_interp_;\
|
::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##MatcherP9);\
|
||||||
};\
|
};\
|
||||||
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
||||||
typename p3##_type, typename p4##_type, typename p5##_type, \
|
typename p3##_type, typename p4##_type, typename p5##_type, \
|
||||||
|
@ -1645,6 +1710,8 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p8##_type p8;\
|
p8##_type p8;\
|
||||||
p9##_type p9;\
|
p9##_type p9;\
|
||||||
const ::testing::internal::Interpolations gmock_interp_;\
|
const ::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
private:\
|
||||||
|
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 {\
|
||||||
|
@ -1673,7 +1740,9 @@ ElementsAreArray(const T (&array)[N]) {
|
||||||
p7##_type p7;\
|
p7##_type p7;\
|
||||||
p8##_type p8;\
|
p8##_type p8;\
|
||||||
p9##_type p9;\
|
p9##_type p9;\
|
||||||
|
private:\
|
||||||
::testing::internal::Interpolations gmock_interp_;\
|
::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##MatcherP10);\
|
||||||
};\
|
};\
|
||||||
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
template <typename p0##_type, typename p1##_type, typename p2##_type, \
|
||||||
typename p3##_type, typename p4##_type, typename p5##_type, \
|
typename p3##_type, typename p4##_type, typename p5##_type, \
|
||||||
|
|
|
@ -91,7 +91,7 @@ template <class Tuple$for j [[, int k$j]]>
|
||||||
class TupleFields<Tuple, $for k, [[$if k < i [[k$k]] $else [[-1]]]]> {
|
class TupleFields<Tuple, $for k, [[$if k < i [[k$k]] $else [[-1]]]]> {
|
||||||
public:
|
public:
|
||||||
typedef ::std::tr1::tuple<$for j, [[GMOCK_FIELD_TYPE_(Tuple, k$j)]]> type;
|
typedef ::std::tr1::tuple<$for j, [[GMOCK_FIELD_TYPE_(Tuple, k$j)]]> type;
|
||||||
static type GetSelectedFields(const Tuple& t) {
|
static type GetSelectedFields(const Tuple& $if i==0 [[/* t */]] $else [[t]]) {
|
||||||
using ::std::tr1::get;
|
using ::std::tr1::get;
|
||||||
return type($for j, [[get<k$j>(t)]]);
|
return type($for j, [[get<k$j>(t)]]);
|
||||||
}
|
}
|
||||||
|
@ -157,6 +157,8 @@ class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const MonomorphicInnerMatcher inner_matcher_;
|
const MonomorphicInnerMatcher inner_matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ArgsMatcherImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class InnerMatcher$for i [[, int k$i = -1]]>
|
template <class InnerMatcher$for i [[, int k$i = -1]]>
|
||||||
|
@ -170,7 +172,10 @@ class ArgsMatcher {
|
||||||
return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, $ks>(inner_matcher_));
|
return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, $ks>(inner_matcher_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
const InnerMatcher inner_matcher_;
|
const InnerMatcher inner_matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ArgsMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements ElementsAre() of 1-$n arguments.
|
// Implements ElementsAre() of 1-$n arguments.
|
||||||
|
@ -224,6 +229,8 @@ $for j [[
|
||||||
const T$j& e$j[[]]_;
|
const T$j& e$j[[]]_;
|
||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher$i);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -512,6 +519,8 @@ $var param_field_decls2 = [[$for j
|
||||||
#name, description, gmock_interp_, gmock_printed_params);\
|
#name, description, gmock_interp_, gmock_printed_params);\
|
||||||
}\$param_field_decls
|
}\$param_field_decls
|
||||||
const ::testing::internal::Interpolations gmock_interp_;\
|
const ::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
private:\
|
||||||
|
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 {\
|
||||||
|
@ -523,7 +532,9 @@ $var param_field_decls2 = [[$for j
|
||||||
gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
|
gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
|
||||||
gmock_param_names, ("" description ""));\
|
gmock_param_names, ("" description ""));\
|
||||||
}\$param_field_decls2
|
}\$param_field_decls2
|
||||||
|
private:\
|
||||||
::testing::internal::Interpolations gmock_interp_;\
|
::testing::internal::Interpolations gmock_interp_;\
|
||||||
|
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);\
|
||||||
|
|
|
@ -155,6 +155,9 @@ class NiceMock : public MockClass {
|
||||||
::testing::Mock::UnregisterCallReaction(
|
::testing::Mock::UnregisterCallReaction(
|
||||||
internal::implicit_cast<MockClass*>(this));
|
internal::implicit_cast<MockClass*>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class MockClass>
|
template <class MockClass>
|
||||||
|
@ -246,6 +249,9 @@ class StrictMock : public MockClass {
|
||||||
::testing::Mock::UnregisterCallReaction(
|
::testing::Mock::UnregisterCallReaction(
|
||||||
internal::implicit_cast<MockClass*>(this));
|
internal::implicit_cast<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)
|
||||||
|
|
|
@ -100,6 +100,9 @@ $range j 1..i
|
||||||
::testing::Mock::UnregisterCallReaction(
|
::testing::Mock::UnregisterCallReaction(
|
||||||
internal::implicit_cast<MockClass*>(this));
|
internal::implicit_cast<MockClass*>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class MockClass>
|
template <class MockClass>
|
||||||
|
@ -132,6 +135,9 @@ $range j 1..i
|
||||||
::testing::Mock::UnregisterCallReaction(
|
::testing::Mock::UnregisterCallReaction(
|
||||||
internal::implicit_cast<MockClass*>(this));
|
internal::implicit_cast<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)
|
||||||
|
|
|
@ -121,6 +121,7 @@ class MatcherBase {
|
||||||
void ExplainMatchResultTo(T x, ::std::ostream* os) const {
|
void ExplainMatchResultTo(T x, ::std::ostream* os) const {
|
||||||
impl_->ExplainMatchResultTo(x, os);
|
impl_->ExplainMatchResultTo(x, os);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MatcherBase() {}
|
MatcherBase() {}
|
||||||
|
|
||||||
|
@ -129,6 +130,7 @@ class MatcherBase {
|
||||||
: impl_(impl) {}
|
: impl_(impl) {}
|
||||||
|
|
||||||
virtual ~MatcherBase() {}
|
virtual ~MatcherBase() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// shared_ptr (util/gtl/shared_ptr.h) and linked_ptr have similar
|
// shared_ptr (util/gtl/shared_ptr.h) and linked_ptr have similar
|
||||||
// interfaces. The former dynamically allocates a chunk of memory
|
// interfaces. The former dynamically allocates a chunk of memory
|
||||||
|
@ -234,7 +236,7 @@ class Matcher<internal::string>
|
||||||
template <class Impl>
|
template <class Impl>
|
||||||
class PolymorphicMatcher {
|
class PolymorphicMatcher {
|
||||||
public:
|
public:
|
||||||
explicit PolymorphicMatcher(const Impl& impl) : impl_(impl) {}
|
explicit PolymorphicMatcher(const Impl& an_impl) : impl_(an_impl) {}
|
||||||
|
|
||||||
// Returns a mutable reference to the underlying matcher
|
// Returns a mutable reference to the underlying matcher
|
||||||
// implementation object.
|
// implementation object.
|
||||||
|
@ -248,6 +250,7 @@ class PolymorphicMatcher {
|
||||||
operator Matcher<T>() const {
|
operator Matcher<T>() const {
|
||||||
return Matcher<T>(new MonomorphicImpl<T>(impl_));
|
return Matcher<T>(new MonomorphicImpl<T>(impl_));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class MonomorphicImpl : public MatcherInterface<T> {
|
class MonomorphicImpl : public MatcherInterface<T> {
|
||||||
|
@ -284,9 +287,13 @@ class PolymorphicMatcher {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Impl impl_;
|
const Impl impl_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(MonomorphicImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
Impl impl_;
|
Impl impl_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(PolymorphicMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Creates a matcher from its implementation. This is easier to use
|
// Creates a matcher from its implementation. This is easier to use
|
||||||
|
@ -522,6 +529,7 @@ class MatcherCastImpl<T, Matcher<U> > {
|
||||||
static Matcher<T> Cast(const Matcher<U>& source_matcher) {
|
static Matcher<T> Cast(const Matcher<U>& source_matcher) {
|
||||||
return Matcher<T>(new Impl(source_matcher));
|
return Matcher<T>(new Impl(source_matcher));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Impl : public MatcherInterface<T> {
|
class Impl : public MatcherInterface<T> {
|
||||||
public:
|
public:
|
||||||
|
@ -544,8 +552,11 @@ class MatcherCastImpl<T, Matcher<U> > {
|
||||||
virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const {
|
virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const {
|
||||||
source_matcher_.ExplainMatchResultTo(static_cast<U>(x), os);
|
source_matcher_.ExplainMatchResultTo(static_cast<U>(x), os);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Matcher<U> source_matcher_;
|
const Matcher<U> source_matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(Impl);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -618,8 +629,10 @@ class AnythingMatcher {
|
||||||
} \
|
} \
|
||||||
private: \
|
private: \
|
||||||
Rhs rhs_; \
|
Rhs rhs_; \
|
||||||
|
GTEST_DISALLOW_ASSIGN_(Impl); \
|
||||||
}; \
|
}; \
|
||||||
Rhs rhs_; \
|
Rhs rhs_; \
|
||||||
|
GTEST_DISALLOW_ASSIGN_(name##Matcher); \
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements Eq(v), Ge(v), Gt(v), Le(v), Lt(v), and Ne(v)
|
// Implements Eq(v), Ge(v), Gt(v), Le(v), Lt(v), and Ne(v)
|
||||||
|
@ -697,6 +710,7 @@ class RefMatcher<T&> {
|
||||||
// reference to a non-const reference.
|
// reference to a non-const reference.
|
||||||
return MakeMatcher(new Impl<Super>(object_));
|
return MakeMatcher(new Impl<Super>(object_));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename Super>
|
template <typename Super>
|
||||||
class Impl : public MatcherInterface<Super&> {
|
class Impl : public MatcherInterface<Super&> {
|
||||||
|
@ -721,11 +735,16 @@ class RefMatcher<T&> {
|
||||||
::std::ostream* os) const {
|
::std::ostream* os) const {
|
||||||
*os << "is located @" << static_cast<const void*>(&x);
|
*os << "is located @" << static_cast<const void*>(&x);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Super& object_;
|
const Super& object_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(Impl);
|
||||||
};
|
};
|
||||||
|
|
||||||
T& object_;
|
T& object_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(RefMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Polymorphic helper functions for narrow and wide string matchers.
|
// Polymorphic helper functions for narrow and wide string matchers.
|
||||||
|
@ -795,6 +814,7 @@ class StrEqualityMatcher {
|
||||||
void DescribeNegationTo(::std::ostream* os) const {
|
void DescribeNegationTo(::std::ostream* os) const {
|
||||||
DescribeToHelper(!expect_eq_, os);
|
DescribeToHelper(!expect_eq_, os);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DescribeToHelper(bool expect_eq, ::std::ostream* os) const {
|
void DescribeToHelper(bool expect_eq, ::std::ostream* os) const {
|
||||||
*os << "is ";
|
*os << "is ";
|
||||||
|
@ -811,6 +831,8 @@ class StrEqualityMatcher {
|
||||||
const StringType string_;
|
const StringType string_;
|
||||||
const bool expect_eq_;
|
const bool expect_eq_;
|
||||||
const bool case_sensitive_;
|
const bool case_sensitive_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(StrEqualityMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the polymorphic HasSubstr(substring) matcher, which
|
// Implements the polymorphic HasSubstr(substring) matcher, which
|
||||||
|
@ -845,8 +867,11 @@ class HasSubstrMatcher {
|
||||||
*os << "has no substring ";
|
*os << "has no substring ";
|
||||||
UniversalPrinter<StringType>::Print(substring_, os);
|
UniversalPrinter<StringType>::Print(substring_, os);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const StringType substring_;
|
const StringType substring_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(HasSubstrMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the polymorphic StartsWith(substring) matcher, which
|
// Implements the polymorphic StartsWith(substring) matcher, which
|
||||||
|
@ -881,8 +906,11 @@ class StartsWithMatcher {
|
||||||
*os << "doesn't start with ";
|
*os << "doesn't start with ";
|
||||||
UniversalPrinter<StringType>::Print(prefix_, os);
|
UniversalPrinter<StringType>::Print(prefix_, os);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const StringType prefix_;
|
const StringType prefix_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(StartsWithMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the polymorphic EndsWith(substring) matcher, which
|
// Implements the polymorphic EndsWith(substring) matcher, which
|
||||||
|
@ -916,8 +944,11 @@ class EndsWithMatcher {
|
||||||
*os << "doesn't end with ";
|
*os << "doesn't end with ";
|
||||||
UniversalPrinter<StringType>::Print(suffix_, os);
|
UniversalPrinter<StringType>::Print(suffix_, os);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const StringType suffix_;
|
const StringType suffix_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(EndsWithMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
#if GMOCK_HAS_REGEX
|
#if GMOCK_HAS_REGEX
|
||||||
|
@ -954,9 +985,12 @@ class MatchesRegexMatcher {
|
||||||
<< " regular expression ";
|
<< " regular expression ";
|
||||||
UniversalPrinter<internal::string>::Print(regex_->pattern(), os);
|
UniversalPrinter<internal::string>::Print(regex_->pattern(), os);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const internal::linked_ptr<const RE> regex_;
|
const internal::linked_ptr<const RE> regex_;
|
||||||
const bool full_match_;
|
const bool full_match_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(MatchesRegexMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GMOCK_HAS_REGEX
|
#endif // GMOCK_HAS_REGEX
|
||||||
|
@ -1030,8 +1064,11 @@ class NotMatcherImpl : public MatcherInterface<T> {
|
||||||
virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const {
|
virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const {
|
||||||
matcher_.ExplainMatchResultTo(x, os);
|
matcher_.ExplainMatchResultTo(x, os);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Matcher<T> matcher_;
|
const Matcher<T> matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(NotMatcherImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the Not(m) matcher, which matches a value that doesn't
|
// Implements the Not(m) matcher, which matches a value that doesn't
|
||||||
|
@ -1047,8 +1084,11 @@ class NotMatcher {
|
||||||
operator Matcher<T>() const {
|
operator Matcher<T>() const {
|
||||||
return Matcher<T>(new NotMatcherImpl<T>(SafeMatcherCast<T>(matcher_)));
|
return Matcher<T>(new NotMatcherImpl<T>(SafeMatcherCast<T>(matcher_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
InnerMatcher matcher_;
|
InnerMatcher matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(NotMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the AllOf(m1, m2) matcher for a particular argument type
|
// Implements the AllOf(m1, m2) matcher for a particular argument type
|
||||||
|
@ -1108,9 +1148,12 @@ class BothOfMatcherImpl : public MatcherInterface<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Matcher<T> matcher1_;
|
const Matcher<T> matcher1_;
|
||||||
const Matcher<T> matcher2_;
|
const Matcher<T> matcher2_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(BothOfMatcherImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used for implementing the AllOf(m_1, ..., m_n) matcher, which
|
// Used for implementing the AllOf(m_1, ..., m_n) matcher, which
|
||||||
|
@ -1129,9 +1172,12 @@ class BothOfMatcher {
|
||||||
return Matcher<T>(new BothOfMatcherImpl<T>(SafeMatcherCast<T>(matcher1_),
|
return Matcher<T>(new BothOfMatcherImpl<T>(SafeMatcherCast<T>(matcher1_),
|
||||||
SafeMatcherCast<T>(matcher2_)));
|
SafeMatcherCast<T>(matcher2_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Matcher1 matcher1_;
|
Matcher1 matcher1_;
|
||||||
Matcher2 matcher2_;
|
Matcher2 matcher2_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(BothOfMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the AnyOf(m1, m2) matcher for a particular argument type
|
// Implements the AnyOf(m1, m2) matcher for a particular argument type
|
||||||
|
@ -1190,9 +1236,12 @@ class EitherOfMatcherImpl : public MatcherInterface<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Matcher<T> matcher1_;
|
const Matcher<T> matcher1_;
|
||||||
const Matcher<T> matcher2_;
|
const Matcher<T> matcher2_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(EitherOfMatcherImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used for implementing the AnyOf(m_1, ..., m_n) matcher, which
|
// Used for implementing the AnyOf(m_1, ..., m_n) matcher, which
|
||||||
|
@ -1212,9 +1261,12 @@ class EitherOfMatcher {
|
||||||
return Matcher<T>(new EitherOfMatcherImpl<T>(
|
return Matcher<T>(new EitherOfMatcherImpl<T>(
|
||||||
SafeMatcherCast<T>(matcher1_), SafeMatcherCast<T>(matcher2_)));
|
SafeMatcherCast<T>(matcher1_), SafeMatcherCast<T>(matcher2_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Matcher1 matcher1_;
|
Matcher1 matcher1_;
|
||||||
Matcher2 matcher2_;
|
Matcher2 matcher2_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(EitherOfMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used for implementing Truly(pred), which turns a predicate into a
|
// Used for implementing Truly(pred), which turns a predicate into a
|
||||||
|
@ -1248,8 +1300,11 @@ class TrulyMatcher {
|
||||||
void DescribeNegationTo(::std::ostream* os) const {
|
void DescribeNegationTo(::std::ostream* os) const {
|
||||||
*os << "doesn't satisfy the given predicate";
|
*os << "doesn't satisfy the given predicate";
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Predicate predicate_;
|
Predicate predicate_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(TrulyMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used for implementing Matches(matcher), which turns a matcher into
|
// Used for implementing Matches(matcher), which turns a matcher into
|
||||||
|
@ -1283,8 +1338,11 @@ class MatcherAsPredicate {
|
||||||
// in all of the above situations.
|
// in all of the above situations.
|
||||||
return MatcherCast<const T&>(matcher_).Matches(x);
|
return MatcherCast<const T&>(matcher_).Matches(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
M matcher_;
|
M matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(MatcherAsPredicate);
|
||||||
};
|
};
|
||||||
|
|
||||||
// For implementing ASSERT_THAT() and EXPECT_THAT(). The template
|
// For implementing ASSERT_THAT() and EXPECT_THAT(). The template
|
||||||
|
@ -1322,8 +1380,11 @@ class PredicateFormatterFromMatcher {
|
||||||
return AssertionFailure(Message() << ss.str());
|
return AssertionFailure(Message() << ss.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const M matcher_;
|
const M matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(PredicateFormatterFromMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// A helper function for converting a matcher to a predicate-formatter
|
// A helper function for converting a matcher to a predicate-formatter
|
||||||
|
@ -1405,6 +1466,8 @@ class FloatingEqMatcher {
|
||||||
private:
|
private:
|
||||||
const FloatType rhs_;
|
const FloatType rhs_;
|
||||||
const bool nan_eq_nan_;
|
const bool nan_eq_nan_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(Impl);
|
||||||
};
|
};
|
||||||
|
|
||||||
// The following 3 type conversion operators allow FloatEq(rhs) and
|
// The following 3 type conversion operators allow FloatEq(rhs) and
|
||||||
|
@ -1427,6 +1490,8 @@ class FloatingEqMatcher {
|
||||||
private:
|
private:
|
||||||
const FloatType rhs_;
|
const FloatType rhs_;
|
||||||
const bool nan_eq_nan_;
|
const bool nan_eq_nan_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(FloatingEqMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the Pointee(m) matcher for matching a pointer whose
|
// Implements the Pointee(m) matcher for matching a pointer whose
|
||||||
|
@ -1448,6 +1513,7 @@ class PointeeMatcher {
|
||||||
operator Matcher<Pointer>() const {
|
operator Matcher<Pointer>() const {
|
||||||
return MakeMatcher(new Impl<Pointer>(matcher_));
|
return MakeMatcher(new Impl<Pointer>(matcher_));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The monomorphic implementation that works for a particular pointer type.
|
// The monomorphic implementation that works for a particular pointer type.
|
||||||
template <typename Pointer>
|
template <typename Pointer>
|
||||||
|
@ -1485,11 +1551,16 @@ class PointeeMatcher {
|
||||||
*os << "points to a value that " << s;
|
*os << "points to a value that " << s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Matcher<const Pointee&> matcher_;
|
const Matcher<const Pointee&> matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(Impl);
|
||||||
};
|
};
|
||||||
|
|
||||||
const InnerMatcher matcher_;
|
const InnerMatcher matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(PointeeMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the Field() matcher for matching a field (i.e. member
|
// Implements the Field() matcher for matching a field (i.e. member
|
||||||
|
@ -1543,9 +1614,12 @@ class FieldMatcher {
|
||||||
ExplainMatchResultTo(false_type(), *p, os);
|
ExplainMatchResultTo(false_type(), *p, os);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const FieldType Class::*field_;
|
const FieldType Class::*field_;
|
||||||
const Matcher<const FieldType&> matcher_;
|
const Matcher<const FieldType&> matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(FieldMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Explains the result of matching an object or pointer against a field matcher.
|
// Explains the result of matching an object or pointer against a field matcher.
|
||||||
|
@ -1613,9 +1687,12 @@ class PropertyMatcher {
|
||||||
ExplainMatchResultTo(false_type(), *p, os);
|
ExplainMatchResultTo(false_type(), *p, os);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PropertyType (Class::*property_)() const;
|
PropertyType (Class::*property_)() const;
|
||||||
const Matcher<RefToConstProperty> matcher_;
|
const Matcher<RefToConstProperty> matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(PropertyMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Explains the result of matching an object or pointer against a
|
// Explains the result of matching an object or pointer against a
|
||||||
|
@ -1636,7 +1713,7 @@ struct CallableTraits {
|
||||||
typedef typename Functor::result_type ResultType;
|
typedef typename Functor::result_type ResultType;
|
||||||
typedef Functor StorageType;
|
typedef Functor StorageType;
|
||||||
|
|
||||||
static void CheckIsValid(Functor functor) {}
|
static void CheckIsValid(Functor /* functor */) {}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static ResultType Invoke(Functor f, T arg) { return f(arg); }
|
static ResultType Invoke(Functor f, T arg) { return f(arg); }
|
||||||
};
|
};
|
||||||
|
@ -1709,6 +1786,7 @@ class ResultOfMatcher {
|
||||||
if (s != "")
|
if (s != "")
|
||||||
*os << "result of the given callable " << s;
|
*os << "result of the given callable " << s;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Functors often define operator() as non-const method even though
|
// Functors often define operator() as non-const method even though
|
||||||
// they are actualy stateless. But we need to use them even when
|
// they are actualy stateless. But we need to use them even when
|
||||||
|
@ -1717,10 +1795,14 @@ class ResultOfMatcher {
|
||||||
// how many times the callable will be invoked.
|
// how many times the callable will be invoked.
|
||||||
mutable CallableStorageType callable_;
|
mutable CallableStorageType callable_;
|
||||||
const Matcher<ResultType> matcher_;
|
const Matcher<ResultType> matcher_;
|
||||||
|
|
||||||
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Explains the result of matching a value against a functor matcher.
|
// Explains the result of matching a value against a functor matcher.
|
||||||
|
@ -1818,8 +1900,11 @@ class ContainerEqMatcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const StlContainer rhs_;
|
const StlContainer rhs_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ContainerEqMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename LhsContainer, typename Container>
|
template <typename LhsContainer, typename Container>
|
||||||
|
@ -1884,6 +1969,8 @@ class ContainsMatcherImpl : public MatcherInterface<Container> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Matcher<const Element&> inner_matcher_;
|
const Matcher<const Element&> inner_matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ContainsMatcherImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements polymorphic Contains(element_matcher).
|
// Implements polymorphic Contains(element_matcher).
|
||||||
|
@ -1899,6 +1986,8 @@ class ContainsMatcher {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const M inner_matcher_;
|
const M inner_matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ContainsMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements Key(inner_matcher) for the given argument pair type.
|
// Implements Key(inner_matcher) for the given argument pair type.
|
||||||
|
@ -1942,6 +2031,8 @@ class KeyMatcherImpl : public MatcherInterface<PairType> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Matcher<const KeyType&> inner_matcher_;
|
const Matcher<const KeyType&> inner_matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(KeyMatcherImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements polymorphic Key(matcher_for_key).
|
// Implements polymorphic Key(matcher_for_key).
|
||||||
|
@ -1957,6 +2048,8 @@ class KeyMatcher {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const M matcher_for_key_;
|
const M matcher_for_key_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(KeyMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements Pair(first_matcher, second_matcher) for the given argument pair
|
// Implements Pair(first_matcher, second_matcher) for the given argument pair
|
||||||
|
@ -2026,6 +2119,8 @@ class PairMatcherImpl : public MatcherInterface<PairType> {
|
||||||
private:
|
private:
|
||||||
const Matcher<const FirstType&> first_matcher_;
|
const Matcher<const FirstType&> first_matcher_;
|
||||||
const Matcher<const SecondType&> second_matcher_;
|
const Matcher<const SecondType&> second_matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(PairMatcherImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements polymorphic Pair(first_matcher, second_matcher).
|
// Implements polymorphic Pair(first_matcher, second_matcher).
|
||||||
|
@ -2045,6 +2140,8 @@ class PairMatcher {
|
||||||
private:
|
private:
|
||||||
const FirstMatcher first_matcher_;
|
const FirstMatcher first_matcher_;
|
||||||
const SecondMatcher second_matcher_;
|
const SecondMatcher second_matcher_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(PairMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements ElementsAre() and ElementsAreArray().
|
// Implements ElementsAre() and ElementsAreArray().
|
||||||
|
@ -2060,10 +2157,10 @@ class ElementsAreMatcherImpl : public MatcherInterface<Container> {
|
||||||
// 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 count) {
|
ElementsAreMatcherImpl(InputIter first, size_t a_count) {
|
||||||
matchers_.reserve(count);
|
matchers_.reserve(a_count);
|
||||||
InputIter it = first;
|
InputIter it = first;
|
||||||
for (size_t i = 0; i != count; ++i, ++it) {
|
for (size_t i = 0; i != a_count; ++i, ++it) {
|
||||||
matchers_.push_back(MatcherCast<const Element&>(*it));
|
matchers_.push_back(MatcherCast<const Element&>(*it));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2185,6 +2282,8 @@ class ElementsAreMatcherImpl : public MatcherInterface<Container> {
|
||||||
|
|
||||||
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements ElementsAre() of 0 arguments.
|
// Implements ElementsAre() of 0 arguments.
|
||||||
|
@ -2224,6 +2323,8 @@ class ElementsAreArrayMatcher {
|
||||||
private:
|
private:
|
||||||
const T* const first_;
|
const T* const first_;
|
||||||
const size_t count_;
|
const size_t count_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ElementsAreArrayMatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Constants denoting interpolations in a matcher description string.
|
// Constants denoting interpolations in a matcher description string.
|
||||||
|
|
|
@ -58,8 +58,11 @@ class InvokeAction {
|
||||||
Result Perform(const ArgumentTuple& args) {
|
Result Perform(const ArgumentTuple& args) {
|
||||||
return InvokeHelper<Result, ArgumentTuple>::Invoke(function_impl_, args);
|
return InvokeHelper<Result, ArgumentTuple>::Invoke(function_impl_, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FunctionImpl function_impl_;
|
FunctionImpl function_impl_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(InvokeAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the Invoke(object_ptr, &Class::Method) action.
|
// Implements the Invoke(object_ptr, &Class::Method) action.
|
||||||
|
@ -74,9 +77,12 @@ class InvokeMethodAction {
|
||||||
return InvokeHelper<Result, ArgumentTuple>::InvokeMethod(
|
return InvokeHelper<Result, ArgumentTuple>::InvokeMethod(
|
||||||
obj_ptr_, method_ptr_, args);
|
obj_ptr_, method_ptr_, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Class* const obj_ptr_;
|
Class* const obj_ptr_;
|
||||||
const MethodPtr method_ptr_;
|
const MethodPtr method_ptr_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(InvokeMethodAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
@ -122,6 +128,16 @@ WithArg(const InnerAction& action) {
|
||||||
return internal::WithArgsAction<InnerAction, k>(action);
|
return internal::WithArgsAction<InnerAction, k>(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The ACTION*() macros trigger warning C4100 (unreferenced formal
|
||||||
|
// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
|
||||||
|
// the macro definition, as the warnings are generated when the macro
|
||||||
|
// is expanded and macro expansion cannot contain #pragma. Therefore
|
||||||
|
// we suppress them here.
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4100)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Action ReturnArg<k>() returns the k-th argument of the mock function.
|
// Action ReturnArg<k>() returns the k-th argument of the mock function.
|
||||||
ACTION_TEMPLATE(ReturnArg,
|
ACTION_TEMPLATE(ReturnArg,
|
||||||
HAS_1_TEMPLATE_PARAMS(int, k),
|
HAS_1_TEMPLATE_PARAMS(int, k),
|
||||||
|
@ -185,6 +201,10 @@ ACTION_TEMPLATE(DeleteArg,
|
||||||
ACTION_P(Throw, exception) { throw exception; }
|
ACTION_P(Throw, exception) { throw exception; }
|
||||||
#endif // GTEST_HAS_EXCEPTIONS
|
#endif // GTEST_HAS_EXCEPTIONS
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
|
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
|
||||||
|
|
|
@ -142,10 +142,10 @@ class DefaultActionSpec {
|
||||||
|
|
||||||
// Constructs a DefaultActionSpec object from the information inside
|
// Constructs a DefaultActionSpec object from the information inside
|
||||||
// the parenthesis of an ON_CALL() statement.
|
// the parenthesis of an ON_CALL() statement.
|
||||||
DefaultActionSpec(const char* file, int line,
|
DefaultActionSpec(const char* a_file, int a_line,
|
||||||
const ArgumentMatcherTuple& matchers)
|
const ArgumentMatcherTuple& matchers)
|
||||||
: file_(file),
|
: file_(a_file),
|
||||||
line_(line),
|
line_(a_line),
|
||||||
matchers_(matchers),
|
matchers_(matchers),
|
||||||
// By default, extra_matcher_ should match anything. However,
|
// By default, extra_matcher_ should match anything. However,
|
||||||
// we cannot initialize it with _ as that triggers a compiler
|
// we cannot initialize it with _ as that triggers a compiler
|
||||||
|
@ -196,6 +196,7 @@ class DefaultActionSpec {
|
||||||
"once in an ON_CALL().");
|
"once in an ON_CALL().");
|
||||||
return action_;
|
return action_;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Gives each clause in the ON_CALL() statement a name.
|
// Gives each clause in the ON_CALL() statement a name.
|
||||||
enum Clause {
|
enum Clause {
|
||||||
|
@ -582,6 +583,7 @@ class ExpectationBase {
|
||||||
// expectation has occurred.
|
// expectation has occurred.
|
||||||
// L >= g_gmock_mutex
|
// L >= g_gmock_mutex
|
||||||
virtual void DescribeCallCountTo(::std::ostream* os) const = 0;
|
virtual void DescribeCallCountTo(::std::ostream* os) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class ::testing::Expectation;
|
friend class ::testing::Expectation;
|
||||||
|
|
||||||
|
@ -620,8 +622,8 @@ class ExpectationBase {
|
||||||
bool cardinality_specified() const { return cardinality_specified_; }
|
bool cardinality_specified() const { return cardinality_specified_; }
|
||||||
|
|
||||||
// Sets the cardinality of this expectation spec.
|
// Sets the cardinality of this expectation spec.
|
||||||
void set_cardinality(const Cardinality& cardinality) {
|
void set_cardinality(const Cardinality& a_cardinality) {
|
||||||
cardinality_ = 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
|
||||||
|
@ -716,6 +718,8 @@ class ExpectationBase {
|
||||||
// and can change as the mock function is called.
|
// and can change as the mock function is called.
|
||||||
int call_count_; // How many times this expectation has been invoked.
|
int call_count_; // How many times this expectation has been invoked.
|
||||||
bool retired_; // True iff this expectation has retired.
|
bool retired_; // True iff this expectation has retired.
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ExpectationBase);
|
||||||
}; // class ExpectationBase
|
}; // class ExpectationBase
|
||||||
|
|
||||||
// Impements an expectation for the given function type.
|
// Impements an expectation for the given function type.
|
||||||
|
@ -727,9 +731,9 @@ class TypedExpectation : public ExpectationBase {
|
||||||
typedef typename Function<F>::Result Result;
|
typedef typename Function<F>::Result Result;
|
||||||
|
|
||||||
TypedExpectation(FunctionMockerBase<F>* owner,
|
TypedExpectation(FunctionMockerBase<F>* owner,
|
||||||
const char* file, int line, const string& source_text,
|
const char* a_file, int a_line, const string& a_source_text,
|
||||||
const ArgumentMatcherTuple& m)
|
const ArgumentMatcherTuple& m)
|
||||||
: ExpectationBase(file, line, source_text),
|
: ExpectationBase(a_file, a_line, a_source_text),
|
||||||
owner_(owner),
|
owner_(owner),
|
||||||
matchers_(m),
|
matchers_(m),
|
||||||
extra_matcher_specified_(false),
|
extra_matcher_specified_(false),
|
||||||
|
@ -769,7 +773,7 @@ class TypedExpectation : public ExpectationBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements the .Times() clause.
|
// Implements the .Times() clause.
|
||||||
TypedExpectation& Times(const Cardinality& cardinality) {
|
TypedExpectation& Times(const Cardinality& a_cardinality) {
|
||||||
if (last_clause_ ==kTimes) {
|
if (last_clause_ ==kTimes) {
|
||||||
ExpectSpecProperty(false,
|
ExpectSpecProperty(false,
|
||||||
".Times() cannot appear "
|
".Times() cannot appear "
|
||||||
|
@ -782,7 +786,7 @@ class TypedExpectation : public ExpectationBase {
|
||||||
}
|
}
|
||||||
last_clause_ = kTimes;
|
last_clause_ = kTimes;
|
||||||
|
|
||||||
ExpectationBase::SpecifyCardinality(cardinality);
|
ExpectationBase::SpecifyCardinality(a_cardinality);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1164,6 +1168,8 @@ class TypedExpectation : public ExpectationBase {
|
||||||
Clause last_clause_;
|
Clause last_clause_;
|
||||||
mutable bool action_count_checked_; // Under mutex_.
|
mutable bool action_count_checked_; // Under mutex_.
|
||||||
mutable Mutex mutex_; // Protects action_count_checked_.
|
mutable Mutex mutex_; // Protects action_count_checked_.
|
||||||
|
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(TypedExpectation);
|
||||||
}; // class TypedExpectation
|
}; // class TypedExpectation
|
||||||
|
|
||||||
// A MockSpec object is used by ON_CALL() or EXPECT_CALL() for
|
// A MockSpec object is used by ON_CALL() or EXPECT_CALL() for
|
||||||
|
@ -1228,6 +1234,8 @@ class MockSpec {
|
||||||
internal::FunctionMockerBase<F>* const function_mocker_;
|
internal::FunctionMockerBase<F>* const function_mocker_;
|
||||||
// The argument matchers specified in the spec.
|
// The argument matchers specified in the spec.
|
||||||
ArgumentMatcherTuple matchers_;
|
ArgumentMatcherTuple matchers_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(MockSpec);
|
||||||
}; // class MockSpec
|
}; // class MockSpec
|
||||||
|
|
||||||
// MSVC warns about using 'this' in base member initializer list, so
|
// MSVC warns about using 'this' in base member initializer list, so
|
||||||
|
@ -1251,7 +1259,7 @@ class MockSpec {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class ActionResultHolder {
|
class ActionResultHolder {
|
||||||
public:
|
public:
|
||||||
explicit ActionResultHolder(T value) : value_(value) {}
|
explicit ActionResultHolder(T a_value) : value_(a_value) {}
|
||||||
|
|
||||||
// The compiler-generated copy constructor and assignment operator
|
// The compiler-generated copy constructor and assignment operator
|
||||||
// are exactly what we need, so we don't need to define them.
|
// are exactly what we need, so we don't need to define them.
|
||||||
|
@ -1285,6 +1293,9 @@ class ActionResultHolder {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T value_;
|
T value_;
|
||||||
|
|
||||||
|
// T could be a reference type, so = isn't supported.
|
||||||
|
GTEST_DISALLOW_ASSIGN_(ActionResultHolder);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Specialization for T = void.
|
// Specialization for T = void.
|
||||||
|
@ -1433,6 +1444,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
friend class MockSpec;
|
friend class MockSpec;
|
||||||
|
@ -1477,6 +1489,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
|
||||||
// The current spec (either default action spec or expectation spec)
|
// The current spec (either default action spec or expectation spec)
|
||||||
// being described on this function mocker.
|
// being described on this function mocker.
|
||||||
MockSpec<F>& current_spec() { return current_spec_; }
|
MockSpec<F>& current_spec() { return current_spec_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename Func> friend class TypedExpectation;
|
template <typename Func> friend class TypedExpectation;
|
||||||
|
|
||||||
|
|
|
@ -640,15 +640,15 @@ class NativeArray {
|
||||||
|
|
||||||
// Initializes this object; makes a copy of the input array if
|
// Initializes this object; makes a copy of the input array if
|
||||||
// 'relation' is kCopy.
|
// 'relation' is kCopy.
|
||||||
void Init(const Element* array, size_t size, RelationToSource relation) {
|
void Init(const Element* array, size_t a_size, RelationToSource relation) {
|
||||||
if (relation == kReference) {
|
if (relation == kReference) {
|
||||||
array_ = array;
|
array_ = array;
|
||||||
} else {
|
} else {
|
||||||
Element* const copy = new Element[size];
|
Element* const copy = new Element[a_size];
|
||||||
CopyArray(array, size, copy);
|
CopyArray(array, a_size, copy);
|
||||||
array_ = copy;
|
array_ = copy;
|
||||||
}
|
}
|
||||||
size_ = size;
|
size_ = a_size;
|
||||||
relation_to_source_ = relation;
|
relation_to_source_ = relation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,9 +105,19 @@ GtestTest = gtest_exports['GtestTest']
|
||||||
gtest_common_exports = SConscript(GTEST_DIR + '/scons/SConscript.common')
|
gtest_common_exports = SConscript(GTEST_DIR + '/scons/SConscript.common')
|
||||||
EnvCreator = gtest_common_exports['EnvCreator']
|
EnvCreator = gtest_common_exports['EnvCreator']
|
||||||
|
|
||||||
# TODO(vladl@google.com): restore warnings as errors once all warnings are fixed
|
env = env.Clone()
|
||||||
# in gMock.
|
if env['PLATFORM'] == 'win32':
|
||||||
env = EnvCreator.Create(env, EnvCreator.WarningOk)
|
env.Append(CCFLAGS=[
|
||||||
|
'-wd4127', # Disables warning "conditional expression is constant",
|
||||||
|
# triggered by VC 8.0's own STL header <list>.
|
||||||
|
'-wd4702', # Disables warning "unreachable code", triggered by VC
|
||||||
|
# 7.1's own STL header <xtree>.
|
||||||
|
'-wd4675', # Disables warning "resolved overload was found by
|
||||||
|
# argument-dependent lookup" generated by VC 7.1.
|
||||||
|
# It just says that VC 7.1 fixed a bug in earlier
|
||||||
|
# versions of VC so the code behavior will be
|
||||||
|
# different than compiled with VC 6.0, for example.
|
||||||
|
])
|
||||||
|
|
||||||
# Note: The relative paths in SConscript files are relative to the location
|
# Note: The relative paths in SConscript files are relative to the location
|
||||||
# of the SConscript file itself. To make a path relative to the location of
|
# of the SConscript file itself. To make a path relative to the location of
|
||||||
|
|
|
@ -64,7 +64,7 @@ string ConvertIdentifierNameToWords(const char* id_name) {
|
||||||
if (isalnum(*p)) {
|
if (isalnum(*p)) {
|
||||||
if (starts_new_word && result != "")
|
if (starts_new_word && result != "")
|
||||||
result += ' ';
|
result += ' ';
|
||||||
result += tolower(*p);
|
result += static_cast<char>(tolower(*p));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -56,12 +56,12 @@ namespace internal {
|
||||||
Mutex g_gmock_mutex(Mutex::NO_CONSTRUCTOR_NEEDED_FOR_STATIC_MUTEX);
|
Mutex g_gmock_mutex(Mutex::NO_CONSTRUCTOR_NEEDED_FOR_STATIC_MUTEX);
|
||||||
|
|
||||||
// Constructs an ExpectationBase object.
|
// Constructs an ExpectationBase object.
|
||||||
ExpectationBase::ExpectationBase(const char* file,
|
ExpectationBase::ExpectationBase(const char* a_file,
|
||||||
int line,
|
int a_line,
|
||||||
const string& source_text)
|
const string& a_source_text)
|
||||||
: file_(file),
|
: file_(a_file),
|
||||||
line_(line),
|
line_(a_line),
|
||||||
source_text_(source_text),
|
source_text_(a_source_text),
|
||||||
cardinality_specified_(false),
|
cardinality_specified_(false),
|
||||||
cardinality_(Exactly(1)),
|
cardinality_(Exactly(1)),
|
||||||
call_count_(0),
|
call_count_(0),
|
||||||
|
@ -73,9 +73,9 @@ ExpectationBase::~ExpectationBase() {}
|
||||||
|
|
||||||
// Explicitly specifies the cardinality of this expectation. Used by
|
// Explicitly specifies the cardinality of this expectation. Used by
|
||||||
// the subclasses to implement the .Times() clause.
|
// the subclasses to implement the .Times() clause.
|
||||||
void ExpectationBase::SpecifyCardinality(const Cardinality& cardinality) {
|
void ExpectationBase::SpecifyCardinality(const Cardinality& a_cardinality) {
|
||||||
cardinality_specified_ = true;
|
cardinality_specified_ = true;
|
||||||
cardinality_ = cardinality;
|
cardinality_ = a_cardinality;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retires all pre-requisites of this expectation.
|
// Retires all pre-requisites of this expectation.
|
||||||
|
@ -427,8 +427,8 @@ void Mock::ClearDefaultActionsLocked(void* mock_obj) {
|
||||||
Expectation::Expectation() {}
|
Expectation::Expectation() {}
|
||||||
|
|
||||||
Expectation::Expectation(
|
Expectation::Expectation(
|
||||||
const internal::linked_ptr<internal::ExpectationBase>& expectation_base)
|
const internal::linked_ptr<internal::ExpectationBase>& an_expectation_base)
|
||||||
: expectation_base_(expectation_base) {}
|
: expectation_base_(an_expectation_base) {}
|
||||||
|
|
||||||
Expectation::~Expectation() {}
|
Expectation::~Expectation() {}
|
||||||
|
|
||||||
|
|
|
@ -95,26 +95,26 @@ TEST(BuiltInDefaultValueTest, ExistsForPointerTypes) {
|
||||||
// Tests that BuiltInDefaultValue<T>::Get() returns 0 when T is a
|
// Tests that BuiltInDefaultValue<T>::Get() returns 0 when T is a
|
||||||
// built-in numeric type.
|
// built-in numeric type.
|
||||||
TEST(BuiltInDefaultValueTest, IsZeroForNumericTypes) {
|
TEST(BuiltInDefaultValueTest, IsZeroForNumericTypes) {
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<unsigned char>::Get());
|
EXPECT_EQ(0U, BuiltInDefaultValue<unsigned char>::Get());
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<signed char>::Get());
|
EXPECT_EQ(0, BuiltInDefaultValue<signed char>::Get());
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<char>::Get());
|
EXPECT_EQ(0, BuiltInDefaultValue<char>::Get());
|
||||||
#if GMOCK_HAS_SIGNED_WCHAR_T_
|
#if GMOCK_HAS_SIGNED_WCHAR_T_
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<unsigned wchar_t>::Get());
|
EXPECT_EQ(0U, BuiltInDefaultValue<unsigned wchar_t>::Get());
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<signed wchar_t>::Get());
|
EXPECT_EQ(0, BuiltInDefaultValue<signed wchar_t>::Get());
|
||||||
#endif
|
#endif
|
||||||
#if GMOCK_WCHAR_T_IS_NATIVE_
|
#if GMOCK_WCHAR_T_IS_NATIVE_
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<wchar_t>::Get());
|
EXPECT_EQ(0, BuiltInDefaultValue<wchar_t>::Get());
|
||||||
#endif
|
#endif
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<unsigned short>::Get()); // NOLINT
|
EXPECT_EQ(0U, BuiltInDefaultValue<unsigned short>::Get()); // NOLINT
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<signed short>::Get()); // NOLINT
|
EXPECT_EQ(0, BuiltInDefaultValue<signed short>::Get()); // NOLINT
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<short>::Get()); // NOLINT
|
EXPECT_EQ(0, BuiltInDefaultValue<short>::Get()); // NOLINT
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<unsigned int>::Get());
|
EXPECT_EQ(0U, BuiltInDefaultValue<unsigned int>::Get());
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<signed int>::Get());
|
EXPECT_EQ(0, BuiltInDefaultValue<signed int>::Get());
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<int>::Get());
|
EXPECT_EQ(0, BuiltInDefaultValue<int>::Get());
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<unsigned long>::Get()); // NOLINT
|
EXPECT_EQ(0U, BuiltInDefaultValue<unsigned long>::Get()); // NOLINT
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<signed long>::Get()); // NOLINT
|
EXPECT_EQ(0, BuiltInDefaultValue<signed long>::Get()); // NOLINT
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<long>::Get()); // NOLINT
|
EXPECT_EQ(0, BuiltInDefaultValue<long>::Get()); // NOLINT
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<UInt64>::Get());
|
EXPECT_EQ(0U, BuiltInDefaultValue<UInt64>::Get());
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<Int64>::Get());
|
EXPECT_EQ(0, BuiltInDefaultValue<Int64>::Get());
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<float>::Get());
|
EXPECT_EQ(0, BuiltInDefaultValue<float>::Get());
|
||||||
EXPECT_EQ(0, BuiltInDefaultValue<double>::Get());
|
EXPECT_EQ(0, BuiltInDefaultValue<double>::Get());
|
||||||
|
@ -517,11 +517,13 @@ TEST(ReturnTest, IsCovariant) {
|
||||||
// gmock-actions.h for more information.
|
// gmock-actions.h for more information.
|
||||||
class FromType {
|
class FromType {
|
||||||
public:
|
public:
|
||||||
FromType(bool* converted) : converted_(converted) {}
|
FromType(bool* is_converted) : converted_(is_converted) {}
|
||||||
bool* converted() const { return converted_; }
|
bool* converted() const { return converted_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool* const converted_;
|
bool* const converted_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_ASSIGN_(FromType);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ToType {
|
class ToType {
|
||||||
|
@ -588,8 +590,13 @@ class MyClass {};
|
||||||
|
|
||||||
class MockClass {
|
class MockClass {
|
||||||
public:
|
public:
|
||||||
|
MockClass() {}
|
||||||
|
|
||||||
MOCK_METHOD1(IntFunc, int(bool flag)); // NOLINT
|
MOCK_METHOD1(IntFunc, int(bool flag)); // NOLINT
|
||||||
MOCK_METHOD0(Foo, MyClass());
|
MOCK_METHOD0(Foo, MyClass());
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockClass);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Tests that DoDefault() returns the built-in default value for the
|
// Tests that DoDefault() returns the built-in default value for the
|
||||||
|
@ -615,7 +622,7 @@ TEST(DoDefaultDeathTest, DiesForUnknowType) {
|
||||||
// Tests that using DoDefault() inside a composite action leads to a
|
// Tests that using DoDefault() inside a composite action leads to a
|
||||||
// run-time error.
|
// run-time error.
|
||||||
|
|
||||||
void VoidFunc(bool flag) {}
|
void VoidFunc(bool /* flag */) {}
|
||||||
|
|
||||||
TEST(DoDefaultDeathTest, DiesIfUsedInCompositeAction) {
|
TEST(DoDefaultDeathTest, DiesIfUsedInCompositeAction) {
|
||||||
MockClass mock;
|
MockClass mock;
|
||||||
|
@ -801,7 +808,7 @@ bool Unary(int x) { return x < 0; }
|
||||||
|
|
||||||
const char* Plus1(const char* s) { return s + 1; }
|
const char* Plus1(const char* s) { return s + 1; }
|
||||||
|
|
||||||
void VoidUnary(int n) { g_done = true; }
|
void VoidUnary(int /* n */) { g_done = true; }
|
||||||
|
|
||||||
bool ByConstRef(const std::string& s) { return s == "Hi"; }
|
bool ByConstRef(const std::string& s) { return s == "Hi"; }
|
||||||
|
|
||||||
|
@ -870,7 +877,7 @@ TEST(InvokeWithoutArgsTest, Function) {
|
||||||
EXPECT_EQ(1, a.Perform(make_tuple(2)));
|
EXPECT_EQ(1, a.Perform(make_tuple(2)));
|
||||||
|
|
||||||
// As an action that takes two arguments.
|
// As an action that takes two arguments.
|
||||||
Action<short(int, double)> a2 = InvokeWithoutArgs(Nullary); // NOLINT
|
Action<int(int, double)> a2 = InvokeWithoutArgs(Nullary); // NOLINT
|
||||||
EXPECT_EQ(1, a2.Perform(make_tuple(2, 3.5)));
|
EXPECT_EQ(1, a2.Perform(make_tuple(2, 3.5)));
|
||||||
|
|
||||||
// As an action that returns void.
|
// As an action that returns void.
|
||||||
|
@ -887,7 +894,7 @@ TEST(InvokeWithoutArgsTest, Functor) {
|
||||||
EXPECT_EQ(2, a.Perform(make_tuple()));
|
EXPECT_EQ(2, a.Perform(make_tuple()));
|
||||||
|
|
||||||
// As an action that takes three arguments.
|
// As an action that takes three arguments.
|
||||||
Action<short(int, double, char)> a2 = // NOLINT
|
Action<int(int, double, char)> a2 = // NOLINT
|
||||||
InvokeWithoutArgs(NullaryFunctor());
|
InvokeWithoutArgs(NullaryFunctor());
|
||||||
EXPECT_EQ(2, a2.Perform(make_tuple(3, 3.5, 'a')));
|
EXPECT_EQ(2, a2.Perform(make_tuple(3, 3.5, 'a')));
|
||||||
|
|
||||||
|
@ -928,7 +935,7 @@ TEST(IgnoreResultTest, MonomorphicAction) {
|
||||||
|
|
||||||
// Tests using IgnoreResult() on an action that returns a class type.
|
// Tests using IgnoreResult() on an action that returns a class type.
|
||||||
|
|
||||||
MyClass ReturnMyClass(double x) {
|
MyClass ReturnMyClass(double /* x */) {
|
||||||
g_done = true;
|
g_done = true;
|
||||||
return MyClass();
|
return MyClass();
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,11 @@ using testing::MakeCardinality;
|
||||||
|
|
||||||
class MockFoo {
|
class MockFoo {
|
||||||
public:
|
public:
|
||||||
|
MockFoo() {}
|
||||||
MOCK_METHOD0(Bar, int()); // NOLINT
|
MOCK_METHOD0(Bar, int()); // NOLINT
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Tests that Cardinality objects can be default constructed.
|
// Tests that Cardinality objects can be default constructed.
|
||||||
|
@ -398,7 +402,9 @@ class EvenCardinality : public CardinalityInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true iff call_count calls will saturate this cardinality.
|
// Returns true iff call_count calls will saturate this cardinality.
|
||||||
virtual bool IsSaturatedByCallCount(int call_count) const { return false; }
|
virtual bool IsSaturatedByCallCount(int /* call_count */) const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Describes self to an ostream.
|
// Describes self to an ostream.
|
||||||
virtual void DescribeTo(::std::ostream* ss) const {
|
virtual void DescribeTo(::std::ostream* ss) const {
|
||||||
|
|
|
@ -63,6 +63,10 @@ using testing::StaticAssertTypeEq;
|
||||||
using testing::Unused;
|
using testing::Unused;
|
||||||
using testing::WithArgs;
|
using testing::WithArgs;
|
||||||
|
|
||||||
|
// For suppressing compiler warnings on conversion possibly losing precision.
|
||||||
|
inline short Short(short n) { return n; } // NOLINT
|
||||||
|
inline char Char(char ch) { return ch; }
|
||||||
|
|
||||||
// Sample functions and functors for testing various actions.
|
// Sample functions and functors for testing various actions.
|
||||||
int Nullary() { return 1; }
|
int Nullary() { return 1; }
|
||||||
|
|
||||||
|
@ -242,7 +246,7 @@ TEST(InvokeArgumentTest, Function10) {
|
||||||
// Tests using InvokeArgument with a function that takes a pointer argument.
|
// Tests using InvokeArgument with a function that takes a pointer argument.
|
||||||
TEST(InvokeArgumentTest, ByPointerFunction) {
|
TEST(InvokeArgumentTest, ByPointerFunction) {
|
||||||
Action<const char*(const char*(*)(const char* input, short n))> a = // NOLINT
|
Action<const char*(const char*(*)(const char* input, short n))> a = // NOLINT
|
||||||
InvokeArgument<0>(static_cast<const char*>("Hi"), 1);
|
InvokeArgument<0>(static_cast<const char*>("Hi"), Short(1));
|
||||||
EXPECT_STREQ("i", a.Perform(make_tuple(&Binary)));
|
EXPECT_STREQ("i", a.Perform(make_tuple(&Binary)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +254,7 @@ TEST(InvokeArgumentTest, ByPointerFunction) {
|
||||||
// by passing it a C-string literal.
|
// by passing it a C-string literal.
|
||||||
TEST(InvokeArgumentTest, FunctionWithCStringLiteral) {
|
TEST(InvokeArgumentTest, FunctionWithCStringLiteral) {
|
||||||
Action<const char*(const char*(*)(const char* input, short n))> a = // NOLINT
|
Action<const char*(const char*(*)(const char* input, short n))> a = // NOLINT
|
||||||
InvokeArgument<0>("Hi", 1);
|
InvokeArgument<0>("Hi", Short(1));
|
||||||
EXPECT_STREQ("i", a.Perform(make_tuple(&Binary)));
|
EXPECT_STREQ("i", a.Perform(make_tuple(&Binary)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,17 +290,17 @@ TEST(WithArgsTest, OneArg) {
|
||||||
|
|
||||||
// Tests using WithArgs with an action that takes 2 arguments.
|
// Tests using WithArgs with an action that takes 2 arguments.
|
||||||
TEST(WithArgsTest, TwoArgs) {
|
TEST(WithArgsTest, TwoArgs) {
|
||||||
Action<const char*(const char* s, double x, int n)> a =
|
Action<const char*(const char* s, double x, short n)> a =
|
||||||
WithArgs<0, 2>(Invoke(Binary));
|
WithArgs<0, 2>(Invoke(Binary));
|
||||||
const char s[] = "Hello";
|
const char s[] = "Hello";
|
||||||
EXPECT_EQ(s + 2, a.Perform(make_tuple(CharPtr(s), 0.5, 2)));
|
EXPECT_EQ(s + 2, a.Perform(make_tuple(CharPtr(s), 0.5, Short(2))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using WithArgs with an action that takes 3 arguments.
|
// Tests using WithArgs with an action that takes 3 arguments.
|
||||||
TEST(WithArgsTest, ThreeArgs) {
|
TEST(WithArgsTest, ThreeArgs) {
|
||||||
Action<int(int, double, char, short)> a = // NOLINT
|
Action<int(int, double, char, short)> a = // NOLINT
|
||||||
WithArgs<0, 2, 3>(Invoke(Ternary));
|
WithArgs<0, 2, 3>(Invoke(Ternary));
|
||||||
EXPECT_EQ(123, a.Perform(make_tuple(100, 6.5, 20, 3)));
|
EXPECT_EQ(123, a.Perform(make_tuple(100, 6.5, Char(20), Short(3))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using WithArgs with an action that takes 4 arguments.
|
// Tests using WithArgs with an action that takes 4 arguments.
|
||||||
|
@ -379,7 +383,7 @@ TEST(WithArgsTest, NonInvokeAction) {
|
||||||
TEST(WithArgsTest, Identity) {
|
TEST(WithArgsTest, Identity) {
|
||||||
Action<int(int x, char y, short z)> a = // NOLINT
|
Action<int(int x, char y, short z)> a = // NOLINT
|
||||||
WithArgs<0, 1, 2>(Invoke(Ternary));
|
WithArgs<0, 1, 2>(Invoke(Ternary));
|
||||||
EXPECT_EQ(123, a.Perform(make_tuple(100, 20, 3)));
|
EXPECT_EQ(123, a.Perform(make_tuple(100, Char(20), Short(3))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using WithArgs with repeated arguments.
|
// Tests using WithArgs with repeated arguments.
|
||||||
|
@ -394,14 +398,14 @@ TEST(WithArgsTest, ReversedArgumentOrder) {
|
||||||
Action<const char*(short n, const char* input)> a = // NOLINT
|
Action<const char*(short n, const char* input)> a = // NOLINT
|
||||||
WithArgs<1, 0>(Invoke(Binary));
|
WithArgs<1, 0>(Invoke(Binary));
|
||||||
const char s[] = "Hello";
|
const char s[] = "Hello";
|
||||||
EXPECT_EQ(s + 2, a.Perform(make_tuple(2, CharPtr(s))));
|
EXPECT_EQ(s + 2, a.Perform(make_tuple(Short(2), CharPtr(s))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using WithArgs with compatible, but not identical, argument types.
|
// Tests using WithArgs with compatible, but not identical, argument types.
|
||||||
TEST(WithArgsTest, ArgsOfCompatibleTypes) {
|
TEST(WithArgsTest, ArgsOfCompatibleTypes) {
|
||||||
Action<long(short x, int y, double z, char c)> a = // NOLINT
|
Action<long(short x, char y, double z, char c)> a = // NOLINT
|
||||||
WithArgs<0, 1, 3>(Invoke(Ternary));
|
WithArgs<0, 1, 3>(Invoke(Ternary));
|
||||||
EXPECT_EQ(123, a.Perform(make_tuple(100, 20, 5.6, 3)));
|
EXPECT_EQ(123, a.Perform(make_tuple(Short(100), Char(20), 5.6, Char(3))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using WithArgs with an action that returns void.
|
// Tests using WithArgs with an action that returns void.
|
||||||
|
@ -583,6 +587,16 @@ TEST(DoAllTest, TenActions) {
|
||||||
EXPECT_EQ('g', g);
|
EXPECT_EQ('g', g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The ACTION*() macros trigger warning C4100 (unreferenced formal
|
||||||
|
// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
|
||||||
|
// the macro definition, as the warnings are generated when the macro
|
||||||
|
// is expanded and macro expansion cannot contain #pragma. Therefore
|
||||||
|
// we suppress them here.
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4100)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Tests the ACTION*() macro family.
|
// Tests the ACTION*() macro family.
|
||||||
|
|
||||||
// Tests that ACTION() can define an action that doesn't reference the
|
// Tests that ACTION() can define an action that doesn't reference the
|
||||||
|
@ -633,7 +647,7 @@ ACTION(Sum2) {
|
||||||
TEST(ActionMacroTest, CanReferenceArgumentTuple) {
|
TEST(ActionMacroTest, CanReferenceArgumentTuple) {
|
||||||
Action<int(int, char, int*)> a1 = Sum2();
|
Action<int(int, char, int*)> a1 = Sum2();
|
||||||
int dummy = 0;
|
int dummy = 0;
|
||||||
EXPECT_EQ(11, a1.Perform(make_tuple(5, static_cast<char>(6), &dummy)));
|
EXPECT_EQ(11, a1.Perform(make_tuple(5, Char(6), &dummy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that the body of ACTION() can reference the mock function
|
// Tests that the body of ACTION() can reference the mock function
|
||||||
|
@ -731,7 +745,7 @@ ACTION_P(TypedPlus, n) {
|
||||||
|
|
||||||
TEST(ActionPMacroTest, CanReferenceArgumentAndParameterTypes) {
|
TEST(ActionPMacroTest, CanReferenceArgumentAndParameterTypes) {
|
||||||
Action<int(char m, bool t)> a1 = TypedPlus(9);
|
Action<int(char m, bool t)> a1 = TypedPlus(9);
|
||||||
EXPECT_EQ(10, a1.Perform(make_tuple(static_cast<char>(1), true)));
|
EXPECT_EQ(10, a1.Perform(make_tuple(Char(1), true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that a parameterized action can be used in any mock function
|
// Tests that a parameterized action can be used in any mock function
|
||||||
|
@ -851,7 +865,7 @@ TEST(ActionPnMacroTest, WorksFor10Parameters) {
|
||||||
ACTION_P2(PadArgument, prefix, suffix) {
|
ACTION_P2(PadArgument, prefix, suffix) {
|
||||||
// The following lines promote the two parameters to desired types.
|
// The following lines promote the two parameters to desired types.
|
||||||
std::string prefix_str(prefix);
|
std::string prefix_str(prefix);
|
||||||
char suffix_char(suffix);
|
char suffix_char = static_cast<char>(suffix);
|
||||||
return prefix_str + arg0 + suffix_char;
|
return prefix_str + arg0 + suffix_char;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1078,7 +1092,7 @@ class BoolResetter {
|
||||||
explicit BoolResetter(bool* value) : value_(value) {}
|
explicit BoolResetter(bool* value) : value_(value) {}
|
||||||
~BoolResetter() { *value_ = false; }
|
~BoolResetter() { *value_ = false; }
|
||||||
private:
|
private:
|
||||||
bool* const value_;
|
bool* value_;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(ActionTemplateTest, WorksForIntegralTemplateParams) {
|
TEST(ActionTemplateTest, WorksForIntegralTemplateParams) {
|
||||||
|
@ -1190,5 +1204,9 @@ TEST(ActionTemplateTest, CanBeOverloadedOnNumberOfValueParameters) {
|
||||||
EXPECT_EQ(12345, a4.Perform(make_tuple()));
|
EXPECT_EQ(12345, a4.Perform(make_tuple()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace gmock_generated_actions_test
|
} // namespace gmock_generated_actions_test
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
|
@ -114,6 +114,8 @@ class FooInterface {
|
||||||
|
|
||||||
class MockFoo : public FooInterface {
|
class MockFoo : public FooInterface {
|
||||||
public:
|
public:
|
||||||
|
MockFoo() {}
|
||||||
|
|
||||||
// Makes sure that a mock function parameter can be named.
|
// Makes sure that a mock function parameter can be named.
|
||||||
MOCK_METHOD1(VoidReturning, void(int n)); // NOLINT
|
MOCK_METHOD1(VoidReturning, void(int n)); // NOLINT
|
||||||
|
|
||||||
|
@ -149,6 +151,9 @@ class MockFoo : public FooInterface {
|
||||||
const string& k));
|
const string& k));
|
||||||
MOCK_CONST_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, CTConst, char(int));
|
MOCK_CONST_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, CTConst, char(int));
|
||||||
#endif // GTEST_OS_WINDOWS
|
#endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
|
||||||
};
|
};
|
||||||
|
|
||||||
class FunctionMockerTest : public testing::Test {
|
class FunctionMockerTest : public testing::Test {
|
||||||
|
@ -305,7 +310,12 @@ TEST_F(FunctionMockerTest, MocksFunctionsConstFunctionWithCallType) {
|
||||||
|
|
||||||
class MockB {
|
class MockB {
|
||||||
public:
|
public:
|
||||||
|
MockB() {}
|
||||||
|
|
||||||
MOCK_METHOD0(DoB, void());
|
MOCK_METHOD0(DoB, void());
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockB);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Tests that functions with no EXPECT_CALL() ruls can be called any
|
// Tests that functions with no EXPECT_CALL() ruls can be called any
|
||||||
|
@ -345,10 +355,15 @@ class StackInterface {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class MockStack : public StackInterface<T> {
|
class MockStack : public StackInterface<T> {
|
||||||
public:
|
public:
|
||||||
|
MockStack() {}
|
||||||
|
|
||||||
MOCK_METHOD1_T(Push, void(const T& elem));
|
MOCK_METHOD1_T(Push, void(const T& elem));
|
||||||
MOCK_METHOD0_T(Pop, void());
|
MOCK_METHOD0_T(Pop, void());
|
||||||
MOCK_CONST_METHOD0_T(GetSize, int()); // NOLINT
|
MOCK_CONST_METHOD0_T(GetSize, int()); // NOLINT
|
||||||
MOCK_CONST_METHOD0_T(GetTop, const T&());
|
MOCK_CONST_METHOD0_T(GetTop, const T&());
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Tests that template mock works.
|
// Tests that template mock works.
|
||||||
|
@ -393,10 +408,15 @@ class StackInterfaceWithCallType {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class MockStackWithCallType : public StackInterfaceWithCallType<T> {
|
class MockStackWithCallType : public StackInterfaceWithCallType<T> {
|
||||||
public:
|
public:
|
||||||
|
MockStackWithCallType() {}
|
||||||
|
|
||||||
MOCK_METHOD1_T_WITH_CALLTYPE(STDMETHODCALLTYPE, Push, void(const T& elem));
|
MOCK_METHOD1_T_WITH_CALLTYPE(STDMETHODCALLTYPE, Push, void(const T& elem));
|
||||||
MOCK_METHOD0_T_WITH_CALLTYPE(STDMETHODCALLTYPE, Pop, void());
|
MOCK_METHOD0_T_WITH_CALLTYPE(STDMETHODCALLTYPE, Pop, void());
|
||||||
MOCK_CONST_METHOD0_T_WITH_CALLTYPE(STDMETHODCALLTYPE, GetSize, int());
|
MOCK_CONST_METHOD0_T_WITH_CALLTYPE(STDMETHODCALLTYPE, GetSize, int());
|
||||||
MOCK_CONST_METHOD0_T_WITH_CALLTYPE(STDMETHODCALLTYPE, GetTop, const T&());
|
MOCK_CONST_METHOD0_T_WITH_CALLTYPE(STDMETHODCALLTYPE, GetTop, const T&());
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStackWithCallType);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Tests that template mock with calltype works.
|
// Tests that template mock with calltype works.
|
||||||
|
@ -430,7 +450,12 @@ TEST(TemplateMockTestWithCallType, Works) {
|
||||||
|
|
||||||
class MockOverloadedOnArgNumber {
|
class MockOverloadedOnArgNumber {
|
||||||
public:
|
public:
|
||||||
|
MockOverloadedOnArgNumber() {}
|
||||||
|
|
||||||
MY_MOCK_METHODS1_;
|
MY_MOCK_METHODS1_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockOverloadedOnArgNumber);
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(OverloadedMockMethodTest, CanOverloadOnArgNumberInMacroBody) {
|
TEST(OverloadedMockMethodTest, CanOverloadOnArgNumberInMacroBody) {
|
||||||
|
@ -450,7 +475,12 @@ TEST(OverloadedMockMethodTest, CanOverloadOnArgNumberInMacroBody) {
|
||||||
|
|
||||||
class MockOverloadedOnConstness {
|
class MockOverloadedOnConstness {
|
||||||
public:
|
public:
|
||||||
|
MockOverloadedOnConstness() {}
|
||||||
|
|
||||||
MY_MOCK_METHODS2_;
|
MY_MOCK_METHODS2_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockOverloadedOnConstness);
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(OverloadedMockMethodTest, CanOverloadOnConstnessInMacroBody) {
|
TEST(OverloadedMockMethodTest, CanOverloadOnConstnessInMacroBody) {
|
||||||
|
|
|
@ -223,8 +223,9 @@ class GreaterThanMatcher : public MatcherInterface<int> {
|
||||||
*os << "is " << -diff << " less than " << rhs_;
|
*os << "is " << -diff << " less than " << rhs_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int rhs_;
|
int rhs_;
|
||||||
};
|
};
|
||||||
|
|
||||||
Matcher<int> GreaterThan(int n) {
|
Matcher<int> GreaterThan(int n) {
|
||||||
|
@ -411,7 +412,7 @@ TEST(ElementsAreTest, WorksForNestedContainer) {
|
||||||
};
|
};
|
||||||
|
|
||||||
vector<list<char> > nested;
|
vector<list<char> > nested;
|
||||||
for (int i = 0; i < GMOCK_ARRAY_SIZE_(strings); i++) {
|
for (size_t i = 0; i < GMOCK_ARRAY_SIZE_(strings); i++) {
|
||||||
nested.push_back(list<char>(strings[i], strings[i] + strlen(strings[i])));
|
nested.push_back(list<char>(strings[i], strings[i] + strlen(strings[i])));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +447,12 @@ TEST(ElementsAreTest, WorksWithNativeArrayPassedByReference) {
|
||||||
|
|
||||||
class NativeArrayPassedAsPointerAndSize {
|
class NativeArrayPassedAsPointerAndSize {
|
||||||
public:
|
public:
|
||||||
|
NativeArrayPassedAsPointerAndSize() {}
|
||||||
|
|
||||||
MOCK_METHOD2(Helper, void(int* array, int size));
|
MOCK_METHOD2(Helper, void(int* array, int size));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(NativeArrayPassedAsPointerAndSize);
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(ElementsAreTest, WorksWithNativeArrayPassedAsPointerAndSize) {
|
TEST(ElementsAreTest, WorksWithNativeArrayPassedAsPointerAndSize) {
|
||||||
|
@ -550,7 +556,10 @@ TEST(MatcherMacroTest, Works) {
|
||||||
// Tests that the description string supplied to MATCHER() must be
|
// Tests that the description string supplied to MATCHER() must be
|
||||||
// valid.
|
// valid.
|
||||||
|
|
||||||
MATCHER(HasBadDescription, "Invalid%") { return true; }
|
MATCHER(HasBadDescription, "Invalid%") {
|
||||||
|
// Uses arg to suppress "unused parameter" warning.
|
||||||
|
return arg==arg;
|
||||||
|
}
|
||||||
|
|
||||||
TEST(MatcherMacroTest,
|
TEST(MatcherMacroTest,
|
||||||
CreatingMatcherWithBadDescriptionGeneratesNonfatalFailure) {
|
CreatingMatcherWithBadDescriptionGeneratesNonfatalFailure) {
|
||||||
|
@ -560,7 +569,7 @@ TEST(MatcherMacroTest,
|
||||||
"use \"%%\" instead of \"%\" to print \"%\".");
|
"use \"%%\" instead of \"%\" to print \"%\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
MATCHER(HasGoodDescription, "good") { return true; }
|
MATCHER(HasGoodDescription, "good") { return arg==arg; }
|
||||||
|
|
||||||
TEST(MatcherMacroTest, AcceptsValidDescription) {
|
TEST(MatcherMacroTest, AcceptsValidDescription) {
|
||||||
const Matcher<int> m = HasGoodDescription();
|
const Matcher<int> m = HasGoodDescription();
|
||||||
|
@ -642,7 +651,7 @@ TEST(MatcherPMacroTest,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MATCHER_P(HasGoodDescription1, n, "good %(n)s") { return true; }
|
MATCHER_P(HasGoodDescription1, n, "good %(n)s") { return arg==arg; }
|
||||||
|
|
||||||
TEST(MatcherPMacroTest, AcceptsValidDescription) {
|
TEST(MatcherPMacroTest, AcceptsValidDescription) {
|
||||||
const Matcher<int> m = HasGoodDescription1(5);
|
const Matcher<int> m = HasGoodDescription1(5);
|
||||||
|
@ -709,7 +718,7 @@ TEST(MatcherPnMacroTest,
|
||||||
|
|
||||||
MATCHER_P2(HasComplexDescription, foo, bar,
|
MATCHER_P2(HasComplexDescription, foo, bar,
|
||||||
"is as complex as %(foo)s %(bar)s (i.e. %(*)s or %%%(foo)s!)") {
|
"is as complex as %(foo)s %(bar)s (i.e. %(*)s or %%%(foo)s!)") {
|
||||||
return true;
|
return arg==arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(MatcherPnMacroTest, AcceptsValidDescription) {
|
TEST(MatcherPnMacroTest, AcceptsValidDescription) {
|
||||||
|
@ -861,7 +870,7 @@ TEST(MatcherPnMacroTest, WorksForDifferentParameterTypes) {
|
||||||
MATCHER_P2(EqConcat, prefix, suffix, "") {
|
MATCHER_P2(EqConcat, prefix, suffix, "") {
|
||||||
// The following lines promote the two parameters to desired types.
|
// The following lines promote the two parameters to desired types.
|
||||||
std::string prefix_str(prefix);
|
std::string prefix_str(prefix);
|
||||||
char suffix_char(suffix);
|
char suffix_char = static_cast<char>(suffix);
|
||||||
return arg == prefix_str + suffix_char;
|
return arg == prefix_str + suffix_char;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -819,7 +819,7 @@ TEST(CopyArrayTest, WorksForTwoDimensionalArrays) {
|
||||||
TEST(NativeArrayTest, ConstructorFromArrayWorks) {
|
TEST(NativeArrayTest, ConstructorFromArrayWorks) {
|
||||||
const int a[3] = { 0, 1, 2 };
|
const int a[3] = { 0, 1, 2 };
|
||||||
NativeArray<int> na(a, 3, kReference);
|
NativeArray<int> na(a, 3, kReference);
|
||||||
EXPECT_EQ(3, na.size());
|
EXPECT_EQ(3U, na.size());
|
||||||
EXPECT_EQ(a, na.begin());
|
EXPECT_EQ(a, na.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -849,7 +849,7 @@ TEST(NativeArrayTest, TypeMembersAreCorrect) {
|
||||||
TEST(NativeArrayTest, MethodsWork) {
|
TEST(NativeArrayTest, MethodsWork) {
|
||||||
const int a[3] = { 0, 1, 2 };
|
const int a[3] = { 0, 1, 2 };
|
||||||
NativeArray<int> na(a, 3, kCopy);
|
NativeArray<int> na(a, 3, kCopy);
|
||||||
ASSERT_EQ(3, na.size());
|
ASSERT_EQ(3U, na.size());
|
||||||
EXPECT_EQ(3, na.end() - na.begin());
|
EXPECT_EQ(3, na.end() - na.begin());
|
||||||
|
|
||||||
NativeArray<int>::const_iterator it = na.begin();
|
NativeArray<int>::const_iterator it = na.begin();
|
||||||
|
@ -875,7 +875,7 @@ TEST(NativeArrayTest, MethodsWork) {
|
||||||
TEST(NativeArrayTest, WorksForTwoDimensionalArray) {
|
TEST(NativeArrayTest, WorksForTwoDimensionalArray) {
|
||||||
const char a[2][3] = { "hi", "lo" };
|
const char a[2][3] = { "hi", "lo" };
|
||||||
NativeArray<char[3]> na(a, 2, kReference);
|
NativeArray<char[3]> na(a, 2, kReference);
|
||||||
ASSERT_EQ(2, na.size());
|
ASSERT_EQ(2U, na.size());
|
||||||
EXPECT_EQ(a, na.begin());
|
EXPECT_EQ(a, na.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -910,11 +910,11 @@ TEST(StlContainerViewTest, WorksForStaticNativeArray) {
|
||||||
|
|
||||||
int a1[3] = { 0, 1, 2 };
|
int a1[3] = { 0, 1, 2 };
|
||||||
NativeArray<int> a2 = StlContainerView<int[3]>::ConstReference(a1);
|
NativeArray<int> a2 = StlContainerView<int[3]>::ConstReference(a1);
|
||||||
EXPECT_EQ(3, a2.size());
|
EXPECT_EQ(3U, a2.size());
|
||||||
EXPECT_EQ(a1, a2.begin());
|
EXPECT_EQ(a1, a2.begin());
|
||||||
|
|
||||||
const NativeArray<int> a3 = StlContainerView<int[3]>::Copy(a1);
|
const NativeArray<int> a3 = StlContainerView<int[3]>::Copy(a1);
|
||||||
ASSERT_EQ(3, a3.size());
|
ASSERT_EQ(3U, a3.size());
|
||||||
EXPECT_EQ(0, a3.begin()[0]);
|
EXPECT_EQ(0, a3.begin()[0]);
|
||||||
EXPECT_EQ(1, a3.begin()[1]);
|
EXPECT_EQ(1, a3.begin()[1]);
|
||||||
EXPECT_EQ(2, a3.begin()[2]);
|
EXPECT_EQ(2, a3.begin()[2]);
|
||||||
|
@ -937,12 +937,12 @@ TEST(StlContainerViewTest, WorksForDynamicNativeArray) {
|
||||||
const int* const p1 = a1;
|
const int* const p1 = a1;
|
||||||
NativeArray<int> a2 = StlContainerView<tuple<const int*, int> >::
|
NativeArray<int> a2 = StlContainerView<tuple<const int*, int> >::
|
||||||
ConstReference(make_tuple(p1, 3));
|
ConstReference(make_tuple(p1, 3));
|
||||||
EXPECT_EQ(3, a2.size());
|
EXPECT_EQ(3U, a2.size());
|
||||||
EXPECT_EQ(a1, a2.begin());
|
EXPECT_EQ(a1, a2.begin());
|
||||||
|
|
||||||
const NativeArray<int> a3 = StlContainerView<tuple<int*, size_t> >::
|
const NativeArray<int> a3 = StlContainerView<tuple<int*, size_t> >::
|
||||||
Copy(make_tuple(static_cast<int*>(a1), 3));
|
Copy(make_tuple(static_cast<int*>(a1), 3));
|
||||||
ASSERT_EQ(3, a3.size());
|
ASSERT_EQ(3U, a3.size());
|
||||||
EXPECT_EQ(0, a3.begin()[0]);
|
EXPECT_EQ(0, a3.begin()[0]);
|
||||||
EXPECT_EQ(1, a3.begin()[1]);
|
EXPECT_EQ(1, a3.begin()[1]);
|
||||||
EXPECT_EQ(2, a3.begin()[2]);
|
EXPECT_EQ(2, a3.begin()[2]);
|
||||||
|
|
|
@ -152,8 +152,9 @@ class GreaterThanMatcher : public MatcherInterface<int> {
|
||||||
*os << "is " << -diff << " less than " << rhs_;
|
*os << "is " << -diff << " less than " << rhs_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int rhs_;
|
int rhs_;
|
||||||
};
|
};
|
||||||
|
|
||||||
Matcher<int> GreaterThan(int n) {
|
Matcher<int> GreaterThan(int n) {
|
||||||
|
@ -335,7 +336,7 @@ class IntValue {
|
||||||
public:
|
public:
|
||||||
// An int can be statically (although not implicitly) cast to a
|
// An int can be statically (although not implicitly) cast to a
|
||||||
// IntValue.
|
// IntValue.
|
||||||
explicit IntValue(int value) : value_(value) {}
|
explicit IntValue(int a_value) : value_(a_value) {}
|
||||||
|
|
||||||
int value() const { return value_; }
|
int value() const { return value_; }
|
||||||
private:
|
private:
|
||||||
|
@ -560,7 +561,7 @@ class Unprintable {
|
||||||
public:
|
public:
|
||||||
Unprintable() : c_('a') {}
|
Unprintable() : c_('a') {}
|
||||||
|
|
||||||
bool operator==(const Unprintable& rhs) { return true; }
|
bool operator==(const Unprintable& /* rhs */) { return true; }
|
||||||
private:
|
private:
|
||||||
char c_;
|
char c_;
|
||||||
};
|
};
|
||||||
|
@ -606,7 +607,7 @@ TEST(TypedEqTest, CanDescribeSelf) {
|
||||||
// "undefined referece".
|
// "undefined referece".
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct Type {
|
struct Type {
|
||||||
static bool IsTypeOf(const T& v) { return true; }
|
static bool IsTypeOf(const T& /* v */) { return true; }
|
||||||
|
|
||||||
template <typename T2>
|
template <typename T2>
|
||||||
static void IsTypeOf(T2 v);
|
static void IsTypeOf(T2 v);
|
||||||
|
@ -1861,8 +1862,9 @@ class IsGreaterThan {
|
||||||
explicit IsGreaterThan(int threshold) : threshold_(threshold) {}
|
explicit IsGreaterThan(int threshold) : threshold_(threshold) {}
|
||||||
|
|
||||||
bool operator()(int n) const { return n > threshold_; }
|
bool operator()(int n) const { return n > threshold_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int threshold_;
|
int threshold_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// For testing Truly().
|
// For testing Truly().
|
||||||
|
@ -1959,7 +1961,12 @@ TEST(AllArgsTest, WorksForNonTuple) {
|
||||||
|
|
||||||
class AllArgsHelper {
|
class AllArgsHelper {
|
||||||
public:
|
public:
|
||||||
|
AllArgsHelper() {}
|
||||||
|
|
||||||
MOCK_METHOD2(Helper, int(char x, int y));
|
MOCK_METHOD2(Helper, int(char x, int y));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(AllArgsHelper);
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(AllArgsTest, WorksInWithClause) {
|
TEST(AllArgsTest, WorksInWithClause) {
|
||||||
|
@ -2384,7 +2391,7 @@ TEST(PointeeTest, CanExplainMatchResult) {
|
||||||
// An uncopyable class.
|
// An uncopyable class.
|
||||||
class Uncopyable {
|
class Uncopyable {
|
||||||
public:
|
public:
|
||||||
explicit Uncopyable(int value) : value_(value) {}
|
explicit Uncopyable(int a_value) : value_(a_value) {}
|
||||||
|
|
||||||
int value() const { return value_; }
|
int value() const { return value_; }
|
||||||
private:
|
private:
|
||||||
|
@ -2405,11 +2412,17 @@ struct AStruct {
|
||||||
const double y; // A const field.
|
const double y; // A const field.
|
||||||
Uncopyable z; // An uncopyable field.
|
Uncopyable z; // An uncopyable field.
|
||||||
const char* p; // A pointer field.
|
const char* p; // A pointer field.
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_ASSIGN_(AStruct);
|
||||||
};
|
};
|
||||||
|
|
||||||
// A derived struct for testing Field().
|
// A derived struct for testing Field().
|
||||||
struct DerivedStruct : public AStruct {
|
struct DerivedStruct : public AStruct {
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_ASSIGN_(DerivedStruct);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Tests that Field(&Foo::field, ...) works when field is non-const.
|
// Tests that Field(&Foo::field, ...) works when field is non-const.
|
||||||
|
@ -2943,7 +2956,7 @@ TEST(ResultOfTest, WorksForReferencingCallables) {
|
||||||
|
|
||||||
class DivisibleByImpl {
|
class DivisibleByImpl {
|
||||||
public:
|
public:
|
||||||
explicit DivisibleByImpl(int divider) : divider_(divider) {}
|
explicit DivisibleByImpl(int a_divider) : divider_(a_divider) {}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool Matches(const T& n) const {
|
bool Matches(const T& n) const {
|
||||||
|
@ -2958,7 +2971,7 @@ class DivisibleByImpl {
|
||||||
*os << "is not divisible by " << divider_;
|
*os << "is not divisible by " << divider_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_divider(int divider) { divider_ = divider; }
|
void set_divider(int a_divider) { divider_ = a_divider; }
|
||||||
int divider() const { return divider_; }
|
int divider() const { return divider_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -3021,7 +3034,7 @@ TEST(ExplainmatcherResultTest, MonomorphicMatcher) {
|
||||||
|
|
||||||
class NotCopyable {
|
class NotCopyable {
|
||||||
public:
|
public:
|
||||||
explicit NotCopyable(int value) : value_(value) {}
|
explicit NotCopyable(int a_value) : value_(a_value) {}
|
||||||
|
|
||||||
int value() const { return value_; }
|
int value() const { return value_; }
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,10 @@ using testing::Unused;
|
||||||
using testing::WithArg;
|
using testing::WithArg;
|
||||||
using testing::WithoutArgs;
|
using testing::WithoutArgs;
|
||||||
|
|
||||||
|
// For suppressing compiler warnings on conversion possibly losing precision.
|
||||||
|
inline short Short(short n) { return n; } // NOLINT
|
||||||
|
inline char Char(char ch) { return ch; }
|
||||||
|
|
||||||
// Sample functions and functors for testing Invoke() and etc.
|
// Sample functions and functors for testing Invoke() and etc.
|
||||||
int Nullary() { return 1; }
|
int Nullary() { return 1; }
|
||||||
|
|
||||||
|
@ -85,7 +89,7 @@ bool Unary(int x) { return x < 0; }
|
||||||
|
|
||||||
const char* Plus1(const char* s) { return s + 1; }
|
const char* Plus1(const char* s) { return s + 1; }
|
||||||
|
|
||||||
void VoidUnary(int n) { g_done = true; }
|
void VoidUnary(int /* n */) { g_done = true; }
|
||||||
|
|
||||||
bool ByConstRef(const string& s) { return s == "Hi"; }
|
bool ByConstRef(const string& s) { return s == "Hi"; }
|
||||||
|
|
||||||
|
@ -239,13 +243,13 @@ TEST(InvokeTest, Unary) {
|
||||||
TEST(InvokeTest, Binary) {
|
TEST(InvokeTest, Binary) {
|
||||||
Action<const char*(const char*, short)> a = Invoke(Binary); // NOLINT
|
Action<const char*(const char*, short)> a = Invoke(Binary); // NOLINT
|
||||||
const char* p = "Hello";
|
const char* p = "Hello";
|
||||||
EXPECT_EQ(p + 2, a.Perform(make_tuple(p, 2)));
|
EXPECT_EQ(p + 2, a.Perform(make_tuple(p, Short(2))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using Invoke() with a ternary function.
|
// Tests using Invoke() with a ternary function.
|
||||||
TEST(InvokeTest, Ternary) {
|
TEST(InvokeTest, Ternary) {
|
||||||
Action<int(int, char, short)> a = Invoke(Ternary); // NOLINT
|
Action<int(int, char, short)> a = Invoke(Ternary); // NOLINT
|
||||||
EXPECT_EQ(6, a.Perform(make_tuple(1, '\2', 3)));
|
EXPECT_EQ(6, a.Perform(make_tuple(1, '\2', Short(3))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using Invoke() with a 4-argument function.
|
// Tests using Invoke() with a 4-argument function.
|
||||||
|
@ -340,14 +344,14 @@ TEST(InvokeTest, MethodWithUnusedParameters) {
|
||||||
|
|
||||||
// Tests using Invoke() with a functor.
|
// Tests using Invoke() with a functor.
|
||||||
TEST(InvokeTest, Functor) {
|
TEST(InvokeTest, Functor) {
|
||||||
Action<int(short, char)> a = Invoke(plus<short>()); // NOLINT
|
Action<long(long, int)> a = Invoke(plus<long>()); // NOLINT
|
||||||
EXPECT_EQ(3, a.Perform(make_tuple(1, 2)));
|
EXPECT_EQ(3L, a.Perform(make_tuple(1, 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using Invoke(f) as an action of a compatible type.
|
// Tests using Invoke(f) as an action of a compatible type.
|
||||||
TEST(InvokeTest, FunctionWithCompatibleType) {
|
TEST(InvokeTest, FunctionWithCompatibleType) {
|
||||||
Action<long(int, short, char, bool)> a = Invoke(SumOf4); // NOLINT
|
Action<long(int, short, char, bool)> a = Invoke(SumOf4); // NOLINT
|
||||||
EXPECT_EQ(4321, a.Perform(make_tuple(4000, 300, 20, true)));
|
EXPECT_EQ(4321, a.Perform(make_tuple(4000, Short(300), Char(20), true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using Invoke() with an object pointer and a method pointer.
|
// Tests using Invoke() with an object pointer and a method pointer.
|
||||||
|
@ -378,7 +382,7 @@ TEST(InvokeMethodTest, Binary) {
|
||||||
TEST(InvokeMethodTest, Ternary) {
|
TEST(InvokeMethodTest, Ternary) {
|
||||||
Foo foo;
|
Foo foo;
|
||||||
Action<int(int, bool, char)> a = Invoke(&foo, &Foo::Ternary); // NOLINT
|
Action<int(int, bool, char)> a = Invoke(&foo, &Foo::Ternary); // NOLINT
|
||||||
EXPECT_EQ(1124, a.Perform(make_tuple(1000, true, 1)));
|
EXPECT_EQ(1124, a.Perform(make_tuple(1000, true, Char(1))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using Invoke() with a 4-argument method.
|
// Tests using Invoke() with a 4-argument method.
|
||||||
|
@ -457,7 +461,7 @@ TEST(InvokeMethodTest, MethodWithCompatibleType) {
|
||||||
Foo foo;
|
Foo foo;
|
||||||
Action<long(int, short, char, bool)> a = // NOLINT
|
Action<long(int, short, char, bool)> a = // NOLINT
|
||||||
Invoke(&foo, &Foo::SumOf4);
|
Invoke(&foo, &Foo::SumOf4);
|
||||||
EXPECT_EQ(4444, a.Perform(make_tuple(4000, 300, 20, true)));
|
EXPECT_EQ(4444, a.Perform(make_tuple(4000, Short(300), Char(20), true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using WithoutArgs with an action that takes no argument.
|
// Tests using WithoutArgs with an action that takes no argument.
|
||||||
|
|
|
@ -40,7 +40,12 @@
|
||||||
// clash with ::testing::Mock.
|
// clash with ::testing::Mock.
|
||||||
class Mock {
|
class Mock {
|
||||||
public:
|
public:
|
||||||
|
Mock() {}
|
||||||
|
|
||||||
MOCK_METHOD0(DoThis, void());
|
MOCK_METHOD0(DoThis, void());
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(Mock);
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
@ -64,10 +69,14 @@ class Foo {
|
||||||
|
|
||||||
class MockFoo : public Foo {
|
class MockFoo : public Foo {
|
||||||
public:
|
public:
|
||||||
|
MockFoo() {}
|
||||||
void Delete() { delete this; }
|
void Delete() { delete this; }
|
||||||
|
|
||||||
MOCK_METHOD0(DoThis, void());
|
MOCK_METHOD0(DoThis, void());
|
||||||
MOCK_METHOD1(DoThat, int(bool flag));
|
MOCK_METHOD1(DoThat, int(bool flag));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockBar {
|
class MockBar {
|
||||||
|
@ -89,6 +98,8 @@ class MockBar {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string str_;
|
string str_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockBar);
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(wan@google.com): find a way to re-enable these tests.
|
// TODO(wan@google.com): find a way to re-enable these tests.
|
||||||
|
|
|
@ -85,7 +85,7 @@ class Castable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool* const converted_;
|
bool* converted_;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(ImplicitCastTest, CanUseNonConstCastOperator) {
|
TEST(ImplicitCastTest, CanUseNonConstCastOperator) {
|
||||||
|
@ -104,7 +104,7 @@ class ConstCastable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool* const converted_;
|
bool* converted_;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(ImplicitCastTest, CanUseConstCastOperatorOnConstValues) {
|
TEST(ImplicitCastTest, CanUseConstCastOperatorOnConstValues) {
|
||||||
|
@ -128,8 +128,8 @@ class ConstAndNonConstCastable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool* const converted_;
|
bool* converted_;
|
||||||
bool* const const_converted_;
|
bool* const_converted_;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(ImplicitCastTest, CanSelectBetweenConstAndNonConstCasrAppropriately) {
|
TEST(ImplicitCastTest, CanSelectBetweenConstAndNonConstCasrAppropriately) {
|
||||||
|
|
|
@ -77,7 +77,7 @@ class StreamableInGlobal {
|
||||||
virtual ~StreamableInGlobal() {}
|
virtual ~StreamableInGlobal() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void operator<<(::std::ostream& os, const StreamableInGlobal& x) {
|
inline void operator<<(::std::ostream& os, const StreamableInGlobal& /* x */) {
|
||||||
os << "StreamableInGlobal";
|
os << "StreamableInGlobal";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ void PrintTo(const PrintableViaPrintTo& x, ::std::ostream* os) {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class PrintableViaPrintToTemplate {
|
class PrintableViaPrintToTemplate {
|
||||||
public:
|
public:
|
||||||
explicit PrintableViaPrintToTemplate(const T& value) : value_(value) {}
|
explicit PrintableViaPrintToTemplate(const T& a_value) : value_(a_value) {}
|
||||||
|
|
||||||
const T& value() const { return value_; }
|
const T& value() const { return value_; }
|
||||||
private:
|
private:
|
||||||
|
@ -440,7 +440,7 @@ TEST(PrintPointerToPointerTest, IntPointerPointer) {
|
||||||
|
|
||||||
// Tests printing (non-member) function pointers.
|
// Tests printing (non-member) function pointers.
|
||||||
|
|
||||||
void MyFunction(int n) {}
|
void MyFunction(int /* n */) {}
|
||||||
|
|
||||||
TEST(PrintPointerTest, NonMemberFunctionPointer) {
|
TEST(PrintPointerTest, NonMemberFunctionPointer) {
|
||||||
// We cannot directly cast &MyFunction to const void* because the
|
// We cannot directly cast &MyFunction to const void* because the
|
||||||
|
@ -464,7 +464,7 @@ struct Foo {
|
||||||
public:
|
public:
|
||||||
virtual ~Foo() {}
|
virtual ~Foo() {}
|
||||||
int MyMethod(char x) { return x + 1; }
|
int MyMethod(char x) { return x + 1; }
|
||||||
virtual char MyVirtualMethod(int n) { return 'a'; }
|
virtual char MyVirtualMethod(int /* n */) { return 'a'; }
|
||||||
|
|
||||||
int value;
|
int value;
|
||||||
};
|
};
|
||||||
|
@ -603,7 +603,7 @@ class AllowsGenericStreaming {};
|
||||||
template <typename Char, typename CharTraits>
|
template <typename Char, typename CharTraits>
|
||||||
std::basic_ostream<Char, CharTraits>& operator<<(
|
std::basic_ostream<Char, CharTraits>& operator<<(
|
||||||
std::basic_ostream<Char, CharTraits>& os,
|
std::basic_ostream<Char, CharTraits>& os,
|
||||||
const AllowsGenericStreaming& a) {
|
const AllowsGenericStreaming& /* a */) {
|
||||||
return os << "AllowsGenericStreaming";
|
return os << "AllowsGenericStreaming";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,7 +620,7 @@ class AllowsGenericStreamingTemplate {};
|
||||||
template <typename Char, typename CharTraits, typename T>
|
template <typename Char, typename CharTraits, typename T>
|
||||||
std::basic_ostream<Char, CharTraits>& operator<<(
|
std::basic_ostream<Char, CharTraits>& operator<<(
|
||||||
std::basic_ostream<Char, CharTraits>& os,
|
std::basic_ostream<Char, CharTraits>& os,
|
||||||
const AllowsGenericStreamingTemplate<T>& a) {
|
const AllowsGenericStreamingTemplate<T>& /* a */) {
|
||||||
return os << "AllowsGenericStreamingTemplate";
|
return os << "AllowsGenericStreamingTemplate";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ class AllowsGenericStreamingAndImplicitConversionTemplate {
|
||||||
template <typename Char, typename CharTraits, typename T>
|
template <typename Char, typename CharTraits, typename T>
|
||||||
std::basic_ostream<Char, CharTraits>& operator<<(
|
std::basic_ostream<Char, CharTraits>& operator<<(
|
||||||
std::basic_ostream<Char, CharTraits>& os,
|
std::basic_ostream<Char, CharTraits>& os,
|
||||||
const AllowsGenericStreamingAndImplicitConversionTemplate<T>& a) {
|
const AllowsGenericStreamingAndImplicitConversionTemplate<T>& /* a */) {
|
||||||
return os << "AllowsGenericStreamingAndImplicitConversionTemplate";
|
return os << "AllowsGenericStreamingAndImplicitConversionTemplate";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,16 +97,26 @@ class Result {};
|
||||||
|
|
||||||
class MockA {
|
class MockA {
|
||||||
public:
|
public:
|
||||||
|
MockA() {}
|
||||||
|
|
||||||
MOCK_METHOD1(DoA, void(int n)); // NOLINT
|
MOCK_METHOD1(DoA, void(int n)); // NOLINT
|
||||||
MOCK_METHOD1(ReturnResult, Result(int n)); // NOLINT
|
MOCK_METHOD1(ReturnResult, Result(int n)); // NOLINT
|
||||||
MOCK_METHOD2(Binary, bool(int x, int y)); // NOLINT
|
MOCK_METHOD2(Binary, bool(int x, int y)); // NOLINT
|
||||||
MOCK_METHOD2(ReturnInt, int(int x, int y)); // NOLINT
|
MOCK_METHOD2(ReturnInt, int(int x, int y)); // NOLINT
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockA);
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockB {
|
class MockB {
|
||||||
public:
|
public:
|
||||||
|
MockB() {}
|
||||||
|
|
||||||
MOCK_CONST_METHOD0(DoB, int()); // NOLINT
|
MOCK_CONST_METHOD0(DoB, int()); // NOLINT
|
||||||
MOCK_METHOD1(DoB, int(int n)); // NOLINT
|
MOCK_METHOD1(DoB, int(int n)); // NOLINT
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockB);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Tests that EXPECT_CALL and ON_CALL compile in a presence of macro
|
// Tests that EXPECT_CALL and ON_CALL compile in a presence of macro
|
||||||
|
@ -123,7 +133,12 @@ class CC {
|
||||||
};
|
};
|
||||||
class MockCC : public CC {
|
class MockCC : public CC {
|
||||||
public:
|
public:
|
||||||
|
MockCC() {}
|
||||||
|
|
||||||
MOCK_METHOD0(Method, int());
|
MOCK_METHOD0(Method, int());
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockCC);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Tests that a method with expanded name compiles.
|
// Tests that a method with expanded name compiles.
|
||||||
|
@ -1617,8 +1632,19 @@ TEST(DeletingMockEarlyTest, Success2) {
|
||||||
|
|
||||||
// Tests that it's OK to delete a mock object itself in its action.
|
// Tests that it's OK to delete a mock object itself in its action.
|
||||||
|
|
||||||
|
// Suppresses warning on unreferenced formal parameter in MSVC with
|
||||||
|
// -W4.
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4100)
|
||||||
|
#endif
|
||||||
|
|
||||||
ACTION_P(Delete, ptr) { delete ptr; }
|
ACTION_P(Delete, ptr) { delete ptr; }
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST(DeletingMockEarlyTest, CanDeleteSelfInActionReturningVoid) {
|
TEST(DeletingMockEarlyTest, CanDeleteSelfInActionReturningVoid) {
|
||||||
MockA* const a = new MockA;
|
MockA* const a = new MockA;
|
||||||
EXPECT_CALL(*a, DoA(_)).WillOnce(Delete(a));
|
EXPECT_CALL(*a, DoA(_)).WillOnce(Delete(a));
|
||||||
|
@ -1691,7 +1717,9 @@ class EvenNumberCardinality : public CardinalityInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true iff call_count calls will saturate this cardinality.
|
// Returns true iff call_count calls will saturate this cardinality.
|
||||||
virtual bool IsSaturatedByCallCount(int call_count) const { return false; }
|
virtual bool IsSaturatedByCallCount(int /* call_count */) const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Describes self to an ostream.
|
// Describes self to an ostream.
|
||||||
virtual void DescribeTo(::std::ostream* os) const {
|
virtual void DescribeTo(::std::ostream* os) const {
|
||||||
|
@ -1740,9 +1768,14 @@ struct Unprintable {
|
||||||
|
|
||||||
class MockC {
|
class MockC {
|
||||||
public:
|
public:
|
||||||
|
MockC() {}
|
||||||
|
|
||||||
MOCK_METHOD6(VoidMethod, void(bool cond, int n, string s, void* p,
|
MOCK_METHOD6(VoidMethod, void(bool cond, int n, string s, void* p,
|
||||||
const Printable& x, Unprintable y));
|
const Printable& x, Unprintable y));
|
||||||
MOCK_METHOD0(NonVoidMethod, int()); // NOLINT
|
MOCK_METHOD0(NonVoidMethod, int()); // NOLINT
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockC);
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(wan@google.com): find a way to re-enable these tests.
|
// TODO(wan@google.com): find a way to re-enable these tests.
|
||||||
|
@ -1935,7 +1968,12 @@ void PrintTo(PrintMeNot /* dummy */, ::std::ostream* /* os */) {
|
||||||
|
|
||||||
class LogTestHelper {
|
class LogTestHelper {
|
||||||
public:
|
public:
|
||||||
|
LogTestHelper() {}
|
||||||
|
|
||||||
MOCK_METHOD1(Foo, PrintMeNot(PrintMeNot));
|
MOCK_METHOD1(Foo, PrintMeNot(PrintMeNot));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(LogTestHelper);
|
||||||
};
|
};
|
||||||
|
|
||||||
class GMockLogTest : public ::testing::Test {
|
class GMockLogTest : public ::testing::Test {
|
||||||
|
|
|
@ -48,7 +48,12 @@ class FooInterface {
|
||||||
|
|
||||||
class MockFoo : public FooInterface {
|
class MockFoo : public FooInterface {
|
||||||
public:
|
public:
|
||||||
|
MockFoo() {}
|
||||||
|
|
||||||
MOCK_METHOD0(DoThis, void());
|
MOCK_METHOD0(DoThis, void());
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(LeakTest, LeakedMockWithExpectCallCausesFailureWhenLeakCheckingIsEnabled) {
|
TEST(LeakTest, LeakedMockWithExpectCallCausesFailureWhenLeakCheckingIsEnabled) {
|
||||||
|
|
|
@ -206,6 +206,8 @@ class Interface {
|
||||||
|
|
||||||
class Mock: public Interface {
|
class Mock: public Interface {
|
||||||
public:
|
public:
|
||||||
|
Mock() {}
|
||||||
|
|
||||||
MOCK_METHOD1(VoidFromString, void(char* str));
|
MOCK_METHOD1(VoidFromString, void(char* str));
|
||||||
MOCK_METHOD1(StringFromString, char*(char* str));
|
MOCK_METHOD1(StringFromString, char*(char* str));
|
||||||
MOCK_METHOD1(IntFromString, int(char* str));
|
MOCK_METHOD1(IntFromString, int(char* str));
|
||||||
|
@ -215,6 +217,9 @@ class Mock: public Interface {
|
||||||
MOCK_METHOD1(VoidFromFloat, void(float n));
|
MOCK_METHOD1(VoidFromFloat, void(float n));
|
||||||
MOCK_METHOD1(VoidFromDouble, void(double n));
|
MOCK_METHOD1(VoidFromDouble, void(double n));
|
||||||
MOCK_METHOD1(VoidFromVector, void(const std::vector<int>& v));
|
MOCK_METHOD1(VoidFromVector, void(const std::vector<int>& v));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(Mock);
|
||||||
};
|
};
|
||||||
|
|
||||||
class InvokeHelper {
|
class InvokeHelper {
|
||||||
|
@ -229,7 +234,7 @@ class InvokeHelper {
|
||||||
|
|
||||||
class FieldHelper {
|
class FieldHelper {
|
||||||
public:
|
public:
|
||||||
FieldHelper(int field) : field_(field) {}
|
FieldHelper(int a_field) : field_(a_field) {}
|
||||||
int field() const { return field_; }
|
int field() const { return field_; }
|
||||||
int field_; // NOLINT -- need external access to field_ to test
|
int field_; // NOLINT -- need external access to field_ to test
|
||||||
// the Field matcher.
|
// the Field matcher.
|
||||||
|
@ -410,6 +415,16 @@ TEST(LinkTest, TestThrow) {
|
||||||
}
|
}
|
||||||
#endif // GTEST_HAS_EXCEPTIONS
|
#endif // GTEST_HAS_EXCEPTIONS
|
||||||
|
|
||||||
|
// The ACTION*() macros trigger warning C4100 (unreferenced formal
|
||||||
|
// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
|
||||||
|
// the macro definition, as the warnings are generated when the macro
|
||||||
|
// is expanded and macro expansion cannot contain #pragma. Therefore
|
||||||
|
// we suppress them here.
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4100)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Tests the linkage of actions created using ACTION macro.
|
// Tests the linkage of actions created using ACTION macro.
|
||||||
namespace {
|
namespace {
|
||||||
ACTION(Return1) { return 1; }
|
ACTION(Return1) { return 1; }
|
||||||
|
@ -441,6 +456,10 @@ ACTION_P2(ReturnEqualsEitherOf, first, second) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST(LinkTest, TestActionP2Macro) {
|
TEST(LinkTest, TestActionP2Macro) {
|
||||||
Mock mock;
|
Mock mock;
|
||||||
char ch = 'x';
|
char ch = 'x';
|
||||||
|
|
|
@ -49,9 +49,14 @@ using testing::Sequence;
|
||||||
|
|
||||||
class MockFoo {
|
class MockFoo {
|
||||||
public:
|
public:
|
||||||
|
MockFoo() {}
|
||||||
|
|
||||||
MOCK_METHOD3(Bar, char(const std::string& s, int i, double x));
|
MOCK_METHOD3(Bar, char(const std::string& s, int i, double x));
|
||||||
MOCK_METHOD2(Bar2, bool(int x, int y));
|
MOCK_METHOD2(Bar2, bool(int x, int y));
|
||||||
MOCK_METHOD2(Bar3, void(int x, int y));
|
MOCK_METHOD2(Bar3, void(int x, int y));
|
||||||
|
|
||||||
|
private:
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
|
||||||
};
|
};
|
||||||
|
|
||||||
class GMockOutputTest : public testing::Test {
|
class GMockOutputTest : public testing::Test {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user