summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--googlemock/CMakeLists.txt1
-rw-r--r--googlemock/Makefile.am3
-rw-r--r--googlemock/include/gmock/gmock-actions.h142
-rw-r--r--googlemock/include/gmock/gmock-generated-actions.h302
-rw-r--r--googlemock/include/gmock/gmock-generated-actions.h.pump70
-rw-r--r--googlemock/include/gmock/gmock-generated-function-mockers.h79
-rw-r--r--googlemock/include/gmock/gmock-generated-function-mockers.h.pump6
-rw-r--r--googlemock/include/gmock/gmock-matchers.h133
-rw-r--r--googlemock/include/gmock/gmock-more-actions.h66
-rw-r--r--googlemock/include/gmock/gmock-spec-builders.h12
-rw-r--r--googlemock/include/gmock/gmock.h18
-rw-r--r--googlemock/include/gmock/internal/gmock-generated-internal-utils.h266
-rw-r--r--googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump125
-rw-r--r--googlemock/include/gmock/internal/gmock-internal-utils.h37
-rw-r--r--googlemock/src/gmock.cc12
-rw-r--r--googlemock/src/gmock_main.cc5
-rw-r--r--googlemock/test/gmock-actions_test.cc11
-rw-r--r--googlemock/test/gmock-function-mocker_test.cc17
-rw-r--r--googlemock/test/gmock-generated-function-mockers_test.cc18
-rw-r--r--googlemock/test/gmock-generated-internal-utils_test.cc130
-rw-r--r--googlemock/test/gmock-generated-matchers_test.cc142
-rw-r--r--googlemock/test/gmock-internal-utils_test.cc64
-rw-r--r--googlemock/test/gmock-matchers_test.cc170
-rw-r--r--googlemock/test/gmock-spec-builders_test.cc1
-rw-r--r--googlemock/test/gmock_all_test.cc1
-rw-r--r--googletest/include/gtest/gtest-matchers.h26
-rw-r--r--googletest/include/gtest/gtest-printers.h7
-rw-r--r--googletest/include/gtest/gtest.h32
-rw-r--r--googletest/include/gtest/internal/gtest-internal.h79
-rw-r--r--googletest/samples/sample6_unittest.cc12
-rw-r--r--googletest/samples/sample7_unittest.cc6
-rw-r--r--googletest/samples/sample8_unittest.cc5
-rw-r--r--googletest/src/gtest.cc16
-rw-r--r--googletest/src/gtest_main.cc8
-rwxr-xr-xgoogletest/test/googletest-catch-exceptions-test.py24
-rw-r--r--googletest/test/googletest-catch-exceptions-test_.cc61
-rw-r--r--googletest/test/googletest-death-test-test.cc4
-rw-r--r--googletest/test/googletest-filter-unittest_.cc4
-rw-r--r--googletest/test/googletest-json-output-unittest.py12
-rw-r--r--googletest/test/googletest-list-tests-unittest_.cc10
-rw-r--r--googletest/test/googletest-listener-test.cc18
-rw-r--r--googletest/test/googletest-output-test-golden-lin.txt56
-rw-r--r--googletest/test/googletest-output-test_.cc64
-rw-r--r--googletest/test/googletest-param-test-invalid-name1-test_.cc8
-rw-r--r--googletest/test/googletest-param-test-invalid-name2-test_.cc8
-rw-r--r--googletest/test/googletest-param-test-test.cc144
-rw-r--r--googletest/test/googletest-param-test-test.h2
-rw-r--r--googletest/test/googletest-param-test2-test.cc14
-rw-r--r--googletest/test/googletest-port-test.cc2
-rw-r--r--googletest/test/googletest-printers-test.cc16
-rw-r--r--googletest/test/googletest-test2_test.cc14
-rw-r--r--googletest/test/gtest-typed-test2_test.cc4
-rw-r--r--googletest/test/gtest-typed-test_test.cc114
-rw-r--r--googletest/test/gtest-typed-test_test.h6
-rw-r--r--googletest/test/gtest-unittest-api_test.cc232
-rw-r--r--googletest/test/gtest_repeat_test.cc6
-rw-r--r--googletest/test/gtest_unittest.cc191
-rwxr-xr-xgoogletest/test/gtest_xml_output_unittest.py12
-rw-r--r--googletest/test/gtest_xml_output_unittest_.cc26
59 files changed, 1206 insertions, 1868 deletions
diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt
index 3e72d75..b0c1db8 100644
--- a/googlemock/CMakeLists.txt
+++ b/googlemock/CMakeLists.txt
@@ -156,7 +156,6 @@ $env:Path = \"$project_bin;$env:Path\"
cxx_test(gmock-function-mocker_test gmock_main)
cxx_test(gmock-generated-actions_test gmock_main)
cxx_test(gmock-generated-function-mockers_test gmock_main)
- cxx_test(gmock-generated-internal-utils_test gmock_main)
cxx_test(gmock-generated-matchers_test gmock_main)
cxx_test(gmock-internal-utils_test gmock_main)
cxx_test(gmock-matchers_test gmock_main)
diff --git a/googlemock/Makefile.am b/googlemock/Makefile.am
index 7fe6809..c2ee96d 100644
--- a/googlemock/Makefile.am
+++ b/googlemock/Makefile.am
@@ -41,7 +41,6 @@ pkginclude_HEADERS = \
pkginclude_internaldir = $(pkgincludedir)/internal
pkginclude_internal_HEADERS = \
- include/gmock/internal/gmock-generated-internal-utils.h \
include/gmock/internal/gmock-internal-utils.h \
include/gmock/internal/gmock-port.h \
include/gmock/internal/gmock-pp.h \
@@ -111,7 +110,6 @@ EXTRA_DIST += \
test/gmock-generated-actions_test.cc \
test/gmock-function-mocker_test.cc \
test/gmock-generated-function-mockers_test.cc \
- test/gmock-generated-internal-utils_test.cc \
test/gmock-generated-matchers_test.cc \
test/gmock-internal-utils_test.cc \
test/gmock-matchers_test.cc \
@@ -141,7 +139,6 @@ EXTRA_DIST += \
include/gmock/gmock-generated-actions.h.pump \
include/gmock/gmock-generated-function-mockers.h.pump \
include/gmock/gmock-generated-matchers.h.pump \
- include/gmock/internal/gmock-generated-internal-utils.h.pump \
include/gmock/internal/custom/gmock-generated-actions.h.pump
# Script for fusing Google Mock and Google Test source files.
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h
index 2814125..2f936a1 100644
--- a/googlemock/include/gmock/gmock-actions.h
+++ b/googlemock/include/gmock/gmock-actions.h
@@ -817,69 +817,47 @@ class SetArgumentPointeeAction<N, Proto, true> {
GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction);
};
+// Implements the Invoke(object_ptr, &Class::Method) action.
+template <class Class, typename MethodPtr>
+struct InvokeMethodAction {
+ Class* const obj_ptr;
+ const MethodPtr method_ptr;
+
+ template <typename... Args>
+ auto operator()(Args&&... args) const
+ -> decltype((obj_ptr->*method_ptr)(std::forward<Args>(args)...)) {
+ return (obj_ptr->*method_ptr)(std::forward<Args>(args)...);
+ }
+};
+
// Implements the InvokeWithoutArgs(f) action. The template argument
// FunctionImpl is the implementation type of f, which can be either a
// function pointer or a functor. InvokeWithoutArgs(f) can be used as an
-// Action<F> as long as f's type is compatible with F (i.e. f can be
-// assigned to a tr1::function<F>).
+// Action<F> as long as f's type is compatible with F.
template <typename FunctionImpl>
-class InvokeWithoutArgsAction {
- public:
- // The c'tor makes a copy of function_impl (either a function
- // pointer or a functor).
- explicit InvokeWithoutArgsAction(FunctionImpl function_impl)
- : function_impl_(function_impl) {}
+struct InvokeWithoutArgsAction {
+ FunctionImpl function_impl;
// Allows InvokeWithoutArgs(f) to be used as any action whose type is
// compatible with f.
- template <typename Result, typename ArgumentTuple>
- Result Perform(const ArgumentTuple&) { return function_impl_(); }
-
- private:
- FunctionImpl function_impl_;
-
- GTEST_DISALLOW_ASSIGN_(InvokeWithoutArgsAction);
+ template <typename... Args>
+ auto operator()(const Args&...) -> decltype(function_impl()) {
+ return function_impl();
+ }
};
// Implements the InvokeWithoutArgs(object_ptr, &Class::Method) action.
template <class Class, typename MethodPtr>
-class InvokeMethodWithoutArgsAction {
- public:
- InvokeMethodWithoutArgsAction(Class* obj_ptr, MethodPtr method_ptr)
- : obj_ptr_(obj_ptr), method_ptr_(method_ptr) {}
+struct InvokeMethodWithoutArgsAction {
+ Class* const obj_ptr;
+ const MethodPtr method_ptr;
- template <typename Result, typename ArgumentTuple>
- Result Perform(const ArgumentTuple&) const {
- return (obj_ptr_->*method_ptr_)();
- }
-
- private:
- Class* const obj_ptr_;
- const MethodPtr method_ptr_;
-
- GTEST_DISALLOW_ASSIGN_(InvokeMethodWithoutArgsAction);
-};
+ using ReturnType = typename std::result_of<MethodPtr(Class*)>::type;
-// Implements the InvokeWithoutArgs(callback) action.
-template <typename CallbackType>
-class InvokeCallbackWithoutArgsAction {
- public:
- // The c'tor takes ownership of the callback.
- explicit InvokeCallbackWithoutArgsAction(CallbackType* callback)
- : callback_(callback) {
- callback->CheckIsRepeatable(); // Makes sure the callback is permanent.
+ template <typename... Args>
+ ReturnType operator()(const Args&...) const {
+ return (obj_ptr->*method_ptr)();
}
-
- // This type conversion operator template allows Invoke(callback) to
- // be used wherever the callback's return type can be implicitly
- // converted to that of the mock function.
- template <typename Result, typename ArgumentTuple>
- Result Perform(const ArgumentTuple&) const { return callback_->Run(); }
-
- private:
- const std::shared_ptr<CallbackType> callback_;
-
- GTEST_DISALLOW_ASSIGN_(InvokeCallbackWithoutArgsAction);
};
// Implements the IgnoreResult(action) action.
@@ -936,33 +914,6 @@ class IgnoreResultAction {
GTEST_DISALLOW_ASSIGN_(IgnoreResultAction);
};
-// A ReferenceWrapper<T> object represents a reference to type T,
-// which can be either const or not. It can be explicitly converted
-// from, and implicitly converted to, a T&. Unlike a reference,
-// ReferenceWrapper<T> can be copied and can survive template type
-// inference. This is used to support by-reference arguments in the
-// InvokeArgument<N>(...) action. The idea was from "reference
-// wrappers" in tr1, which we don't have in our source tree yet.
-template <typename T>
-class ReferenceWrapper {
- public:
- // Constructs a ReferenceWrapper<T> object from a T&.
- explicit ReferenceWrapper(T& l_value) : pointer_(&l_value) {} // NOLINT
-
- // Allows a ReferenceWrapper<T> object to be implicitly converted to
- // a T&.
- operator T&() const { return *pointer_; }
- private:
- T* pointer_;
-};
-
-// Allows the expression ByRef(x) to be printed as a reference to x.
-template <typename T>
-void PrintTo(const ReferenceWrapper<T>& ref, ::std::ostream* os) {
- T& value = ref;
- UniversalPrinter<T&>::Print(value, os);
-}
-
template <typename InnerAction, size_t... I>
struct WithArgsAction {
InnerAction action;
@@ -1184,24 +1135,38 @@ SetErrnoAndReturn(int errval, T result) {
#endif // !GTEST_OS_WINDOWS_MOBILE
-// Various overloads for InvokeWithoutArgs().
+// Various overloads for Invoke().
+
+// Legacy function.
+// Actions can now be implicitly constructed from callables. No need to create
+// wrapper objects.
+// This function exists for backwards compatibility.
+template <typename FunctionImpl>
+typename std::decay<FunctionImpl>::type Invoke(FunctionImpl&& function_impl) {
+ return std::forward<FunctionImpl>(function_impl);
+}
+
+// Creates an action that invokes the given method on the given object
+// with the mock function's arguments.
+template <class Class, typename MethodPtr>
+internal::InvokeMethodAction<Class, MethodPtr> Invoke(Class* obj_ptr,
+ MethodPtr method_ptr) {
+ return {obj_ptr, method_ptr};
+}
// Creates an action that invokes 'function_impl' with no argument.
template <typename FunctionImpl>
-PolymorphicAction<internal::InvokeWithoutArgsAction<FunctionImpl> >
+internal::InvokeWithoutArgsAction<typename std::decay<FunctionImpl>::type>
InvokeWithoutArgs(FunctionImpl function_impl) {
- return MakePolymorphicAction(
- internal::InvokeWithoutArgsAction<FunctionImpl>(function_impl));
+ return {std::move(function_impl)};
}
// Creates an action that invokes the given method on the given object
// with no argument.
template <class Class, typename MethodPtr>
-PolymorphicAction<internal::InvokeMethodWithoutArgsAction<Class, MethodPtr> >
-InvokeWithoutArgs(Class* obj_ptr, MethodPtr method_ptr) {
- return MakePolymorphicAction(
- internal::InvokeMethodWithoutArgsAction<Class, MethodPtr>(
- obj_ptr, method_ptr));
+internal::InvokeMethodWithoutArgsAction<Class, MethodPtr> InvokeWithoutArgs(
+ Class* obj_ptr, MethodPtr method_ptr) {
+ return {obj_ptr, method_ptr};
}
// Creates an action that performs an_action and throws away its
@@ -1219,9 +1184,12 @@ inline internal::IgnoreResultAction<A> IgnoreResult(const A& an_action) {
// where Base is a base class of Derived, just write:
//
// ByRef<const Base>(derived)
+//
+// N.B. ByRef is redundant with std::ref, std::cref and std::reference_wrapper.
+// However, it may still be used for consistency with ByMove().
template <typename T>
-inline internal::ReferenceWrapper<T> ByRef(T& l_value) { // NOLINT
- return internal::ReferenceWrapper<T>(l_value);
+inline ::std::reference_wrapper<T> ByRef(T& l_value) { // NOLINT
+ return ::std::reference_wrapper<T>(l_value);
}
} // namespace testing
diff --git a/googlemock/include/gmock/gmock-generated-actions.h b/googlemock/include/gmock/gmock-generated-actions.h
index 910436e..3264bca 100644
--- a/googlemock/include/gmock/gmock-generated-actions.h
+++ b/googlemock/include/gmock/gmock-generated-actions.h
@@ -50,308 +50,6 @@
namespace testing {
namespace internal {
-// InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
-// function, method, or callback with the unpacked values, where F is
-// a function type that takes N arguments.
-template <typename Result, typename ArgumentTuple>
-class InvokeHelper;
-
-template <typename R>
-class InvokeHelper<R, ::std::tuple<> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tuple<>&) {
- return function();
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tuple<>&) {
- return (obj_ptr->*method_ptr)();
- }
-
- template <typename CallbackType>
- static R InvokeCallback(CallbackType* callback,
- const ::std::tuple<>&) {
- return callback->Run();
- }
-};
-
-template <typename R, typename A1>
-class InvokeHelper<R, ::std::tuple<A1> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tuple<A1>& args) {
- return function(std::get<0>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tuple<A1>& args) {
- return (obj_ptr->*method_ptr)(std::get<0>(args));
- }
-
- template <typename CallbackType>
- static R InvokeCallback(CallbackType* callback,
- const ::std::tuple<A1>& args) {
- return callback->Run(std::get<0>(args));
- }
-};
-
-template <typename R, typename A1, typename A2>
-class InvokeHelper<R, ::std::tuple<A1, A2> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tuple<A1, A2>& args) {
- return function(std::get<0>(args), std::get<1>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tuple<A1, A2>& args) {
- return (obj_ptr->*method_ptr)(std::get<0>(args), std::get<1>(args));
- }
-
- template <typename CallbackType>
- static R InvokeCallback(CallbackType* callback,
- const ::std::tuple<A1, A2>& args) {
- return callback->Run(std::get<0>(args), std::get<1>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3>
-class InvokeHelper<R, ::std::tuple<A1, A2, A3> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tuple<A1, A2, A3>& args) {
- return function(std::get<0>(args), std::get<1>(args),
- std::get<2>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tuple<A1, A2, A3>& args) {
- return (obj_ptr->*method_ptr)(std::get<0>(args), std::get<1>(args),
- std::get<2>(args));
- }
-
- template <typename CallbackType>
- static R InvokeCallback(CallbackType* callback,
- const ::std::tuple<A1, A2, A3>& args) {
- return callback->Run(std::get<0>(args), std::get<1>(args),
- std::get<2>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4>
-class InvokeHelper<R, ::std::tuple<A1, A2, A3, A4> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tuple<A1, A2, A3, A4>& args) {
- return function(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tuple<A1, A2, A3, A4>& args) {
- return (obj_ptr->*method_ptr)(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args));
- }
-
- template <typename CallbackType>
- static R InvokeCallback(CallbackType* callback,
- const ::std::tuple<A1, A2, A3, A4>& args) {
- return callback->Run(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5>
-class InvokeHelper<R, ::std::tuple<A1, A2, A3, A4, A5> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tuple<A1, A2, A3, A4,
- A5>& args) {
- return function(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args), std::get<4>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tuple<A1, A2, A3, A4, A5>& args) {
- return (obj_ptr->*method_ptr)(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args), std::get<4>(args));
- }
-
- template <typename CallbackType>
- static R InvokeCallback(CallbackType* callback,
- const ::std::tuple<A1, A2, A3, A4, A5>& args) {
- return callback->Run(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args), std::get<4>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6>
-class InvokeHelper<R, ::std::tuple<A1, A2, A3, A4, A5, A6> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tuple<A1, A2, A3, A4, A5,
- A6>& args) {
- return function(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args), std::get<4>(args),
- std::get<5>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tuple<A1, A2, A3, A4, A5, A6>& args) {
- return (obj_ptr->*method_ptr)(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args), std::get<4>(args),
- std::get<5>(args));
- }
-
- // There is no InvokeCallback() for 6-tuples
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7>
-class InvokeHelper<R, ::std::tuple<A1, A2, A3, A4, A5, A6, A7> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tuple<A1, A2, A3, A4, A5, A6,
- A7>& args) {
- return function(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args), std::get<4>(args),
- std::get<5>(args), std::get<6>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tuple<A1, A2, A3, A4, A5, A6, A7>& args) {
- return (obj_ptr->*method_ptr)(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args), std::get<4>(args),
- std::get<5>(args), std::get<6>(args));
- }
-
- // There is no InvokeCallback() for 7-tuples
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8>
-class InvokeHelper<R, ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tuple<A1, A2, A3, A4, A5, A6,
- A7, A8>& args) {
- return function(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args), std::get<4>(args),
- std::get<5>(args), std::get<6>(args), std::get<7>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tuple<A1, A2, A3, A4, A5, A6, A7,
- A8>& args) {
- return (obj_ptr->*method_ptr)(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args), std::get<4>(args),
- std::get<5>(args), std::get<6>(args), std::get<7>(args));
- }
-
- // There is no InvokeCallback() for 8-tuples
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9>
-class InvokeHelper<R, ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tuple<A1, A2, A3, A4, A5, A6,
- A7, A8, A9>& args) {
- return function(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args), std::get<4>(args),
- std::get<5>(args), std::get<6>(args), std::get<7>(args),
- std::get<8>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
- A9>& args) {
- return (obj_ptr->*method_ptr)(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args), std::get<4>(args),
- std::get<5>(args), std::get<6>(args), std::get<7>(args),
- std::get<8>(args));
- }
-
- // There is no InvokeCallback() for 9-tuples
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9,
- typename A10>
-class InvokeHelper<R, ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tuple<A1, A2, A3, A4, A5, A6,
- A7, A8, A9, A10>& args) {
- return function(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args), std::get<4>(args),
- std::get<5>(args), std::get<6>(args), std::get<7>(args),
- std::get<8>(args), std::get<9>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
- A10>& args) {
- return (obj_ptr->*method_ptr)(std::get<0>(args), std::get<1>(args),
- std::get<2>(args), std::get<3>(args), std::get<4>(args),
- std::get<5>(args), std::get<6>(args), std::get<7>(args),
- std::get<8>(args), std::get<9>(args));
- }
-
- // There is no InvokeCallback() for 10-tuples
-};
-
-// Implements the Invoke(callback) action.
-template <typename CallbackType>
-class InvokeCallbackAction {
- public:
- // The c'tor takes ownership of the callback.
- explicit InvokeCallbackAction(CallbackType* callback)
- : callback_(callback) {
- callback->CheckIsRepeatable(); // Makes sure the callback is permanent.
- }
-
- // This type conversion operator template allows Invoke(callback) to
- // be used wherever the callback's type is compatible with that of
- // the mock function, i.e. if the mock function's arguments can be
- // implicitly converted to the callback's arguments and the
- // callback's result can be implicitly converted to the mock
- // function's result.
- template <typename Result, typename ArgumentTuple>
- Result Perform(const ArgumentTuple& args) const {
- return InvokeHelper<Result, ArgumentTuple>::InvokeCallback(
- callback_.get(), args);
- }
- private:
- const std::shared_ptr<CallbackType> callback_;
-};
-
// A macro from the ACTION* family (defined later in this file)
// defines an action that can be used in a mock function. Typically,
// these actions only care about a subset of the arguments of the mock
diff --git a/googlemock/include/gmock/gmock-generated-actions.h.pump b/googlemock/include/gmock/gmock-generated-actions.h.pump
index 27c96ef..1e9549f 100644
--- a/googlemock/include/gmock/gmock-generated-actions.h.pump
+++ b/googlemock/include/gmock/gmock-generated-actions.h.pump
@@ -52,76 +52,6 @@ $$}} This meta comment fixes auto-indentation in editors.
namespace testing {
namespace internal {
-// InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
-// function, method, or callback with the unpacked values, where F is
-// a function type that takes N arguments.
-template <typename Result, typename ArgumentTuple>
-class InvokeHelper;
-
-
-$var max_callback_arity = 5
-$range i 0..n
-$for i [[
-$range j 1..i
-$var types = [[$for j [[, typename A$j]]]]
-$var as = [[$for j, [[A$j]]]]
-$var args = [[$if i==0 [[]] $else [[ args]]]]
-$var gets = [[$for j, [[std::get<$(j - 1)>(args)]]]]
-template <typename R$types>
-class InvokeHelper<R, ::std::tuple<$as> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tuple<$as>&$args) {
- return function($gets);
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tuple<$as>&$args) {
- return (obj_ptr->*method_ptr)($gets);
- }
-
-
-$if i <= max_callback_arity [[
- template <typename CallbackType>
- static R InvokeCallback(CallbackType* callback,
- const ::std::tuple<$as>&$args) {
- return callback->Run($gets);
- }
-]] $else [[
- // There is no InvokeCallback() for $i-tuples
-]]
-
-};
-
-
-]]
-// Implements the Invoke(callback) action.
-template <typename CallbackType>
-class InvokeCallbackAction {
- public:
- // The c'tor takes ownership of the callback.
- explicit InvokeCallbackAction(CallbackType* callback)
- : callback_(callback) {
- callback->CheckIsRepeatable(); // Makes sure the callback is permanent.
- }
-
- // This type conversion operator template allows Invoke(callback) to
- // be used wherever the callback's type is compatible with that of
- // the mock function, i.e. if the mock function's arguments can be
- // implicitly converted to the callback's arguments and the
- // callback's result can be implicitly converted to the mock
- // function's result.
- template <typename Result, typename ArgumentTuple>
- Result Perform(const ArgumentTuple& args) const {
- return InvokeHelper<Result, ArgumentTuple>::InvokeCallback(
- callback_.get(), args);
- }
- private:
- const std::shared_ptr<CallbackType> callback_;
-};
-
// A macro from the ACTION* family (defined later in this file)
// defines an action that can be used in a mock function. Typically,
// these actions only care about a subset of the arguments of the mock
diff --git a/googlemock/include/gmock/gmock-generated-function-mockers.h b/googlemock/include/gmock/gmock-generated-function-mockers.h
index 5229cc1..cd95781 100644
--- a/googlemock/include/gmock/gmock-generated-function-mockers.h
+++ b/googlemock/include/gmock/gmock-generated-function-mockers.h
@@ -121,7 +121,7 @@ using internal::FunctionMocker;
// The type of argument N of the given function type.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_ARG_(tn, N, ...) \
- tn ::testing::internal::Function<__VA_ARGS__>::Argument##N
+ tn ::testing::internal::Function<__VA_ARGS__>::template Arg<N-1>::type
// The matcher type for argument N of the given function type.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
@@ -135,12 +135,11 @@ using internal::FunctionMocker;
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \
+ static_assert(0 == \
+ ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
+ "MOCK_METHOD<N> must match argument count.");\
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
) constness { \
- GTEST_COMPILE_ASSERT_((::std::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 0), \
- this_method_does_not_take_0_arguments); \
GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(0, constness, Method).Invoke(); \
} \
@@ -160,12 +159,11 @@ using internal::FunctionMocker;
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \
+ static_assert(1 == \
+ ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
+ "MOCK_METHOD<N> must match argument count.");\
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
- GTEST_COMPILE_ASSERT_((::std::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 1), \
- this_method_does_not_take_1_argument); \
GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(1, constness, \
Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \
@@ -187,13 +185,12 @@ using internal::FunctionMocker;
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \
+ static_assert(2 == \
+ ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
+ "MOCK_METHOD<N> must match argument count.");\
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
__VA_ARGS__) gmock_a2) constness { \
- GTEST_COMPILE_ASSERT_((::std::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 2), \
- this_method_does_not_take_2_arguments); \
GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(2, constness, \
Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \
@@ -218,14 +215,13 @@ using internal::FunctionMocker;
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \
+ static_assert(3 == \
+ ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
+ "MOCK_METHOD<N> must match argument count.");\
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
__VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, \
__VA_ARGS__) gmock_a3) constness { \
- GTEST_COMPILE_ASSERT_((::std::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 3), \
- this_method_does_not_take_3_arguments); \
GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(3, constness, \
Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \
@@ -254,14 +250,13 @@ using internal::FunctionMocker;
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \
+ static_assert(4 == \
+ ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
+ "MOCK_METHOD<N> must match argument count.");\
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
__VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
- GTEST_COMPILE_ASSERT_((::std::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 4), \
- this_method_does_not_take_4_arguments); \
GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(4, constness, \
Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \
@@ -293,15 +288,14 @@ using internal::FunctionMocker;
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \
+ static_assert(5 == \
+ ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
+ "MOCK_METHOD<N> must match argument count.");\
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
__VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \
__VA_ARGS__) gmock_a5) constness { \
- GTEST_COMPILE_ASSERT_((::std::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 5), \
- this_method_does_not_take_5_arguments); \
GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(5, constness, \
Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \
@@ -336,16 +330,15 @@ using internal::FunctionMocker;
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \
+ static_assert(6 == \
+ ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
+ "MOCK_METHOD<N> must match argument count.");\
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
__VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \
__VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, \
__VA_ARGS__) gmock_a6) constness { \
- GTEST_COMPILE_ASSERT_((::std::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 6), \
- this_method_does_not_take_6_arguments); \
GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(6, constness, \
Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \
@@ -383,16 +376,15 @@ using internal::FunctionMocker;
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \
+ static_assert(7 == \
+ ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
+ "MOCK_METHOD<N> must match argument count.");\
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
__VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \
__VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
- GTEST_COMPILE_ASSERT_((::std::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 7), \
- this_method_does_not_take_7_arguments); \
GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(7, constness, \
Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \
@@ -433,6 +425,9 @@ using internal::FunctionMocker;
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \
+ static_assert(8 == \
+ ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
+ "MOCK_METHOD<N> must match argument count.");\
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
__VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
@@ -440,10 +435,6 @@ using internal::FunctionMocker;
__VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(tn, 8, \
__VA_ARGS__) gmock_a8) constness { \
- GTEST_COMPILE_ASSERT_((::std::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 8), \
- this_method_does_not_take_8_arguments); \
GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(8, constness, \
Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \
@@ -487,6 +478,9 @@ using internal::FunctionMocker;
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \
+ static_assert(9 == \
+ ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
+ "MOCK_METHOD<N> must match argument count.");\
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
__VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
@@ -495,10 +489,6 @@ using internal::FunctionMocker;
GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(tn, 8, \
__VA_ARGS__) gmock_a8, GMOCK_ARG_(tn, 9, \
__VA_ARGS__) gmock_a9) constness { \
- GTEST_COMPILE_ASSERT_((::std::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 9), \
- this_method_does_not_take_9_arguments); \
GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(9, constness, \
Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \
@@ -546,6 +536,9 @@ using internal::FunctionMocker;
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \
+ static_assert(10 == \
+ ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
+ "MOCK_METHOD<N> must match argument count.");\
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
__VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
@@ -554,10 +547,6 @@ using internal::FunctionMocker;
GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(tn, 8, \
__VA_ARGS__) gmock_a8, GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9, \
GMOCK_ARG_(tn, 10, __VA_ARGS__) gmock_a10) constness { \
- GTEST_COMPILE_ASSERT_((::std::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 10), \
- this_method_does_not_take_10_arguments); \
GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(10, constness, \
Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \
diff --git a/googlemock/include/gmock/gmock-generated-function-mockers.h.pump b/googlemock/include/gmock/gmock-generated-function-mockers.h.pump
index a5ec738..a56e132 100644
--- a/googlemock/include/gmock/gmock-generated-function-mockers.h.pump
+++ b/googlemock/include/gmock/gmock-generated-function-mockers.h.pump
@@ -124,7 +124,7 @@ using internal::FunctionMocker;
// The type of argument N of the given function type.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_ARG_(tn, N, ...) \
- tn ::testing::internal::Function<__VA_ARGS__>::Argument##N
+ tn ::testing::internal::Function<__VA_ARGS__>::template Arg<N-1>::type
// The matcher type for argument N of the given function type.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
@@ -149,11 +149,9 @@ $var anything_matchers = [[$for j, \
[[::testing::A<GMOCK_ARG_(tn, $j, __VA_ARGS__)>()]]]]
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, ...) \
+ static_assert($i == ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, "MOCK_METHOD<N> must match argument count.");\
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
$arg_as) constness { \
- GTEST_COMPILE_ASSERT_((::std::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value == $i), \
- this_method_does_not_take_$i[[]]_argument[[$if i != 1 [[s]]]]); \
GMOCK_MOCKER_($i, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_($i, constness, Method).Invoke($as); \
} \
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index b99fdc3..fa24fd2 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -128,9 +128,9 @@ class MatcherCastImpl {
return CastImpl(
polymorphic_matcher_or_value,
BooleanConstant<
- internal::ImplicitlyConvertible<M, Matcher<T> >::value>(),
+ std::is_convertible<M, Matcher<T> >::value>(),
BooleanConstant<
- internal::ImplicitlyConvertible<M, T>::value>());
+ std::is_convertible<M, T>::value>());
}
private:
@@ -268,8 +268,8 @@ class SafeMatcherCastImpl {
template <typename U>
static inline Matcher<T> Cast(const Matcher<U>& matcher) {
// Enforce that T can be implicitly converted to U.
- GTEST_COMPILE_ASSERT_((internal::ImplicitlyConvertible<T, U>::value),
- T_must_be_implicitly_convertible_to_U);
+ GTEST_COMPILE_ASSERT_((std::is_convertible<T, U>::value),
+ "T must be implicitly convertible to U");
// Enforce that we are not converting a non-reference type T to a reference
// type U.
GTEST_COMPILE_ASSERT_(
@@ -900,7 +900,7 @@ class PairMatchBase {
public:
template <typename T1, typename T2>
operator Matcher<::std::tuple<T1, T2>>() const {
- return MakeMatcher(new Impl<::std::tuple<T1, T2>>);
+ return Matcher<::std::tuple<T1, T2>>(new Impl<const ::std::tuple<T1, T2>&>);
}
template <typename T1, typename T2>
operator Matcher<const ::std::tuple<T1, T2>&>() const {
@@ -1175,6 +1175,37 @@ class AnyOfMatcherImpl : public MatcherInterface<const T&> {
template <typename... Args>
using AnyOfMatcher = VariadicMatcher<AnyOfMatcherImpl, Args...>;
+// Wrapper for implementation of Any/AllOfArray().
+template <template <class> class MatcherImpl, typename T>
+class SomeOfArrayMatcher {
+ public:
+ // Constructs the matcher from a sequence of element values or
+ // element matchers.
+ template <typename Iter>
+ SomeOfArrayMatcher(Iter first, Iter last) : matchers_(first, last) {}
+
+ template <typename U>
+ operator Matcher<U>() const { // NOLINT
+ using RawU = typename std::decay<U>::type;
+ std::vector<Matcher<RawU>> matchers;
+ for (const auto& matcher : matchers_) {
+ matchers.push_back(MatcherCast<RawU>(matcher));
+ }
+ return Matcher<U>(new MatcherImpl<RawU>(std::move(matchers)));
+ }
+
+ private:
+ const ::std::vector<T> matchers_;
+
+ GTEST_DISALLOW_ASSIGN_(SomeOfArrayMatcher);
+};
+
+template <typename T>
+using AllOfArrayMatcher = SomeOfArrayMatcher<AllOfMatcherImpl, T>;
+
+template <typename T>
+using AnyOfArrayMatcher = SomeOfArrayMatcher<AnyOfMatcherImpl, T>;
+
// Used for implementing Truly(pred), which turns a predicate into a
// matcher.
template <typename Predicate>
@@ -2535,7 +2566,8 @@ class KeyMatcher {
template <typename PairType>
operator Matcher<PairType>() const {
- return MakeMatcher(new KeyMatcherImpl<PairType>(matcher_for_key_));
+ return Matcher<PairType>(
+ new KeyMatcherImpl<const PairType&>(matcher_for_key_));
}
private:
@@ -2640,9 +2672,8 @@ class PairMatcher {
template <typename PairType>
operator Matcher<PairType> () const {
- return MakeMatcher(
- new PairMatcherImpl<PairType>(
- first_matcher_, second_matcher_));
+ return Matcher<PairType>(
+ new PairMatcherImpl<const PairType&>(first_matcher_, second_matcher_));
}
private:
@@ -3205,7 +3236,7 @@ class OptionalMatcher {
template <typename Optional>
operator Matcher<Optional>() const {
- return MakeMatcher(new Impl<Optional>(value_matcher_));
+ return Matcher<Optional>(new Impl<const Optional&>(value_matcher_));
}
template <typename Optional>
@@ -4376,6 +4407,88 @@ internal::AnyOfMatcher<typename std::decay<const Args&>::type...> AnyOf(
matchers...);
}
+// AnyOfArray(array)
+// AnyOfArray(pointer, count)
+// AnyOfArray(container)
+// AnyOfArray({ e1, e2, ..., en })
+// AnyOfArray(iterator_first, iterator_last)
+//
+// AnyOfArray() verifies whether a given value matches any member of a
+// collection of matchers.
+//
+// AllOfArray(array)
+// AllOfArray(pointer, count)
+// AllOfArray(container)
+// AllOfArray({ e1, e2, ..., en })
+// AllOfArray(iterator_first, iterator_last)
+//
+// AllOfArray() verifies whether a given value matches all members of a
+// collection of matchers.
+//
+// The matchers can be specified as an array, a pointer and count, a container,
+// an initializer list, or an STL iterator range. In each of these cases, the
+// underlying matchers can be either values or matchers.
+
+template <typename Iter>
+inline internal::AnyOfArrayMatcher<
+ typename ::std::iterator_traits<Iter>::value_type>
+AnyOfArray(Iter first, Iter last) {
+ return internal::AnyOfArrayMatcher<
+ typename ::std::iterator_traits<Iter>::value_type>(first, last);
+}
+
+template <typename Iter>
+inline internal::AllOfArrayMatcher<
+ typename ::std::iterator_traits<Iter>::value_type>
+AllOfArray(Iter first, Iter last) {
+ return internal::AllOfArrayMatcher<
+ typename ::std::iterator_traits<Iter>::value_type>(first, last);
+}
+
+template <typename T>
+inline internal::AnyOfArrayMatcher<T> AnyOfArray(const T* ptr, size_t count) {
+ return AnyOfArray(ptr, ptr + count);
+}
+
+template <typename T>
+inline internal::AllOfArrayMatcher<T> AllOfArray(const T* ptr, size_t count) {
+ return AllOfArray(ptr, ptr + count);
+}
+
+template <typename T, size_t N>
+inline internal::AnyOfArrayMatcher<T> AnyOfArray(const T (&array)[N]) {
+ return AnyOfArray(array, N);
+}
+
+template <typename T, size_t N>
+inline internal::AllOfArrayMatcher<T> AllOfArray(const T (&array)[N]) {
+ return AllOfArray(array, N);
+}
+
+template <typename Container>
+inline internal::AnyOfArrayMatcher<typename Container::value_type> AnyOfArray(
+ const Container& container) {
+ return AnyOfArray(container.begin(), container.end());
+}
+
+template <typename Container>
+inline internal::AllOfArrayMatcher<typename Container::value_type> AllOfArray(
+ const Container& container) {
+ return AllOfArray(container.begin(), container.end());
+}
+
+template <typename T>
+inline internal::AnyOfArrayMatcher<T> AnyOfArray(
+ ::std::initializer_list<T> xs) {
+ return AnyOfArray(xs.begin(), xs.end());
+}
+
+template <typename T>
+inline internal::AllOfArrayMatcher<T> AllOfArray(
+ ::std::initializer_list<T> xs) {
+ return AllOfArray(xs.begin(), xs.end());
+}
+
// Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected
// fields of it matches a_matcher. C++ doesn't support default
// arguments for function templates, so we have to overload it.
diff --git a/googlemock/include/gmock/gmock-more-actions.h b/googlemock/include/gmock/gmock-more-actions.h
index 1098408..a052495 100644
--- a/googlemock/include/gmock/gmock-more-actions.h
+++ b/googlemock/include/gmock/gmock-more-actions.h
@@ -38,59 +38,13 @@
#define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
#include <algorithm>
+#include <type_traits>
#include "gmock/gmock-generated-actions.h"
namespace testing {
namespace internal {
-// Implements the Invoke(f) action. The template argument
-// FunctionImpl is the implementation type of f, which can be either a
-// function pointer or a functor. Invoke(f) can be used as an
-// Action<F> as long as f's type is compatible with F (i.e. f can be
-// assigned to a tr1::function<F>).
-template <typename FunctionImpl>
-class InvokeAction {
- public:
- // The c'tor makes a copy of function_impl (either a function
- // pointer or a functor).
- explicit InvokeAction(FunctionImpl function_impl)
- : function_impl_(function_impl) {}
-
- template <typename Result, typename ArgumentTuple>
- Result Perform(const ArgumentTuple& args) {
- return InvokeHelper<Result, ArgumentTuple>::Invoke(function_impl_, args);
- }
-
- private:
- FunctionImpl function_impl_;
-
- GTEST_DISALLOW_ASSIGN_(InvokeAction);
-};
-
-// Implements the Invoke(object_ptr, &Class::Method) action.
-template <class Class, typename MethodPtr>
-class InvokeMethodAction {
- public:
- InvokeMethodAction(Class* obj_ptr, MethodPtr method_ptr)
- : method_ptr_(method_ptr), obj_ptr_(obj_ptr) {}
-
- template <typename Result, typename ArgumentTuple>
- Result Perform(const ArgumentTuple& args) const {
- return InvokeHelper<Result, ArgumentTuple>::InvokeMethod(
- obj_ptr_, method_ptr_, args);
- }
-
- private:
- // The order of these members matters. Reversing the order can trigger
- // warning C4121 in MSVC (see
- // http://computer-programming-forum.com/7-vc.net/6fbc30265f860ad1.htm ).
- const MethodPtr method_ptr_;
- Class* const obj_ptr_;
-
- GTEST_DISALLOW_ASSIGN_(InvokeMethodAction);
-};
-
// An internal replacement for std::copy which mimics its behavior. This is
// necessary because Visual Studio deprecates ::std::copy, issuing warning 4996.
// However Visual Studio 2010 and later do not honor #pragmas which disable that
@@ -109,24 +63,6 @@ inline OutputIterator CopyElements(InputIterator first,
// Various overloads for Invoke().
-// Creates an action that invokes 'function_impl' with the mock
-// function's arguments.
-template <typename FunctionImpl>
-PolymorphicAction<internal::InvokeAction<FunctionImpl> > Invoke(
- FunctionImpl function_impl) {
- return MakePolymorphicAction(
- internal::InvokeAction<FunctionImpl>(function_impl));
-}
-
-// Creates an action that invokes the given method on the given object
-// with the mock function's arguments.
-template <class Class, typename MethodPtr>
-PolymorphicAction<internal::InvokeMethodAction<Class, MethodPtr> > Invoke(
- Class* obj_ptr, MethodPtr method_ptr) {
- return MakePolymorphicAction(
- internal::InvokeMethodAction<Class, MethodPtr>(obj_ptr, method_ptr));
-}
-
// 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
diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h
index 526fe7a..1f261bd 100644
--- a/googlemock/include/gmock/gmock-spec-builders.h
+++ b/googlemock/include/gmock/gmock-spec-builders.h
@@ -300,7 +300,10 @@ class OnCallSpec : public UntypedOnCallSpecBase {
const ArgumentMatcherTuple& matchers)
: UntypedOnCallSpecBase(a_file, a_line),
matchers_(matchers),
- extra_matcher_(_) {}
+ // By default, extra_matcher_ should match anything. However,
+ // we cannot initialize it with _ as that causes ambiguity between
+ // Matcher's copy and move constructor for some argument types.
+ extra_matcher_(A<const ArgumentTuple&>()) {}
// Implements the .With() clause.
OnCallSpec& With(const Matcher<const ArgumentTuple&>& m) {
@@ -890,7 +893,10 @@ class TypedExpectation : public ExpectationBase {
: ExpectationBase(a_file, a_line, a_source_text),
owner_(owner),
matchers_(m),
- extra_matcher_(_),
+ // By default, extra_matcher_ should match anything. However,
+ // we cannot initialize it with _ as that causes ambiguity between
+ // Matcher's copy and move constructor for some argument types.
+ extra_matcher_(A<const ArgumentTuple&>()),
repeated_action_(DoDefault()) {}
~TypedExpectation() override {
@@ -1447,7 +1453,7 @@ template <typename F>
class FunctionMocker;
template <typename R, typename... Args>
-class FunctionMocker<R(Args...)> : public UntypedFunctionMockerBase {
+class FunctionMocker<R(Args...)> final : public UntypedFunctionMockerBase {
using F = R(Args...);
public:
diff --git a/googlemock/include/gmock/gmock.h b/googlemock/include/gmock/gmock.h
index 69ac0c1..7096984 100644
--- a/googlemock/include/gmock/gmock.h
+++ b/googlemock/include/gmock/gmock.h
@@ -92,21 +92,9 @@ GTEST_API_ void InitGoogleMock(int* argc, char** argv);
// UNICODE mode.
GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv);
-#ifdef ARDUINO
-inline void gmock_setup() {
- // Since Arduino doesn't have a command line, fake out the argc/argv arguments
- int argc = 1;
- const auto arg0 = "PlatformIO";
- char* argv0 = const_cast<char*>(arg0);
- char** argv = &argv0;
-
- // Since Google Mock depends on Google Test, InitGoogleMock() is
- // also responsible for initializing Google Test. Therefore there's
- // no need for calling testing::InitGoogleTest() separately.
- testing::InitGoogleMock(&argc, argv);
-}
-inline void gmock_loop() { RUN_ALL_TESTS(); }
-#endif
+// This overloaded version can be used on Arduino/embedded platforms where
+// there is no argc/argv.
+GTEST_API_ void InitGoogleMock();
} // namespace testing
diff --git a/googlemock/include/gmock/internal/gmock-generated-internal-utils.h b/googlemock/include/gmock/internal/gmock-generated-internal-utils.h
deleted file mode 100644
index eb85e26..0000000
--- a/googlemock/include/gmock/internal/gmock-generated-internal-utils.h
+++ /dev/null
@@ -1,266 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gmock-generated-internal-utils.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file contains template meta-programming utility classes needed
-// for implementing Google Mock.
-
-// GOOGLETEST_CM0002 DO NOT DELETE
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
-
-#include "gmock/internal/gmock-port.h"
-#include "gtest/gtest.h"
-
-namespace testing {
-
-template <typename T>
-class Matcher;
-
-namespace internal {
-
-// MatcherTuple<T>::type is a tuple type where each field is a Matcher
-// for the corresponding field in tuple type T.
-template <typename Tuple>
-struct MatcherTuple;
-
-template <>
-struct MatcherTuple< ::std::tuple<> > {
- typedef ::std::tuple< > type;
-};
-
-template <typename A1>
-struct MatcherTuple< ::std::tuple<A1> > {
- typedef ::std::tuple<Matcher<A1> > type;
-};
-
-template <typename A1, typename A2>
-struct MatcherTuple< ::std::tuple<A1, A2> > {
- typedef ::std::tuple<Matcher<A1>, Matcher<A2> > type;
-};
-
-template <typename A1, typename A2, typename A3>
-struct MatcherTuple< ::std::tuple<A1, A2, A3> > {
- typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4>
-struct MatcherTuple< ::std::tuple<A1, A2, A3, A4> > {
- typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>,
- Matcher<A4> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5>
-struct MatcherTuple< ::std::tuple<A1, A2, A3, A4, A5> > {
- typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6>
-struct MatcherTuple< ::std::tuple<A1, A2, A3, A4, A5, A6> > {
- typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7>
-struct MatcherTuple< ::std::tuple<A1, A2, A3, A4, A5, A6, A7> > {
- typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6>, Matcher<A7> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8>
-struct MatcherTuple< ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
- typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9>
-struct MatcherTuple< ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
- typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9, typename A10>
-struct MatcherTuple< ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> > {
- typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9>,
- Matcher<A10> > type;
-};
-
-// Template struct Function<F>, where F must be a function type, contains
-// the following typedefs:
-//
-// Result: the function's return type.
-// ArgumentN: the type of the N-th argument, where N starts with 1.
-// ArgumentTuple: the tuple type consisting of all parameters of F.
-// ArgumentMatcherTuple: the tuple type consisting of Matchers for all
-// parameters of F.
-// MakeResultVoid: the function type obtained by substituting void
-// for the return type of F.
-// MakeResultIgnoredValue:
-// the function type obtained by substituting Something
-// for the return type of F.
-template <typename F>
-struct Function;
-
-template <typename R>
-struct Function<R()> {
- typedef R Result;
- typedef ::std::tuple<> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid();
- typedef IgnoredValue MakeResultIgnoredValue();
-};
-
-template <typename R, typename A1>
-struct Function<R(A1)>
- : Function<R()> {
- typedef A1 Argument1;
- typedef ::std::tuple<A1> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1);
- typedef IgnoredValue MakeResultIgnoredValue(A1);
-};
-
-template <typename R, typename A1, typename A2>
-struct Function<R(A1, A2)>
- : Function<R(A1)> {
- typedef A2 Argument2;
- typedef ::std::tuple<A1, A2> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2);
-};
-
-template <typename R, typename A1, typename A2, typename A3>
-struct Function<R(A1, A2, A3)>
- : Function<R(A1, A2)> {
- typedef A3 Argument3;
- typedef ::std::tuple<A1, A2, A3> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4>
-struct Function<R(A1, A2, A3, A4)>
- : Function<R(A1, A2, A3)> {
- typedef A4 Argument4;
- typedef ::std::tuple<A1, A2, A3, A4> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5>
-struct Function<R(A1, A2, A3, A4, A5)>
- : Function<R(A1, A2, A3, A4)> {
- typedef A5 Argument5;
- typedef ::std::tuple<A1, A2, A3, A4, A5> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6>
-struct Function<R(A1, A2, A3, A4, A5, A6)>
- : Function<R(A1, A2, A3, A4, A5)> {
- typedef A6 Argument6;
- typedef ::std::tuple<A1, A2, A3, A4, A5, A6> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7)>
- : Function<R(A1, A2, A3, A4, A5, A6)> {
- typedef A7 Argument7;
- typedef ::std::tuple<A1, A2, A3, A4, A5, A6, A7> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8)>
- : Function<R(A1, A2, A3, A4, A5, A6, A7)> {
- typedef A8 Argument8;
- typedef ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
- : Function<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
- typedef A9 Argument9;
- typedef ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
- A9);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9,
- typename A10>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
- : Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
- typedef A10 Argument10;
- typedef ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
- A9, A10);
-};
-
-} // namespace internal
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
diff --git a/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump b/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump
deleted file mode 100644
index 6787905..0000000
--- a/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump
+++ /dev/null
@@ -1,125 +0,0 @@
-$$ -*- mode: c++; -*-
-$$ This is a Pump source file. Please use Pump to convert it to
-$$ gmock-generated-function-mockers.h.
-$$
-$var n = 10 $$ The maximum arity we support.
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file contains template meta-programming utility classes needed
-// for implementing Google Mock.
-
-// GOOGLETEST_CM0002 DO NOT DELETE
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
-
-#include "gmock/internal/gmock-port.h"
-#include "gtest/gtest.h"
-
-namespace testing {
-
-template <typename T>
-class Matcher;
-
-namespace internal {
-
-// MatcherTuple<T>::type is a tuple type where each field is a Matcher
-// for the corresponding field in tuple type T.
-template <typename Tuple>
-struct MatcherTuple;
-
-
-$range i 0..n
-$for i [[
-$range j 1..i
-$var typename_As = [[$for j, [[typename A$j]]]]
-$var As = [[$for j, [[A$j]]]]
-$var matcher_As = [[$for j, [[Matcher<A$j>]]]]
-template <$typename_As>
-struct MatcherTuple< ::std::tuple<$As> > {
- typedef ::std::tuple<$matcher_As > type;
-};
-
-
-]]
-// Template struct Function<F>, where F must be a function type, contains
-// the following typedefs:
-//
-// Result: the function's return type.
-// ArgumentN: the type of the N-th argument, where N starts with 1.
-// ArgumentTuple: the tuple type consisting of all parameters of F.
-// ArgumentMatcherTuple: the tuple type consisting of Matchers for all
-// parameters of F.
-// MakeResultVoid: the function type obtained by substituting void
-// for the return type of F.
-// MakeResultIgnoredValue:
-// the function type obtained by substituting Something
-// for the return type of F.
-template <typename F>
-struct Function;
-
-template <typename R>
-struct Function<R()> {
- typedef R Result;
- typedef ::std::tuple<> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid();
- typedef IgnoredValue MakeResultIgnoredValue();
-};
-
-
-$range i 1..n
-$for i [[
-$range j 1..i
-$var typename_As = [[$for j [[, typename A$j]]]]
-$var As = [[$for j, [[A$j]]]]
-$var matcher_As = [[$for j, [[Matcher<A$j>]]]]
-$range k 1..i-1
-$var prev_As = [[$for k, [[A$k]]]]
-template <typename R$typename_As>
-struct Function<R($As)>
- : Function<R($prev_As)> {
- typedef A$i Argument$i;
- typedef ::std::tuple<$As> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid($As);
- typedef IgnoredValue MakeResultIgnoredValue($As);
-};
-
-
-]]
-} // namespace internal
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h
index 7ebd645..093b465 100644
--- a/googlemock/include/gmock/internal/gmock-internal-utils.h
+++ b/googlemock/include/gmock/internal/gmock-internal-utils.h
@@ -42,11 +42,15 @@
#include <stdio.h>
#include <ostream> // NOLINT
#include <string>
-#include "gmock/internal/gmock-generated-internal-utils.h"
+#include <type_traits>
#include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h"
namespace testing {
+
+template <typename>
+class Matcher;
+
namespace internal {
// Silence MSVC C4100 (unreferenced formal parameter) and
@@ -525,6 +529,37 @@ auto Apply(F&& f, Tuple&& args)
make_int_pack<std::tuple_size<Tuple>::value>());
}
+// Template struct Function<F>, where F must be a function type, contains
+// the following typedefs:
+//
+// Result: the function's return type.
+// Arg<N>: the type of the N-th argument, where N starts with 0.
+// ArgumentTuple: the tuple type consisting of all parameters of F.
+// ArgumentMatcherTuple: the tuple type consisting of Matchers for all
+// parameters of F.
+// MakeResultVoid: the function type obtained by substituting void
+// for the return type of F.
+// MakeResultIgnoredValue:
+// the function type obtained by substituting Something
+// for the return type of F.
+template <typename T>
+struct Function;
+
+template <typename R, typename... Args>
+struct Function<R(Args...)> {
+ using Result = R;
+ static constexpr size_t ArgumentCount = sizeof...(Args);
+ template <size_t I>
+ using Arg = ElemFromList<I, typename MakeIndexSequence<sizeof...(Args)>::type,
+ Args...>;
+ using ArgumentTuple = std::tuple<Args...>;
+ using ArgumentMatcherTuple = std::tuple<Matcher<Args>...>;
+ using MakeResultVoid = void(Args...);
+ using MakeResultIgnoredValue = IgnoredValue(Args...);
+};
+
+template <typename R, typename... Args>
+constexpr size_t Function<R(Args...)>::ArgumentCount;
#ifdef _MSC_VER
# pragma warning(pop)
diff --git a/googlemock/src/gmock.cc b/googlemock/src/gmock.cc
index 3fd2e93..05566e2 100644
--- a/googlemock/src/gmock.cc
+++ b/googlemock/src/gmock.cc
@@ -198,4 +198,16 @@ GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv) {
internal::InitGoogleMockImpl(argc, argv);
}
+// This overloaded version can be used on Arduino/embedded platforms where
+// there is no argc/argv.
+GTEST_API_ void InitGoogleMock() {
+ // Since Arduino doesn't have a command line, fake out the argc/argv arguments
+ int argc = 1;
+ const auto arg0 = "dummy";
+ char* argv0 = const_cast<char*>(arg0);
+ char** argv = &argv0;
+
+ internal::InitGoogleMockImpl(&argc, argv);
+}
+
} // namespace testing
diff --git a/googlemock/src/gmock_main.cc b/googlemock/src/gmock_main.cc
index 3306ffc..98611b9 100644
--- a/googlemock/src/gmock_main.cc
+++ b/googlemock/src/gmock_main.cc
@@ -34,12 +34,10 @@
#ifdef ARDUINO
void setup() {
- int argc = 0;
- char** argv = nullptr;
// Since Google Mock depends on Google Test, InitGoogleMock() is
// also responsible for initializing Google Test. Therefore there's
// no need for calling testing::InitGoogleTest() separately.
- testing::InitGoogleMock(&argc, argv);
+ testing::InitGoogleMock();
}
void loop() { RUN_ALL_TESTS(); }
#else
@@ -64,5 +62,4 @@ GTEST_API_ int main(int argc, char** argv) {
testing::InitGoogleMock(&argc, argv);
return RUN_ALL_TESTS();
}
-
#endif
diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc
index f918410..b3fef67 100644
--- a/googlemock/test/gmock-actions_test.cc
+++ b/googlemock/test/gmock-actions_test.cc
@@ -54,12 +54,14 @@
namespace {
// This list should be kept sorted.
+using testing::_;
using testing::Action;
using testing::ActionInterface;
using testing::Assign;
using testing::ByMove;
using testing::ByRef;
using testing::DefaultValue;
+using testing::DoAll;
using testing::DoDefault;
using testing::IgnoreResult;
using testing::Invoke;
@@ -75,7 +77,6 @@ using testing::SetArgPointee;
using testing::SetArgumentPointee;
using testing::Unused;
using testing::WithArgs;
-using testing::_;
using testing::internal::BuiltInDefaultValue;
using testing::internal::Int64;
using testing::internal::UInt64;
@@ -1164,13 +1165,12 @@ TEST_F(SetErrnoAndReturnTest, CompatibleTypes) {
// Tests ByRef().
-// Tests that ReferenceWrapper<T> is copyable.
+// Tests that the result of ByRef() is copyable.
TEST(ByRefTest, IsCopyable) {
const std::string s1 = "Hi";
const std::string s2 = "Hello";
- ::testing::internal::ReferenceWrapper<const std::string> ref_wrapper =
- ByRef(s1);
+ auto ref_wrapper = ByRef(s1);
const std::string& r1 = ref_wrapper;
EXPECT_EQ(&s1, &r1);
@@ -1179,8 +1179,7 @@ TEST(ByRefTest, IsCopyable) {
const std::string& r2 = ref_wrapper;
EXPECT_EQ(&s2, &r2);
- ::testing::internal::ReferenceWrapper<const std::string> ref_wrapper1 =
- ByRef(s1);
+ auto ref_wrapper1 = ByRef(s1);
// Copies ref_wrapper1 to ref_wrapper.
ref_wrapper = ref_wrapper1;
const std::string& r3 = ref_wrapper;
diff --git a/googlemock/test/gmock-function-mocker_test.cc b/googlemock/test/gmock-function-mocker_test.cc
index f29433f..d16006f 100644
--- a/googlemock/test/gmock-function-mocker_test.cc
+++ b/googlemock/test/gmock-function-mocker_test.cc
@@ -62,6 +62,15 @@ using testing::Return;
using testing::ReturnRef;
using testing::TypedEq;
+template<typename T>
+class TemplatedCopyable {
+ public:
+ TemplatedCopyable() {}
+
+ template <typename U>
+ TemplatedCopyable(const U& other) {} // NOLINT
+};
+
class FooInterface {
public:
virtual ~FooInterface() {}
@@ -90,6 +99,7 @@ class FooInterface {
virtual int TypeWithHole(int (*func)()) = 0;
virtual int TypeWithComma(const std::map<int, std::string>& a_map) = 0;
+ virtual int TypeWithTemplatedCopyCtor(const TemplatedCopyable<int>&) = 0;
#if GTEST_OS_WINDOWS
STDMETHOD_(int, CTNullary)() = 0;
@@ -146,6 +156,8 @@ class MockFoo : public FooInterface {
MOCK_METHOD(int, TypeWithHole, (int (*)()), ()); // NOLINT
MOCK_METHOD(int, TypeWithComma, ((const std::map<int, std::string>&)));
+ MOCK_METHOD(int, TypeWithTemplatedCopyCtor,
+ (const TemplatedCopyable<int>&)); // NOLINT
#if GTEST_OS_WINDOWS
MOCK_METHOD(int, CTNullary, (), (Calltype(STDMETHODCALLTYPE)));
@@ -288,6 +300,11 @@ TEST_F(MockMethodFunctionMockerTest, MocksReturnTypeWithComma) {
EXPECT_EQ(a_map, mock_foo_.ReturnTypeWithComma(42));
}
+TEST_F(MockMethodFunctionMockerTest, MocksTypeWithTemplatedCopyCtor) {
+ EXPECT_CALL(mock_foo_, TypeWithTemplatedCopyCtor(_)).WillOnce(Return(true));
+ EXPECT_TRUE(foo_->TypeWithTemplatedCopyCtor(TemplatedCopyable<int>()));
+}
+
#if GTEST_OS_WINDOWS
// Tests mocking a nullary function with calltype.
TEST_F(MockMethodFunctionMockerTest, MocksNullaryFunctionWithCallType) {
diff --git a/googlemock/test/gmock-generated-function-mockers_test.cc b/googlemock/test/gmock-generated-function-mockers_test.cc
index 52d9b8b..f07226c 100644
--- a/googlemock/test/gmock-generated-function-mockers_test.cc
+++ b/googlemock/test/gmock-generated-function-mockers_test.cc
@@ -63,6 +63,15 @@ using testing::Return;
using testing::ReturnRef;
using testing::TypedEq;
+template<typename T>
+class TemplatedCopyable {
+ public:
+ TemplatedCopyable() {}
+
+ template <typename U>
+ TemplatedCopyable(const U& other) {} // NOLINT
+};
+
class FooInterface {
public:
virtual ~FooInterface() {}
@@ -91,6 +100,8 @@ class FooInterface {
virtual int TypeWithHole(int (*func)()) = 0;
virtual int TypeWithComma(const std::map<int, std::string>& a_map) = 0;
+ virtual int TypeWithTemplatedCopyCtor(
+ const TemplatedCopyable<int>& a_vector) = 0;
#if GTEST_OS_WINDOWS
STDMETHOD_(int, CTNullary)() = 0;
@@ -146,6 +157,8 @@ class MockFoo : public FooInterface {
MOCK_METHOD1(TypeWithHole, int(int (*)())); // NOLINT
MOCK_METHOD1(TypeWithComma,
int(const std::map<int, std::string>&)); // NOLINT
+ MOCK_METHOD1(TypeWithTemplatedCopyCtor,
+ int(const TemplatedCopyable<int>&)); // NOLINT
#if GTEST_OS_WINDOWS
MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, CTNullary, int());
@@ -288,6 +301,11 @@ TEST_F(FunctionMockerTest, MocksReturnTypeWithComma) {
EXPECT_EQ(a_map, mock_foo_.ReturnTypeWithComma(42));
}
+TEST_F(FunctionMockerTest, MocksTypeWithTemplatedCopyCtor) {
+ EXPECT_CALL(mock_foo_, TypeWithTemplatedCopyCtor(_)).WillOnce(Return(true));
+ EXPECT_TRUE(foo_->TypeWithTemplatedCopyCtor(TemplatedCopyable<int>()));
+}
+
#if GTEST_OS_WINDOWS
// Tests mocking a nullary function with calltype.
TEST_F(FunctionMockerTest, MocksNullaryFunctionWithCallType) {
diff --git a/googlemock/test/gmock-generated-internal-utils_test.cc b/googlemock/test/gmock-generated-internal-utils_test.cc
deleted file mode 100644
index 965cbaa..0000000
--- a/googlemock/test/gmock-generated-internal-utils_test.cc
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file tests the internal utilities.
-
-#include "gmock/internal/gmock-generated-internal-utils.h"
-#include "gmock/internal/gmock-internal-utils.h"
-#include "gtest/gtest.h"
-
-namespace {
-
-using ::testing::Matcher;
-using ::testing::internal::CompileAssertTypesEqual;
-using ::testing::internal::MatcherTuple;
-using ::testing::internal::Function;
-using ::testing::internal::IgnoredValue;
-
-// Tests the MatcherTuple template struct.
-
-TEST(MatcherTupleTest, ForSize0) {
- CompileAssertTypesEqual<std::tuple<>, MatcherTuple<std::tuple<> >::type>();
-}
-
-TEST(MatcherTupleTest, ForSize1) {
- CompileAssertTypesEqual<std::tuple<Matcher<int> >,
- MatcherTuple<std::tuple<int> >::type>();
-}
-
-TEST(MatcherTupleTest, ForSize2) {
- CompileAssertTypesEqual<std::tuple<Matcher<int>, Matcher<char> >,
- MatcherTuple<std::tuple<int, char> >::type>();
-}
-
-TEST(MatcherTupleTest, ForSize5) {
- CompileAssertTypesEqual<
- std::tuple<Matcher<int>, Matcher<char>, Matcher<bool>, Matcher<double>,
- Matcher<char*> >,
- MatcherTuple<std::tuple<int, char, bool, double, char*> >::type>();
-}
-
-// Tests the Function template struct.
-
-TEST(FunctionTest, Nullary) {
- typedef Function<int()> F; // NOLINT
- CompileAssertTypesEqual<int, F::Result>();
- CompileAssertTypesEqual<std::tuple<>, F::ArgumentTuple>();
- CompileAssertTypesEqual<std::tuple<>, F::ArgumentMatcherTuple>();
- CompileAssertTypesEqual<void(), F::MakeResultVoid>();
- CompileAssertTypesEqual<IgnoredValue(), F::MakeResultIgnoredValue>();
-}
-
-TEST(FunctionTest, Unary) {
- typedef Function<int(bool)> F; // NOLINT
- CompileAssertTypesEqual<int, F::Result>();
- CompileAssertTypesEqual<bool, F::Argument1>();
- CompileAssertTypesEqual<std::tuple<bool>, F::ArgumentTuple>();
- CompileAssertTypesEqual<std::tuple<Matcher<bool> >,
- F::ArgumentMatcherTuple>();
- CompileAssertTypesEqual<void(bool), F::MakeResultVoid>(); // NOLINT
- CompileAssertTypesEqual<IgnoredValue(bool), // NOLINT
- F::MakeResultIgnoredValue>();
-}
-
-TEST(FunctionTest, Binary) {
- typedef Function<int(bool, const long&)> F; // NOLINT
- CompileAssertTypesEqual<int, F::Result>();
- CompileAssertTypesEqual<bool, F::Argument1>();
- CompileAssertTypesEqual<const long&, F::Argument2>(); // NOLINT
- CompileAssertTypesEqual<std::tuple<bool, const long&>, // NOLINT
- F::ArgumentTuple>();
- CompileAssertTypesEqual<
- std::tuple<Matcher<bool>, Matcher<const long&> >, // NOLINT
- F::ArgumentMatcherTuple>();
- CompileAssertTypesEqual<void(bool, const long&), F::MakeResultVoid>(); // NOLINT
- CompileAssertTypesEqual<IgnoredValue(bool, const long&), // NOLINT
- F::MakeResultIgnoredValue>();
-}
-
-TEST(FunctionTest, LongArgumentList) {
- typedef Function<char(bool, int, char*, int&, const long&)> F; // NOLINT
- CompileAssertTypesEqual<char, F::Result>();
- CompileAssertTypesEqual<bool, F::Argument1>();
- CompileAssertTypesEqual<int, F::Argument2>();
- CompileAssertTypesEqual<char*, F::Argument3>();
- CompileAssertTypesEqual<int&, F::Argument4>();
- CompileAssertTypesEqual<const long&, F::Argument5>(); // NOLINT
- CompileAssertTypesEqual<
- std::tuple<bool, int, char*, int&, const long&>, // NOLINT
- F::ArgumentTuple>();
- CompileAssertTypesEqual<
- std::tuple<Matcher<bool>, Matcher<int>, Matcher<char*>, Matcher<int&>,
- Matcher<const long&> >, // NOLINT
- F::ArgumentMatcherTuple>();
- CompileAssertTypesEqual<void(bool, int, char*, int&, const long&), // NOLINT
- F::MakeResultVoid>();
- CompileAssertTypesEqual<
- IgnoredValue(bool, int, char*, int&, const long&), // NOLINT
- F::MakeResultIgnoredValue>();
-}
-
-} // Unnamed namespace
diff --git a/googlemock/test/gmock-generated-matchers_test.cc b/googlemock/test/gmock-generated-matchers_test.cc
index 426e954..d79cef9 100644
--- a/googlemock/test/gmock-generated-matchers_test.cc
+++ b/googlemock/test/gmock-generated-matchers_test.cc
@@ -64,7 +64,9 @@ using std::stringstream;
using std::vector;
using testing::_;
using testing::AllOf;
+using testing::AllOfArray;
using testing::AnyOf;
+using testing::AnyOfArray;
using testing::Args;
using testing::Contains;
using testing::ElementsAre;
@@ -1094,6 +1096,146 @@ TEST(ContainsTest, WorksForTwoDimensionalNativeArray) {
EXPECT_THAT(a, Contains(Not(Contains(5))));
}
+TEST(AllOfArrayTest, BasicForms) {
+ // Iterator
+ std::vector<int> v0{};
+ std::vector<int> v1{1};
+ std::vector<int> v2{2, 3};
+ std::vector<int> v3{4, 4, 4};
+ EXPECT_THAT(0, AllOfArray(v0.begin(), v0.end()));
+ EXPECT_THAT(1, AllOfArray(v1.begin(), v1.end()));
+ EXPECT_THAT(2, Not(AllOfArray(v1.begin(), v1.end())));
+ EXPECT_THAT(3, Not(AllOfArray(v2.begin(), v2.end())));
+ EXPECT_THAT(4, AllOfArray(v3.begin(), v3.end()));
+ // Pointer + size
+ int ar[6] = {1, 2, 3, 4, 4, 4};
+ EXPECT_THAT(0, AllOfArray(ar, 0));
+ EXPECT_THAT(1, AllOfArray(ar, 1));
+ EXPECT_THAT(2, Not(AllOfArray(ar, 1)));
+ EXPECT_THAT(3, Not(AllOfArray(ar + 1, 3)));
+ EXPECT_THAT(4, AllOfArray(ar + 3, 3));
+ // Array
+ // int ar0[0]; Not usable
+ int ar1[1] = {1};
+ int ar2[2] = {2, 3};
+ int ar3[3] = {4, 4, 4};
+ // EXPECT_THAT(0, Not(AllOfArray(ar0))); // Cannot work
+ EXPECT_THAT(1, AllOfArray(ar1));
+ EXPECT_THAT(2, Not(AllOfArray(ar1)));
+ EXPECT_THAT(3, Not(AllOfArray(ar2)));
+ EXPECT_THAT(4, AllOfArray(ar3));
+ // Container
+ EXPECT_THAT(0, AllOfArray(v0));
+ EXPECT_THAT(1, AllOfArray(v1));
+ EXPECT_THAT(2, Not(AllOfArray(v1)));
+ EXPECT_THAT(3, Not(AllOfArray(v2)));
+ EXPECT_THAT(4, AllOfArray(v3));
+ // Initializer
+ EXPECT_THAT(0, AllOfArray<int>({})); // Requires template arg.
+ EXPECT_THAT(1, AllOfArray({1}));
+ EXPECT_THAT(2, Not(AllOfArray({1})));
+ EXPECT_THAT(3, Not(AllOfArray({2, 3})));
+ EXPECT_THAT(4, AllOfArray({4, 4, 4}));
+}
+
+TEST(AllOfArrayTest, Matchers) {
+ // vector
+ std::vector<Matcher<int>> matchers{Ge(1), Lt(2)};
+ EXPECT_THAT(0, Not(AllOfArray(matchers)));
+ EXPECT_THAT(1, AllOfArray(matchers));
+ EXPECT_THAT(2, Not(AllOfArray(matchers)));
+ // initializer_list
+ EXPECT_THAT(0, Not(AllOfArray({Ge(0), Ge(1)})));
+ EXPECT_THAT(1, AllOfArray({Ge(0), Ge(1)}));
+}
+
+TEST(AnyOfArrayTest, BasicForms) {
+ // Iterator
+ std::vector<int> v0{};
+ std::vector<int> v1{1};
+ std::vector<int> v2{2, 3};
+ EXPECT_THAT(0, Not(AnyOfArray(v0.begin(), v0.end())));
+ EXPECT_THAT(1, AnyOfArray(v1.begin(), v1.end()));
+ EXPECT_THAT(2, Not(AnyOfArray(v1.begin(), v1.end())));
+ EXPECT_THAT(3, AnyOfArray(v2.begin(), v2.end()));
+ EXPECT_THAT(4, Not(AnyOfArray(v2.begin(), v2.end())));
+ // Pointer + size
+ int ar[3] = {1, 2, 3};
+ EXPECT_THAT(0, Not(AnyOfArray(ar, 0)));
+ EXPECT_THAT(1, AnyOfArray(ar, 1));
+ EXPECT_THAT(2, Not(AnyOfArray(ar, 1)));
+ EXPECT_THAT(3, AnyOfArray(ar + 1, 3));
+ EXPECT_THAT(4, Not(AnyOfArray(ar + 1, 3)));
+ // Array
+ // int ar0[0]; Not usable
+ int ar1[1] = {1};
+ int ar2[2] = {2, 3};
+ // EXPECT_THAT(0, Not(AnyOfArray(ar0))); // Cannot work
+ EXPECT_THAT(1, AnyOfArray(ar1));
+ EXPECT_THAT(2, Not(AnyOfArray(ar1)));
+ EXPECT_THAT(3, AnyOfArray(ar2));
+ EXPECT_THAT(4, Not(AnyOfArray(ar2)));
+ // Container
+ EXPECT_THAT(0, Not(AnyOfArray(v0)));
+ EXPECT_THAT(1, AnyOfArray(v1));
+ EXPECT_THAT(2, Not(AnyOfArray(v1)));
+ EXPECT_THAT(3, AnyOfArray(v2));
+ EXPECT_THAT(4, Not(AnyOfArray(v2)));
+ // Initializer
+ EXPECT_THAT(0, Not(AnyOfArray<int>({}))); // Requires template arg.
+ EXPECT_THAT(1, AnyOfArray({1}));
+ EXPECT_THAT(2, Not(AnyOfArray({1})));
+ EXPECT_THAT(3, AnyOfArray({2, 3}));
+ EXPECT_THAT(4, Not(AnyOfArray({2, 3})));
+}
+
+TEST(AnyOfArrayTest, Matchers) {
+ // We negate test AllOfArrayTest.Matchers.
+ // vector
+ std::vector<Matcher<int>> matchers{Lt(1), Ge(2)};
+ EXPECT_THAT(0, AnyOfArray(matchers));
+ EXPECT_THAT(1, Not(AnyOfArray(matchers)));
+ EXPECT_THAT(2, AnyOfArray(matchers));
+ // initializer_list
+ EXPECT_THAT(0, AnyOfArray({Lt(0), Lt(1)}));
+ EXPECT_THAT(1, Not(AllOfArray({Lt(0), Lt(1)})));
+}
+
+TEST(AnyOfArrayTest, ExplainsMatchResultCorrectly) {
+ // AnyOfArray and AllOfArry use the same underlying template-template,
+ // thus it is sufficient to test one here.
+ const std::vector<int> v0{};
+ const std::vector<int> v1{1};
+ const std::vector<int> v2{2, 3};
+ const Matcher<int> m0 = AnyOfArray(v0);
+ const Matcher<int> m1 = AnyOfArray(v1);
+ const Matcher<int> m2 = AnyOfArray(v2);
+ EXPECT_EQ("", Explain(m0, 0));
+ EXPECT_EQ("", Explain(m1, 1));
+ EXPECT_EQ("", Explain(m1, 2));
+ EXPECT_EQ("", Explain(m2, 3));
+ EXPECT_EQ("", Explain(m2, 4));
+ EXPECT_EQ("()", Describe(m0));
+ EXPECT_EQ("(is equal to 1)", Describe(m1));
+ EXPECT_EQ("(is equal to 2) or (is equal to 3)", Describe(m2));
+ EXPECT_EQ("()", DescribeNegation(m0));
+ EXPECT_EQ("(isn't equal to 1)", DescribeNegation(m1));
+ EXPECT_EQ("(isn't equal to 2) and (isn't equal to 3)", DescribeNegation(m2));
+ // Explain with matchers
+ const Matcher<int> g1 = AnyOfArray({GreaterThan(1)});
+ const Matcher<int> g2 = AnyOfArray({GreaterThan(1), GreaterThan(2)});
+ // Explains the first positiv match and all prior negative matches...
+ EXPECT_EQ("which is 1 less than 1", Explain(g1, 0));
+ EXPECT_EQ("which is the same as 1", Explain(g1, 1));
+ EXPECT_EQ("which is 1 more than 1", Explain(g1, 2));
+ EXPECT_EQ("which is 1 less than 1, and which is 2 less than 2",
+ Explain(g2, 0));
+ EXPECT_EQ("which is the same as 1, and which is 1 less than 2",
+ Explain(g2, 1));
+ EXPECT_EQ("which is 1 more than 1", // Only the first
+ Explain(g2, 2));
+}
+
TEST(AllOfTest, HugeMatcher) {
// Verify that using AllOf with many arguments doesn't cause
// the compiler to exceed template instantiation depth limit.
diff --git a/googlemock/test/gmock-internal-utils_test.cc b/googlemock/test/gmock-internal-utils_test.cc
index b322f2d..0adcdfb 100644
--- a/googlemock/test/gmock-internal-utils_test.cc
+++ b/googlemock/test/gmock-internal-utils_test.cc
@@ -690,6 +690,70 @@ TEST(StlContainerViewTest, WorksForDynamicNativeArray) {
EXPECT_EQ(0, a3.begin()[0]);
}
+// Tests the Function template struct.
+
+TEST(FunctionTest, Nullary) {
+ typedef Function<int()> F; // NOLINT
+ EXPECT_EQ(0u, F::ArgumentCount);
+ CompileAssertTypesEqual<int, F::Result>();
+ CompileAssertTypesEqual<std::tuple<>, F::ArgumentTuple>();
+ CompileAssertTypesEqual<std::tuple<>, F::ArgumentMatcherTuple>();
+ CompileAssertTypesEqual<void(), F::MakeResultVoid>();
+ CompileAssertTypesEqual<IgnoredValue(), F::MakeResultIgnoredValue>();
+}
+
+TEST(FunctionTest, Unary) {
+ typedef Function<int(bool)> F; // NOLINT
+ EXPECT_EQ(1u, F::ArgumentCount);
+ CompileAssertTypesEqual<int, F::Result>();
+ CompileAssertTypesEqual<bool, F::Arg<0>::type>();
+ CompileAssertTypesEqual<std::tuple<bool>, F::ArgumentTuple>();
+ CompileAssertTypesEqual<std::tuple<Matcher<bool> >,
+ F::ArgumentMatcherTuple>();
+ CompileAssertTypesEqual<void(bool), F::MakeResultVoid>(); // NOLINT
+ CompileAssertTypesEqual<IgnoredValue(bool), // NOLINT
+ F::MakeResultIgnoredValue>();
+}
+
+TEST(FunctionTest, Binary) {
+ typedef Function<int(bool, const long&)> F; // NOLINT
+ EXPECT_EQ(2u, F::ArgumentCount);
+ CompileAssertTypesEqual<int, F::Result>();
+ CompileAssertTypesEqual<bool, F::Arg<0>::type>();
+ CompileAssertTypesEqual<const long&, F::Arg<1>::type>(); // NOLINT
+ CompileAssertTypesEqual<std::tuple<bool, const long&>, // NOLINT
+ F::ArgumentTuple>();
+ CompileAssertTypesEqual<
+ std::tuple<Matcher<bool>, Matcher<const long&> >, // NOLINT
+ F::ArgumentMatcherTuple>();
+ CompileAssertTypesEqual<void(bool, const long&), F::MakeResultVoid>(); // NOLINT
+ CompileAssertTypesEqual<IgnoredValue(bool, const long&), // NOLINT
+ F::MakeResultIgnoredValue>();
+}
+
+TEST(FunctionTest, LongArgumentList) {
+ typedef Function<char(bool, int, char*, int&, const long&)> F; // NOLINT
+ EXPECT_EQ(5u, F::ArgumentCount);
+ CompileAssertTypesEqual<char, F::Result>();
+ CompileAssertTypesEqual<bool, F::Arg<0>::type>();
+ CompileAssertTypesEqual<int, F::Arg<1>::type>();
+ CompileAssertTypesEqual<char*, F::Arg<2>::type>();
+ CompileAssertTypesEqual<int&, F::Arg<3>::type>();
+ CompileAssertTypesEqual<const long&, F::Arg<4>::type>(); // NOLINT
+ CompileAssertTypesEqual<
+ std::tuple<bool, int, char*, int&, const long&>, // NOLINT
+ F::ArgumentTuple>();
+ CompileAssertTypesEqual<
+ std::tuple<Matcher<bool>, Matcher<int>, Matcher<char*>, Matcher<int&>,
+ Matcher<const long&> >, // NOLINT
+ F::ArgumentMatcherTuple>();
+ CompileAssertTypesEqual<void(bool, int, char*, int&, const long&), // NOLINT
+ F::MakeResultVoid>();
+ CompileAssertTypesEqual<
+ IgnoredValue(bool, int, char*, int&, const long&), // NOLINT
+ F::MakeResultIgnoredValue>();
+}
+
} // namespace
} // namespace internal
} // namespace testing
diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc
index a35942d..932229e 100644
--- a/googlemock/test/gmock-matchers_test.cc
+++ b/googlemock/test/gmock-matchers_test.cc
@@ -80,65 +80,6 @@ using std::pair;
using std::set;
using std::stringstream;
using std::vector;
-using testing::_;
-using testing::A;
-using testing::AllArgs;
-using testing::AllOf;
-using testing::An;
-using testing::AnyOf;
-using testing::ByRef;
-using testing::ContainsRegex;
-using testing::DoubleEq;
-using testing::DoubleNear;
-using testing::EndsWith;
-using testing::Eq;
-using testing::ExplainMatchResult;
-using testing::Field;
-using testing::FloatEq;
-using testing::FloatNear;
-using testing::Ge;
-using testing::Gt;
-using testing::HasSubstr;
-using testing::IsEmpty;
-using testing::IsNull;
-using testing::Key;
-using testing::Le;
-using testing::Lt;
-using testing::MakeMatcher;
-using testing::MakePolymorphicMatcher;
-using testing::Matcher;
-using testing::MatcherCast;
-using testing::MatcherInterface;
-using testing::Matches;
-using testing::MatchesRegex;
-using testing::MatchResultListener;
-using testing::NanSensitiveDoubleEq;
-using testing::NanSensitiveDoubleNear;
-using testing::NanSensitiveFloatEq;
-using testing::NanSensitiveFloatNear;
-using testing::Ne;
-using testing::Not;
-using testing::NotNull;
-using testing::Pair;
-using testing::Pointee;
-using testing::Pointwise;
-using testing::PolymorphicMatcher;
-using testing::Property;
-using testing::Ref;
-using testing::ResultOf;
-using testing::SizeIs;
-using testing::StartsWith;
-using testing::StrCaseEq;
-using testing::StrCaseNe;
-using testing::StrEq;
-using testing::StringMatchResultListener;
-using testing::StrNe;
-using testing::Truly;
-using testing::TypedEq;
-using testing::UnorderedPointwise;
-using testing::Value;
-using testing::WhenSorted;
-using testing::WhenSortedBy;
using testing::internal::DummyMatchResultListener;
using testing::internal::ElementMatcherPair;
using testing::internal::ElementMatcherPairs;
@@ -1154,6 +1095,47 @@ TEST(NeTest, CanDescribeSelf) {
EXPECT_EQ("isn't equal to 5", Describe(m));
}
+class MoveOnly {
+ public:
+ explicit MoveOnly(int i) : i_(i) {}
+ MoveOnly(const MoveOnly&) = delete;
+ MoveOnly(MoveOnly&&) = default;
+ MoveOnly& operator=(const MoveOnly&) = delete;
+ MoveOnly& operator=(MoveOnly&&) = default;
+
+ bool operator==(const MoveOnly& other) const { return i_ == other.i_; }
+ bool operator!=(const MoveOnly& other) const { return i_ != other.i_; }
+ bool operator<(const MoveOnly& other) const { return i_ < other.i_; }
+ bool operator<=(const MoveOnly& other) const { return i_ <= other.i_; }
+ bool operator>(const MoveOnly& other) const { return i_ > other.i_; }
+ bool operator>=(const MoveOnly& other) const { return i_ >= other.i_; }
+
+ private:
+ int i_;
+};
+
+struct MoveHelper {
+ MOCK_METHOD1(Call, void(MoveOnly));
+};
+
+TEST(ComparisonBaseTest, WorksWithMoveOnly) {
+ MoveOnly m{0};
+ MoveHelper helper;
+
+ EXPECT_CALL(helper, Call(Eq(ByRef(m))));
+ helper.Call(MoveOnly(0));
+ EXPECT_CALL(helper, Call(Ne(ByRef(m))));
+ helper.Call(MoveOnly(1));
+ EXPECT_CALL(helper, Call(Le(ByRef(m))));
+ helper.Call(MoveOnly(0));
+ EXPECT_CALL(helper, Call(Lt(ByRef(m))));
+ helper.Call(MoveOnly(-1));
+ EXPECT_CALL(helper, Call(Ge(ByRef(m))));
+ helper.Call(MoveOnly(0));
+ EXPECT_CALL(helper, Call(Gt(ByRef(m))));
+ helper.Call(MoveOnly(1));
+}
+
// Tests that IsNull() matches any NULL pointer of any type.
TEST(IsNullTest, MatchesNullPointer) {
Matcher<int*> m1 = IsNull();
@@ -1507,6 +1489,11 @@ TEST(KeyTest, MatchesCorrectly) {
EXPECT_THAT(p, Not(Key(Lt(25))));
}
+TEST(KeyTest, WorksWithMoveOnly) {
+ pair<std::unique_ptr<int>, std::unique_ptr<int>> p;
+ EXPECT_THAT(p, Key(Eq(nullptr)));
+}
+
template <size_t I>
struct Tag {};
@@ -1650,6 +1637,12 @@ TEST(PairTest, MatchesCorrectly) {
EXPECT_THAT(p, Not(Pair(Lt(13), HasSubstr("a"))));
}
+TEST(PairTest, WorksWithMoveOnly) {
+ pair<std::unique_ptr<int>, std::unique_ptr<int>> p;
+ p.second.reset(new int(7));
+ EXPECT_THAT(p, Pair(Eq(nullptr), Ne(nullptr)));
+}
+
TEST(PairTest, SafelyCastsInnerMatchers) {
Matcher<int> is_positive = Gt(0);
Matcher<int> is_negative = Lt(0);
@@ -2303,6 +2296,15 @@ TEST(Ne2Test, CanDescribeSelf) {
EXPECT_EQ("are an unequal pair", Describe(m));
}
+TEST(PairMatchBaseTest, WorksWithMoveOnly) {
+ using Pointers = std::tuple<std::unique_ptr<int>, std::unique_ptr<int>>;
+ Matcher<Pointers> matcher = Eq();
+ Pointers pointers;
+ // Tested values don't matter; the point is that matcher does not copy the
+ // matched values.
+ EXPECT_TRUE(matcher.Matches(pointers));
+}
+
// Tests that FloatEq() matches a 2-tuple where
// FloatEq(first field) matches the second field.
TEST(FloatEq2Test, MatchesEqualArguments) {
@@ -6625,49 +6627,53 @@ TEST(UnorderedPointwiseTest, WorksWithMoveOnly) {
// Sample optional type implementation with minimal requirements for use with
// Optional matcher.
-class SampleOptionalInt {
+template <typename T>
+class SampleOptional {
public:
- typedef int value_type;
- explicit SampleOptionalInt(int value) : value_(value), has_value_(true) {}
- SampleOptionalInt() : value_(0), has_value_(false) {}
- operator bool() const {
- return has_value_;
- }
- const int& operator*() const {
- return value_;
- }
+ using value_type = T;
+ explicit SampleOptional(T value)
+ : value_(std::move(value)), has_value_(true) {}
+ SampleOptional() : value_(), has_value_(false) {}
+ operator bool() const { return has_value_; }
+ const T& operator*() const { return value_; }
+
private:
- int value_;
+ T value_;
bool has_value_;
};
TEST(OptionalTest, DescribesSelf) {
- const Matcher<SampleOptionalInt> m = Optional(Eq(1));
+ const Matcher<SampleOptional<int>> m = Optional(Eq(1));
EXPECT_EQ("value is equal to 1", Describe(m));
}
TEST(OptionalTest, ExplainsSelf) {
- const Matcher<SampleOptionalInt> m = Optional(Eq(1));
- EXPECT_EQ("whose value 1 matches", Explain(m, SampleOptionalInt(1)));
- EXPECT_EQ("whose value 2 doesn't match", Explain(m, SampleOptionalInt(2)));
+ const Matcher<SampleOptional<int>> m = Optional(Eq(1));
+ EXPECT_EQ("whose value 1 matches", Explain(m, SampleOptional<int>(1)));
+ EXPECT_EQ("whose value 2 doesn't match", Explain(m, SampleOptional<int>(2)));
}
TEST(OptionalTest, MatchesNonEmptyOptional) {
- const Matcher<SampleOptionalInt> m1 = Optional(1);
- const Matcher<SampleOptionalInt> m2 = Optional(Eq(2));
- const Matcher<SampleOptionalInt> m3 = Optional(Lt(3));
- SampleOptionalInt opt(1);
+ const Matcher<SampleOptional<int>> m1 = Optional(1);
+ const Matcher<SampleOptional<int>> m2 = Optional(Eq(2));
+ const Matcher<SampleOptional<int>> m3 = Optional(Lt(3));
+ SampleOptional<int> opt(1);
EXPECT_TRUE(m1.Matches(opt));
EXPECT_FALSE(m2.Matches(opt));
EXPECT_TRUE(m3.Matches(opt));
}
TEST(OptionalTest, DoesNotMatchNullopt) {
- const Matcher<SampleOptionalInt> m = Optional(1);
- SampleOptionalInt empty;
+ const Matcher<SampleOptional<int>> m = Optional(1);
+ SampleOptional<int> empty;
EXPECT_FALSE(m.Matches(empty));
}
+TEST(OptionalTest, WorksWithMoveOnly) {
+ Matcher<SampleOptional<std::unique_ptr<int>>> m = Optional(Eq(nullptr));
+ EXPECT_TRUE(m.Matches(SampleOptional<std::unique_ptr<int>>(nullptr)));
+}
+
class SampleVariantIntString {
public:
SampleVariantIntString(int i) : i_(i), has_int_(true) {}
@@ -6995,10 +7001,6 @@ class PredicateFormatterFromMatcherTest : public ::testing::Test {
matcher);
return predicate_formatter("dummy-name", behavior);
}
-
- const std::string kMatcherType =
- "testing::gmock_matchers_test::PredicateFormatterFromMatcherTest::"
- "Behavior";
};
TEST_F(PredicateFormatterFromMatcherTest, ShortCircuitOnSuccess) {
diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc
index 557abae..10869b6 100644
--- a/googlemock/test/gmock-spec-builders_test.cc
+++ b/googlemock/test/gmock-spec-builders_test.cc
@@ -78,6 +78,7 @@ using testing::Expectation;
using testing::ExpectationSet;
using testing::GMOCK_FLAG(verbose);
using testing::Gt;
+using testing::IgnoreResult;
using testing::InSequence;
using testing::Invoke;
using testing::InvokeWithoutArgs;
diff --git a/googlemock/test/gmock_all_test.cc b/googlemock/test/gmock_all_test.cc
index e1774fb..b2b2027 100644
--- a/googlemock/test/gmock_all_test.cc
+++ b/googlemock/test/gmock_all_test.cc
@@ -39,7 +39,6 @@
#include "test/gmock-cardinalities_test.cc"
#include "test/gmock-generated-actions_test.cc"
#include "test/gmock-generated-function-mockers_test.cc"
-#include "test/gmock-generated-internal-utils_test.cc"
#include "test/gmock-generated-matchers_test.cc"
#include "test/gmock-internal-utils_test.cc"
#include "test/gmock-matchers_test.cc"
diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h
index 7bc855b..9a8841b 100644
--- a/googletest/include/gtest/gtest-matchers.h
+++ b/googletest/include/gtest/gtest-matchers.h
@@ -296,6 +296,11 @@ class MatcherBase {
!internal::IsSame<U, const U&>::value>::type* = nullptr)
: impl_(new internal::MatcherInterfaceAdapter<U>(impl)) {}
+ MatcherBase(const MatcherBase&) = default;
+ MatcherBase& operator=(const MatcherBase&) = default;
+ MatcherBase(MatcherBase&&) = default;
+ MatcherBase& operator=(MatcherBase&&) = default;
+
virtual ~MatcherBase() {}
private:
@@ -545,22 +550,17 @@ class PolymorphicMatcher {
private:
const Impl impl_;
-
- GTEST_DISALLOW_ASSIGN_(MonomorphicImpl);
};
Impl impl_;
-
- GTEST_DISALLOW_ASSIGN_(PolymorphicMatcher);
};
-// Creates a matcher from its implementation. This is easier to use
-// than the Matcher<T> constructor as it doesn't require you to
-// explicitly write the template argument, e.g.
+// Creates a matcher from its implementation.
+// DEPRECATED: Especially in the generic code, prefer:
+// Matcher<T>(new MyMatcherImpl<const T&>(...));
//
-// MakeMatcher(foo);
-// vs
-// Matcher<const string&>(foo);
+// MakeMatcher may create a Matcher that accepts its argument by value, which
+// leads to unnecessary copies & lack of support for non-copyable types.
template <typename T>
inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) {
return Matcher<T>(impl);
@@ -595,7 +595,7 @@ class ComparisonBase {
explicit ComparisonBase(const Rhs& rhs) : rhs_(rhs) {}
template <typename Lhs>
operator Matcher<Lhs>() const {
- return MakeMatcher(new Impl<Lhs>(rhs_));
+ return Matcher<Lhs>(new Impl<const Lhs&>(rhs_));
}
private:
@@ -618,10 +618,8 @@ class ComparisonBase {
private:
Rhs rhs_;
- GTEST_DISALLOW_ASSIGN_(Impl);
};
Rhs rhs_;
- GTEST_DISALLOW_ASSIGN_(ComparisonBase);
};
template <typename Rhs>
@@ -724,8 +722,6 @@ class MatchesRegexMatcher {
private:
const std::shared_ptr<const RE> regex_;
const bool full_match_;
-
- GTEST_DISALLOW_ASSIGN_(MatchesRegexMatcher);
};
} // namespace internal
diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h
index d6596e4..ef166b0 100644
--- a/googletest/include/gtest/gtest-printers.h
+++ b/googletest/include/gtest/gtest-printers.h
@@ -232,12 +232,12 @@ template <typename Char, typename CharTraits, typename T>
::std::basic_ostream<Char, CharTraits>& os, const T& x) {
TypeWithoutFormatter<T, (internal::IsAProtocolMessage<T>::value
? kProtobuf
- : internal::ImplicitlyConvertible<
+ : std::is_convertible<
const T&, internal::BiggestInt>::value
? kConvertibleToInteger
:
#if GTEST_HAS_ABSL
- internal::ImplicitlyConvertible<
+ std::is_convertible<
const T&, absl::string_view>::value
? kConvertibleToStringView
:
@@ -637,8 +637,7 @@ inline void PrintTo(std::nullptr_t, ::std::ostream* os) { *os << "(nullptr)"; }
template <typename T>
void PrintTo(std::reference_wrapper<T> ref, ::std::ostream* os) {
- // Delegate to wrapped value.
- PrintTo(ref.get(), os);
+ UniversalPrinter<T&>::Print(ref.get(), os);
}
// Helper function for printing a tuple. T must be instantiated with
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index 70c93da..bcea145 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -306,7 +306,7 @@ class GTEST_API_ AssertionResult {
explicit AssertionResult(
const T& success,
typename internal::EnableIf<
- !internal::ImplicitlyConvertible<T, AssertionResult>::value>::type*
+ !std::is_convertible<T, AssertionResult>::value>::type*
/*enabler*/
= nullptr)
: success_(success) {}
@@ -1087,11 +1087,11 @@ class TestEventListener {
virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
// Fired before the test suite starts.
- virtual void OnTestSuiteStart(const TestSuite& test_suite) {}
+ virtual void OnTestSuiteStart(const TestSuite& /*test_suite*/) {}
// Legacy API is deprecated but still available
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
- virtual void OnTestCaseStart(const TestCase& test_case) {}
+ virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
// Fired before the test starts.
@@ -1106,11 +1106,11 @@ class TestEventListener {
virtual void OnTestEnd(const TestInfo& test_info) = 0;
// Fired after the test suite ends.
- virtual void OnTestSuiteEnd(const TestSuite& test_suite) {}
+ virtual void OnTestSuiteEnd(const TestSuite& /*test_suite*/) {}
// Legacy API is deprecated but still available
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
- virtual void OnTestCaseEnd(const TestCase& test_case) {}
+ virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
// Fired before environment tear-down for each iteration of tests starts.
@@ -1142,7 +1142,7 @@ class EmptyTestEventListener : public TestEventListener {
void OnTestSuiteStart(const TestSuite& /*test_suite*/) override {}
// Legacy API is deprecated but still available
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
- void OnTestCaseStart(const TestCase& tc /*test_suite*/) override {}
+ void OnTestCaseStart(const TestCase& /*test_case*/) override {}
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
void OnTestStart(const TestInfo& /*test_info*/) override {}
@@ -1150,7 +1150,7 @@ class EmptyTestEventListener : public TestEventListener {
void OnTestEnd(const TestInfo& /*test_info*/) override {}
void OnTestSuiteEnd(const TestSuite& /*test_suite*/) override {}
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
- void OnTestCaseEnd(const TestCase& tc /*test_suite*/) override {}
+ void OnTestCaseEnd(const TestCase& /*test_case*/) override {}
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) override {}
@@ -1484,6 +1484,10 @@ GTEST_API_ void InitGoogleTest(int* argc, char** argv);
// UNICODE mode.
GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
+// This overloaded version can be used on Arduino/embedded platforms where
+// there is no argc/argv.
+GTEST_API_ void InitGoogleTest();
+
namespace internal {
// Separate the error generating code from the code path to reduce the stack
@@ -2499,20 +2503,6 @@ inline int RUN_ALL_TESTS() {
return ::testing::UnitTest::GetInstance()->Run();
}
-#ifdef ARDUINO
-inline void gtest_setup() {
- // Since Arduino doesn't have a command line, fake out the argc/argv arguments
- int argc = 1;
- const auto arg0 = "PlatformIO";
- char* argv0 = const_cast<char*>(arg0);
- char** argv = &argv0;
-
- testing::InitGoogleTest(&argc, argv);
-}
-
-inline void gtest_loop() { RUN_ALL_TESTS(); }
-#endif
-
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
#endif // GTEST_INCLUDE_GTEST_GTEST_H_
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h
index 02ef3b3..94773df 100644
--- a/googletest/include/gtest/internal/gtest-internal.h
+++ b/googletest/include/gtest/internal/gtest-internal.h
@@ -58,6 +58,7 @@
#include <map>
#include <set>
#include <string>
+#include <type_traits>
#include <vector>
#include "gtest/gtest-message.h"
@@ -108,16 +109,29 @@ GTEST_API_ extern const char kStackTraceMarker[];
// An IgnoredValue object can be implicitly constructed from ANY value.
class IgnoredValue {
+ struct Sink {};
public:
// This constructor template allows any value to be implicitly
// converted to IgnoredValue. The object has no data member and
// doesn't try to remember anything about the argument. We
// deliberately omit the 'explicit' keyword in order to allow the
// conversion to be implicit.
- template <typename T>
+ // Disable the conversion if T already has a magical conversion operator.
+ // Otherwise we get ambiguity.
+ template <typename T,
+ typename std::enable_if<!std::is_convertible<T, Sink>::value,
+ int>::type = 0>
IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
};
+// The only type that should be convertible to Secret* is nullptr.
+// The other null pointer constants are not of a type that is convertible to
+// Secret*. Only the literal with the right value is.
+template <typename T>
+using TypeIsValidNullptrConstant = std::integral_constant<
+ bool, std::is_same<typename std::decay<T>::type, std::nullptr_t>::value ||
+ !std::is_convertible<T, Secret*>::value>;
+
// Two overloaded helpers for checking at compile time whether an
// expression is a null pointer literal (i.e. NULL or any 0-valued
// compile-time integral constant). These helpers have no
@@ -130,13 +144,16 @@ class IgnoredValue {
// a null pointer literal. Therefore, we know that x is a null
// pointer literal if and only if the first version is picked by the
// compiler.
-std::true_type IsNullLiteralHelper(Secret*);
-std::false_type IsNullLiteralHelper(IgnoredValue);
+std::true_type IsNullLiteralHelper(Secret*, std::true_type);
+std::false_type IsNullLiteralHelper(IgnoredValue, std::false_type);
+std::false_type IsNullLiteralHelper(IgnoredValue, std::true_type);
// A compile-time bool constant that is true if and only if x is a null pointer
// literal (i.e. nullptr, NULL or any 0-valued compile-time integral constant).
-#define GTEST_IS_NULL_LITERAL_(x) \
- decltype(::testing::internal::IsNullLiteralHelper(x))::value
+#define GTEST_IS_NULL_LITERAL_(x) \
+ decltype(::testing::internal::IsNullLiteralHelper( \
+ x, \
+ ::testing::internal::TypeIsValidNullptrConstant<decltype(x)>()))::value
// Appends the user-supplied message to the Google-Test-generated message.
GTEST_API_ std::string AppendUserMessage(
@@ -903,62 +920,14 @@ struct RemoveConst<const T[N]> {
#define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))
-// ImplicitlyConvertible<From, To>::value is a compile-time bool
-// constant that's true iff type From can be implicitly converted to
-// type To.
-template <typename From, typename To>
-class ImplicitlyConvertible {
- private:
- // We need the following helper functions only for their types.
- // They have no implementations.
-
- // MakeFrom() is an expression whose type is From. We cannot simply
- // use From(), as the type From may not have a public default
- // constructor.
- static typename AddReference<From>::type MakeFrom();
-
- // These two functions are overloaded. Given an expression
- // Helper(x), the compiler will pick the first version if x can be
- // implicitly converted to type To; otherwise it will pick the
- // second version.
- //
- // The first version returns a value of size 1, and the second
- // version returns a value of size 2. Therefore, by checking the
- // size of Helper(x), which can be done at compile time, we can tell
- // which version of Helper() is used, and hence whether x can be
- // implicitly converted to type To.
- static char Helper(To);
- static char (&Helper(...))[2]; // NOLINT
-
- // We have to put the 'public' section after the 'private' section,
- // or MSVC refuses to compile the code.
- public:
-#if defined(__BORLANDC__)
- // C++Builder cannot use member overload resolution during template
- // instantiation. The simplest workaround is to use its C++0x type traits
- // functions (C++Builder 2009 and above only).
- static const bool value = __is_convertible(From, To);
-#else
- // MSVC warns about implicitly converting from double to int for
- // possible loss of data, so we need to temporarily disable the
- // warning.
- GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244)
- static const bool value =
- sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
- GTEST_DISABLE_MSC_WARNINGS_POP_()
-#endif // __BORLANDC__
-};
-template <typename From, typename To>
-const bool ImplicitlyConvertible<From, To>::value;
-
// IsAProtocolMessage<T>::value is a compile-time bool constant that's
// true iff T is type ProtocolMessage, proto2::Message, or a subclass
// of those.
template <typename T>
struct IsAProtocolMessage
: public bool_constant<
- ImplicitlyConvertible<const T*, const ::ProtocolMessage*>::value ||
- ImplicitlyConvertible<const T*, const ::proto2::Message*>::value> {
+ std::is_convertible<const T*, const ::ProtocolMessage*>::value ||
+ std::is_convertible<const T*, const ::proto2::Message*>::value> {
};
// When the compiler sees expression IsContainerTest<C>(0), if C is an
diff --git a/googletest/samples/sample6_unittest.cc b/googletest/samples/sample6_unittest.cc
index d234429..9a9d917 100644
--- a/googletest/samples/sample6_unittest.cc
+++ b/googletest/samples/sample6_unittest.cc
@@ -92,7 +92,7 @@ using testing::Types;
// The list of types we want to test.
typedef Types<OnTheFlyPrimeTable, PreCalculatedPrimeTable> Implementations;
-TYPED_TEST_CASE(PrimeTableTest, Implementations);
+TYPED_TEST_SUITE(PrimeTableTest, Implementations);
// Then use TYPED_TEST(TestCaseName, TestName) to define a typed test,
// similar to TEST_F.
@@ -163,7 +163,7 @@ class PrimeTableTest2 : public PrimeTableTest<T> {
// Then, declare the test case. The argument is the name of the test
// fixture, and also the name of the test case (as usual). The _P
// suffix is for "parameterized" or "pattern".
-TYPED_TEST_CASE_P(PrimeTableTest2);
+TYPED_TEST_SUITE_P(PrimeTableTest2);
// Next, use TYPED_TEST_P(TestCaseName, TestName) to define a test,
// similar to what you do with TEST_F.
@@ -196,7 +196,7 @@ TYPED_TEST_P(PrimeTableTest2, CanGetNextPrime) {
// Type-parameterized tests involve one extra step: you have to
// enumerate the tests you defined:
-REGISTER_TYPED_TEST_CASE_P(
+REGISTER_TYPED_TEST_SUITE_P(
PrimeTableTest2, // The first argument is the test case name.
// The rest of the arguments are the test names.
ReturnsFalseForNonPrimes, ReturnsTrueForPrimes, CanGetNextPrime);
@@ -216,9 +216,9 @@ REGISTER_TYPED_TEST_CASE_P(
// defined at the time we write the TYPED_TEST_P()s.
typedef Types<OnTheFlyPrimeTable, PreCalculatedPrimeTable>
PrimeTableImplementations;
-INSTANTIATE_TYPED_TEST_CASE_P(OnTheFlyAndPreCalculated, // Instance name
- PrimeTableTest2, // Test case name
- PrimeTableImplementations); // Type list
+INSTANTIATE_TYPED_TEST_SUITE_P(OnTheFlyAndPreCalculated, // Instance name
+ PrimeTableTest2, // Test case name
+ PrimeTableImplementations); // Type list
#endif // GTEST_HAS_TYPED_TEST_P
} // namespace
diff --git a/googletest/samples/sample7_unittest.cc b/googletest/samples/sample7_unittest.cc
index 7e6e35e..e0efc29 100644
--- a/googletest/samples/sample7_unittest.cc
+++ b/googletest/samples/sample7_unittest.cc
@@ -110,8 +110,8 @@ TEST_P(PrimeTableTestSmpl7, CanGetNextPrime) {
//
// Here, we instantiate our tests with a list of two PrimeTable object
// factory functions:
-INSTANTIATE_TEST_CASE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7,
- Values(&CreateOnTheFlyPrimeTable,
- &CreatePreCalculatedPrimeTable<1000>));
+INSTANTIATE_TEST_SUITE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7,
+ Values(&CreateOnTheFlyPrimeTable,
+ &CreatePreCalculatedPrimeTable<1000>));
} // namespace
diff --git a/googletest/samples/sample8_unittest.cc b/googletest/samples/sample8_unittest.cc
index 39163a8..10488b0 100644
--- a/googletest/samples/sample8_unittest.cc
+++ b/googletest/samples/sample8_unittest.cc
@@ -148,8 +148,7 @@ TEST_P(PrimeTableTest, CanGetNextPrime) {
// will put some of the tested numbers beyond the capability of the
// PrecalcPrimeTable instance and some inside it (10). Combine will produce all
// possible combinations.
-INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters,
- PrimeTableTest,
- Combine(Bool(), Values(1, 10)));
+INSTANTIATE_TEST_SUITE_P(MeaningfulTestParameters, PrimeTableTest,
+ Combine(Bool(), Values(1, 10)));
} // namespace
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 23b6e5f..d1cfb53 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -6020,6 +6020,22 @@ void InitGoogleTest(int* argc, wchar_t** argv) {
#endif // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
}
+// This overloaded version can be used on Arduino/embedded platforms where
+// there is no argc/argv.
+void InitGoogleTest() {
+ // Since Arduino doesn't have a command line, fake out the argc/argv arguments
+ int argc = 1;
+ const auto arg0 = "dummy";
+ char* argv0 = const_cast<char*>(arg0);
+ char** argv = &argv0;
+
+#if defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
+ GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_(&argc, argv);
+#else // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
+ internal::InitGoogleTestImpl(&argc, argv);
+#endif // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
+}
+
std::string TempDir() {
#if defined(GTEST_CUSTOM_TEMPDIR_FUNCTION_)
return GTEST_CUSTOM_TEMPDIR_FUNCTION_();
diff --git a/googletest/src/gtest_main.cc b/googletest/src/gtest_main.cc
index 92285a3..f6e1dd9 100644
--- a/googletest/src/gtest_main.cc
+++ b/googletest/src/gtest_main.cc
@@ -27,14 +27,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include <stdio.h>
+#include <cstdio>
#include "gtest/gtest.h"
#ifdef ARDUINO
void setup() {
- int argc = 0;
- char** argv = nullptr;
- testing::InitGoogleTest(&argc, argv);
+ testing::InitGoogleTest();
}
void loop() { RUN_ALL_TESTS(); }
@@ -46,6 +44,4 @@ GTEST_API_ int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
-
#endif
-
diff --git a/googletest/test/googletest-catch-exceptions-test.py b/googletest/test/googletest-catch-exceptions-test.py
index 6a4dce2..4e90be7 100755
--- a/googletest/test/googletest-catch-exceptions-test.py
+++ b/googletest/test/googletest-catch-exceptions-test.py
@@ -89,9 +89,9 @@ if SUPPORTS_SEH_EXCEPTIONS:
self.assert_('SEH exception with code 0x2a thrown '
'in the test fixture\'s destructor'
in test_output)
- self.assert_('SEH exception with code 0x2a thrown in SetUpTestCase()'
+ self.assert_('SEH exception with code 0x2a thrown in SetUpTestSuite()'
in test_output)
- self.assert_('SEH exception with code 0x2a thrown in TearDownTestCase()'
+ self.assert_('SEH exception with code 0x2a thrown in TearDownTestSuite()'
in test_output)
self.assert_('SEH exception with code 0x2a thrown in SetUp()'
in test_output)
@@ -134,29 +134,29 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
'"Standard C++ exception" thrown '
'in the test fixture\'s destructor'
in EX_BINARY_OUTPUT)
- self.assert_('CxxExceptionInDestructorTest::TearDownTestCase() '
+ self.assert_('CxxExceptionInDestructorTest::TearDownTestSuite() '
'called as expected.'
in EX_BINARY_OUTPUT)
def testCatchesCxxExceptionsInSetUpTestCase(self):
self.assert_('C++ exception with description "Standard C++ exception"'
' thrown in SetUpTestSuite()' in EX_BINARY_OUTPUT)
- self.assert_('CxxExceptionInConstructorTest::TearDownTestCase() '
+ self.assert_('CxxExceptionInConstructorTest::TearDownTestSuite() '
'called as expected.'
in EX_BINARY_OUTPUT)
- self.assert_('CxxExceptionInSetUpTestCaseTest constructor '
+ self.assert_('CxxExceptionInSetUpTestSuiteTest constructor '
'called as expected.'
in EX_BINARY_OUTPUT)
- self.assert_('CxxExceptionInSetUpTestCaseTest destructor '
+ self.assert_('CxxExceptionInSetUpTestSuiteTest destructor '
'called as expected.'
in EX_BINARY_OUTPUT)
- self.assert_('CxxExceptionInSetUpTestCaseTest::SetUp() '
+ self.assert_('CxxExceptionInSetUpTestSuiteTest::SetUp() '
'called as expected.'
in EX_BINARY_OUTPUT)
- self.assert_('CxxExceptionInSetUpTestCaseTest::TearDown() '
+ self.assert_('CxxExceptionInSetUpTestSuiteTest::TearDown() '
'called as expected.'
in EX_BINARY_OUTPUT)
- self.assert_('CxxExceptionInSetUpTestCaseTest test body '
+ self.assert_('CxxExceptionInSetUpTestSuiteTest test body '
'called as expected.'
in EX_BINARY_OUTPUT)
@@ -168,7 +168,7 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
self.assert_('C++ exception with description "Standard C++ exception"'
' thrown in SetUp()'
in EX_BINARY_OUTPUT)
- self.assert_('CxxExceptionInSetUpTest::TearDownTestCase() '
+ self.assert_('CxxExceptionInSetUpTest::TearDownTestSuite() '
'called as expected.'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInSetUpTest destructor '
@@ -186,7 +186,7 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
self.assert_('C++ exception with description "Standard C++ exception"'
' thrown in TearDown()'
in EX_BINARY_OUTPUT)
- self.assert_('CxxExceptionInTearDownTest::TearDownTestCase() '
+ self.assert_('CxxExceptionInTearDownTest::TearDownTestSuite() '
'called as expected.'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInTearDownTest destructor '
@@ -197,7 +197,7 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
self.assert_('C++ exception with description "Standard C++ exception"'
' thrown in the test body'
in EX_BINARY_OUTPUT)
- self.assert_('CxxExceptionInTestBodyTest::TearDownTestCase() '
+ self.assert_('CxxExceptionInTestBodyTest::TearDownTestSuite() '
'called as expected.'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInTestBodyTest destructor '
diff --git a/googletest/test/googletest-catch-exceptions-test_.cc b/googletest/test/googletest-catch-exceptions-test_.cc
index 8270f64..8c127d4 100644
--- a/googletest/test/googletest-catch-exceptions-test_.cc
+++ b/googletest/test/googletest-catch-exceptions-test_.cc
@@ -64,19 +64,20 @@ class SehExceptionInDestructorTest : public Test {
TEST_F(SehExceptionInDestructorTest, ThrowsExceptionInDestructor) {}
-class SehExceptionInSetUpTestCaseTest : public Test {
+class SehExceptionInSetUpTestSuiteTest : public Test {
public:
- static void SetUpTestCase() { RaiseException(42, 0, 0, NULL); }
+ static void SetUpTestSuite() { RaiseException(42, 0, 0, NULL); }
};
-TEST_F(SehExceptionInSetUpTestCaseTest, ThrowsExceptionInSetUpTestCase) {}
+TEST_F(SehExceptionInSetUpTestSuiteTest, ThrowsExceptionInSetUpTestSuite) {}
-class SehExceptionInTearDownTestCaseTest : public Test {
+class SehExceptionInTearDownTestSuiteTest : public Test {
public:
- static void TearDownTestCase() { RaiseException(42, 0, 0, NULL); }
+ static void TearDownTestSuite() { RaiseException(42, 0, 0, NULL); }
};
-TEST_F(SehExceptionInTearDownTestCaseTest, ThrowsExceptionInTearDownTestCase) {}
+TEST_F(SehExceptionInTearDownTestSuiteTest,
+ ThrowsExceptionInTearDownTestSuite) {}
class SehExceptionInSetUpTest : public Test {
protected:
@@ -109,9 +110,9 @@ class CxxExceptionInConstructorTest : public Test {
throw std::runtime_error("Standard C++ exception"));
}
- static void TearDownTestCase() {
+ static void TearDownTestSuite() {
printf("%s",
- "CxxExceptionInConstructorTest::TearDownTestCase() "
+ "CxxExceptionInConstructorTest::TearDownTestSuite() "
"called as expected.\n");
}
@@ -137,65 +138,65 @@ TEST_F(CxxExceptionInConstructorTest, ThrowsExceptionInConstructor) {
<< "called unexpectedly.";
}
-
-class CxxExceptionInSetUpTestCaseTest : public Test {
+class CxxExceptionInSetUpTestSuiteTest : public Test {
public:
- CxxExceptionInSetUpTestCaseTest() {
+ CxxExceptionInSetUpTestSuiteTest() {
printf("%s",
- "CxxExceptionInSetUpTestCaseTest constructor "
+ "CxxExceptionInSetUpTestSuiteTest constructor "
"called as expected.\n");
}
- static void SetUpTestCase() {
+ static void SetUpTestSuite() {
throw std::runtime_error("Standard C++ exception");
}
- static void TearDownTestCase() {
+ static void TearDownTestSuite() {
printf("%s",
- "CxxExceptionInSetUpTestCaseTest::TearDownTestCase() "
+ "CxxExceptionInSetUpTestSuiteTest::TearDownTestSuite() "
"called as expected.\n");
}
protected:
- ~CxxExceptionInSetUpTestCaseTest() override {
+ ~CxxExceptionInSetUpTestSuiteTest() override {
printf("%s",
- "CxxExceptionInSetUpTestCaseTest destructor "
+ "CxxExceptionInSetUpTestSuiteTest destructor "
"called as expected.\n");
}
void SetUp() override {
printf("%s",
- "CxxExceptionInSetUpTestCaseTest::SetUp() "
+ "CxxExceptionInSetUpTestSuiteTest::SetUp() "
"called as expected.\n");
}
void TearDown() override {
printf("%s",
- "CxxExceptionInSetUpTestCaseTest::TearDown() "
+ "CxxExceptionInSetUpTestSuiteTest::TearDown() "
"called as expected.\n");
}
};
-TEST_F(CxxExceptionInSetUpTestCaseTest, ThrowsExceptionInSetUpTestCase) {
+TEST_F(CxxExceptionInSetUpTestSuiteTest, ThrowsExceptionInSetUpTestSuite) {
printf("%s",
- "CxxExceptionInSetUpTestCaseTest test body "
+ "CxxExceptionInSetUpTestSuiteTest test body "
"called as expected.\n");
}
-class CxxExceptionInTearDownTestCaseTest : public Test {
+class CxxExceptionInTearDownTestSuiteTest : public Test {
public:
- static void TearDownTestCase() {
+ static void TearDownTestSuite() {
throw std::runtime_error("Standard C++ exception");
}
};
-TEST_F(CxxExceptionInTearDownTestCaseTest, ThrowsExceptionInTearDownTestCase) {}
+TEST_F(CxxExceptionInTearDownTestSuiteTest,
+ ThrowsExceptionInTearDownTestSuite) {}
class CxxExceptionInSetUpTest : public Test {
public:
- static void TearDownTestCase() {
+ static void TearDownTestSuite() {
printf("%s",
- "CxxExceptionInSetUpTest::TearDownTestCase() "
+ "CxxExceptionInSetUpTest::TearDownTestSuite() "
"called as expected.\n");
}
@@ -222,9 +223,9 @@ TEST_F(CxxExceptionInSetUpTest, ThrowsExceptionInSetUp) {
class CxxExceptionInTearDownTest : public Test {
public:
- static void TearDownTestCase() {
+ static void TearDownTestSuite() {
printf("%s",
- "CxxExceptionInTearDownTest::TearDownTestCase() "
+ "CxxExceptionInTearDownTest::TearDownTestSuite() "
"called as expected.\n");
}
@@ -244,9 +245,9 @@ TEST_F(CxxExceptionInTearDownTest, ThrowsExceptionInTearDown) {}
class CxxExceptionInTestBodyTest : public Test {
public:
- static void TearDownTestCase() {
+ static void TearDownTestSuite() {
printf("%s",
- "CxxExceptionInTestBodyTest::TearDownTestCase() "
+ "CxxExceptionInTestBodyTest::TearDownTestSuite() "
"called as expected.\n");
}
diff --git a/googletest/test/googletest-death-test-test.cc b/googletest/test/googletest-death-test-test.cc
index 78e05eb..01837ea 100644
--- a/googletest/test/googletest-death-test-test.cc
+++ b/googletest/test/googletest-death-test-test.cc
@@ -1017,12 +1017,12 @@ class MacroLogicDeathTest : public testing::Test {
static testing::internal::ReplaceDeathTestFactory* replacer_;
static MockDeathTestFactory* factory_;
- static void SetUpTestCase() {
+ static void SetUpTestSuite() {
factory_ = new MockDeathTestFactory;
replacer_ = new testing::internal::ReplaceDeathTestFactory(factory_);
}
- static void TearDownTestCase() {
+ static void TearDownTestSuite() {
delete replacer_;
replacer_ = nullptr;
delete factory_;
diff --git a/googletest/test/googletest-filter-unittest_.cc b/googletest/test/googletest-filter-unittest_.cc
index d335b60..d30ec9c 100644
--- a/googletest/test/googletest-filter-unittest_.cc
+++ b/googletest/test/googletest-filter-unittest_.cc
@@ -125,8 +125,8 @@ TEST_P(ParamTest, TestX) {
TEST_P(ParamTest, TestY) {
}
-INSTANTIATE_TEST_CASE_P(SeqP, ParamTest, testing::Values(1, 2));
-INSTANTIATE_TEST_CASE_P(SeqQ, ParamTest, testing::Values(5, 6));
+INSTANTIATE_TEST_SUITE_P(SeqP, ParamTest, testing::Values(1, 2));
+INSTANTIATE_TEST_SUITE_P(SeqQ, ParamTest, testing::Values(5, 6));
} // namespace
diff --git a/googletest/test/googletest-json-output-unittest.py b/googletest/test/googletest-json-output-unittest.py
index b09b590..93028ff 100644
--- a/googletest/test/googletest-json-output-unittest.py
+++ b/googletest/test/googletest-json-output-unittest.py
@@ -241,8 +241,8 @@ EXPECTED_NON_EMPTY = {
u'disabled': 0,
u'errors': 0,
u'time': u'*',
- u'SetUpTestCase': u'yes',
- u'TearDownTestCase': u'aye',
+ u'SetUpTestSuite': u'yes',
+ u'TearDownTestSuite': u'aye',
u'testsuite': [
{
u'name': u'OneProperty',
@@ -343,7 +343,7 @@ EXPECTED_NON_EMPTY = {
]
},
{
- u'name': u'Single/TypeParameterizedTestCase/0',
+ u'name': u'Single/TypeParameterizedTestSuite/0',
u'tests': 1,
u'failures': 0,
u'disabled': 0,
@@ -355,12 +355,12 @@ EXPECTED_NON_EMPTY = {
u'type_param': u'int',
u'status': u'RUN',
u'time': u'*',
- u'classname': u'Single/TypeParameterizedTestCase/0'
+ u'classname': u'Single/TypeParameterizedTestSuite/0'
}
]
},
{
- u'name': u'Single/TypeParameterizedTestCase/1',
+ u'name': u'Single/TypeParameterizedTestSuite/1',
u'tests': 1,
u'failures': 0,
u'disabled': 0,
@@ -372,7 +372,7 @@ EXPECTED_NON_EMPTY = {
u'type_param': u'long',
u'status': u'RUN',
u'time': u'*',
- u'classname': u'Single/TypeParameterizedTestCase/1'
+ u'classname': u'Single/TypeParameterizedTestSuite/1'
}
]
},
diff --git a/googletest/test/googletest-list-tests-unittest_.cc b/googletest/test/googletest-list-tests-unittest_.cc
index f473c7d..493c6f0 100644
--- a/googletest/test/googletest-list-tests-unittest_.cc
+++ b/googletest/test/googletest-list-tests-unittest_.cc
@@ -99,7 +99,7 @@ TEST_P(ValueParamTest, TestA) {
TEST_P(ValueParamTest, TestB) {
}
-INSTANTIATE_TEST_CASE_P(
+INSTANTIATE_TEST_SUITE_P(
MyInstantiation, ValueParamTest,
testing::Values(MyType("one line"),
MyType("two\nlines"),
@@ -123,7 +123,7 @@ class MyArray {
typedef testing::Types<VeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooogName, // NOLINT
int*, MyArray<bool, 42> > MyTypes;
-TYPED_TEST_CASE(TypedTest, MyTypes);
+TYPED_TEST_SUITE(TypedTest, MyTypes);
TYPED_TEST(TypedTest, TestA) {
}
@@ -137,7 +137,7 @@ template <typename T>
class TypeParamTest : public testing::Test {
};
-TYPED_TEST_CASE_P(TypeParamTest);
+TYPED_TEST_SUITE_P(TypeParamTest);
TYPED_TEST_P(TypeParamTest, TestA) {
}
@@ -145,9 +145,9 @@ TYPED_TEST_P(TypeParamTest, TestA) {
TYPED_TEST_P(TypeParamTest, TestB) {
}
-REGISTER_TYPED_TEST_CASE_P(TypeParamTest, TestA, TestB);
+REGISTER_TYPED_TEST_SUITE_P(TypeParamTest, TestA, TestB);
-INSTANTIATE_TYPED_TEST_CASE_P(My, TypeParamTest, MyTypes);
+INSTANTIATE_TYPED_TEST_SUITE_P(My, TypeParamTest, MyTypes);
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
diff --git a/googletest/test/googletest-listener-test.cc b/googletest/test/googletest-listener-test.cc
index e033109..f50faaf 100644
--- a/googletest/test/googletest-listener-test.cc
+++ b/googletest/test/googletest-listener-test.cc
@@ -40,7 +40,7 @@ using ::testing::AddGlobalTestEnvironment;
using ::testing::Environment;
using ::testing::InitGoogleTest;
using ::testing::Test;
-using ::testing::TestCase;
+using ::testing::TestSuite;
using ::testing::TestEventListener;
using ::testing::TestInfo;
using ::testing::TestPartResult;
@@ -206,12 +206,12 @@ class EnvironmentInvocationCatcher : public Environment {
class ListenerTest : public Test {
protected:
- static void SetUpTestCase() {
- g_events->push_back("ListenerTest::SetUpTestCase");
+ static void SetUpTestSuite() {
+ g_events->push_back("ListenerTest::SetUpTestSuite");
}
- static void TearDownTestCase() {
- g_events->push_back("ListenerTest::TearDownTestCase");
+ static void TearDownTestSuite() {
+ g_events->push_back("ListenerTest::TearDownTestSuite");
}
void SetUp() override { g_events->push_back("ListenerTest::SetUp"); }
@@ -299,7 +299,7 @@ int main(int argc, char **argv) {
"3rd.OnTestSuiteStart",
"1st.OnTestCaseStart",
"2nd.OnTestCaseStart",
- "ListenerTest::SetUpTestCase",
+ "ListenerTest::SetUpTestSuite",
"1st.OnTestStart",
"2nd.OnTestStart",
"3rd.OnTestStart",
@@ -324,7 +324,7 @@ int main(int argc, char **argv) {
"3rd.OnTestEnd",
"2nd.OnTestEnd",
"1st.OnTestEnd",
- "ListenerTest::TearDownTestCase",
+ "ListenerTest::TearDownTestSuite",
"3rd.OnTestSuiteEnd",
"2nd.OnTestCaseEnd",
"1st.OnTestCaseEnd",
@@ -351,7 +351,7 @@ int main(int argc, char **argv) {
"3rd.OnTestSuiteStart",
"1st.OnTestCaseStart",
"2nd.OnTestCaseStart",
- "ListenerTest::SetUpTestCase",
+ "ListenerTest::SetUpTestSuite",
"1st.OnTestStart",
"2nd.OnTestStart",
"3rd.OnTestStart",
@@ -376,7 +376,7 @@ int main(int argc, char **argv) {
"3rd.OnTestEnd",
"2nd.OnTestEnd",
"1st.OnTestEnd",
- "ListenerTest::TearDownTestCase",
+ "ListenerTest::TearDownTestSuite",
"3rd.OnTestSuiteEnd",
"2nd.OnTestCaseEnd",
"1st.OnTestCaseEnd",
diff --git a/googletest/test/googletest-output-test-golden-lin.txt b/googletest/test/googletest-output-test-golden-lin.txt
index 464a03a..29507fc 100644
--- a/googletest/test/googletest-output-test-golden-lin.txt
+++ b/googletest/test/googletest-output-test-golden-lin.txt
@@ -384,16 +384,16 @@ Expected failure in foo.cc
Stack trace: (omitted)
[ FAILED ] AddFailureAtTest.MessageContainsSpecifiedFileAndLineNumber
-[----------] 4 tests from MixedUpTestCaseTest
-[ RUN ] MixedUpTestCaseTest.FirstTestFromNamespaceFoo
-[ OK ] MixedUpTestCaseTest.FirstTestFromNamespaceFoo
-[ RUN ] MixedUpTestCaseTest.SecondTestFromNamespaceFoo
-[ OK ] MixedUpTestCaseTest.SecondTestFromNamespaceFoo
-[ RUN ] MixedUpTestCaseTest.ThisShouldFail
+[----------] 4 tests from MixedUpTestSuiteTest
+[ RUN ] MixedUpTestSuiteTest.FirstTestFromNamespaceFoo
+[ OK ] MixedUpTestSuiteTest.FirstTestFromNamespaceFoo
+[ RUN ] MixedUpTestSuiteTest.SecondTestFromNamespaceFoo
+[ OK ] MixedUpTestSuiteTest.SecondTestFromNamespaceFoo
+[ RUN ] MixedUpTestSuiteTest.ThisShouldFail
gtest.cc:#: Failure
Failed
All tests in the same test suite must use the same test fixture
-class. However, in test suite MixedUpTestCaseTest,
+class. However, in test suite MixedUpTestSuiteTest,
you defined test FirstTestFromNamespaceFoo and test ThisShouldFail
using two different test fixture classes. This can happen if
the two classes are from different namespaces or translation
@@ -401,12 +401,12 @@ units and have the same name. You should probably rename one
of the classes to put the tests into different test suites.
Stack trace: (omitted)
-[ FAILED ] MixedUpTestCaseTest.ThisShouldFail
-[ RUN ] MixedUpTestCaseTest.ThisShouldFailToo
+[ FAILED ] MixedUpTestSuiteTest.ThisShouldFail
+[ RUN ] MixedUpTestSuiteTest.ThisShouldFailToo
gtest.cc:#: Failure
Failed
All tests in the same test suite must use the same test fixture
-class. However, in test suite MixedUpTestCaseTest,
+class. However, in test suite MixedUpTestSuiteTest,
you defined test FirstTestFromNamespaceFoo and test ThisShouldFailToo
using two different test fixture classes. This can happen if
the two classes are from different namespaces or translation
@@ -414,15 +414,15 @@ units and have the same name. You should probably rename one
of the classes to put the tests into different test suites.
Stack trace: (omitted)
-[ FAILED ] MixedUpTestCaseTest.ThisShouldFailToo
-[----------] 2 tests from MixedUpTestCaseWithSameTestNameTest
-[ RUN ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
-[ OK ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
-[ RUN ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+[ FAILED ] MixedUpTestSuiteTest.ThisShouldFailToo
+[----------] 2 tests from MixedUpTestSuiteWithSameTestNameTest
+[ RUN ] MixedUpTestSuiteWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+[ OK ] MixedUpTestSuiteWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+[ RUN ] MixedUpTestSuiteWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
gtest.cc:#: Failure
Failed
All tests in the same test suite must use the same test fixture
-class. However, in test suite MixedUpTestCaseWithSameTestNameTest,
+class. However, in test suite MixedUpTestSuiteWithSameTestNameTest,
you defined test TheSecondTestWithThisNameShouldFail and test TheSecondTestWithThisNameShouldFail
using two different test fixture classes. This can happen if
the two classes are from different namespaces or translation
@@ -430,7 +430,7 @@ units and have the same name. You should probably rename one
of the classes to put the tests into different test suites.
Stack trace: (omitted)
-[ FAILED ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+[ FAILED ] MixedUpTestSuiteWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
[----------] 2 tests from TEST_F_before_TEST_in_same_test_case
[ RUN ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F
[ OK ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F
@@ -871,7 +871,7 @@ Stack trace: (omitted)
[ FAILED ] ScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread
[----------] 2 tests from DynamicFixture
-DynamicFixture::SetUpTestCase
+DynamicFixture::SetUpTestSuite
[ RUN ] DynamicFixture.DynamicTestPass
DynamicFixture()
DynamicFixture::SetUp
@@ -890,18 +890,18 @@ Stack trace: (omitted)
DynamicFixture::TearDown
~DynamicFixture()
[ FAILED ] DynamicFixture.DynamicTestFail
-DynamicFixture::TearDownTestCase
+DynamicFixture::TearDownTestSuite
[----------] 1 test from DynamicFixtureAnotherName
-DynamicFixture::SetUpTestCase
+DynamicFixture::SetUpTestSuite
[ RUN ] DynamicFixtureAnotherName.DynamicTestPass
DynamicFixture()
DynamicFixture::SetUp
DynamicFixture::TearDown
~DynamicFixture()
[ OK ] DynamicFixtureAnotherName.DynamicTestPass
-DynamicFixture::TearDownTestCase
+DynamicFixture::TearDownTestSuite
[----------] 2 tests from BadDynamicFixture1
-DynamicFixture::SetUpTestCase
+DynamicFixture::SetUpTestSuite
[ RUN ] BadDynamicFixture1.FixtureBase
DynamicFixture()
DynamicFixture::SetUp
@@ -923,9 +923,9 @@ Stack trace: (omitted)
~DynamicFixture()
[ FAILED ] BadDynamicFixture1.TestBase
-DynamicFixture::TearDownTestCase
+DynamicFixture::TearDownTestSuite
[----------] 2 tests from BadDynamicFixture2
-DynamicFixture::SetUpTestCase
+DynamicFixture::SetUpTestSuite
[ RUN ] BadDynamicFixture2.FixtureBase
DynamicFixture()
DynamicFixture::SetUp
@@ -947,7 +947,7 @@ Stack trace: (omitted)
~DynamicFixture()
[ FAILED ] BadDynamicFixture2.Derived
-DynamicFixture::TearDownTestCase
+DynamicFixture::TearDownTestSuite
[----------] 1 test from PrintingFailingParams/FailingParamTest
[ RUN ] PrintingFailingParams/FailingParamTest.Fails/0
googletest-output-test_.cc:#: Failure
@@ -1006,9 +1006,9 @@ Stack trace: (omitted)
[ FAILED ] NonFatalFailureInSetUpTest.FailureInSetUp
[ FAILED ] FatalFailureInSetUpTest.FailureInSetUp
[ FAILED ] AddFailureAtTest.MessageContainsSpecifiedFileAndLineNumber
-[ FAILED ] MixedUpTestCaseTest.ThisShouldFail
-[ FAILED ] MixedUpTestCaseTest.ThisShouldFailToo
-[ FAILED ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+[ FAILED ] MixedUpTestSuiteTest.ThisShouldFail
+[ FAILED ] MixedUpTestSuiteTest.ThisShouldFailToo
+[ FAILED ] MixedUpTestSuiteWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
[ FAILED ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail
[ FAILED ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail
[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure
diff --git a/googletest/test/googletest-output-test_.cc b/googletest/test/googletest-output-test_.cc
index f86d814..c6ce59e 100644
--- a/googletest/test/googletest-output-test_.cc
+++ b/googletest/test/googletest-output-test_.cc
@@ -92,9 +92,9 @@ TEST_P(FailingParamTest, Fails) {
// This generates a test which will fail. Google Test is expected to print
// its parameter when it outputs the list of all failed tests.
-INSTANTIATE_TEST_CASE_P(PrintingFailingParams,
- FailingParamTest,
- testing::Values(2));
+INSTANTIATE_TEST_SUITE_P(PrintingFailingParams,
+ FailingParamTest,
+ testing::Values(2));
static const char kGoldenString[] = "\"Line\0 1\"\nLine 2";
@@ -521,48 +521,48 @@ class DeathTestAndMultiThreadsTest : public testing::Test {
#endif // GTEST_IS_THREADSAFE
-// The MixedUpTestCaseTest test case verifies that Google Test will fail a
+// The MixedUpTestSuiteTest test case verifies that Google Test will fail a
// test if it uses a different fixture class than what other tests in
// the same test case use. It deliberately contains two fixture
// classes with the same name but defined in different namespaces.
-// The MixedUpTestCaseWithSameTestNameTest test case verifies that
+// The MixedUpTestSuiteWithSameTestNameTest test case verifies that
// when the user defines two tests with the same test case name AND
// same test name (but in different namespaces), the second test will
// fail.
namespace foo {
-class MixedUpTestCaseTest : public testing::Test {
+class MixedUpTestSuiteTest : public testing::Test {
};
-TEST_F(MixedUpTestCaseTest, FirstTestFromNamespaceFoo) {}
-TEST_F(MixedUpTestCaseTest, SecondTestFromNamespaceFoo) {}
+TEST_F(MixedUpTestSuiteTest, FirstTestFromNamespaceFoo) {}
+TEST_F(MixedUpTestSuiteTest, SecondTestFromNamespaceFoo) {}
-class MixedUpTestCaseWithSameTestNameTest : public testing::Test {
+class MixedUpTestSuiteWithSameTestNameTest : public testing::Test {
};
-TEST_F(MixedUpTestCaseWithSameTestNameTest,
+TEST_F(MixedUpTestSuiteWithSameTestNameTest,
TheSecondTestWithThisNameShouldFail) {}
} // namespace foo
namespace bar {
-class MixedUpTestCaseTest : public testing::Test {
+class MixedUpTestSuiteTest : public testing::Test {
};
// The following two tests are expected to fail. We rely on the
// golden file to check that Google Test generates the right error message.
-TEST_F(MixedUpTestCaseTest, ThisShouldFail) {}
-TEST_F(MixedUpTestCaseTest, ThisShouldFailToo) {}
+TEST_F(MixedUpTestSuiteTest, ThisShouldFail) {}
+TEST_F(MixedUpTestSuiteTest, ThisShouldFailToo) {}
-class MixedUpTestCaseWithSameTestNameTest : public testing::Test {
+class MixedUpTestSuiteWithSameTestNameTest : public testing::Test {
};
// Expected to fail. We rely on the golden file to check that Google Test
// generates the right error message.
-TEST_F(MixedUpTestCaseWithSameTestNameTest,
+TEST_F(MixedUpTestSuiteWithSameTestNameTest,
TheSecondTestWithThisNameShouldFail) {}
} // namespace bar
@@ -773,10 +773,10 @@ TEST_P(ParamTest, Failure) {
EXPECT_EQ("b", GetParam()) << "Expected failure";
}
-INSTANTIATE_TEST_CASE_P(PrintingStrings,
- ParamTest,
- testing::Values(std::string("a")),
- ParamNameFunc);
+INSTANTIATE_TEST_SUITE_P(PrintingStrings,
+ ParamTest,
+ testing::Values(std::string("a")),
+ ParamNameFunc);
// This #ifdef block tests the output of typed tests.
#if GTEST_HAS_TYPED_TEST
@@ -785,7 +785,7 @@ template <typename T>
class TypedTest : public testing::Test {
};
-TYPED_TEST_CASE(TypedTest, testing::Types<int>);
+TYPED_TEST_SUITE(TypedTest, testing::Types<int>);
TYPED_TEST(TypedTest, Success) {
EXPECT_EQ(0, TypeParam());
@@ -811,7 +811,7 @@ class TypedTestNames {
}
};
-TYPED_TEST_CASE(TypedTestWithNames, TypesForTestWithNames, TypedTestNames);
+TYPED_TEST_SUITE(TypedTestWithNames, TypesForTestWithNames, TypedTestNames);
TYPED_TEST(TypedTestWithNames, Success) {}
@@ -826,7 +826,7 @@ template <typename T>
class TypedTestP : public testing::Test {
};
-TYPED_TEST_CASE_P(TypedTestP);
+TYPED_TEST_SUITE_P(TypedTestP);
TYPED_TEST_P(TypedTestP, Success) {
EXPECT_EQ(0U, TypeParam());
@@ -836,10 +836,10 @@ TYPED_TEST_P(TypedTestP, Failure) {
EXPECT_EQ(1U, TypeParam()) << "Expected failure";
}
-REGISTER_TYPED_TEST_CASE_P(TypedTestP, Success, Failure);
+REGISTER_TYPED_TEST_SUITE_P(TypedTestP, Success, Failure);
typedef testing::Types<unsigned char, unsigned int> UnsignedTypes;
-INSTANTIATE_TYPED_TEST_CASE_P(Unsigned, TypedTestP, UnsignedTypes);
+INSTANTIATE_TYPED_TEST_SUITE_P(Unsigned, TypedTestP, UnsignedTypes);
class TypedTestPNames {
public:
@@ -854,7 +854,7 @@ class TypedTestPNames {
}
};
-INSTANTIATE_TYPED_TEST_CASE_P(UnsignedCustomName, TypedTestP, UnsignedTypes,
+INSTANTIATE_TYPED_TEST_SUITE_P(UnsignedCustomName, TypedTestP, UnsignedTypes,
TypedTestPNames);
#endif // GTEST_HAS_TYPED_TEST_P
@@ -877,7 +877,7 @@ class ATypedDeathTest : public testing::Test {
};
typedef testing::Types<int, double> NumericTypes;
-TYPED_TEST_CASE(ATypedDeathTest, NumericTypes);
+TYPED_TEST_SUITE(ATypedDeathTest, NumericTypes);
TYPED_TEST(ATypedDeathTest, ShouldRunFirst) {
}
@@ -894,14 +894,14 @@ template <typename T>
class ATypeParamDeathTest : public testing::Test {
};
-TYPED_TEST_CASE_P(ATypeParamDeathTest);
+TYPED_TEST_SUITE_P(ATypeParamDeathTest);
TYPED_TEST_P(ATypeParamDeathTest, ShouldRunFirst) {
}
-REGISTER_TYPED_TEST_CASE_P(ATypeParamDeathTest, ShouldRunFirst);
+REGISTER_TYPED_TEST_SUITE_P(ATypeParamDeathTest, ShouldRunFirst);
-INSTANTIATE_TYPED_TEST_CASE_P(My, ATypeParamDeathTest, NumericTypes);
+INSTANTIATE_TYPED_TEST_SUITE_P(My, ATypeParamDeathTest, NumericTypes);
# endif // GTEST_HAS_TYPED_TEST_P
@@ -1031,9 +1031,9 @@ class DynamicFixture : public testing::Test {
void SetUp() override { printf("DynamicFixture::SetUp\n"); }
void TearDown() override { printf("DynamicFixture::TearDown\n"); }
- static void SetUpTestCase() { printf("DynamicFixture::SetUpTestCase\n"); }
- static void TearDownTestCase() {
- printf("DynamicFixture::TearDownTestCase\n");
+ static void SetUpTestSuite() { printf("DynamicFixture::SetUpTestSuite\n"); }
+ static void TearDownTestSuite() {
+ printf("DynamicFixture::TearDownTestSuite\n");
}
};
diff --git a/googletest/test/googletest-param-test-invalid-name1-test_.cc b/googletest/test/googletest-param-test-invalid-name1-test_.cc
index 5a95155..955d699 100644
--- a/googletest/test/googletest-param-test-invalid-name1-test_.cc
+++ b/googletest/test/googletest-param-test-invalid-name1-test_.cc
@@ -36,10 +36,10 @@ class DummyTest : public ::testing::TestWithParam<const char *> {};
TEST_P(DummyTest, Dummy) {
}
-INSTANTIATE_TEST_CASE_P(InvalidTestName,
- DummyTest,
- ::testing::Values("InvalidWithQuotes"),
- ::testing::PrintToStringParamName());
+INSTANTIATE_TEST_SUITE_P(InvalidTestName,
+ DummyTest,
+ ::testing::Values("InvalidWithQuotes"),
+ ::testing::PrintToStringParamName());
} // namespace
diff --git a/googletest/test/googletest-param-test-invalid-name2-test_.cc b/googletest/test/googletest-param-test-invalid-name2-test_.cc
index ef09349..76371df 100644
--- a/googletest/test/googletest-param-test-invalid-name2-test_.cc
+++ b/googletest/test/googletest-param-test-invalid-name2-test_.cc
@@ -41,10 +41,10 @@ std::string StringParamTestSuffix(
TEST_P(DummyTest, Dummy) {
}
-INSTANTIATE_TEST_CASE_P(DuplicateTestNames,
- DummyTest,
- ::testing::Values("a", "b", "a", "c"),
- StringParamTestSuffix);
+INSTANTIATE_TEST_SUITE_P(DuplicateTestNames,
+ DummyTest,
+ ::testing::Values("a", "b", "a", "c"),
+ StringParamTestSuffix);
} // namespace
int main(int argc, char *argv[]) {
diff --git a/googletest/test/googletest-param-test-test.cc b/googletest/test/googletest-param-test-test.cc
index fc33378..626c1b9 100644
--- a/googletest/test/googletest-param-test-test.cc
+++ b/googletest/test/googletest-param-test-test.cc
@@ -542,12 +542,12 @@ TEST(ParamGeneratorTest, AssignmentWorks) {
// This test verifies that the tests are expanded and run as specified:
// one test per element from the sequence produced by the generator
-// specified in INSTANTIATE_TEST_CASE_P. It also verifies that the test's
+// specified in INSTANTIATE_TEST_SUITE_P. It also verifies that the test's
// fixture constructor, SetUp(), and TearDown() have run and have been
// supplied with the correct parameters.
// The use of environment object allows detection of the case where no test
-// case functionality is run at all. In this case TestCaseTearDown will not
+// case functionality is run at all. In this case TearDownTestSuite will not
// be able to detect missing tests, naturally.
template <int kExpectedCalls>
class TestGenerationEnvironment : public ::testing::Environment {
@@ -628,7 +628,7 @@ class TestGenerationTest : public TestWithParam<int> {
EXPECT_EQ(current_parameter_, GetParam());
}
- static void SetUpTestCase() {
+ static void SetUpTestSuite() {
bool all_tests_in_test_case_selected = true;
for (int i = 0; i < PARAMETER_COUNT; ++i) {
@@ -649,7 +649,7 @@ class TestGenerationTest : public TestWithParam<int> {
collected_parameters_.clear();
}
- static void TearDownTestCase() {
+ static void TearDownTestSuite() {
vector<int> expected_values(test_generation_params,
test_generation_params + PARAMETER_COUNT);
// Test execution order is not guaranteed by Google Test,
@@ -675,17 +675,17 @@ TEST_P(TestGenerationTest, TestsExpandedAndRun) {
EXPECT_EQ(current_parameter_, GetParam());
collected_parameters_.push_back(GetParam());
}
-INSTANTIATE_TEST_CASE_P(TestExpansionModule, TestGenerationTest,
- ValuesIn(test_generation_params));
+INSTANTIATE_TEST_SUITE_P(TestExpansionModule, TestGenerationTest,
+ ValuesIn(test_generation_params));
// This test verifies that the element sequence (third parameter of
-// INSTANTIATE_TEST_CASE_P) is evaluated in InitGoogleTest() and neither at
-// the call site of INSTANTIATE_TEST_CASE_P nor in RUN_ALL_TESTS(). For
+// INSTANTIATE_TEST_SUITE_P) is evaluated in InitGoogleTest() and neither at
+// the call site of INSTANTIATE_TEST_SUITE_P nor in RUN_ALL_TESTS(). For
// that, we declare param_value_ to be a static member of
// GeneratorEvaluationTest and initialize it to 0. We set it to 1 in
// main(), just before invocation of InitGoogleTest(). After calling
// InitGoogleTest(), we set the value to 2. If the sequence is evaluated
-// before or after InitGoogleTest, INSTANTIATE_TEST_CASE_P will create a
+// before or after InitGoogleTest, INSTANTIATE_TEST_SUITE_P will create a
// test with parameter other than 1, and the test body will fail the
// assertion.
class GeneratorEvaluationTest : public TestWithParam<int> {
@@ -701,9 +701,8 @@ int GeneratorEvaluationTest::param_value_ = 0;
TEST_P(GeneratorEvaluationTest, GeneratorsEvaluatedInMain) {
EXPECT_EQ(1, GetParam());
}
-INSTANTIATE_TEST_CASE_P(GenEvalModule,
- GeneratorEvaluationTest,
- Values(GeneratorEvaluationTest::param_value()));
+INSTANTIATE_TEST_SUITE_P(GenEvalModule, GeneratorEvaluationTest,
+ Values(GeneratorEvaluationTest::param_value()));
// Tests that generators defined in a different translation unit are
// functional. Generator extern_gen is defined in gtest-param-test_test2.cc.
@@ -714,9 +713,8 @@ TEST_P(ExternalGeneratorTest, ExternalGenerator) {
// which we verify here.
EXPECT_EQ(GetParam(), 33);
}
-INSTANTIATE_TEST_CASE_P(ExternalGeneratorModule,
- ExternalGeneratorTest,
- extern_gen);
+INSTANTIATE_TEST_SUITE_P(ExternalGeneratorModule, ExternalGeneratorTest,
+ extern_gen);
// Tests that a parameterized test case can be defined in one translation
// unit and instantiated in another. This test will be instantiated in
@@ -731,20 +729,19 @@ TEST_P(ExternalInstantiationTest, IsMultipleOf33) {
class MultipleInstantiationTest : public TestWithParam<int> {};
TEST_P(MultipleInstantiationTest, AllowsMultipleInstances) {
}
-INSTANTIATE_TEST_CASE_P(Sequence1, MultipleInstantiationTest, Values(1, 2));
-INSTANTIATE_TEST_CASE_P(Sequence2, MultipleInstantiationTest, Range(3, 5));
+INSTANTIATE_TEST_SUITE_P(Sequence1, MultipleInstantiationTest, Values(1, 2));
+INSTANTIATE_TEST_SUITE_P(Sequence2, MultipleInstantiationTest, Range(3, 5));
// Tests that a parameterized test case can be instantiated
// in multiple translation units. This test will be instantiated
// here and in gtest-param-test_test2.cc.
// InstantiationInMultipleTranslationUnitsTest fixture class
// is defined in gtest-param-test_test.h.
-TEST_P(InstantiationInMultipleTranslaionUnitsTest, IsMultipleOf42) {
+TEST_P(InstantiationInMultipleTranslationUnitsTest, IsMultipleOf42) {
EXPECT_EQ(0, GetParam() % 42);
}
-INSTANTIATE_TEST_CASE_P(Sequence1,
- InstantiationInMultipleTranslaionUnitsTest,
- Values(42, 42*2));
+INSTANTIATE_TEST_SUITE_P(Sequence1, InstantiationInMultipleTranslationUnitsTest,
+ Values(42, 42 * 2));
// Tests that each iteration of parameterized test runs in a separate test
// object.
@@ -752,7 +749,7 @@ class SeparateInstanceTest : public TestWithParam<int> {
public:
SeparateInstanceTest() : count_(0) {}
- static void TearDownTestCase() {
+ static void TearDownTestSuite() {
EXPECT_GE(global_count_, 2)
<< "If some (but not all) SeparateInstanceTest tests have been "
<< "filtered out this test will fail. Make sure that all "
@@ -770,20 +767,20 @@ TEST_P(SeparateInstanceTest, TestsRunInSeparateInstances) {
EXPECT_EQ(0, count_++);
global_count_++;
}
-INSTANTIATE_TEST_CASE_P(FourElemSequence, SeparateInstanceTest, Range(1, 4));
+INSTANTIATE_TEST_SUITE_P(FourElemSequence, SeparateInstanceTest, Range(1, 4));
// Tests that all instantiations of a test have named appropriately. Test
-// defined with TEST_P(TestCaseName, TestName) and instantiated with
-// INSTANTIATE_TEST_CASE_P(SequenceName, TestCaseName, generator) must be named
-// SequenceName/TestCaseName.TestName/i, where i is the 0-based index of the
-// sequence element used to instantiate the test.
+// defined with TEST_P(TestSuiteName, TestName) and instantiated with
+// INSTANTIATE_TEST_SUITE_P(SequenceName, TestSuiteName, generator) must be
+// named SequenceName/TestSuiteName.TestName/i, where i is the 0-based index of
+// the sequence element used to instantiate the test.
class NamingTest : public TestWithParam<int> {};
TEST_P(NamingTest, TestsReportCorrectNamesAndParameters) {
const ::testing::TestInfo* const test_info =
::testing::UnitTest::GetInstance()->current_test_info();
- EXPECT_STREQ("ZeroToFiveSequence/NamingTest", test_info->test_case_name());
+ EXPECT_STREQ("ZeroToFiveSequence/NamingTest", test_info->test_suite_name());
Message index_stream;
index_stream << "TestsReportCorrectNamesAndParameters/" << GetParam();
@@ -792,7 +789,7 @@ TEST_P(NamingTest, TestsReportCorrectNamesAndParameters) {
EXPECT_EQ(::testing::PrintToString(GetParam()), test_info->value_param());
}
-INSTANTIATE_TEST_CASE_P(ZeroToFiveSequence, NamingTest, Range(0, 5));
+INSTANTIATE_TEST_SUITE_P(ZeroToFiveSequence, NamingTest, Range(0, 5));
// Tests that macros in test names are expanded correctly.
class MacroNamingTest : public TestWithParam<int> {};
@@ -804,11 +801,11 @@ TEST_P(PREFIX_WITH_MACRO(NamingTest), PREFIX_WITH_FOO(SomeTestName)) {
const ::testing::TestInfo* const test_info =
::testing::UnitTest::GetInstance()->current_test_info();
- EXPECT_STREQ("FortyTwo/MacroNamingTest", test_info->test_case_name());
+ EXPECT_STREQ("FortyTwo/MacroNamingTest", test_info->test_suite_name());
EXPECT_STREQ("FooSomeTestName", test_info->name());
}
-INSTANTIATE_TEST_CASE_P(FortyTwo, MacroNamingTest, Values(42));
+INSTANTIATE_TEST_SUITE_P(FortyTwo, MacroNamingTest, Values(42));
// Tests the same thing for non-parametrized tests.
class MacroNamingTestNonParametrized : public ::testing::Test {};
@@ -818,7 +815,7 @@ TEST_F(PREFIX_WITH_MACRO(NamingTestNonParametrized),
const ::testing::TestInfo* const test_info =
::testing::UnitTest::GetInstance()->current_test_info();
- EXPECT_STREQ("MacroNamingTestNonParametrized", test_info->test_case_name());
+ EXPECT_STREQ("MacroNamingTestNonParametrized", test_info->test_suite_name());
EXPECT_STREQ("FooSomeTestName", test_info->name());
}
@@ -835,17 +832,14 @@ struct CustomParamNameFunctor {
}
};
-INSTANTIATE_TEST_CASE_P(CustomParamNameFunctor,
- CustomFunctorNamingTest,
- Values(std::string("FunctorName")),
- CustomParamNameFunctor());
+INSTANTIATE_TEST_SUITE_P(CustomParamNameFunctor, CustomFunctorNamingTest,
+ Values(std::string("FunctorName")),
+ CustomParamNameFunctor());
-INSTANTIATE_TEST_CASE_P(AllAllowedCharacters,
- CustomFunctorNamingTest,
- Values("abcdefghijklmnopqrstuvwxyz",
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
- "01234567890_"),
- CustomParamNameFunctor());
+INSTANTIATE_TEST_SUITE_P(AllAllowedCharacters, CustomFunctorNamingTest,
+ Values("abcdefghijklmnopqrstuvwxyz",
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "01234567890_"),
+ CustomParamNameFunctor());
inline std::string CustomParamNameFunction(
const ::testing::TestParamInfo<std::string>& inf) {
@@ -855,33 +849,30 @@ inline std::string CustomParamNameFunction(
class CustomFunctionNamingTest : public TestWithParam<std::string> {};
TEST_P(CustomFunctionNamingTest, CustomTestNames) {}
-INSTANTIATE_TEST_CASE_P(CustomParamNameFunction,
- CustomFunctionNamingTest,
- Values(std::string("FunctionName")),
- CustomParamNameFunction);
+INSTANTIATE_TEST_SUITE_P(CustomParamNameFunction, CustomFunctionNamingTest,
+ Values(std::string("FunctionName")),
+ CustomParamNameFunction);
// Test custom naming with a lambda
class CustomLambdaNamingTest : public TestWithParam<std::string> {};
TEST_P(CustomLambdaNamingTest, CustomTestNames) {}
-INSTANTIATE_TEST_CASE_P(CustomParamNameLambda, CustomLambdaNamingTest,
- Values(std::string("LambdaName")),
- [](const ::testing::TestParamInfo<std::string>& inf) {
- return inf.param;
- });
+INSTANTIATE_TEST_SUITE_P(CustomParamNameLambda, CustomLambdaNamingTest,
+ Values(std::string("LambdaName")),
+ [](const ::testing::TestParamInfo<std::string>& inf) {
+ return inf.param;
+ });
TEST(CustomNamingTest, CheckNameRegistry) {
::testing::UnitTest* unit_test = ::testing::UnitTest::GetInstance();
std::set<std::string> test_names;
- for (int case_num = 0;
- case_num < unit_test->total_test_case_count();
- ++case_num) {
- const ::testing::TestCase* test_case = unit_test->GetTestCase(case_num);
- for (int test_num = 0;
- test_num < test_case->total_test_count();
+ for (int suite_num = 0; suite_num < unit_test->total_test_suite_count();
+ ++suite_num) {
+ const ::testing::TestSuite* test_suite = unit_test->GetTestSuite(suite_num);
+ for (int test_num = 0; test_num < test_suite->total_test_count();
++test_num) {
- const ::testing::TestInfo* test_info = test_case->GetTestInfo(test_num);
+ const ::testing::TestInfo* test_info = test_suite->GetTestInfo(test_num);
test_names.insert(std::string(test_info->name()));
}
}
@@ -902,10 +893,8 @@ TEST_P(CustomIntegerNamingTest, TestsReportCorrectNames) {
EXPECT_STREQ(test_name_stream.GetString().c_str(), test_info->name());
}
-INSTANTIATE_TEST_CASE_P(PrintToString,
- CustomIntegerNamingTest,
- Range(0, 5),
- ::testing::PrintToStringParamName());
+INSTANTIATE_TEST_SUITE_P(PrintToString, CustomIntegerNamingTest, Range(0, 5),
+ ::testing::PrintToStringParamName());
// Test a custom struct with PrintToString.
@@ -929,10 +918,9 @@ TEST_P(CustomStructNamingTest, TestsReportCorrectNames) {
EXPECT_STREQ(test_name_stream.GetString().c_str(), test_info->name());
}
-INSTANTIATE_TEST_CASE_P(PrintToString,
- CustomStructNamingTest,
- Values(CustomStruct(0), CustomStruct(1)),
- ::testing::PrintToStringParamName());
+INSTANTIATE_TEST_SUITE_P(PrintToString, CustomStructNamingTest,
+ Values(CustomStruct(0), CustomStruct(1)),
+ ::testing::PrintToStringParamName());
// Test that using a stateful parameter naming function works as expected.
@@ -961,10 +949,8 @@ TEST_P(StatefulNamingTest, TestsReportCorrectNames) {
EXPECT_STREQ(test_name_stream.GetString().c_str(), test_info->name());
}
-INSTANTIATE_TEST_CASE_P(StatefulNamingFunctor,
- StatefulNamingTest,
- Range(0, 5),
- StatefulNamingFunctor());
+INSTANTIATE_TEST_SUITE_P(StatefulNamingFunctor, StatefulNamingTest, Range(0, 5),
+ StatefulNamingFunctor());
// Class that cannot be streamed into an ostream. It needs to be copyable
// (and, in case of MSVC, also assignable) in order to be a test parameter
@@ -987,9 +973,8 @@ TEST_P(CommentTest, TestsCorrectlyReportUnstreamableParams) {
EXPECT_EQ(::testing::PrintToString(GetParam()), test_info->value_param());
}
-INSTANTIATE_TEST_CASE_P(InstantiationWithComments,
- CommentTest,
- Values(Unstreamable(1)));
+INSTANTIATE_TEST_SUITE_P(InstantiationWithComments, CommentTest,
+ Values(Unstreamable(1)));
// Verify that we can create a hierarchy of test fixtures, where the base
// class fixture is not parameterized and the derived class is. In this case
@@ -1029,7 +1014,8 @@ TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
".* value-parameterized test .*");
}
-INSTANTIATE_TEST_CASE_P(RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5));
+INSTANTIATE_TEST_SUITE_P(RangeZeroToFive, ParameterizedDerivedTest,
+ Range(0, 5));
// Tests param generator working with Enums
enum MyEnums {
@@ -1041,19 +1027,19 @@ enum MyEnums {
class MyEnumTest : public testing::TestWithParam<MyEnums> {};
TEST_P(MyEnumTest, ChecksParamMoreThanZero) { EXPECT_GE(10, GetParam()); }
-INSTANTIATE_TEST_CASE_P(MyEnumTests, MyEnumTest,
- ::testing::Values(ENUM1, ENUM2, 0));
+INSTANTIATE_TEST_SUITE_P(MyEnumTests, MyEnumTest,
+ ::testing::Values(ENUM1, ENUM2, 0));
int main(int argc, char **argv) {
- // Used in TestGenerationTest test case.
+ // Used in TestGenerationTest test suite.
AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance());
- // Used in GeneratorEvaluationTest test case. Tests that the updated value
+ // Used in GeneratorEvaluationTest test suite. Tests that the updated value
// will be picked up for instantiating tests in GeneratorEvaluationTest.
GeneratorEvaluationTest::set_param_value(1);
::testing::InitGoogleTest(&argc, argv);
- // Used in GeneratorEvaluationTest test case. Tests that value updated
+ // Used in GeneratorEvaluationTest test suite. Tests that value updated
// here will NOT be used for instantiating tests in
// GeneratorEvaluationTest.
GeneratorEvaluationTest::set_param_value(2);
diff --git a/googletest/test/googletest-param-test-test.h b/googletest/test/googletest-param-test-test.h
index 632a61f..6480570 100644
--- a/googletest/test/googletest-param-test-test.h
+++ b/googletest/test/googletest-param-test-test.h
@@ -44,7 +44,7 @@ class ExternalInstantiationTest : public ::testing::TestWithParam<int> {
// Test fixture for testing instantiation of a test in multiple
// translation units.
-class InstantiationInMultipleTranslaionUnitsTest
+class InstantiationInMultipleTranslationUnitsTest
: public ::testing::TestWithParam<int> {
};
diff --git a/googletest/test/googletest-param-test2-test.cc b/googletest/test/googletest-param-test2-test.cc
index 25bb945..2a29fb1 100644
--- a/googletest/test/googletest-param-test2-test.cc
+++ b/googletest/test/googletest-param-test2-test.cc
@@ -46,16 +46,16 @@ ParamGenerator<int> extern_gen = Values(33);
// and instantiated in another. The test is defined in
// googletest-param-test-test.cc and ExternalInstantiationTest fixture class is
// defined in gtest-param-test_test.h.
-INSTANTIATE_TEST_CASE_P(MultiplesOf33,
- ExternalInstantiationTest,
- Values(33, 66));
+INSTANTIATE_TEST_SUITE_P(MultiplesOf33,
+ ExternalInstantiationTest,
+ Values(33, 66));
// Tests that a parameterized test case can be instantiated
// in multiple translation units. Another instantiation is defined
// in googletest-param-test-test.cc and
-// InstantiationInMultipleTranslaionUnitsTest fixture is defined in
+// InstantiationInMultipleTranslationUnitsTest fixture is defined in
// gtest-param-test_test.h
-INSTANTIATE_TEST_CASE_P(Sequence2,
- InstantiationInMultipleTranslaionUnitsTest,
- Values(42*3, 42*4, 42*5));
+INSTANTIATE_TEST_SUITE_P(Sequence2,
+ InstantiationInMultipleTranslationUnitsTest,
+ Values(42*3, 42*4, 42*5));
diff --git a/googletest/test/googletest-port-test.cc b/googletest/test/googletest-port-test.cc
index e6a227b..8d6aa28 100644
--- a/googletest/test/googletest-port-test.cc
+++ b/googletest/test/googletest-port-test.cc
@@ -393,7 +393,7 @@ typedef testing::Types<
# endif // GTEST_HAS_GLOBAL_STRING
const char*> StringTypes;
-TYPED_TEST_CASE(RETest, StringTypes);
+TYPED_TEST_SUITE(RETest, StringTypes);
// Tests RE's implicit constructors.
TYPED_TEST(RETest, ImplicitConstructorWorks) {
diff --git a/googletest/test/googletest-printers-test.cc b/googletest/test/googletest-printers-test.cc
index 961e818..5ce2a77 100644
--- a/googletest/test/googletest-printers-test.cc
+++ b/googletest/test/googletest-printers-test.cc
@@ -1023,16 +1023,20 @@ TEST(PrintNullptrT, Basic) {
TEST(PrintReferenceWrapper, Printable) {
int x = 5;
- EXPECT_EQ("5", Print(std::ref(x)));
- EXPECT_EQ("5", Print(std::cref(x)));
+ EXPECT_EQ("@" + PrintPointer(&x) + " 5", Print(std::ref(x)));
+ EXPECT_EQ("@" + PrintPointer(&x) + " 5", Print(std::cref(x)));
}
TEST(PrintReferenceWrapper, Unprintable) {
::foo::UnprintableInFoo up;
- EXPECT_EQ("16-byte object <EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>",
- Print(std::ref(up)));
- EXPECT_EQ("16-byte object <EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>",
- Print(std::cref(up)));
+ EXPECT_EQ(
+ "@" + PrintPointer(&up) +
+ " 16-byte object <EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>",
+ Print(std::ref(up)));
+ EXPECT_EQ(
+ "@" + PrintPointer(&up) +
+ " 16-byte object <EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>",
+ Print(std::cref(up)));
}
// Tests printing user-defined unprintable types.
diff --git a/googletest/test/googletest-test2_test.cc b/googletest/test/googletest-test2_test.cc
index c2f98dc..2e425da 100644
--- a/googletest/test/googletest-test2_test.cc
+++ b/googletest/test/googletest-test2_test.cc
@@ -46,16 +46,16 @@ ParamGenerator<int> extern_gen_2 = Values(33);
// and instantiated in another. The test is defined in
// googletest-param-test-test.cc and ExternalInstantiationTest fixture class is
// defined in gtest-param-test_test.h.
-INSTANTIATE_TEST_CASE_P(MultiplesOf33,
- ExternalInstantiationTest,
- Values(33, 66));
+INSTANTIATE_TEST_SUITE_P(MultiplesOf33,
+ ExternalInstantiationTest,
+ Values(33, 66));
// Tests that a parameterized test case can be instantiated
// in multiple translation units. Another instantiation is defined
// in googletest-param-test-test.cc and
-// InstantiationInMultipleTranslaionUnitsTest fixture is defined in
+// InstantiationInMultipleTranslationUnitsTest fixture is defined in
// gtest-param-test_test.h
-INSTANTIATE_TEST_CASE_P(Sequence2,
- InstantiationInMultipleTranslaionUnitsTest,
- Values(42*3, 42*4, 42*5));
+INSTANTIATE_TEST_SUITE_P(Sequence2,
+ InstantiationInMultipleTranslationUnitsTest,
+ Values(42*3, 42*4, 42*5));
diff --git a/googletest/test/gtest-typed-test2_test.cc b/googletest/test/gtest-typed-test2_test.cc
index ed96421..7000160 100644
--- a/googletest/test/gtest-typed-test2_test.cc
+++ b/googletest/test/gtest-typed-test2_test.cc
@@ -38,7 +38,7 @@
// Tests that the same type-parameterized test case can be
// instantiated in different translation units linked together.
// (ContainerTest is also instantiated in gtest-typed-test_test.cc.)
-INSTANTIATE_TYPED_TEST_CASE_P(Vector, ContainerTest,
- testing::Types<std::vector<int> >);
+INSTANTIATE_TYPED_TEST_SUITE_P(Vector, ContainerTest,
+ testing::Types<std::vector<int> >);
#endif // GTEST_HAS_TYPED_TEST_P
diff --git a/googletest/test/gtest-typed-test_test.cc b/googletest/test/gtest-typed-test_test.cc
index 4b0ae08..f1ca937 100644
--- a/googletest/test/gtest-typed-test_test.cc
+++ b/googletest/test/gtest-typed-test_test.cc
@@ -41,19 +41,19 @@ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127 /* conditional expression is constant */)
using testing::Test;
-// Used for testing that SetUpTestCase()/TearDownTestCase(), fixture
+// Used for testing that SetUpTestSuite()/TearDownTestSuite(), fixture
// ctor/dtor, and SetUp()/TearDown() work correctly in typed tests and
// type-parameterized test.
template <typename T>
class CommonTest : public Test {
- // For some technical reason, SetUpTestCase() and TearDownTestCase()
+ // For some technical reason, SetUpTestSuite() and TearDownTestSuite()
// must be public.
public:
- static void SetUpTestCase() {
+ static void SetUpTestSuite() {
shared_ = new T(5);
}
- static void TearDownTestCase() {
+ static void TearDownTestSuite() {
delete shared_;
shared_ = nullptr;
}
@@ -92,11 +92,11 @@ T* CommonTest<T>::shared_ = nullptr;
using testing::Types;
-// Tests that SetUpTestCase()/TearDownTestCase(), fixture ctor/dtor,
+// Tests that SetUpTestSuite()/TearDownTestSuite(), fixture ctor/dtor,
// and SetUp()/TearDown() work correctly in typed tests
typedef Types<char, int> TwoTypes;
-TYPED_TEST_CASE(CommonTest, TwoTypes);
+TYPED_TEST_SUITE(CommonTest, TwoTypes);
TYPED_TEST(CommonTest, ValuesAreCorrect) {
// Static members of the fixture class template can be visited via
@@ -128,25 +128,25 @@ TYPED_TEST(CommonTest, ValuesAreStillCorrect) {
EXPECT_EQ(static_cast<TypeParam>(2), this->value_);
}
-// Tests that multiple TYPED_TEST_CASE's can be defined in the same
+// Tests that multiple TYPED_TEST_SUITE's can be defined in the same
// translation unit.
template <typename T>
class TypedTest1 : public Test {
};
-// Verifies that the second argument of TYPED_TEST_CASE can be a
+// Verifies that the second argument of TYPED_TEST_SUITE can be a
// single type.
-TYPED_TEST_CASE(TypedTest1, int);
+TYPED_TEST_SUITE(TypedTest1, int);
TYPED_TEST(TypedTest1, A) {}
template <typename T>
class TypedTest2 : public Test {
};
-// Verifies that the second argument of TYPED_TEST_CASE can be a
+// Verifies that the second argument of TYPED_TEST_SUITE can be a
// Types<...> type list.
-TYPED_TEST_CASE(TypedTest2, Types<int>);
+TYPED_TEST_SUITE(TypedTest2, Types<int>);
// This also verifies that tests from different typed test cases can
// share the same name.
@@ -161,7 +161,7 @@ class NumericTest : public Test {
};
typedef Types<int, long> NumericTypes;
-TYPED_TEST_CASE(NumericTest, NumericTypes);
+TYPED_TEST_SUITE(NumericTest, NumericTypes);
TYPED_TEST(NumericTest, DefaultIsZero) {
EXPECT_EQ(0, TypeParam());
@@ -186,9 +186,9 @@ class TypedTestNames {
}
};
-TYPED_TEST_CASE(TypedTestWithNames, TwoTypes, TypedTestNames);
+TYPED_TEST_SUITE(TypedTestWithNames, TwoTypes, TypedTestNames);
-TYPED_TEST(TypedTestWithNames, TestCaseName) {
+TYPED_TEST(TypedTestWithNames, TestSuiteName) {
if (testing::internal::IsSame<TypeParam, char>::value) {
EXPECT_STREQ(::testing::UnitTest::GetInstance()
->current_test_info()
@@ -209,11 +209,11 @@ TYPED_TEST(TypedTestWithNames, TestCaseName) {
#if GTEST_HAS_TYPED_TEST_P
using testing::Types;
-using testing::internal::TypedTestCasePState;
+using testing::internal::TypedTestSuitePState;
-// Tests TypedTestCasePState.
+// Tests TypedTestSuitePState.
-class TypedTestCasePStateTest : public Test {
+class TypedTestSuitePStateTest : public Test {
protected:
void SetUp() override {
state_.AddTestName("foo.cc", 0, "FooTest", "A");
@@ -221,10 +221,10 @@ class TypedTestCasePStateTest : public Test {
state_.AddTestName("foo.cc", 0, "FooTest", "C");
}
- TypedTestCasePState state_;
+ TypedTestSuitePState state_;
};
-TEST_F(TypedTestCasePStateTest, SucceedsForMatchingList) {
+TEST_F(TypedTestSuitePStateTest, SucceedsForMatchingList) {
const char* tests = "A, B, C";
EXPECT_EQ(tests,
state_.VerifyRegisteredTestNames("foo.cc", 1, tests));
@@ -232,27 +232,27 @@ TEST_F(TypedTestCasePStateTest, SucceedsForMatchingList) {
// Makes sure that the order of the tests and spaces around the names
// don't matter.
-TEST_F(TypedTestCasePStateTest, IgnoresOrderAndSpaces) {
+TEST_F(TypedTestSuitePStateTest, IgnoresOrderAndSpaces) {
const char* tests = "A,C, B";
EXPECT_EQ(tests,
state_.VerifyRegisteredTestNames("foo.cc", 1, tests));
}
-typedef TypedTestCasePStateTest TypedTestCasePStateDeathTest;
+using TypedTestSuitePStateDeathTest = TypedTestSuitePStateTest;
-TEST_F(TypedTestCasePStateDeathTest, DetectsDuplicates) {
+TEST_F(TypedTestSuitePStateDeathTest, DetectsDuplicates) {
EXPECT_DEATH_IF_SUPPORTED(
state_.VerifyRegisteredTestNames("foo.cc", 1, "A, B, A, C"),
"foo\\.cc.1.?: Test A is listed more than once\\.");
}
-TEST_F(TypedTestCasePStateDeathTest, DetectsExtraTest) {
+TEST_F(TypedTestSuitePStateDeathTest, DetectsExtraTest) {
EXPECT_DEATH_IF_SUPPORTED(
state_.VerifyRegisteredTestNames("foo.cc", 1, "A, B, C, D"),
"foo\\.cc.1.?: No test named D can be found in this test suite\\.");
}
-TEST_F(TypedTestCasePStateDeathTest, DetectsMissedTest) {
+TEST_F(TypedTestSuitePStateDeathTest, DetectsMissedTest) {
EXPECT_DEATH_IF_SUPPORTED(
state_.VerifyRegisteredTestNames("foo.cc", 1, "A, C"),
"foo\\.cc.1.?: You forgot to list test B\\.");
@@ -260,7 +260,7 @@ TEST_F(TypedTestCasePStateDeathTest, DetectsMissedTest) {
// Tests that defining a test for a parameterized test case generates
// a run-time error if the test case has been registered.
-TEST_F(TypedTestCasePStateDeathTest, DetectsTestAfterRegistration) {
+TEST_F(TypedTestSuitePStateDeathTest, DetectsTestAfterRegistration) {
state_.VerifyRegisteredTestNames("foo.cc", 1, "A, B, C");
EXPECT_DEATH_IF_SUPPORTED(
state_.AddTestName("foo.cc", 2, "FooTest", "D"),
@@ -268,14 +268,14 @@ TEST_F(TypedTestCasePStateDeathTest, DetectsTestAfterRegistration) {
"\\(FooTest, \\.\\.\\.\\)\\.");
}
-// Tests that SetUpTestCase()/TearDownTestCase(), fixture ctor/dtor,
+// Tests that SetUpTestSuite()/TearDownTestSuite(), fixture ctor/dtor,
// and SetUp()/TearDown() work correctly in type-parameterized tests.
template <typename T>
class DerivedTest : public CommonTest<T> {
};
-TYPED_TEST_CASE_P(DerivedTest);
+TYPED_TEST_SUITE_P(DerivedTest);
TYPED_TEST_P(DerivedTest, ValuesAreCorrect) {
// Static members of the fixture class template can be visited via
@@ -297,20 +297,20 @@ TYPED_TEST_P(DerivedTest, ValuesAreStillCorrect) {
EXPECT_EQ(2, this->value_);
}
-REGISTER_TYPED_TEST_CASE_P(DerivedTest,
+REGISTER_TYPED_TEST_SUITE_P(DerivedTest,
ValuesAreCorrect, ValuesAreStillCorrect);
typedef Types<short, long> MyTwoTypes;
-INSTANTIATE_TYPED_TEST_CASE_P(My, DerivedTest, MyTwoTypes);
+INSTANTIATE_TYPED_TEST_SUITE_P(My, DerivedTest, MyTwoTypes);
// Tests that custom names work with type parametrized tests. We reuse the
// TwoTypes from above here.
template <typename T>
class TypeParametrizedTestWithNames : public Test {};
-TYPED_TEST_CASE_P(TypeParametrizedTestWithNames);
+TYPED_TEST_SUITE_P(TypeParametrizedTestWithNames);
-TYPED_TEST_P(TypeParametrizedTestWithNames, TestCaseName) {
+TYPED_TEST_P(TypeParametrizedTestWithNames, TestSuiteName) {
if (testing::internal::IsSame<TypeParam, char>::value) {
EXPECT_STREQ(::testing::UnitTest::GetInstance()
->current_test_info()
@@ -325,7 +325,7 @@ TYPED_TEST_P(TypeParametrizedTestWithNames, TestCaseName) {
}
}
-REGISTER_TYPED_TEST_CASE_P(TypeParametrizedTestWithNames, TestCaseName);
+REGISTER_TYPED_TEST_SUITE_P(TypeParametrizedTestWithNames, TestSuiteName);
class TypeParametrizedTestNames {
public:
@@ -340,62 +340,62 @@ class TypeParametrizedTestNames {
}
};
-INSTANTIATE_TYPED_TEST_CASE_P(CustomName, TypeParametrizedTestWithNames,
+INSTANTIATE_TYPED_TEST_SUITE_P(CustomName, TypeParametrizedTestWithNames,
TwoTypes, TypeParametrizedTestNames);
-// Tests that multiple TYPED_TEST_CASE_P's can be defined in the same
+// Tests that multiple TYPED_TEST_SUITE_P's can be defined in the same
// translation unit.
template <typename T>
class TypedTestP1 : public Test {
};
-TYPED_TEST_CASE_P(TypedTestP1);
+TYPED_TEST_SUITE_P(TypedTestP1);
-// For testing that the code between TYPED_TEST_CASE_P() and
+// For testing that the code between TYPED_TEST_SUITE_P() and
// TYPED_TEST_P() is not enclosed in a namespace.
-typedef int IntAfterTypedTestCaseP;
+using IntAfterTypedTestSuiteP = int;
TYPED_TEST_P(TypedTestP1, A) {}
TYPED_TEST_P(TypedTestP1, B) {}
// For testing that the code between TYPED_TEST_P() and
-// REGISTER_TYPED_TEST_CASE_P() is not enclosed in a namespace.
-typedef int IntBeforeRegisterTypedTestCaseP;
+// REGISTER_TYPED_TEST_SUITE_P() is not enclosed in a namespace.
+using IntBeforeRegisterTypedTestSuiteP = int;
-REGISTER_TYPED_TEST_CASE_P(TypedTestP1, A, B);
+REGISTER_TYPED_TEST_SUITE_P(TypedTestP1, A, B);
template <typename T>
class TypedTestP2 : public Test {
};
-TYPED_TEST_CASE_P(TypedTestP2);
+TYPED_TEST_SUITE_P(TypedTestP2);
// This also verifies that tests from different type-parameterized
// test cases can share the same name.
TYPED_TEST_P(TypedTestP2, A) {}
-REGISTER_TYPED_TEST_CASE_P(TypedTestP2, A);
+REGISTER_TYPED_TEST_SUITE_P(TypedTestP2, A);
-// Verifies that the code between TYPED_TEST_CASE_P() and
-// REGISTER_TYPED_TEST_CASE_P() is not enclosed in a namespace.
-IntAfterTypedTestCaseP after = 0;
-IntBeforeRegisterTypedTestCaseP before = 0;
+// Verifies that the code between TYPED_TEST_SUITE_P() and
+// REGISTER_TYPED_TEST_SUITE_P() is not enclosed in a namespace.
+IntAfterTypedTestSuiteP after = 0;
+IntBeforeRegisterTypedTestSuiteP before = 0;
-// Verifies that the last argument of INSTANTIATE_TYPED_TEST_CASE_P()
+// Verifies that the last argument of INSTANTIATE_TYPED_TEST_SUITE_P()
// can be either a single type or a Types<...> type list.
-INSTANTIATE_TYPED_TEST_CASE_P(Int, TypedTestP1, int);
-INSTANTIATE_TYPED_TEST_CASE_P(Int, TypedTestP2, Types<int>);
+INSTANTIATE_TYPED_TEST_SUITE_P(Int, TypedTestP1, int);
+INSTANTIATE_TYPED_TEST_SUITE_P(Int, TypedTestP2, Types<int>);
// Tests that the same type-parameterized test case can be
// instantiated more than once in the same translation unit.
-INSTANTIATE_TYPED_TEST_CASE_P(Double, TypedTestP2, Types<double>);
+INSTANTIATE_TYPED_TEST_SUITE_P(Double, TypedTestP2, Types<double>);
// Tests that the same type-parameterized test case can be
// instantiated in different translation units linked together.
// (ContainerTest is also instantiated in gtest-typed-test_test.cc.)
typedef Types<std::vector<double>, std::set<char> > MyContainers;
-INSTANTIATE_TYPED_TEST_CASE_P(My, ContainerTest, MyContainers);
+INSTANTIATE_TYPED_TEST_SUITE_P(My, ContainerTest, MyContainers);
// Tests that a type-parameterized test case can be defined and
// instantiated in a namespace.
@@ -406,7 +406,7 @@ template <typename T>
class NumericTest : public Test {
};
-TYPED_TEST_CASE_P(NumericTest);
+TYPED_TEST_SUITE_P(NumericTest);
TYPED_TEST_P(NumericTest, DefaultIsZero) {
EXPECT_EQ(0, TypeParam());
@@ -416,29 +416,29 @@ TYPED_TEST_P(NumericTest, ZeroIsLessThanOne) {
EXPECT_LT(TypeParam(0), TypeParam(1));
}
-REGISTER_TYPED_TEST_CASE_P(NumericTest,
+REGISTER_TYPED_TEST_SUITE_P(NumericTest,
DefaultIsZero, ZeroIsLessThanOne);
typedef Types<int, double> NumericTypes;
-INSTANTIATE_TYPED_TEST_CASE_P(My, NumericTest, NumericTypes);
+INSTANTIATE_TYPED_TEST_SUITE_P(My, NumericTest, NumericTypes);
static const char* GetTestName() {
return testing::UnitTest::GetInstance()->current_test_info()->name();
}
// Test the stripping of space from test names
template <typename T> class TrimmedTest : public Test { };
-TYPED_TEST_CASE_P(TrimmedTest);
+TYPED_TEST_SUITE_P(TrimmedTest);
TYPED_TEST_P(TrimmedTest, Test1) { EXPECT_STREQ("Test1", GetTestName()); }
TYPED_TEST_P(TrimmedTest, Test2) { EXPECT_STREQ("Test2", GetTestName()); }
TYPED_TEST_P(TrimmedTest, Test3) { EXPECT_STREQ("Test3", GetTestName()); }
TYPED_TEST_P(TrimmedTest, Test4) { EXPECT_STREQ("Test4", GetTestName()); }
TYPED_TEST_P(TrimmedTest, Test5) { EXPECT_STREQ("Test5", GetTestName()); }
-REGISTER_TYPED_TEST_CASE_P(
+REGISTER_TYPED_TEST_SUITE_P(
TrimmedTest,
Test1, Test2,Test3 , Test4 ,Test5 ); // NOLINT
template <typename T1, typename T2> struct MyPair {};
// Be sure to try a type with a comma in its name just in case it matters.
typedef Types<int, double, MyPair<int, int> > TrimTypes;
-INSTANTIATE_TYPED_TEST_CASE_P(My, TrimmedTest, TrimTypes);
+INSTANTIATE_TYPED_TEST_SUITE_P(My, TrimmedTest, TrimTypes);
} // namespace library2
diff --git a/googletest/test/gtest-typed-test_test.h b/googletest/test/gtest-typed-test_test.h
index 2cce67c..23137b7 100644
--- a/googletest/test/gtest-typed-test_test.h
+++ b/googletest/test/gtest-typed-test_test.h
@@ -46,7 +46,7 @@ template <typename T>
class ContainerTest : public Test {
};
-TYPED_TEST_CASE_P(ContainerTest);
+TYPED_TEST_SUITE_P(ContainerTest);
TYPED_TEST_P(ContainerTest, CanBeDefaultConstructed) {
TypeParam container;
@@ -57,8 +57,8 @@ TYPED_TEST_P(ContainerTest, InitialSizeIsZero) {
EXPECT_EQ(0U, container.size());
}
-REGISTER_TYPED_TEST_CASE_P(ContainerTest,
- CanBeDefaultConstructed, InitialSizeIsZero);
+REGISTER_TYPED_TEST_SUITE_P(ContainerTest,
+ CanBeDefaultConstructed, InitialSizeIsZero);
#endif // GTEST_HAS_TYPED_TEST_P
diff --git a/googletest/test/gtest-unittest-api_test.cc b/googletest/test/gtest-unittest-api_test.cc
index 2bcbedf..480a41f 100644
--- a/googletest/test/gtest-unittest-api_test.cc
+++ b/googletest/test/gtest-unittest-api_test.cc
@@ -51,59 +51,59 @@ struct LessByName {
class UnitTestHelper {
public:
- // Returns the array of pointers to all test cases sorted by the test case
+ // Returns the array of pointers to all test suites sorted by the test suite
// name. The caller is responsible for deleting the array.
- static TestCase const** GetSortedTestCases() {
+ static TestSuite const** GetSortedTestSuites() {
UnitTest& unit_test = *UnitTest::GetInstance();
- TestCase const** const test_cases =
- new const TestCase*[unit_test.total_test_case_count()];
+ auto const** const test_suites =
+ new const TestSuite*[unit_test.total_test_suite_count()];
- for (int i = 0; i < unit_test.total_test_case_count(); ++i)
- test_cases[i] = unit_test.GetTestCase(i);
+ for (int i = 0; i < unit_test.total_test_suite_count(); ++i)
+ test_suites[i] = unit_test.GetTestSuite(i);
- std::sort(test_cases,
- test_cases + unit_test.total_test_case_count(),
- LessByName<TestCase>());
- return test_cases;
+ std::sort(test_suites,
+ test_suites + unit_test.total_test_suite_count(),
+ LessByName<TestSuite>());
+ return test_suites;
}
- // Returns the test case by its name. The caller doesn't own the returned
+ // Returns the test suite by its name. The caller doesn't own the returned
// pointer.
- static const TestCase* FindTestCase(const char* name) {
+ static const TestSuite* FindTestSuite(const char* name) {
UnitTest& unit_test = *UnitTest::GetInstance();
- for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
- const TestCase* test_case = unit_test.GetTestCase(i);
- if (0 == strcmp(test_case->name(), name))
- return test_case;
+ for (int i = 0; i < unit_test.total_test_suite_count(); ++i) {
+ const TestSuite* test_suite = unit_test.GetTestSuite(i);
+ if (0 == strcmp(test_suite->name(), name))
+ return test_suite;
}
return nullptr;
}
- // Returns the array of pointers to all tests in a particular test case
+ // Returns the array of pointers to all tests in a particular test suite
// sorted by the test name. The caller is responsible for deleting the
// array.
- static TestInfo const** GetSortedTests(const TestCase* test_case) {
+ static TestInfo const** GetSortedTests(const TestSuite* test_suite) {
TestInfo const** const tests =
- new const TestInfo*[test_case->total_test_count()];
+ new const TestInfo*[test_suite->total_test_count()];
- for (int i = 0; i < test_case->total_test_count(); ++i)
- tests[i] = test_case->GetTestInfo(i);
+ for (int i = 0; i < test_suite->total_test_count(); ++i)
+ tests[i] = test_suite->GetTestInfo(i);
- std::sort(tests, tests + test_case->total_test_count(),
+ std::sort(tests, tests + test_suite->total_test_count(),
LessByName<TestInfo>());
return tests;
}
};
#if GTEST_HAS_TYPED_TEST
-template <typename T> class TestCaseWithCommentTest : public Test {};
-TYPED_TEST_CASE(TestCaseWithCommentTest, Types<int>);
-TYPED_TEST(TestCaseWithCommentTest, Dummy) {}
+template <typename T> class TestSuiteWithCommentTest : public Test {};
+TYPED_TEST_SUITE(TestSuiteWithCommentTest, Types<int>);
+TYPED_TEST(TestSuiteWithCommentTest, Dummy) {}
-const int kTypedTestCases = 1;
+const int kTypedTestSuites = 1;
const int kTypedTests = 1;
#else
-const int kTypedTestCases = 0;
+const int kTypedTestSuites = 0;
const int kTypedTests = 0;
#endif // GTEST_HAS_TYPED_TEST
@@ -113,21 +113,21 @@ const int kTypedTests = 0;
TEST(ApiTest, UnitTestImmutableAccessorsWork) {
UnitTest* unit_test = UnitTest::GetInstance();
- ASSERT_EQ(2 + kTypedTestCases, unit_test->total_test_case_count());
- EXPECT_EQ(1 + kTypedTestCases, unit_test->test_case_to_run_count());
+ ASSERT_EQ(2 + kTypedTestSuites, unit_test->total_test_suite_count());
+ EXPECT_EQ(1 + kTypedTestSuites, unit_test->test_suite_to_run_count());
EXPECT_EQ(2, unit_test->disabled_test_count());
EXPECT_EQ(5 + kTypedTests, unit_test->total_test_count());
EXPECT_EQ(3 + kTypedTests, unit_test->test_to_run_count());
- const TestCase** const test_cases = UnitTestHelper::GetSortedTestCases();
+ const TestSuite** const test_suites = UnitTestHelper::GetSortedTestSuites();
- EXPECT_STREQ("ApiTest", test_cases[0]->name());
- EXPECT_STREQ("DISABLED_Test", test_cases[1]->name());
+ EXPECT_STREQ("ApiTest", test_suites[0]->name());
+ EXPECT_STREQ("DISABLED_Test", test_suites[1]->name());
#if GTEST_HAS_TYPED_TEST
- EXPECT_STREQ("TestCaseWithCommentTest/0", test_cases[2]->name());
+ EXPECT_STREQ("TestSuiteWithCommentTest/0", test_suites[2]->name());
#endif // GTEST_HAS_TYPED_TEST
- delete[] test_cases;
+ delete[] test_suites;
// The following lines initiate actions to verify certain methods in
// FinalSuccessChecker::TearDown.
@@ -143,39 +143,39 @@ AssertionResult IsNull(const char* str) {
return AssertionSuccess();
}
-TEST(ApiTest, TestCaseImmutableAccessorsWork) {
- const TestCase* test_case = UnitTestHelper::FindTestCase("ApiTest");
- ASSERT_TRUE(test_case != nullptr);
+TEST(ApiTest, TestSuiteImmutableAccessorsWork) {
+ const TestSuite* test_suite = UnitTestHelper::FindTestSuite("ApiTest");
+ ASSERT_TRUE(test_suite != nullptr);
- EXPECT_STREQ("ApiTest", test_case->name());
- EXPECT_TRUE(IsNull(test_case->type_param()));
- EXPECT_TRUE(test_case->should_run());
- EXPECT_EQ(1, test_case->disabled_test_count());
- EXPECT_EQ(3, test_case->test_to_run_count());
- ASSERT_EQ(4, test_case->total_test_count());
+ EXPECT_STREQ("ApiTest", test_suite->name());
+ EXPECT_TRUE(IsNull(test_suite->type_param()));
+ EXPECT_TRUE(test_suite->should_run());
+ EXPECT_EQ(1, test_suite->disabled_test_count());
+ EXPECT_EQ(3, test_suite->test_to_run_count());
+ ASSERT_EQ(4, test_suite->total_test_count());
- const TestInfo** tests = UnitTestHelper::GetSortedTests(test_case);
+ const TestInfo** tests = UnitTestHelper::GetSortedTests(test_suite);
EXPECT_STREQ("DISABLED_Dummy1", tests[0]->name());
- EXPECT_STREQ("ApiTest", tests[0]->test_case_name());
+ EXPECT_STREQ("ApiTest", tests[0]->test_suite_name());
EXPECT_TRUE(IsNull(tests[0]->value_param()));
EXPECT_TRUE(IsNull(tests[0]->type_param()));
EXPECT_FALSE(tests[0]->should_run());
- EXPECT_STREQ("TestCaseDisabledAccessorsWork", tests[1]->name());
- EXPECT_STREQ("ApiTest", tests[1]->test_case_name());
+ EXPECT_STREQ("TestSuiteDisabledAccessorsWork", tests[1]->name());
+ EXPECT_STREQ("ApiTest", tests[1]->test_suite_name());
EXPECT_TRUE(IsNull(tests[1]->value_param()));
EXPECT_TRUE(IsNull(tests[1]->type_param()));
EXPECT_TRUE(tests[1]->should_run());
- EXPECT_STREQ("TestCaseImmutableAccessorsWork", tests[2]->name());
- EXPECT_STREQ("ApiTest", tests[2]->test_case_name());
+ EXPECT_STREQ("TestSuiteImmutableAccessorsWork", tests[2]->name());
+ EXPECT_STREQ("ApiTest", tests[2]->test_suite_name());
EXPECT_TRUE(IsNull(tests[2]->value_param()));
EXPECT_TRUE(IsNull(tests[2]->type_param()));
EXPECT_TRUE(tests[2]->should_run());
EXPECT_STREQ("UnitTestImmutableAccessorsWork", tests[3]->name());
- EXPECT_STREQ("ApiTest", tests[3]->test_case_name());
+ EXPECT_STREQ("ApiTest", tests[3]->test_suite_name());
EXPECT_TRUE(IsNull(tests[3]->value_param()));
EXPECT_TRUE(IsNull(tests[3]->type_param()));
EXPECT_TRUE(tests[3]->should_run());
@@ -184,20 +184,20 @@ TEST(ApiTest, TestCaseImmutableAccessorsWork) {
tests = nullptr;
#if GTEST_HAS_TYPED_TEST
- test_case = UnitTestHelper::FindTestCase("TestCaseWithCommentTest/0");
- ASSERT_TRUE(test_case != nullptr);
+ test_suite = UnitTestHelper::FindTestSuite("TestSuiteWithCommentTest/0");
+ ASSERT_TRUE(test_suite != nullptr);
- EXPECT_STREQ("TestCaseWithCommentTest/0", test_case->name());
- EXPECT_STREQ(GetTypeName<int>().c_str(), test_case->type_param());
- EXPECT_TRUE(test_case->should_run());
- EXPECT_EQ(0, test_case->disabled_test_count());
- EXPECT_EQ(1, test_case->test_to_run_count());
- ASSERT_EQ(1, test_case->total_test_count());
+ EXPECT_STREQ("TestSuiteWithCommentTest/0", test_suite->name());
+ EXPECT_STREQ(GetTypeName<int>().c_str(), test_suite->type_param());
+ EXPECT_TRUE(test_suite->should_run());
+ EXPECT_EQ(0, test_suite->disabled_test_count());
+ EXPECT_EQ(1, test_suite->test_to_run_count());
+ ASSERT_EQ(1, test_suite->total_test_count());
- tests = UnitTestHelper::GetSortedTests(test_case);
+ tests = UnitTestHelper::GetSortedTests(test_suite);
EXPECT_STREQ("Dummy", tests[0]->name());
- EXPECT_STREQ("TestCaseWithCommentTest/0", tests[0]->test_case_name());
+ EXPECT_STREQ("TestSuiteWithCommentTest/0", tests[0]->test_suite_name());
EXPECT_TRUE(IsNull(tests[0]->value_param()));
EXPECT_STREQ(GetTypeName<int>().c_str(), tests[0]->type_param());
EXPECT_TRUE(tests[0]->should_run());
@@ -206,27 +206,27 @@ TEST(ApiTest, TestCaseImmutableAccessorsWork) {
#endif // GTEST_HAS_TYPED_TEST
}
-TEST(ApiTest, TestCaseDisabledAccessorsWork) {
- const TestCase* test_case = UnitTestHelper::FindTestCase("DISABLED_Test");
- ASSERT_TRUE(test_case != nullptr);
+TEST(ApiTest, TestSuiteDisabledAccessorsWork) {
+ const TestSuite* test_suite = UnitTestHelper::FindTestSuite("DISABLED_Test");
+ ASSERT_TRUE(test_suite != nullptr);
- EXPECT_STREQ("DISABLED_Test", test_case->name());
- EXPECT_TRUE(IsNull(test_case->type_param()));
- EXPECT_FALSE(test_case->should_run());
- EXPECT_EQ(1, test_case->disabled_test_count());
- EXPECT_EQ(0, test_case->test_to_run_count());
- ASSERT_EQ(1, test_case->total_test_count());
+ EXPECT_STREQ("DISABLED_Test", test_suite->name());
+ EXPECT_TRUE(IsNull(test_suite->type_param()));
+ EXPECT_FALSE(test_suite->should_run());
+ EXPECT_EQ(1, test_suite->disabled_test_count());
+ EXPECT_EQ(0, test_suite->test_to_run_count());
+ ASSERT_EQ(1, test_suite->total_test_count());
- const TestInfo* const test_info = test_case->GetTestInfo(0);
+ const TestInfo* const test_info = test_suite->GetTestInfo(0);
EXPECT_STREQ("Dummy2", test_info->name());
- EXPECT_STREQ("DISABLED_Test", test_info->test_case_name());
+ EXPECT_STREQ("DISABLED_Test", test_info->test_suite_name());
EXPECT_TRUE(IsNull(test_info->value_param()));
EXPECT_TRUE(IsNull(test_info->type_param()));
EXPECT_FALSE(test_info->should_run());
}
// These two tests are here to provide support for testing
-// test_case_to_run_count, disabled_test_count, and test_to_run_count.
+// test_suite_to_run_count, disabled_test_count, and test_to_run_count.
TEST(ApiTest, DISABLED_Dummy1) {}
TEST(DISABLED_Test, Dummy2) {}
@@ -235,62 +235,62 @@ class FinalSuccessChecker : public Environment {
void TearDown() override {
UnitTest* unit_test = UnitTest::GetInstance();
- EXPECT_EQ(1 + kTypedTestCases, unit_test->successful_test_case_count());
+ EXPECT_EQ(1 + kTypedTestSuites, unit_test->successful_test_suite_count());
EXPECT_EQ(3 + kTypedTests, unit_test->successful_test_count());
- EXPECT_EQ(0, unit_test->failed_test_case_count());
+ EXPECT_EQ(0, unit_test->failed_test_suite_count());
EXPECT_EQ(0, unit_test->failed_test_count());
EXPECT_TRUE(unit_test->Passed());
EXPECT_FALSE(unit_test->Failed());
- ASSERT_EQ(2 + kTypedTestCases, unit_test->total_test_case_count());
-
- const TestCase** const test_cases = UnitTestHelper::GetSortedTestCases();
-
- EXPECT_STREQ("ApiTest", test_cases[0]->name());
- EXPECT_TRUE(IsNull(test_cases[0]->type_param()));
- EXPECT_TRUE(test_cases[0]->should_run());
- EXPECT_EQ(1, test_cases[0]->disabled_test_count());
- ASSERT_EQ(4, test_cases[0]->total_test_count());
- EXPECT_EQ(3, test_cases[0]->successful_test_count());
- EXPECT_EQ(0, test_cases[0]->failed_test_count());
- EXPECT_TRUE(test_cases[0]->Passed());
- EXPECT_FALSE(test_cases[0]->Failed());
-
- EXPECT_STREQ("DISABLED_Test", test_cases[1]->name());
- EXPECT_TRUE(IsNull(test_cases[1]->type_param()));
- EXPECT_FALSE(test_cases[1]->should_run());
- EXPECT_EQ(1, test_cases[1]->disabled_test_count());
- ASSERT_EQ(1, test_cases[1]->total_test_count());
- EXPECT_EQ(0, test_cases[1]->successful_test_count());
- EXPECT_EQ(0, test_cases[1]->failed_test_count());
+ ASSERT_EQ(2 + kTypedTestSuites, unit_test->total_test_suite_count());
+
+ const TestSuite** const test_suites = UnitTestHelper::GetSortedTestSuites();
+
+ EXPECT_STREQ("ApiTest", test_suites[0]->name());
+ EXPECT_TRUE(IsNull(test_suites[0]->type_param()));
+ EXPECT_TRUE(test_suites[0]->should_run());
+ EXPECT_EQ(1, test_suites[0]->disabled_test_count());
+ ASSERT_EQ(4, test_suites[0]->total_test_count());
+ EXPECT_EQ(3, test_suites[0]->successful_test_count());
+ EXPECT_EQ(0, test_suites[0]->failed_test_count());
+ EXPECT_TRUE(test_suites[0]->Passed());
+ EXPECT_FALSE(test_suites[0]->Failed());
+
+ EXPECT_STREQ("DISABLED_Test", test_suites[1]->name());
+ EXPECT_TRUE(IsNull(test_suites[1]->type_param()));
+ EXPECT_FALSE(test_suites[1]->should_run());
+ EXPECT_EQ(1, test_suites[1]->disabled_test_count());
+ ASSERT_EQ(1, test_suites[1]->total_test_count());
+ EXPECT_EQ(0, test_suites[1]->successful_test_count());
+ EXPECT_EQ(0, test_suites[1]->failed_test_count());
#if GTEST_HAS_TYPED_TEST
- EXPECT_STREQ("TestCaseWithCommentTest/0", test_cases[2]->name());
- EXPECT_STREQ(GetTypeName<int>().c_str(), test_cases[2]->type_param());
- EXPECT_TRUE(test_cases[2]->should_run());
- EXPECT_EQ(0, test_cases[2]->disabled_test_count());
- ASSERT_EQ(1, test_cases[2]->total_test_count());
- EXPECT_EQ(1, test_cases[2]->successful_test_count());
- EXPECT_EQ(0, test_cases[2]->failed_test_count());
- EXPECT_TRUE(test_cases[2]->Passed());
- EXPECT_FALSE(test_cases[2]->Failed());
+ EXPECT_STREQ("TestSuiteWithCommentTest/0", test_suites[2]->name());
+ EXPECT_STREQ(GetTypeName<int>().c_str(), test_suites[2]->type_param());
+ EXPECT_TRUE(test_suites[2]->should_run());
+ EXPECT_EQ(0, test_suites[2]->disabled_test_count());
+ ASSERT_EQ(1, test_suites[2]->total_test_count());
+ EXPECT_EQ(1, test_suites[2]->successful_test_count());
+ EXPECT_EQ(0, test_suites[2]->failed_test_count());
+ EXPECT_TRUE(test_suites[2]->Passed());
+ EXPECT_FALSE(test_suites[2]->Failed());
#endif // GTEST_HAS_TYPED_TEST
- const TestCase* test_case = UnitTestHelper::FindTestCase("ApiTest");
- const TestInfo** tests = UnitTestHelper::GetSortedTests(test_case);
+ const TestSuite* test_suite = UnitTestHelper::FindTestSuite("ApiTest");
+ const TestInfo** tests = UnitTestHelper::GetSortedTests(test_suite);
EXPECT_STREQ("DISABLED_Dummy1", tests[0]->name());
- EXPECT_STREQ("ApiTest", tests[0]->test_case_name());
+ EXPECT_STREQ("ApiTest", tests[0]->test_suite_name());
EXPECT_FALSE(tests[0]->should_run());
- EXPECT_STREQ("TestCaseDisabledAccessorsWork", tests[1]->name());
- EXPECT_STREQ("ApiTest", tests[1]->test_case_name());
+ EXPECT_STREQ("TestSuiteDisabledAccessorsWork", tests[1]->name());
+ EXPECT_STREQ("ApiTest", tests[1]->test_suite_name());
EXPECT_TRUE(IsNull(tests[1]->value_param()));
EXPECT_TRUE(IsNull(tests[1]->type_param()));
EXPECT_TRUE(tests[1]->should_run());
EXPECT_TRUE(tests[1]->result()->Passed());
EXPECT_EQ(0, tests[1]->result()->test_property_count());
- EXPECT_STREQ("TestCaseImmutableAccessorsWork", tests[2]->name());
- EXPECT_STREQ("ApiTest", tests[2]->test_case_name());
+ EXPECT_STREQ("TestSuiteImmutableAccessorsWork", tests[2]->name());
+ EXPECT_STREQ("ApiTest", tests[2]->test_suite_name());
EXPECT_TRUE(IsNull(tests[2]->value_param()));
EXPECT_TRUE(IsNull(tests[2]->type_param()));
EXPECT_TRUE(tests[2]->should_run());
@@ -298,7 +298,7 @@ class FinalSuccessChecker : public Environment {
EXPECT_EQ(0, tests[2]->result()->test_property_count());
EXPECT_STREQ("UnitTestImmutableAccessorsWork", tests[3]->name());
- EXPECT_STREQ("ApiTest", tests[3]->test_case_name());
+ EXPECT_STREQ("ApiTest", tests[3]->test_suite_name());
EXPECT_TRUE(IsNull(tests[3]->value_param()));
EXPECT_TRUE(IsNull(tests[3]->type_param()));
EXPECT_TRUE(tests[3]->should_run());
@@ -311,11 +311,11 @@ class FinalSuccessChecker : public Environment {
delete[] tests;
#if GTEST_HAS_TYPED_TEST
- test_case = UnitTestHelper::FindTestCase("TestCaseWithCommentTest/0");
- tests = UnitTestHelper::GetSortedTests(test_case);
+ test_suite = UnitTestHelper::FindTestSuite("TestSuiteWithCommentTest/0");
+ tests = UnitTestHelper::GetSortedTests(test_suite);
EXPECT_STREQ("Dummy", tests[0]->name());
- EXPECT_STREQ("TestCaseWithCommentTest/0", tests[0]->test_case_name());
+ EXPECT_STREQ("TestSuiteWithCommentTest/0", tests[0]->test_suite_name());
EXPECT_TRUE(IsNull(tests[0]->value_param()));
EXPECT_STREQ(GetTypeName<int>().c_str(), tests[0]->type_param());
EXPECT_TRUE(tests[0]->should_run());
@@ -324,7 +324,7 @@ class FinalSuccessChecker : public Environment {
delete[] tests;
#endif // GTEST_HAS_TYPED_TEST
- delete[] test_cases;
+ delete[] test_suites;
}
};
diff --git a/googletest/test/gtest_repeat_test.cc b/googletest/test/gtest_repeat_test.cc
index 3ec416f..7da4a15 100644
--- a/googletest/test/gtest_repeat_test.cc
+++ b/googletest/test/gtest_repeat_test.cc
@@ -120,9 +120,9 @@ TEST_P(MyParamTest, ShouldPass) {
GTEST_CHECK_INT_EQ_(g_param_test_count % kNumberOfParamTests, GetParam());
g_param_test_count++;
}
-INSTANTIATE_TEST_CASE_P(MyParamSequence,
- MyParamTest,
- testing::Range(0, kNumberOfParamTests));
+INSTANTIATE_TEST_SUITE_P(MyParamSequence,
+ MyParamTest,
+ testing::Range(0, kNumberOfParamTests));
// Resets the count for each test.
void ResetCounts() {
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc
index 5e0e43a..4ab298c 100644
--- a/googletest/test/gtest_unittest.cc
+++ b/googletest/test/gtest_unittest.cc
@@ -250,7 +250,6 @@ using testing::internal::GetTestTypeId;
using testing::internal::GetTimeInMillis;
using testing::internal::GetTypeId;
using testing::internal::GetUnitTestImpl;
-using testing::internal::ImplicitlyConvertible;
using testing::internal::Int32;
using testing::internal::Int32FromEnvOrDie;
using testing::internal::IsAProtocolMessage;
@@ -519,9 +518,9 @@ TEST_F(FormatEpochTimeInMillisAsIso8601Test, PrintsEpochStart) {
// Tests that GTEST_IS_NULL_LITERAL_(x) is true when x is a null
// pointer literal.
TEST(NullLiteralTest, IsTrueForNullLiterals) {
- EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(nullptr));
- EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(nullptr));
- EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(nullptr));
+ EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(NULL)); // NOLINT
+ EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0)); // NOLINT
+ EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0u)); // NOLINT
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(nullptr));
}
@@ -534,6 +533,26 @@ TEST(NullLiteralTest, IsFalseForNonNullLiterals) {
EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(static_cast<void*>(nullptr)));
}
+struct ConvertToAll {
+ template <typename T>
+ operator T() const { // NOLINT
+ return T();
+ }
+};
+
+struct ConvertToAllButNoPointers {
+ template <typename T,
+ typename std::enable_if<!std::is_pointer<T>::value, int>::type = 0>
+ operator T() const { // NOLINT
+ return T();
+ }
+};
+
+TEST(NullLiteralTest, ImplicitConversion) {
+ EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(ConvertToAll{}));
+ EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(ConvertToAllButNoPointers{}));
+}
+
# ifdef __BORLANDC__
// Restores warnings after previous "#pragma option push" suppressed them.
# pragma option pop
@@ -1551,7 +1570,7 @@ class GTestFlagSaverTest : public Test {
// Saves the Google Test flags such that we can restore them later, and
// then sets them to their default values. This will be called
// before the first test in this test case is run.
- static void SetUpTestCase() {
+ static void SetUpTestSuite() {
saver_ = new GTestFlagSaver;
GTEST_FLAG(also_run_disabled_tests) = false;
@@ -1573,7 +1592,7 @@ class GTestFlagSaverTest : public Test {
// Restores the Google Test flags that the tests have modified. This will
// be called after the last test in this test case is run.
- static void TearDownTestCase() {
+ static void TearDownTestSuite() {
delete saver_;
saver_ = nullptr;
}
@@ -1937,7 +1956,7 @@ TEST(ShouldRunTestOnShardTest, IsPartitionWhenThereAreFiveShards) {
// Test class, there are no separate tests for the following classes
// (except for some trivial cases):
//
-// TestCase, UnitTest, UnitTestResultPrinter.
+// TestSuite, UnitTest, UnitTestResultPrinter.
//
// Similarly, there are no separate tests for the following macros:
//
@@ -1971,7 +1990,7 @@ void ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(
key);
}
-void ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
+void ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestSuite(
const char* key) {
const TestCase* test_case = UnitTest::GetInstance()->current_test_case();
ASSERT_TRUE(test_case != nullptr);
@@ -1979,7 +1998,7 @@ void ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
test_case->ad_hoc_test_result(), key);
}
-void ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+void ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestSuite(
const char* key) {
ExpectNonFatalFailureRecordingPropertyWithReservedKey(
UnitTest::GetInstance()->ad_hoc_test_result(), key);
@@ -1991,29 +2010,30 @@ void ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
class UnitTestRecordPropertyTest :
public testing::internal::UnitTestRecordPropertyTestHelper {
public:
- static void SetUpTestCase() {
- ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
+ static void SetUpTestSuite() {
+ ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestSuite(
"disabled");
- ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
+ ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestSuite(
"errors");
- ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
+ ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestSuite(
"failures");
- ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
+ ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestSuite(
"name");
- ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
+ ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestSuite(
"tests");
- ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
+ ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestSuite(
"time");
Test::RecordProperty("test_case_key_1", "1");
- const TestCase* test_case = UnitTest::GetInstance()->current_test_case();
- ASSERT_TRUE(test_case != nullptr);
+ const testing::TestSuite* test_suite =
+ UnitTest::GetInstance()->current_test_case();
+ ASSERT_TRUE(test_suite != nullptr);
- ASSERT_EQ(1, test_case->ad_hoc_test_result().test_property_count());
+ ASSERT_EQ(1, test_suite->ad_hoc_test_result().test_property_count());
EXPECT_STREQ("test_case_key_1",
- test_case->ad_hoc_test_result().GetTestProperty(0).key());
+ test_suite->ad_hoc_test_result().GetTestProperty(0).key());
EXPECT_STREQ("1",
- test_case->ad_hoc_test_result().GetTestProperty(0).value());
+ test_suite->ad_hoc_test_result().GetTestProperty(0).value());
}
};
@@ -2066,7 +2086,7 @@ TEST_F(UnitTestRecordPropertyTest, OverridesValuesForDuplicateKeys) {
}
TEST_F(UnitTestRecordPropertyTest,
- AddFailureInsideTestsWhenUsingTestCaseReservedKeys) {
+ AddFailureInsideTestsWhenUsingTestSuiteReservedKeys) {
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(
"name");
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(
@@ -2092,21 +2112,21 @@ TEST_F(UnitTestRecordPropertyTest,
class UnitTestRecordPropertyTestEnvironment : public Environment {
public:
void TearDown() override {
- ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+ ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestSuite(
"tests");
- ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+ ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestSuite(
"failures");
- ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+ ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestSuite(
"disabled");
- ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+ ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestSuite(
"errors");
- ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+ ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestSuite(
"name");
- ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+ ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestSuite(
"timestamp");
- ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+ ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestSuite(
"time");
- ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+ ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestSuite(
"random_seed");
}
};
@@ -3100,28 +3120,28 @@ TEST(DisabledTest, NotDISABLED_TestShouldRun) {
// A test case whose name starts with DISABLED_.
// Should not run.
-TEST(DISABLED_TestCase, TestShouldNotRun) {
+TEST(DISABLED_TestSuite, TestShouldNotRun) {
FAIL() << "Unexpected failure: Test in disabled test case should not be run.";
}
// A test case and test whose names start with DISABLED_.
// Should not run.
-TEST(DISABLED_TestCase, DISABLED_TestShouldNotRun) {
+TEST(DISABLED_TestSuite, DISABLED_TestShouldNotRun) {
FAIL() << "Unexpected failure: Test in disabled test case should not be run.";
}
-// Check that when all tests in a test case are disabled, SetUpTestCase() and
-// TearDownTestCase() are not called.
+// Check that when all tests in a test case are disabled, SetUpTestSuite() and
+// TearDownTestSuite() are not called.
class DisabledTestsTest : public Test {
protected:
- static void SetUpTestCase() {
+ static void SetUpTestSuite() {
FAIL() << "Unexpected failure: All tests disabled in test case. "
- "SetUpTestCase() should not be called.";
+ "SetUpTestSuite() should not be called.";
}
- static void TearDownTestCase() {
+ static void TearDownTestSuite() {
FAIL() << "Unexpected failure: All tests disabled in test case. "
- "TearDownTestCase() should not be called.";
+ "TearDownTestSuite() should not be called.";
}
};
@@ -3142,7 +3162,7 @@ class TypedTest : public Test {
};
typedef testing::Types<int, double> NumericTypes;
-TYPED_TEST_CASE(TypedTest, NumericTypes);
+TYPED_TEST_SUITE(TypedTest, NumericTypes);
TYPED_TEST(TypedTest, DISABLED_ShouldNotRun) {
FAIL() << "Unexpected failure: Disabled typed test should not run.";
@@ -3152,7 +3172,7 @@ template <typename T>
class DISABLED_TypedTest : public Test {
};
-TYPED_TEST_CASE(DISABLED_TypedTest, NumericTypes);
+TYPED_TEST_SUITE(DISABLED_TypedTest, NumericTypes);
TYPED_TEST(DISABLED_TypedTest, ShouldNotRun) {
FAIL() << "Unexpected failure: Disabled typed test should not run.";
@@ -3168,31 +3188,31 @@ template <typename T>
class TypedTestP : public Test {
};
-TYPED_TEST_CASE_P(TypedTestP);
+TYPED_TEST_SUITE_P(TypedTestP);
TYPED_TEST_P(TypedTestP, DISABLED_ShouldNotRun) {
FAIL() << "Unexpected failure: "
<< "Disabled type-parameterized test should not run.";
}
-REGISTER_TYPED_TEST_CASE_P(TypedTestP, DISABLED_ShouldNotRun);
+REGISTER_TYPED_TEST_SUITE_P(TypedTestP, DISABLED_ShouldNotRun);
-INSTANTIATE_TYPED_TEST_CASE_P(My, TypedTestP, NumericTypes);
+INSTANTIATE_TYPED_TEST_SUITE_P(My, TypedTestP, NumericTypes);
template <typename T>
class DISABLED_TypedTestP : public Test {
};
-TYPED_TEST_CASE_P(DISABLED_TypedTestP);
+TYPED_TEST_SUITE_P(DISABLED_TypedTestP);
TYPED_TEST_P(DISABLED_TypedTestP, ShouldNotRun) {
FAIL() << "Unexpected failure: "
<< "Disabled type-parameterized test should not run.";
}
-REGISTER_TYPED_TEST_CASE_P(DISABLED_TypedTestP, ShouldNotRun);
+REGISTER_TYPED_TEST_SUITE_P(DISABLED_TypedTestP, ShouldNotRun);
-INSTANTIATE_TYPED_TEST_CASE_P(My, DISABLED_TypedTestP, NumericTypes);
+INSTANTIATE_TYPED_TEST_SUITE_P(My, DISABLED_TypedTestP, NumericTypes);
#endif // GTEST_HAS_TYPED_TEST_P
@@ -3468,7 +3488,7 @@ std::vector<std::string> CharsToLines(const std::string& str) {
return out;
}
-TEST(EditDistance, TestCases) {
+TEST(EditDistance, TestSuites) {
struct Case {
int line;
const char* left;
@@ -5291,11 +5311,11 @@ namespace testing {
class TestInfoTest : public Test {
protected:
static const TestInfo* GetTestInfo(const char* test_name) {
- const TestCase* const test_case =
- GetUnitTestImpl()->GetTestCase("TestInfoTest", "", nullptr, nullptr);
+ const TestSuite* const test_suite =
+ GetUnitTestImpl()->GetTestSuite("TestInfoTest", "", nullptr, nullptr);
- for (int i = 0; i < test_case->total_test_count(); ++i) {
- const TestInfo* const test_info = test_case->GetTestInfo(i);
+ for (int i = 0; i < test_suite->total_test_count(); ++i) {
+ const TestInfo* const test_info = test_suite->GetTestInfo(i);
if (strcmp(test_name, test_info->name()) == 0)
return test_info;
}
@@ -5352,13 +5372,13 @@ TEST_P(CodeLocationForTESTP, Verify) {
VERIFY_CODE_LOCATION;
}
-INSTANTIATE_TEST_CASE_P(, CodeLocationForTESTP, Values(0));
+INSTANTIATE_TEST_SUITE_P(, CodeLocationForTESTP, Values(0));
template <typename T>
class CodeLocationForTYPEDTEST : public Test {
};
-TYPED_TEST_CASE(CodeLocationForTYPEDTEST, int);
+TYPED_TEST_SUITE(CodeLocationForTYPEDTEST, int);
TYPED_TEST(CodeLocationForTYPEDTEST, Verify) {
VERIFY_CODE_LOCATION;
@@ -5368,20 +5388,21 @@ template <typename T>
class CodeLocationForTYPEDTESTP : public Test {
};
-TYPED_TEST_CASE_P(CodeLocationForTYPEDTESTP);
+TYPED_TEST_SUITE_P(CodeLocationForTYPEDTESTP);
TYPED_TEST_P(CodeLocationForTYPEDTESTP, Verify) {
VERIFY_CODE_LOCATION;
}
-REGISTER_TYPED_TEST_CASE_P(CodeLocationForTYPEDTESTP, Verify);
+REGISTER_TYPED_TEST_SUITE_P(CodeLocationForTYPEDTESTP, Verify);
-INSTANTIATE_TYPED_TEST_CASE_P(My, CodeLocationForTYPEDTESTP, int);
+INSTANTIATE_TYPED_TEST_SUITE_P(My, CodeLocationForTYPEDTESTP, int);
#undef VERIFY_CODE_LOCATION
// Tests setting up and tearing down a test case.
-
+// Legacy API is deprecated but still available
+#ifndef REMOVE_LEGACY_TEST_CASEAPI
class SetUpTestCaseTest : public Test {
protected:
// This will be called once before the first test in this test case
@@ -5440,8 +5461,9 @@ TEST_F(SetUpTestCaseTest, Test1) { EXPECT_STRNE(nullptr, shared_resource_); }
TEST_F(SetUpTestCaseTest, Test2) {
EXPECT_STREQ("123", shared_resource_);
}
+#endif // REMOVE_LEGACY_TEST_CASEAPI
-// Tests SetupTestSuite/TearDown TestSuite API
+// Tests SetupTestSuite/TearDown TestSuite
class SetUpTestSuiteTest : public Test {
protected:
// This will be called once before the first test in this test case
@@ -6259,7 +6281,7 @@ class CurrentTestInfoTest : public Test {
protected:
// Tests that current_test_info() returns NULL before the first test in
// the test case is run.
- static void SetUpTestCase() {
+ static void SetUpTestSuite() {
// There should be no tests running at this point.
const TestInfo* test_info =
UnitTest::GetInstance()->current_test_info();
@@ -6269,7 +6291,7 @@ class CurrentTestInfoTest : public Test {
// Tests that current_test_info() returns NULL after the last test in
// the test case has run.
- static void TearDownTestCase() {
+ static void TearDownTestSuite() {
const TestInfo* test_info =
UnitTest::GetInstance()->current_test_info();
EXPECT_TRUE(test_info == nullptr)
@@ -6279,14 +6301,14 @@ class CurrentTestInfoTest : public Test {
// Tests that current_test_info() returns TestInfo for currently running
// test by checking the expected test name against the actual one.
-TEST_F(CurrentTestInfoTest, WorksForFirstTestInATestCase) {
+TEST_F(CurrentTestInfoTest, WorksForFirstTestInATestSuite) {
const TestInfo* test_info =
UnitTest::GetInstance()->current_test_info();
ASSERT_TRUE(nullptr != test_info)
<< "There is a test running so we should have a valid TestInfo.";
EXPECT_STREQ("CurrentTestInfoTest", test_info->test_case_name())
<< "Expected the name of the currently running test case.";
- EXPECT_STREQ("WorksForFirstTestInATestCase", test_info->name())
+ EXPECT_STREQ("WorksForFirstTestInATestSuite", test_info->name())
<< "Expected the name of the currently running test.";
}
@@ -6294,14 +6316,14 @@ TEST_F(CurrentTestInfoTest, WorksForFirstTestInATestCase) {
// test by checking the expected test name against the actual one. We
// use this test to see that the TestInfo object actually changed from
// the previous invocation.
-TEST_F(CurrentTestInfoTest, WorksForSecondTestInATestCase) {
+TEST_F(CurrentTestInfoTest, WorksForSecondTestInATestSuite) {
const TestInfo* test_info =
UnitTest::GetInstance()->current_test_info();
ASSERT_TRUE(nullptr != test_info)
<< "There is a test running so we should have a valid TestInfo.";
EXPECT_STREQ("CurrentTestInfoTest", test_info->test_case_name())
<< "Expected the name of the currently running test case.";
- EXPECT_STREQ("WorksForSecondTestInATestCase", test_info->name())
+ EXPECT_STREQ("WorksForSecondTestInATestSuite", test_info->name())
<< "Expected the name of the currently running test.";
}
@@ -7220,35 +7242,6 @@ TEST(GTestReferenceToConstTest, Works) {
TestGTestReferenceToConst<const std::string&, const std::string&>();
}
-// Tests that ImplicitlyConvertible<T1, T2>::value is a compile-time constant.
-TEST(ImplicitlyConvertibleTest, ValueIsCompileTimeConstant) {
- GTEST_COMPILE_ASSERT_((ImplicitlyConvertible<int, int>::value), const_true);
- GTEST_COMPILE_ASSERT_((!ImplicitlyConvertible<void*, int*>::value),
- const_false);
-}
-
-// Tests that ImplicitlyConvertible<T1, T2>::value is true when T1 can
-// be implicitly converted to T2.
-TEST(ImplicitlyConvertibleTest, ValueIsTrueWhenConvertible) {
- EXPECT_TRUE((ImplicitlyConvertible<int, double>::value));
- EXPECT_TRUE((ImplicitlyConvertible<double, int>::value));
- EXPECT_TRUE((ImplicitlyConvertible<int*, void*>::value));
- EXPECT_TRUE((ImplicitlyConvertible<int*, const int*>::value));
- EXPECT_TRUE((ImplicitlyConvertible<ConversionHelperDerived&,
- const ConversionHelperBase&>::value));
- EXPECT_TRUE((ImplicitlyConvertible<const ConversionHelperBase,
- ConversionHelperBase>::value));
-}
-
-// Tests that ImplicitlyConvertible<T1, T2>::value is false when T1
-// cannot be implicitly converted to T2.
-TEST(ImplicitlyConvertibleTest, ValueIsFalseWhenNotConvertible) {
- EXPECT_FALSE((ImplicitlyConvertible<double, int*>::value));
- EXPECT_FALSE((ImplicitlyConvertible<void*, int*>::value));
- EXPECT_FALSE((ImplicitlyConvertible<const int*, int*>::value));
- EXPECT_FALSE((ImplicitlyConvertible<ConversionHelperBase&,
- ConversionHelperDerived&>::value));
-}
// Tests IsContainerTest.
@@ -7559,14 +7552,14 @@ TEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) {
class AdHocTestResultTest : public testing::Test {
protected:
- static void SetUpTestCase() {
- FAIL() << "A failure happened inside SetUpTestCase().";
+ static void SetUpTestSuite() {
+ FAIL() << "A failure happened inside SetUpTestSuite().";
}
};
-TEST_F(AdHocTestResultTest, AdHocTestResultForTestCaseShowsFailure) {
+TEST_F(AdHocTestResultTest, AdHocTestResultForTestSuiteShowsFailure) {
const testing::TestResult& test_result = testing::UnitTest::GetInstance()
- ->current_test_case()
+ ->current_test_suite()
->ad_hoc_test_result();
EXPECT_TRUE(test_result.Failed());
}
@@ -7589,8 +7582,8 @@ auto* dynamic_test = testing::RegisterTest(
TEST(RegisterTest, WasRegistered) {
auto* unittest = testing::UnitTest::GetInstance();
- for (int i = 0; i < unittest->total_test_case_count(); ++i) {
- auto* tests = unittest->GetTestCase(i);
+ for (int i = 0; i < unittest->total_test_suite_count(); ++i) {
+ auto* tests = unittest->GetTestSuite(i);
if (tests->name() != std::string("DynamicUnitTestFixture")) continue;
for (int j = 0; j < tests->total_test_count(); ++j) {
if (tests->GetTestInfo(j)->name() != std::string("DynamicTest")) continue;
diff --git a/googletest/test/gtest_xml_output_unittest.py b/googletest/test/gtest_xml_output_unittest.py
index ab733d1..ce444f0 100755
--- a/googletest/test/gtest_xml_output_unittest.py
+++ b/googletest/test/gtest_xml_output_unittest.py
@@ -111,7 +111,7 @@ Invalid characters in brackets []%(stack)s]]></failure>
<testsuite name="SkippedTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="Skipped" status="skipped" time="*" classname="SkippedTest"/>
</testsuite>
- <testsuite name="PropertyRecordingTest" tests="4" failures="0" disabled="0" errors="0" time="*" SetUpTestCase="yes" TearDownTestCase="aye">
+ <testsuite name="PropertyRecordingTest" tests="4" failures="0" disabled="0" errors="0" time="*" SetUpTestSuite="yes" TearDownTestSuite="aye">
<testcase name="OneProperty" status="run" time="*" classname="PropertyRecordingTest">
<properties>
<property name="key_1" value="1"/>
@@ -164,11 +164,11 @@ Invalid characters in brackets []%(stack)s]]></failure>
<testsuite name="TypedTest/1" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="TypedTest/1" />
</testsuite>
- <testsuite name="Single/TypeParameterizedTestCase/0" tests="1" failures="0" disabled="0" errors="0" time="*">
- <testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="Single/TypeParameterizedTestCase/0" />
+ <testsuite name="Single/TypeParameterizedTestSuite/0" tests="1" failures="0" disabled="0" errors="0" time="*">
+ <testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="Single/TypeParameterizedTestSuite/0" />
</testsuite>
- <testsuite name="Single/TypeParameterizedTestCase/1" tests="1" failures="0" disabled="0" errors="0" time="*">
- <testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="Single/TypeParameterizedTestCase/1" />
+ <testsuite name="Single/TypeParameterizedTestSuite/1" tests="1" failures="0" disabled="0" errors="0" time="*">
+ <testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="Single/TypeParameterizedTestSuite/1" />
</testsuite>
</testsuites>""" % {'stack': STACK_TRACE_TEMPLATE}
@@ -186,7 +186,7 @@ EXPECTED_SHARDED_TEST_XML = """<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="SuccessfulTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="Succeeds" status="run" time="*" classname="SuccessfulTest"/>
</testsuite>
- <testsuite name="PropertyRecordingTest" tests="1" failures="0" disabled="0" errors="0" time="*" SetUpTestCase="yes" TearDownTestCase="aye">
+ <testsuite name="PropertyRecordingTest" tests="1" failures="0" disabled="0" errors="0" time="*" SetUpTestSuite="yes" TearDownTestSuite="aye">
<testcase name="TwoValuesForOneKeyUsesLastValue" status="run" time="*" classname="PropertyRecordingTest">
<properties>
<property name="key_1" value="2"/>
diff --git a/googletest/test/gtest_xml_output_unittest_.cc b/googletest/test/gtest_xml_output_unittest_.cc
index 39d9b4e..c95fd66 100644
--- a/googletest/test/gtest_xml_output_unittest_.cc
+++ b/googletest/test/gtest_xml_output_unittest_.cc
@@ -101,8 +101,10 @@ TEST(InvalidCharactersTest, InvalidCharactersInMessage) {
class PropertyRecordingTest : public Test {
public:
- static void SetUpTestCase() { RecordProperty("SetUpTestCase", "yes"); }
- static void TearDownTestCase() { RecordProperty("TearDownTestCase", "aye"); }
+ static void SetUpTestSuite() { RecordProperty("SetUpTestSuite", "yes"); }
+ static void TearDownTestSuite() {
+ RecordProperty("TearDownTestSuite", "aye");
+ }
};
TEST_F(PropertyRecordingTest, OneProperty) {
@@ -150,28 +152,28 @@ TEST(NoFixtureTest, ExternalUtilityThatCallsRecordStringValuedProperty) {
class ValueParamTest : public TestWithParam<int> {};
TEST_P(ValueParamTest, HasValueParamAttribute) {}
TEST_P(ValueParamTest, AnotherTestThatHasValueParamAttribute) {}
-INSTANTIATE_TEST_CASE_P(Single, ValueParamTest, Values(33, 42));
+INSTANTIATE_TEST_SUITE_P(Single, ValueParamTest, Values(33, 42));
#if GTEST_HAS_TYPED_TEST
// Verifies that the type parameter name is output in the 'type_param'
// XML attribute for typed tests.
template <typename T> class TypedTest : public Test {};
typedef testing::Types<int, long> TypedTestTypes;
-TYPED_TEST_CASE(TypedTest, TypedTestTypes);
+TYPED_TEST_SUITE(TypedTest, TypedTestTypes);
TYPED_TEST(TypedTest, HasTypeParamAttribute) {}
#endif
#if GTEST_HAS_TYPED_TEST_P
// Verifies that the type parameter name is output in the 'type_param'
// XML attribute for type-parameterized tests.
-template <typename T> class TypeParameterizedTestCase : public Test {};
-TYPED_TEST_CASE_P(TypeParameterizedTestCase);
-TYPED_TEST_P(TypeParameterizedTestCase, HasTypeParamAttribute) {}
-REGISTER_TYPED_TEST_CASE_P(TypeParameterizedTestCase, HasTypeParamAttribute);
-typedef testing::Types<int, long> TypeParameterizedTestCaseTypes;
-INSTANTIATE_TYPED_TEST_CASE_P(Single,
- TypeParameterizedTestCase,
- TypeParameterizedTestCaseTypes);
+template <typename T>
+class TypeParameterizedTestSuite : public Test {};
+TYPED_TEST_SUITE_P(TypeParameterizedTestSuite);
+TYPED_TEST_P(TypeParameterizedTestSuite, HasTypeParamAttribute) {}
+REGISTER_TYPED_TEST_SUITE_P(TypeParameterizedTestSuite, HasTypeParamAttribute);
+typedef testing::Types<int, long> TypeParameterizedTestSuiteTypes; // NOLINT
+INSTANTIATE_TYPED_TEST_SUITE_P(Single, TypeParameterizedTestSuite,
+ TypeParameterizedTestSuiteTypes);
#endif
int main(int argc, char** argv) {