From 7d3b73c85a42811309eac26e5cbe054c40b64785 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 9 Oct 2018 14:50:26 -0400 Subject: Unconditionally use std::tuple. Remove all mention of TR1 tuple and our own implementation of tuple. PiperOrigin-RevId: 216395043 --- googlemock/CMakeLists.txt | 25 - googlemock/include/gmock/gmock-actions.h | 6 +- googlemock/include/gmock/gmock-generated-actions.h | 366 +++---- .../include/gmock/gmock-generated-actions.h.pump | 34 +- .../gmock/gmock-generated-function-mockers.h | 1035 +++++++++----------- .../gmock/gmock-generated-function-mockers.h.pump | 4 +- .../include/gmock/gmock-generated-matchers.h | 138 +-- .../include/gmock/gmock-generated-matchers.h.pump | 19 +- googlemock/include/gmock/gmock-matchers.h | 92 +- googlemock/include/gmock/gmock-more-actions.h | 16 +- .../internal/gmock-generated-internal-utils.h | 91 +- .../internal/gmock-generated-internal-utils.h.pump | 8 +- .../include/gmock/internal/gmock-internal-utils.h | 11 +- googlemock/test/gmock-actions_test.cc | 182 ++-- googlemock/test/gmock-generated-actions_test.cc | 223 +++-- .../test/gmock-generated-internal-utils_test.cc | 40 +- googlemock/test/gmock-generated-matchers_test.cc | 82 +- googlemock/test/gmock-internal-utils_test.cc | 43 +- googlemock/test/gmock-matchers_test.cc | 93 +- googlemock/test/gmock-more-actions_test.cc | 162 ++- googletest/CMakeLists.txt | 27 - googletest/cmake/internal_utils.cmake | 1 - googletest/include/gtest/gtest-param-test.h | 14 +- googletest/include/gtest/gtest-param-test.h.pump | 14 +- googletest/include/gtest/gtest-printers.h | 223 +---- .../gtest/internal/gtest-param-util-generated.h | 84 +- .../internal/gtest-param-util-generated.h.pump | 11 +- googletest/include/gtest/internal/gtest-port.h | 186 +--- googletest/include/gtest/internal/gtest-tuple.h | 1021 ------------------- .../include/gtest/internal/gtest-tuple.h.pump | 348 ------- googletest/samples/sample8_unittest.cc | 27 +- googletest/test/googletest-param-test-test.cc | 108 +- googletest/test/googletest-printers-test.cc | 125 +-- googletest/test/googletest-tuple-test.cc | 319 ------ 34 files changed, 1447 insertions(+), 3731 deletions(-) delete mode 100644 googletest/include/gtest/internal/gtest-tuple.h delete mode 100644 googletest/include/gtest/internal/gtest-tuple.h.pump delete mode 100644 googletest/test/googletest-tuple-test.cc diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt index 78762b0..1fd758e 100644 --- a/googlemock/CMakeLists.txt +++ b/googlemock/CMakeLists.txt @@ -75,18 +75,6 @@ set(gmock_build_include_dirs "${gtest_SOURCE_DIR}") include_directories(${gmock_build_include_dirs}) -# Summary of tuple support for Microsoft Visual Studio: -# Compiler version(MS) version(cmake) Support -# ---------- ----------- -------------- ----------------------------- -# <= VS 2010 <= 10 <= 1600 Use Google Tests's own tuple. -# VS 2012 11 1700 std::tr1::tuple + _VARIADIC_MAX=10 -# VS 2013 12 1800 std::tr1::tuple -# VS 2015 14 1900 std::tuple -# VS 2017 15 >= 1910 std::tuple -if (MSVC AND MSVC_VERSION EQUAL 1700) - add_definitions(/D _VARIADIC_MAX=10) -endif() - ######################################################################## # # Defines the gmock & gmock_main libraries. User tests should link @@ -199,25 +187,12 @@ $env:Path = \"$project_bin;$env:Path\" cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) - if (MSVC_VERSION LESS 1600) # 1600 is Visual Studio 2010. - # Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that - # conflict with our own definitions. Therefore using our own tuple does not - # work on those compilers. - cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}" - "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) - - cxx_test_with_flags(gmock_use_own_tuple_test "${cxx_use_own_tuple}" - gmock_main_use_own_tuple test/gmock-spec-builders_test.cc) - endif() else() cxx_library(gmock_main_no_exception "${cxx_no_exception}" src/gmock_main.cc) target_link_libraries(gmock_main_no_exception PUBLIC gmock) cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" src/gmock_main.cc) target_link_libraries(gmock_main_no_rtti PUBLIC gmock) - - cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}" src/gmock_main.cc) - target_link_libraries(gmock_main_use_own_tuple PUBLIC gmock) endif() cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}" gmock_main_no_exception test/gmock-more-actions_test.cc) diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index e3b3f09..8e7e0e7 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -439,7 +439,7 @@ class Action { // template // Result Perform(const ArgumentTuple& args) const { // // Processes the arguments and returns a result, using -// // tr1::get(args) to get the N-th (0-based) argument in the tuple. +// // std::get(args) to get the N-th (0-based) argument in the tuple. // } // ... // }; @@ -838,7 +838,7 @@ class SetArgumentPointeeAction { template void Perform(const ArgumentTuple& args) const { CompileAssertTypesEqual(); - *::testing::get(args) = value_; + *::std::get(args) = value_; } private: @@ -861,7 +861,7 @@ class SetArgumentPointeeAction { template void Perform(const ArgumentTuple& args) const { CompileAssertTypesEqual(); - ::testing::get(args)->CopyFrom(*proto_); + ::std::get(args)->CopyFrom(*proto_); } private: diff --git a/googlemock/include/gmock/gmock-generated-actions.h b/googlemock/include/gmock/gmock-generated-actions.h index 260036d..3ea14dd 100644 --- a/googlemock/include/gmock/gmock-generated-actions.h +++ b/googlemock/include/gmock/gmock-generated-actions.h @@ -54,164 +54,167 @@ template class InvokeHelper; template -class InvokeHelper > { +class InvokeHelper > { public: template - static R Invoke(Function function, const ::testing::tuple<>&) { + static R Invoke(Function function, const ::std::tuple<>&) { return function(); } template static R InvokeMethod(Class* obj_ptr, MethodPtr method_ptr, - const ::testing::tuple<>&) { + const ::std::tuple<>&) { return (obj_ptr->*method_ptr)(); } template static R InvokeCallback(CallbackType* callback, - const ::testing::tuple<>&) { + const ::std::tuple<>&) { return callback->Run(); } }; template -class InvokeHelper > { +class InvokeHelper > { public: template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args)); + static R Invoke(Function function, const ::std::tuple& args) { + return function(std::get<0>(args)); } template static R InvokeMethod(Class* obj_ptr, MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args)); + const ::std::tuple& args) { + return (obj_ptr->*method_ptr)(std::get<0>(args)); } template static R InvokeCallback(CallbackType* callback, - const ::testing::tuple& args) { - return callback->Run(get<0>(args)); + const ::std::tuple& args) { + return callback->Run(std::get<0>(args)); } }; template -class InvokeHelper > { +class InvokeHelper > { public: template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args)); + static R Invoke(Function function, const ::std::tuple& args) { + return function(std::get<0>(args), std::get<1>(args)); } template static R InvokeMethod(Class* obj_ptr, MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args)); + const ::std::tuple& args) { + return (obj_ptr->*method_ptr)(std::get<0>(args), std::get<1>(args)); } template static R InvokeCallback(CallbackType* callback, - const ::testing::tuple& args) { - return callback->Run(get<0>(args), get<1>(args)); + const ::std::tuple& args) { + return callback->Run(std::get<0>(args), std::get<1>(args)); } }; template -class InvokeHelper > { +class InvokeHelper > { public: template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args)); + static R Invoke(Function function, const ::std::tuple& args) { + return function(std::get<0>(args), std::get<1>(args), + std::get<2>(args)); } template static R InvokeMethod(Class* obj_ptr, MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args)); + const ::std::tuple& args) { + return (obj_ptr->*method_ptr)(std::get<0>(args), std::get<1>(args), + std::get<2>(args)); } template static R InvokeCallback(CallbackType* callback, - const ::testing::tuple& args) { - return callback->Run(get<0>(args), get<1>(args), get<2>(args)); + const ::std::tuple& args) { + return callback->Run(std::get<0>(args), std::get<1>(args), + std::get<2>(args)); } }; template -class InvokeHelper > { +class InvokeHelper > { public: template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args), - get<3>(args)); + static R Invoke(Function function, const ::std::tuple& args) { + return function(std::get<0>(args), std::get<1>(args), + std::get<2>(args), std::get<3>(args)); } template static R InvokeMethod(Class* obj_ptr, MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args), get<3>(args)); + const ::std::tuple& args) { + return (obj_ptr->*method_ptr)(std::get<0>(args), std::get<1>(args), + std::get<2>(args), std::get<3>(args)); } template static R InvokeCallback(CallbackType* callback, - const ::testing::tuple& args) { - return callback->Run(get<0>(args), get<1>(args), get<2>(args), - get<3>(args)); + const ::std::tuple& args) { + return callback->Run(std::get<0>(args), std::get<1>(args), + std::get<2>(args), std::get<3>(args)); } }; template -class InvokeHelper > { +class InvokeHelper > { public: template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args), - get<3>(args), get<4>(args)); + return function(std::get<0>(args), std::get<1>(args), + std::get<2>(args), std::get<3>(args), std::get<4>(args)); } template static R InvokeMethod(Class* obj_ptr, MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args), get<3>(args), get<4>(args)); + const ::std::tuple& 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 static R InvokeCallback(CallbackType* callback, - const ::testing::tuple& args) { - return callback->Run(get<0>(args), get<1>(args), get<2>(args), - get<3>(args), get<4>(args)); + const ::std::tuple& 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 -class InvokeHelper > { +class InvokeHelper > { public: template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args), - get<3>(args), get<4>(args), get<5>(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 static R InvokeMethod(Class* obj_ptr, MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args), get<3>(args), get<4>(args), get<5>(args)); + const ::std::tuple& 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 @@ -219,23 +222,23 @@ class InvokeHelper > { template -class InvokeHelper > { +class InvokeHelper > { public: template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args), - get<3>(args), get<4>(args), get<5>(args), get<6>(args)); + static R Invoke(Function function, const ::std::tuple& 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 static R InvokeMethod(Class* obj_ptr, MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args), get<3>(args), get<4>(args), get<5>(args), - get<6>(args)); + const ::std::tuple& 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 @@ -243,24 +246,24 @@ class InvokeHelper > { template -class InvokeHelper > { +class InvokeHelper > { public: template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args), - get<3>(args), get<4>(args), get<5>(args), get<6>(args), - get<7>(args)); + static R Invoke(Function function, const ::std::tuple& 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 static R InvokeMethod(Class* obj_ptr, MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args), get<3>(args), get<4>(args), get<5>(args), - get<6>(args), get<7>(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 @@ -268,24 +271,26 @@ class InvokeHelper > { template -class InvokeHelper > { +class InvokeHelper > { public: template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args), - get<3>(args), get<4>(args), get<5>(args), get<6>(args), - get<7>(args), get<8>(args)); + static R Invoke(Function function, const ::std::tuple& 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 static R InvokeMethod(Class* obj_ptr, MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args), get<3>(args), get<4>(args), get<5>(args), - get<6>(args), get<7>(args), get<8>(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 @@ -294,25 +299,26 @@ class InvokeHelper > { template -class InvokeHelper > { +class InvokeHelper > { public: template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args), - get<3>(args), get<4>(args), get<5>(args), get<6>(args), - get<7>(args), get<8>(args), get<9>(args)); + static R Invoke(Function function, const ::std::tuple& 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 static R InvokeMethod(Class* obj_ptr, MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args), get<3>(args), get<4>(args), get<5>(args), - get<6>(args), get<7>(args), get<8>(args), get<9>(args)); + const ::std::tuple& 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 @@ -346,20 +352,20 @@ class InvokeCallbackAction { // An INTERNAL macro for extracting the type of a tuple field. It's // subject to change without notice - DO NOT USE IN USER CODE! #define GMOCK_FIELD_(Tuple, N) \ - typename ::testing::tuple_element::type + typename ::std::tuple_element::type // SelectArgs::type is the // type of an n-ary function whose i-th (1-based) argument type is the // k{i}-th (0-based) field of ArgumentTuple, which must be a tuple // type, and whose return type is Result. For example, -// SelectArgs, 0, 3>::type +// SelectArgs, 0, 3>::type // is int(bool, long). // // SelectArgs::Select(args) // returns the selected fields (k1, k2, ..., k_n) of args as a tuple. // For example, -// SelectArgs, 2, 0>::Select( -// ::testing::make_tuple(true, 'a', 2.5)) +// SelectArgs, 2, 0>::Select( +// ::std::make_tuple(true, 'a', 2.5)) // returns tuple (2.5, true). // // The numbers in list k1, k2, ..., k_n must be >= 0, where n can be @@ -378,9 +384,10 @@ class SelectArgs { GMOCK_FIELD_(ArgumentTuple, k10)); typedef typename Function::ArgumentTuple SelectedArgs; static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args), - get(args), get(args), get(args), get(args), - get(args), get(args), get(args)); + return SelectedArgs(std::get(args), std::get(args), + std::get(args), std::get(args), std::get(args), + std::get(args), std::get(args), std::get(args), + std::get(args), std::get(args)); } }; @@ -402,7 +409,7 @@ class SelectArgs::ArgumentTuple SelectedArgs; static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args)); + return SelectedArgs(std::get(args)); } }; @@ -414,7 +421,7 @@ class SelectArgs::ArgumentTuple SelectedArgs; static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args)); + return SelectedArgs(std::get(args), std::get(args)); } }; @@ -426,7 +433,8 @@ class SelectArgs::ArgumentTuple SelectedArgs; static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args)); + return SelectedArgs(std::get(args), std::get(args), + std::get(args)); } }; @@ -440,8 +448,8 @@ class SelectArgs::ArgumentTuple SelectedArgs; static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args), - get(args)); + return SelectedArgs(std::get(args), std::get(args), + std::get(args), std::get(args)); } }; @@ -455,8 +463,8 @@ class SelectArgs::ArgumentTuple SelectedArgs; static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args), - get(args), get(args)); + return SelectedArgs(std::get(args), std::get(args), + std::get(args), std::get(args), std::get(args)); } }; @@ -471,8 +479,9 @@ class SelectArgs::ArgumentTuple SelectedArgs; static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args), - get(args), get(args), get(args)); + return SelectedArgs(std::get(args), std::get(args), + std::get(args), std::get(args), std::get(args), + std::get(args)); } }; @@ -487,8 +496,9 @@ class SelectArgs::ArgumentTuple SelectedArgs; static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args), - get(args), get(args), get(args), get(args)); + return SelectedArgs(std::get(args), std::get(args), + std::get(args), std::get(args), std::get(args), + std::get(args), std::get(args)); } }; @@ -504,9 +514,9 @@ class SelectArgs::ArgumentTuple SelectedArgs; static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args), - get(args), get(args), get(args), get(args), - get(args)); + return SelectedArgs(std::get(args), std::get(args), + std::get(args), std::get(args), std::get(args), + std::get(args), std::get(args), std::get(args)); } }; @@ -522,9 +532,10 @@ class SelectArgs::ArgumentTuple SelectedArgs; static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args), - get(args), get(args), get(args), get(args), - get(args), get(args)); + return SelectedArgs(std::get(args), std::get(args), + std::get(args), std::get(args), std::get(args), + std::get(args), std::get(args), std::get(args), + std::get(args)); } }; @@ -587,7 +598,7 @@ struct ExcessiveArg {}; template class ActionHelper { public: - static Result Perform(Impl* impl, const ::testing::tuple<>& args) { + static Result Perform(Impl* impl, const ::std::tuple<>& args) { return impl->template gmock_PerformImpl<>(args, ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), @@ -595,95 +606,96 @@ class ActionHelper { } template - static Result Perform(Impl* impl, const ::testing::tuple& args) { - return impl->template gmock_PerformImpl(args, get<0>(args), + static Result Perform(Impl* impl, const ::std::tuple& args) { + return impl->template gmock_PerformImpl(args, std::get<0>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg()); } template - static Result Perform(Impl* impl, const ::testing::tuple& args) { - return impl->template gmock_PerformImpl(args, get<0>(args), - get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), + static Result Perform(Impl* impl, const ::std::tuple& args) { + return impl->template gmock_PerformImpl(args, std::get<0>(args), + std::get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg()); } template - static Result Perform(Impl* impl, const ::testing::tuple& args) { - return impl->template gmock_PerformImpl(args, get<0>(args), - get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(), + static Result Perform(Impl* impl, const ::std::tuple& args) { + return impl->template gmock_PerformImpl(args, + std::get<0>(args), std::get<1>(args), std::get<2>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); + ExcessiveArg(), ExcessiveArg(), ExcessiveArg()); } template - static Result Perform(Impl* impl, const ::testing::tuple& args) { - return impl->template gmock_PerformImpl(args, get<0>(args), - get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); + static Result Perform(Impl* impl, const ::std::tuple& args) { + return impl->template gmock_PerformImpl(args, + std::get<0>(args), std::get<1>(args), std::get<2>(args), + std::get<3>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), + ExcessiveArg(), ExcessiveArg(), ExcessiveArg()); } template - static Result Perform(Impl* impl, const ::testing::tuple& args) { return impl->template gmock_PerformImpl(args, - get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); + std::get<0>(args), std::get<1>(args), std::get<2>(args), + std::get<3>(args), std::get<4>(args), ExcessiveArg(), ExcessiveArg(), + ExcessiveArg(), ExcessiveArg(), ExcessiveArg()); } template - static Result Perform(Impl* impl, const ::testing::tuple& args) { return impl->template gmock_PerformImpl(args, - get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), - get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); + std::get<0>(args), std::get<1>(args), std::get<2>(args), + std::get<3>(args), std::get<4>(args), std::get<5>(args), + ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg()); } template - static Result Perform(Impl* impl, const ::testing::tuple& args) { + static Result Perform(Impl* impl, const ::std::tuple& args) { return impl->template gmock_PerformImpl(args, - get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), - get<5>(args), get<6>(args), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); + 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), ExcessiveArg(), ExcessiveArg(), ExcessiveArg()); } template - static Result Perform(Impl* impl, const ::testing::tuple& args) { + static Result Perform(Impl* impl, const ::std::tuple& args) { return impl->template gmock_PerformImpl(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), - get<4>(args), get<5>(args), get<6>(args), get<7>(args), ExcessiveArg(), - ExcessiveArg()); + A7>(args, 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), ExcessiveArg(), ExcessiveArg()); } template - static Result Perform(Impl* impl, const ::testing::tuple& args) { + static Result Perform(Impl* impl, const ::std::tuple& args) { return impl->template gmock_PerformImpl(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), - get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args), + A8>(args, 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), ExcessiveArg()); } template - static Result Perform(Impl* impl, const ::testing::tuple& args) { + static Result Perform(Impl* impl, const ::std::tuple& args) { return impl->template gmock_PerformImpl(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), - get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args), - get<9>(args)); + A9>(args, 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)); } }; @@ -950,8 +962,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, // // MORE INFORMATION: // -// To learn more about using these macros, please search for 'ACTION' -// on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md +// To learn more about using these macros, please search for 'ACTION' on +// https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md // An internal macro needed for implementing ACTION*(). #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ @@ -991,7 +1003,7 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, // ACTION_TEMPLATE(DuplicateArg, // HAS_2_TEMPLATE_PARAMS(int, k, typename, T), // AND_1_VALUE_PARAMS(output)) { -// *output = T(::testing::get(args)); +// *output = T(::std::get(args)); // } // ... // int n; @@ -2389,7 +2401,7 @@ ACTION_TEMPLATE(InvokeArgument, using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl( internal::invoke_argument::AdlTag(), - ::testing::get(args)); + ::std::get(args)); } ACTION_TEMPLATE(InvokeArgument, @@ -2398,7 +2410,7 @@ ACTION_TEMPLATE(InvokeArgument, using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl( internal::invoke_argument::AdlTag(), - ::testing::get(args), p0); + ::std::get(args), p0); } ACTION_TEMPLATE(InvokeArgument, @@ -2407,7 +2419,7 @@ ACTION_TEMPLATE(InvokeArgument, using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl( internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1); + ::std::get(args), p0, p1); } ACTION_TEMPLATE(InvokeArgument, @@ -2416,7 +2428,7 @@ ACTION_TEMPLATE(InvokeArgument, using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl( internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2); + ::std::get(args), p0, p1, p2); } ACTION_TEMPLATE(InvokeArgument, @@ -2425,7 +2437,7 @@ ACTION_TEMPLATE(InvokeArgument, using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl( internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2, p3); + ::std::get(args), p0, p1, p2, p3); } ACTION_TEMPLATE(InvokeArgument, @@ -2434,7 +2446,7 @@ ACTION_TEMPLATE(InvokeArgument, using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl( internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2, p3, p4); + ::std::get(args), p0, p1, p2, p3, p4); } ACTION_TEMPLATE(InvokeArgument, @@ -2443,7 +2455,7 @@ ACTION_TEMPLATE(InvokeArgument, using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl( internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2, p3, p4, p5); + ::std::get(args), p0, p1, p2, p3, p4, p5); } ACTION_TEMPLATE(InvokeArgument, @@ -2452,7 +2464,7 @@ ACTION_TEMPLATE(InvokeArgument, using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl( internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2, p3, p4, p5, p6); + ::std::get(args), p0, p1, p2, p3, p4, p5, p6); } ACTION_TEMPLATE(InvokeArgument, @@ -2461,7 +2473,7 @@ ACTION_TEMPLATE(InvokeArgument, using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl( internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2, p3, p4, p5, p6, p7); + ::std::get(args), p0, p1, p2, p3, p4, p5, p6, p7); } ACTION_TEMPLATE(InvokeArgument, @@ -2470,7 +2482,7 @@ ACTION_TEMPLATE(InvokeArgument, using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl( internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2, p3, p4, p5, p6, p7, p8); + ::std::get(args), p0, p1, p2, p3, p4, p5, p6, p7, p8); } ACTION_TEMPLATE(InvokeArgument, @@ -2479,7 +2491,7 @@ ACTION_TEMPLATE(InvokeArgument, using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl( internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); + ::std::get(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); } // Various overloads for ReturnNew(). diff --git a/googlemock/include/gmock/gmock-generated-actions.h.pump b/googlemock/include/gmock/gmock-generated-actions.h.pump index f1ee4a6..2794ebb 100644 --- a/googlemock/include/gmock/gmock-generated-actions.h.pump +++ b/googlemock/include/gmock/gmock-generated-actions.h.pump @@ -63,19 +63,19 @@ $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, [[get<$(j - 1)>(args)]]]] +$var gets = [[$for j, [[std::get<$(j - 1)>(args)]]]] template -class InvokeHelper > { +class InvokeHelper > { public: template - static R Invoke(Function function, const ::testing::tuple<$as>&$args) { + static R Invoke(Function function, const ::std::tuple<$as>&$args) { return function($gets); } template static R InvokeMethod(Class* obj_ptr, MethodPtr method_ptr, - const ::testing::tuple<$as>&$args) { + const ::std::tuple<$as>&$args) { return (obj_ptr->*method_ptr)($gets); } @@ -83,7 +83,7 @@ class InvokeHelper > { $if i <= max_callback_arity [[ template static R InvokeCallback(CallbackType* callback, - const ::testing::tuple<$as>&$args) { + const ::std::tuple<$as>&$args) { return callback->Run($gets); } ]] $else [[ @@ -122,7 +122,7 @@ class InvokeCallbackAction { // An INTERNAL macro for extracting the type of a tuple field. It's // subject to change without notice - DO NOT USE IN USER CODE! #define GMOCK_FIELD_(Tuple, N) \ - typename ::testing::tuple_element::type + typename ::std::tuple_element::type $range i 1..n @@ -130,14 +130,14 @@ $range i 1..n // type of an n-ary function whose i-th (1-based) argument type is the // k{i}-th (0-based) field of ArgumentTuple, which must be a tuple // type, and whose return type is Result. For example, -// SelectArgs, 0, 3>::type +// SelectArgs, 0, 3>::type // is int(bool, long). // // SelectArgs::Select(args) // returns the selected fields (k1, k2, ..., k_n) of args as a tuple. // For example, -// SelectArgs, 2, 0>::Select( -// ::testing::make_tuple(true, 'a', 2.5)) +// SelectArgs, 2, 0>::Select( +// ::std::make_tuple(true, 'a', 2.5)) // returns tuple (2.5, true). // // The numbers in list k1, k2, ..., k_n must be >= 0, where n can be @@ -150,7 +150,7 @@ class SelectArgs { typedef Result type($for i, [[GMOCK_FIELD_(ArgumentTuple, k$i)]]); typedef typename Function::ArgumentTuple SelectedArgs; static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs($for i, [[get(args)]]); + return SelectedArgs($for i, [[std::get(args)]]); } }; @@ -166,7 +166,7 @@ class SelectArgs::ArgumentTuple SelectedArgs; static SelectedArgs Select(const ArgumentTuple& [[]] $if i == 1 [[/* args */]] $else [[args]]) { - return SelectedArgs($for j1, [[get(args)]]); + return SelectedArgs($for j1, [[std::get(args)]]); } }; @@ -240,12 +240,12 @@ $range j 0..i-1 ]]]] $range j 0..i-1 $var As = [[$for j, [[A$j]]]] -$var as = [[$for j, [[get<$j>(args)]]]] +$var as = [[$for j, [[std::get<$j>(args)]]]] $range k 1..n-i $var eas = [[$for k, [[ExcessiveArg()]]]] $var arg_list = [[$if (i==0) | (i==n) [[$as$eas]] $else [[$as, $eas]]]] $template - static Result Perform(Impl* impl, const ::testing::tuple<$As>& args) { + static Result Perform(Impl* impl, const ::std::tuple<$As>& args) { return impl->template gmock_PerformImpl<$As>(args, $arg_list); } @@ -395,8 +395,8 @@ $range j2 2..i // // MORE INFORMATION: // -// To learn more about using these macros, please search for 'ACTION' -// on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md +// To learn more about using these macros, please search for 'ACTION' on +// https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md $range i 0..n $range k 0..n-1 @@ -432,7 +432,7 @@ $for k [[, \ // ACTION_TEMPLATE(DuplicateArg, // HAS_2_TEMPLATE_PARAMS(int, k, typename, T), // AND_1_VALUE_PARAMS(output)) { -// *output = T(::testing::get(args)); +// *output = T(::std::get(args)); // } // ... // int n; @@ -796,7 +796,7 @@ ACTION_TEMPLATE(InvokeArgument, using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl( internal::invoke_argument::AdlTag(), - ::testing::get(args)$for j [[, p$j]]); + ::std::get(args)$for j [[, p$j]]); } ]] diff --git a/googlemock/include/gmock/gmock-generated-function-mockers.h b/googlemock/include/gmock/gmock-generated-function-mockers.h index aab4582..9886115 100644 --- a/googlemock/include/gmock/gmock-generated-function-mockers.h +++ b/googlemock/include/gmock/gmock-generated-function-mockers.h @@ -70,7 +70,7 @@ class FunctionMocker : public typedef typename internal::Function::ArgumentTuple ArgumentTuple; MockSpec With() { - return MockSpec(this, ::testing::make_tuple()); + return MockSpec(this, ::std::make_tuple()); } R Invoke() { @@ -90,7 +90,7 @@ class FunctionMocker : public typedef typename internal::Function::ArgumentTuple ArgumentTuple; MockSpec With(const Matcher& m1) { - return MockSpec(this, ::testing::make_tuple(m1)); + return MockSpec(this, ::std::make_tuple(m1)); } R Invoke(A1 a1) { @@ -110,7 +110,7 @@ class FunctionMocker : public typedef typename internal::Function::ArgumentTuple ArgumentTuple; MockSpec With(const Matcher& m1, const Matcher& m2) { - return MockSpec(this, ::testing::make_tuple(m1, m2)); + return MockSpec(this, ::std::make_tuple(m1, m2)); } R Invoke(A1 a1, A2 a2) { @@ -132,7 +132,7 @@ class FunctionMocker : public MockSpec With(const Matcher& m1, const Matcher& m2, const Matcher& m3) { - return MockSpec(this, ::testing::make_tuple(m1, m2, m3)); + return MockSpec(this, ::std::make_tuple(m1, m2, m3)); } R Invoke(A1 a1, A2 a2, A3 a3) { @@ -154,7 +154,7 @@ class FunctionMocker : public MockSpec With(const Matcher& m1, const Matcher& m2, const Matcher& m3, const Matcher& m4) { - return MockSpec(this, ::testing::make_tuple(m1, m2, m3, m4)); + return MockSpec(this, ::std::make_tuple(m1, m2, m3, m4)); } R Invoke(A1 a1, A2 a2, A3 a3, A4 a4) { @@ -178,7 +178,7 @@ class FunctionMocker : public MockSpec With(const Matcher& m1, const Matcher& m2, const Matcher& m3, const Matcher& m4, const Matcher& m5) { - return MockSpec(this, ::testing::make_tuple(m1, m2, m3, m4, m5)); + return MockSpec(this, ::std::make_tuple(m1, m2, m3, m4, m5)); } R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { @@ -203,7 +203,7 @@ class FunctionMocker : public MockSpec With(const Matcher& m1, const Matcher& m2, const Matcher& m3, const Matcher& m4, const Matcher& m5, const Matcher& m6) { - return MockSpec(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6)); + return MockSpec(this, ::std::make_tuple(m1, m2, m3, m4, m5, m6)); } R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { @@ -229,7 +229,7 @@ class FunctionMocker : public MockSpec With(const Matcher& m1, const Matcher& m2, const Matcher& m3, const Matcher& m4, const Matcher& m5, const Matcher& m6, const Matcher& m7) { - return MockSpec(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7)); + return MockSpec(this, ::std::make_tuple(m1, m2, m3, m4, m5, m6, m7)); } R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { @@ -255,8 +255,7 @@ class FunctionMocker : public MockSpec With(const Matcher& m1, const Matcher& m2, const Matcher& m3, const Matcher& m4, const Matcher& m5, const Matcher& m6, const Matcher& m7, const Matcher& m8) { - return MockSpec(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7, - m8)); + return MockSpec(this, ::std::make_tuple(m1, m2, m3, m4, m5, m6, m7, m8)); } R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { @@ -284,8 +283,8 @@ class FunctionMocker : public const Matcher& m3, const Matcher& m4, const Matcher& m5, const Matcher& m6, const Matcher& m7, const Matcher& m8, const Matcher& m9) { - return MockSpec(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7, - m8, m9)); + return MockSpec(this, ::std::make_tuple(m1, m2, m3, m4, m5, m6, m7, m8, + m9)); } R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { @@ -314,8 +313,8 @@ class FunctionMocker : public const Matcher& m3, const Matcher& m4, const Matcher& m5, const Matcher& m6, const Matcher& m7, const Matcher& m8, const Matcher& m9, const Matcher& m10) { - return MockSpec(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7, - m8, m9, m10)); + return MockSpec(this, ::std::make_tuple(m1, m2, m3, m4, m5, m6, m7, m8, + m9, m10)); } R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, @@ -418,534 +417,478 @@ using internal::FunctionMocker; GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__) // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method() constness { \ - GTEST_COMPILE_ASSERT_( \ - (::testing::tuple_size::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(); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method() constness { \ - GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(0, constness, Method).With(); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>*) const { \ - return ::testing::internal::AdjustConstness_##constness(this) \ - ->gmock_##Method(); \ - } \ +#define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \ + 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(); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method() constness { \ + GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(0, constness, Method).With(); \ + } \ + ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ + const ::testing::internal::WithoutMatchers&, \ + constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ + return ::testing::internal::AdjustConstness_##constness(this)-> \ + gmock_##Method(); \ + } \ mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \ - Method) + Method) // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \ - GMOCK_RESULT_(tn, __VA_ARGS__) \ - ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \ - GTEST_COMPILE_ASSERT_( \ - (::testing::tuple_size::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(::testing::internal::forward( \ - gmock_a1)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness { \ - GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>*) const { \ - return ::testing::internal::AdjustConstness_##constness(this) \ - ->gmock_##Method(::testing::A()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \ - Method) +#define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \ + 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(::testing::internal::forward(gmock_a1)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness { \ + GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \ + } \ + ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ + const ::testing::internal::WithoutMatchers&, \ + constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ + return ::testing::internal::AdjustConstness_##constness(this)-> \ + gmock_##Method(::testing::A()); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \ + Method) // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \ - 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_( \ - (::testing::tuple_size::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(::testing::internal::forward( \ - gmock_a1), \ - ::testing::internal::forward( \ - gmock_a2)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) constness { \ - GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>*) const { \ - return ::testing::internal::AdjustConstness_##constness(this) \ - ->gmock_##Method(::testing::A(), \ - ::testing::A()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \ - Method) +#define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \ + 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(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) constness { \ + GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \ + } \ + ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ + const ::testing::internal::WithoutMatchers&, \ + constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ + return ::testing::internal::AdjustConstness_##constness(this)-> \ + gmock_##Method(::testing::A(), \ + ::testing::A()); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \ + Method) // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \ - 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_( \ - (::testing::tuple_size::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(::testing::internal::forward( \ - gmock_a1), \ - ::testing::internal::forward( \ - gmock_a2), \ - ::testing::internal::forward( \ - gmock_a3)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) constness { \ - GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(3, constness, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>*) const { \ - return ::testing::internal::AdjustConstness_##constness(this) \ - ->gmock_##Method(::testing::A(), \ - ::testing::A(), \ - ::testing::A()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \ - Method) +#define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \ + 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(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) constness { \ + GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3); \ + } \ + ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ + const ::testing::internal::WithoutMatchers&, \ + constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ + return ::testing::internal::AdjustConstness_##constness(this)-> \ + gmock_##Method(::testing::A(), \ + ::testing::A(), \ + ::testing::A()); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \ + Method) // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \ - 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_( \ - (::testing::tuple_size::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(::testing::internal::forward( \ - gmock_a1), \ - ::testing::internal::forward( \ - gmock_a2), \ - ::testing::internal::forward( \ - gmock_a3), \ - ::testing::internal::forward( \ - gmock_a4)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) constness { \ - GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(4, constness, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>*) const { \ - return ::testing::internal::AdjustConstness_##constness(this) \ - ->gmock_##Method(::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \ - Method) +#define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \ + 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(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3), \ + ::testing::internal::forward(gmock_a4)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) constness { \ + GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3, gmock_a4); \ + } \ + ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ + const ::testing::internal::WithoutMatchers&, \ + constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ + return ::testing::internal::AdjustConstness_##constness(this)-> \ + gmock_##Method(::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A()); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \ + Method) // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \ - 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_( \ - (::testing::tuple_size::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(::testing::internal::forward( \ - gmock_a1), \ - ::testing::internal::forward( \ - gmock_a2), \ - ::testing::internal::forward( \ - gmock_a3), \ - ::testing::internal::forward( \ - gmock_a4), \ - ::testing::internal::forward( \ - gmock_a5)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) constness { \ - GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(5, constness, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>*) const { \ - return ::testing::internal::AdjustConstness_##constness(this) \ - ->gmock_##Method(::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \ - Method) +#define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \ + 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(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3), \ + ::testing::internal::forward(gmock_a4), \ + ::testing::internal::forward(gmock_a5)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ + GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) constness { \ + GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3, gmock_a4, gmock_a5); \ + } \ + ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ + const ::testing::internal::WithoutMatchers&, \ + constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ + return ::testing::internal::AdjustConstness_##constness(this)-> \ + gmock_##Method(::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A()); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \ + Method) // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \ - 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_( \ - (::testing::tuple_size::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(::testing::internal::forward( \ - gmock_a1), \ - ::testing::internal::forward( \ - gmock_a2), \ - ::testing::internal::forward( \ - gmock_a3), \ - ::testing::internal::forward( \ - gmock_a4), \ - ::testing::internal::forward( \ - gmock_a5), \ - ::testing::internal::forward( \ - gmock_a6)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) constness { \ - GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(6, constness, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>*) const { \ - return ::testing::internal::AdjustConstness_##constness(this) \ - ->gmock_##Method(::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \ - Method) +#define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \ + 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(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3), \ + ::testing::internal::forward(gmock_a4), \ + ::testing::internal::forward(gmock_a5), \ + ::testing::internal::forward(gmock_a6)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ + GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ + GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) constness { \ + GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3, gmock_a4, gmock_a5, gmock_a6); \ + } \ + ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ + const ::testing::internal::WithoutMatchers&, \ + constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ + return ::testing::internal::AdjustConstness_##constness(this)-> \ + gmock_##Method(::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A()); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \ + Method) // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \ - 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_( \ - (::testing::tuple_size::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(::testing::internal::forward( \ - gmock_a1), \ - ::testing::internal::forward( \ - gmock_a2), \ - ::testing::internal::forward( \ - gmock_a3), \ - ::testing::internal::forward( \ - gmock_a4), \ - ::testing::internal::forward( \ - gmock_a5), \ - ::testing::internal::forward( \ - gmock_a6), \ - ::testing::internal::forward( \ - gmock_a7)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) constness { \ - GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(7, constness, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, \ - gmock_a7); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>*) const { \ - return ::testing::internal::AdjustConstness_##constness(this) \ - ->gmock_##Method(::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \ - Method) +#define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \ + 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(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3), \ + ::testing::internal::forward(gmock_a4), \ + ::testing::internal::forward(gmock_a5), \ + ::testing::internal::forward(gmock_a6), \ + ::testing::internal::forward(gmock_a7)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ + GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ + GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ + GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) constness { \ + GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ + } \ + ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ + const ::testing::internal::WithoutMatchers&, \ + constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ + return ::testing::internal::AdjustConstness_##constness(this)-> \ + gmock_##Method(::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A()); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \ + Method) // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \ - 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, \ - GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8) constness { \ - GTEST_COMPILE_ASSERT_( \ - (::testing::tuple_size::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(::testing::internal::forward( \ - gmock_a1), \ - ::testing::internal::forward( \ - gmock_a2), \ - ::testing::internal::forward( \ - gmock_a3), \ - ::testing::internal::forward( \ - gmock_a4), \ - ::testing::internal::forward( \ - gmock_a5), \ - ::testing::internal::forward( \ - gmock_a6), \ - ::testing::internal::forward( \ - gmock_a7), \ - ::testing::internal::forward( \ - gmock_a8)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ - GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) constness { \ - GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(8, constness, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, \ - gmock_a7, gmock_a8); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>*) const { \ - return ::testing::internal::AdjustConstness_##constness(this) \ - ->gmock_##Method(::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \ - Method) +#define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \ + 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, 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(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3), \ + ::testing::internal::forward(gmock_a4), \ + ::testing::internal::forward(gmock_a5), \ + ::testing::internal::forward(gmock_a6), \ + ::testing::internal::forward(gmock_a7), \ + ::testing::internal::forward(gmock_a8)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ + GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ + GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ + GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ + GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) constness { \ + GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(8, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ + } \ + ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ + const ::testing::internal::WithoutMatchers&, \ + constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ + return ::testing::internal::AdjustConstness_##constness(this)-> \ + gmock_##Method(::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A()); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \ + Method) // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \ - 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, \ - GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \ - GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9) constness { \ - GTEST_COMPILE_ASSERT_( \ - (::testing::tuple_size::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(::testing::internal::forward( \ - gmock_a1), \ - ::testing::internal::forward( \ - gmock_a2), \ - ::testing::internal::forward( \ - gmock_a3), \ - ::testing::internal::forward( \ - gmock_a4), \ - ::testing::internal::forward( \ - gmock_a5), \ - ::testing::internal::forward( \ - gmock_a6), \ - ::testing::internal::forward( \ - gmock_a7), \ - ::testing::internal::forward( \ - gmock_a8), \ - ::testing::internal::forward( \ - gmock_a9)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ - GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \ - GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) constness { \ - GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(9, constness, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, \ - gmock_a7, gmock_a8, gmock_a9); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>*) const { \ - return ::testing::internal::AdjustConstness_##constness(this) \ - ->gmock_##Method(::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \ - Method) +#define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \ + 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, 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(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3), \ + ::testing::internal::forward(gmock_a4), \ + ::testing::internal::forward(gmock_a5), \ + ::testing::internal::forward(gmock_a6), \ + ::testing::internal::forward(gmock_a7), \ + ::testing::internal::forward(gmock_a8), \ + ::testing::internal::forward(gmock_a9)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ + GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ + GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ + GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ + GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \ + GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) constness { \ + GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(9, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \ + gmock_a9); \ + } \ + ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ + const ::testing::internal::WithoutMatchers&, \ + constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ + return ::testing::internal::AdjustConstness_##constness(this)-> \ + gmock_##Method(::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A()); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \ + Method) // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \ - 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, \ - 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_( \ - (::testing::tuple_size::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(::testing::internal::forward( \ - gmock_a1), \ - ::testing::internal::forward( \ - gmock_a2), \ - ::testing::internal::forward( \ - gmock_a3), \ - ::testing::internal::forward( \ - gmock_a4), \ - ::testing::internal::forward( \ - gmock_a5), \ - ::testing::internal::forward( \ - gmock_a6), \ - ::testing::internal::forward( \ - gmock_a7), \ - ::testing::internal::forward( \ - gmock_a8), \ - ::testing::internal::forward( \ - gmock_a9), \ - ::testing::internal::forward( \ - gmock_a10)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ - GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \ - GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \ - GMOCK_MATCHER_(tn, 10, __VA_ARGS__) gmock_a10) constness { \ - GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(10, constness, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, \ - gmock_a7, gmock_a8, gmock_a9, gmock_a10); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>*) const { \ - return ::testing::internal::AdjustConstness_##constness(this) \ - ->gmock_##Method(::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A(), \ - ::testing::A()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \ - Method) +#define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \ + 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, 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(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3), \ + ::testing::internal::forward(gmock_a4), \ + ::testing::internal::forward(gmock_a5), \ + ::testing::internal::forward(gmock_a6), \ + ::testing::internal::forward(gmock_a7), \ + ::testing::internal::forward(gmock_a8), \ + ::testing::internal::forward(gmock_a9), \ + ::testing::internal::forward(gmock_a10)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ + GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ + GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ + GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ + GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \ + GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \ + GMOCK_MATCHER_(tn, 10, \ + __VA_ARGS__) gmock_a10) constness { \ + GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(10, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \ + gmock_a10); \ + } \ + ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ + const ::testing::internal::WithoutMatchers&, \ + constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ + return ::testing::internal::AdjustConstness_##constness(this)-> \ + gmock_##Method(::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A(), \ + ::testing::A()); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \ + Method) #define MOCK_METHOD0(m, ...) GMOCK_METHOD0_(, , , m, __VA_ARGS__) #define MOCK_METHOD1(m, ...) GMOCK_METHOD1_(, , , m, __VA_ARGS__) @@ -1175,7 +1118,9 @@ class MockFunction { #if GTEST_HAS_STD_FUNCTION_ ::std::function AsStdFunction() { - return [this](A0 a0) -> R { return this->Call(::std::forward(a0)); }; + return [this](A0 a0) -> R { + return this->Call(::std::forward(a0)); + }; } #endif // GTEST_HAS_STD_FUNCTION_ @@ -1213,7 +1158,7 @@ class MockFunction { ::std::function AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2) -> R { return this->Call(::std::forward(a0), ::std::forward(a1), - ::std::forward(a2)); + ::std::forward(a2)); }; } #endif // GTEST_HAS_STD_FUNCTION_ @@ -1233,7 +1178,7 @@ class MockFunction { ::std::function AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2, A3 a3) -> R { return this->Call(::std::forward(a0), ::std::forward(a1), - ::std::forward(a2), ::std::forward(a3)); + ::std::forward(a2), ::std::forward(a3)); }; } #endif // GTEST_HAS_STD_FUNCTION_ @@ -1254,8 +1199,8 @@ class MockFunction { ::std::function AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) -> R { return this->Call(::std::forward(a0), ::std::forward(a1), - ::std::forward(a2), ::std::forward(a3), - ::std::forward(a4)); + ::std::forward(a2), ::std::forward(a3), + ::std::forward(a4)); }; } #endif // GTEST_HAS_STD_FUNCTION_ @@ -1276,8 +1221,8 @@ class MockFunction { ::std::function AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -> R { return this->Call(::std::forward(a0), ::std::forward(a1), - ::std::forward(a2), ::std::forward(a3), - ::std::forward(a4), ::std::forward(a5)); + ::std::forward(a2), ::std::forward(a3), + ::std::forward(a4), ::std::forward(a5)); }; } #endif // GTEST_HAS_STD_FUNCTION_ @@ -1298,9 +1243,9 @@ class MockFunction { ::std::function AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -> R { return this->Call(::std::forward(a0), ::std::forward(a1), - ::std::forward(a2), ::std::forward(a3), - ::std::forward(a4), ::std::forward(a5), - ::std::forward(a6)); + ::std::forward(a2), ::std::forward(a3), + ::std::forward(a4), ::std::forward(a5), + ::std::forward(a6)); }; } #endif // GTEST_HAS_STD_FUNCTION_ @@ -1321,9 +1266,9 @@ class MockFunction { ::std::function AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -> R { return this->Call(::std::forward(a0), ::std::forward(a1), - ::std::forward(a2), ::std::forward(a3), - ::std::forward(a4), ::std::forward(a5), - ::std::forward(a6), ::std::forward(a7)); + ::std::forward(a2), ::std::forward(a3), + ::std::forward(a4), ::std::forward(a5), + ::std::forward(a6), ::std::forward(a7)); }; } #endif // GTEST_HAS_STD_FUNCTION_ @@ -1343,12 +1288,12 @@ class MockFunction { #if GTEST_HAS_STD_FUNCTION_ ::std::function AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, - A8 a8) -> R { + A8 a8) -> R { return this->Call(::std::forward(a0), ::std::forward(a1), - ::std::forward(a2), ::std::forward(a3), - ::std::forward(a4), ::std::forward(a5), - ::std::forward(a6), ::std::forward(a7), - ::std::forward(a8)); + ::std::forward(a2), ::std::forward(a3), + ::std::forward(a4), ::std::forward(a5), + ::std::forward(a6), ::std::forward(a7), + ::std::forward(a8)); }; } #endif // GTEST_HAS_STD_FUNCTION_ @@ -1368,13 +1313,13 @@ class MockFunction { #if GTEST_HAS_STD_FUNCTION_ ::std::function AsStdFunction() { - return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, - A9 a9) -> R { + return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, + A8 a8, A9 a9) -> R { return this->Call(::std::forward(a0), ::std::forward(a1), - ::std::forward(a2), ::std::forward(a3), - ::std::forward(a4), ::std::forward(a5), - ::std::forward(a6), ::std::forward(a7), - ::std::forward(a8), ::std::forward(a9)); + ::std::forward(a2), ::std::forward(a3), + ::std::forward(a4), ::std::forward(a5), + ::std::forward(a6), ::std::forward(a7), + ::std::forward(a8), ::std::forward(a9)); }; } #endif // GTEST_HAS_STD_FUNCTION_ diff --git a/googlemock/include/gmock/gmock-generated-function-mockers.h.pump b/googlemock/include/gmock/gmock-generated-function-mockers.h.pump index 106abe8..e05b18d 100644 --- a/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +++ b/googlemock/include/gmock/gmock-generated-function-mockers.h.pump @@ -81,7 +81,7 @@ class FunctionMocker : public typedef typename internal::Function::ArgumentTuple ArgumentTuple; MockSpec With($matchers) { - return MockSpec(this, ::testing::make_tuple($ms)); + return MockSpec(this, ::std::make_tuple($ms)); } R Invoke($Aas) { @@ -194,7 +194,7 @@ $var anything_matchers = [[$for j, \ #define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, ...) \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ $arg_as) constness { \ - GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ + 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); \ diff --git a/googlemock/include/gmock/gmock-generated-matchers.h b/googlemock/include/gmock/gmock-generated-matchers.h index 61fe66a..745ee33 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h +++ b/googlemock/include/gmock/gmock-generated-matchers.h @@ -51,7 +51,7 @@ namespace internal { // The type of the i-th (0-based) field of Tuple. #define GMOCK_FIELD_TYPE_(Tuple, i) \ - typename ::testing::tuple_element::type + typename ::std::tuple_element::type // TupleFields is for selecting fields from a // tuple of type Tuple. It has two members: @@ -59,10 +59,11 @@ namespace internal { // type: a tuple type whose i-th field is the ki-th field of Tuple. // GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple. // -// For example, in class TupleFields, 2, 0>, we have: +// For example, in class TupleFields, 2, 0>, +// we have: // -// type is tuple, and -// GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true). +// type is std::tuple, and +// GetSelectedFields(std::make_tuple(true, 'a', 42)) is (42, true). template class TupleFields { public: - typedef ::testing::tuple type; + typedef ::std::tuple type; static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t), get(t), get(t), - get(t), get(t), get(t), get(t), get(t)); + return type(std::get(t), std::get(t), std::get(t), + std::get(t), std::get(t), std::get(t), std::get(t), + std::get(t), std::get(t), std::get(t)); } }; @@ -91,7 +92,7 @@ class TupleFields { template class TupleFields { public: - typedef ::testing::tuple<> type; + typedef ::std::tuple<> type; static type GetSelectedFields(const Tuple& /* t */) { return type(); } @@ -100,77 +101,77 @@ class TupleFields { template class TupleFields { public: - typedef ::testing::tuple type; + typedef ::std::tuple type; static type GetSelectedFields(const Tuple& t) { - return type(get(t)); + return type(std::get(t)); } }; template class TupleFields { public: - typedef ::testing::tuple type; + typedef ::std::tuple type; static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t)); + return type(std::get(t), std::get(t)); } }; template class TupleFields { public: - typedef ::testing::tuple type; + typedef ::std::tuple type; static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t)); + return type(std::get(t), std::get(t), std::get(t)); } }; template class TupleFields { public: - typedef ::testing::tuple type; + typedef ::std::tuple type; static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t), get(t)); + return type(std::get(t), std::get(t), std::get(t), + std::get(t)); } }; template class TupleFields { public: - typedef ::testing::tuple type; + typedef ::std::tuple type; static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t), get(t), get(t)); + return type(std::get(t), std::get(t), std::get(t), + std::get(t), std::get(t)); } }; template class TupleFields { public: - typedef ::testing::tuple type; + typedef ::std::tuple type; static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t), get(t), get(t), - get(t)); + return type(std::get(t), std::get(t), std::get(t), + std::get(t), std::get(t), std::get(t)); } }; template class TupleFields { public: - typedef ::testing::tuple type; + typedef ::std::tuple type; static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t), get(t), get(t), - get(t), get(t)); + return type(std::get(t), std::get(t), std::get(t), + std::get(t), std::get(t), std::get(t), std::get(t)); } }; @@ -178,14 +179,14 @@ template class TupleFields { public: - typedef ::testing::tuple type; + typedef ::std::tuple type; static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t), get(t), get(t), - get(t), get(t), get(t)); + return type(std::get(t), std::get(t), std::get(t), + std::get(t), std::get(t), std::get(t), std::get(t), + std::get(t)); } }; @@ -193,14 +194,15 @@ template class TupleFields { public: - typedef ::testing::tuple type; + typedef ::std::tuple type; static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t), get(t), get(t), - get(t), get(t), get(t), get(t)); + return type(std::get(t), std::get(t), std::get(t), + std::get(t), std::get(t), std::get(t), std::get(t), + std::get(t), std::get(t)); } }; @@ -466,6 +468,7 @@ Args(const InnerMatcher& matcher) { } + // AnyOf(m1, m2, ..., mk) matches any value that matches any of the given // sub-matchers. AnyOf is called fully qualified to prevent ADL from firing. @@ -795,7 +798,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple<>()));\ + ::std::tuple<>()));\ }\ };\ template \ @@ -845,7 +848,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0)));\ + ::std::tuple(p0)));\ }\ };\ template \ @@ -901,7 +904,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1)));\ + ::std::tuple(p0, p1)));\ }\ };\ template \ @@ -963,8 +966,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, \ - p2)));\ + ::std::tuple(p0, p1, p2)));\ }\ };\ template \ @@ -1032,8 +1034,8 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, p2, p3)));\ + ::std::tuple(p0, \ + p1, p2, p3)));\ }\ };\ template \ @@ -1110,7 +1112,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, p2, p3, p4)));\ }\ };\ @@ -1192,7 +1194,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, p2, p3, p4, p5)));\ }\ };\ @@ -1280,7 +1282,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, p2, p3, p4, p5, \ p6)));\ }\ @@ -1377,7 +1379,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, p2, \ p3, p4, p5, p6, p7)));\ }\ @@ -1480,7 +1482,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\ }\ @@ -1590,7 +1592,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\ }\ diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index ad02ea7..311e127 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -55,7 +55,7 @@ $range i 0..n-1 // The type of the i-th (0-based) field of Tuple. #define GMOCK_FIELD_TYPE_(Tuple, i) \ - typename ::testing::tuple_element::type + typename ::std::tuple_element::type // TupleFields is for selecting fields from a // tuple of type Tuple. It has two members: @@ -63,10 +63,11 @@ $range i 0..n-1 // type: a tuple type whose i-th field is the ki-th field of Tuple. // GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple. // -// For example, in class TupleFields, 2, 0>, we have: +// For example, in class TupleFields, 2, 0>, +// we have: // -// type is tuple, and -// GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true). +// type is std::tuple, and +// GetSelectedFields(std::make_tuple(true, 'a', 42)) is (42, true). template class TupleFields; @@ -75,9 +76,9 @@ class TupleFields; template class TupleFields { public: - typedef ::testing::tuple<$for i, [[GMOCK_FIELD_TYPE_(Tuple, k$i)]]> type; + typedef ::std::tuple<$for i, [[GMOCK_FIELD_TYPE_(Tuple, k$i)]]> type; static type GetSelectedFields(const Tuple& t) { - return type($for i, [[get(t)]]); + return type($for i, [[std::get(t)]]); } }; @@ -91,9 +92,9 @@ $range k 0..n-1 template class TupleFields { public: - typedef ::testing::tuple<$for j, [[GMOCK_FIELD_TYPE_(Tuple, k$j)]]> type; + typedef ::std::tuple<$for j, [[GMOCK_FIELD_TYPE_(Tuple, k$j)]]> type; static type GetSelectedFields(const Tuple& $if i==0 [[/* t */]] $else [[t]]) { - return type($for j, [[get(t)]]); + return type($for j, [[std::get(t)]]); } }; @@ -534,7 +535,7 @@ $var param_field_decls2 = [[$for j return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\ + ::std::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\ }\ };\ template \ diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 9d31e5d..08371f1 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -905,8 +905,8 @@ class TuplePrefix { template static bool Matches(const MatcherTuple& matcher_tuple, const ValueTuple& value_tuple) { - return TuplePrefix::Matches(matcher_tuple, value_tuple) - && get(matcher_tuple).Matches(get(value_tuple)); + return TuplePrefix::Matches(matcher_tuple, value_tuple) && + std::get(matcher_tuple).Matches(std::get(value_tuple)); } // TuplePrefix::ExplainMatchFailuresTo(matchers, values, os) @@ -922,16 +922,16 @@ class TuplePrefix { // Then describes the failure (if any) in the (N - 1)-th (0-based) // field. - typename tuple_element::type matcher = - get(matchers); - typedef typename tuple_element::type Value; - GTEST_REFERENCE_TO_CONST_(Value) value = get(values); + typename std::tuple_element::type matcher = + std::get(matchers); + typedef typename std::tuple_element::type Value; + GTEST_REFERENCE_TO_CONST_(Value) value = std::get(values); StringMatchResultListener listener; if (!matcher.MatchAndExplain(value, &listener)) { // FIXME: include in the message the name of the parameter // as used in MOCK_METHOD*() when possible. *os << " Expected arg #" << N - 1 << ": "; - get(matchers).DescribeTo(os); + std::get(matchers).DescribeTo(os); *os << "\n Actual: "; // We remove the reference in type Value to prevent the // universal printer from printing the address of value, which @@ -971,11 +971,11 @@ bool TupleMatches(const MatcherTuple& matcher_tuple, const ValueTuple& value_tuple) { // Makes sure that matcher_tuple and value_tuple have the same // number of fields. - GTEST_COMPILE_ASSERT_(tuple_size::value == - tuple_size::value, + GTEST_COMPILE_ASSERT_(std::tuple_size::value == + std::tuple_size::value, matcher_and_value_have_different_numbers_of_fields); - return TuplePrefix::value>:: - Matches(matcher_tuple, value_tuple); + return TuplePrefix::value>::Matches(matcher_tuple, + value_tuple); } // Describes failures in matching matchers against values. If there @@ -984,7 +984,7 @@ template void ExplainMatchFailureTupleTo(const MatcherTuple& matchers, const ValueTuple& values, ::std::ostream* os) { - TuplePrefix::value>::ExplainMatchFailuresTo( + TuplePrefix::value>::ExplainMatchFailuresTo( matchers, values, os); } @@ -995,7 +995,7 @@ void ExplainMatchFailureTupleTo(const MatcherTuple& matchers, template class TransformTupleValuesHelper { private: - typedef ::testing::tuple_size TupleSize; + typedef ::std::tuple_size TupleSize; public: // For each member of tuple 't', taken in order, evaluates '*out++ = f(t)'. @@ -1008,7 +1008,7 @@ class TransformTupleValuesHelper { template struct IterateOverTuple { OutIter operator() (Func f, const Tup& t, OutIter out) const { - *out++ = f(::testing::get(t)); + *out++ = f(::std::get(t)); return IterateOverTuple()(f, t, out); } }; @@ -1597,19 +1597,19 @@ class MatchesRegexMatcher { // compared don't have to have the same type. // // The matcher defined here is polymorphic (for example, Eq() can be -// used to match a tuple, a tuple, +// used to match a std::tuple, a std::tuple, // etc). Therefore we use a template type conversion operator in the // implementation. template class PairMatchBase { public: template - operator Matcher< ::testing::tuple >() const { - return MakeMatcher(new Impl< ::testing::tuple >); + operator Matcher<::std::tuple>() const { + return MakeMatcher(new Impl<::std::tuple>); } template - operator Matcher&>() const { - return MakeMatcher(new Impl&>); + operator Matcher&>() const { + return MakeMatcher(new Impl&>); } private: @@ -1623,7 +1623,7 @@ class PairMatchBase { virtual bool MatchAndExplain( Tuple args, MatchResultListener* /* listener */) const { - return Op()(::testing::get<0>(args), ::testing::get<1>(args)); + return Op()(::std::get<0>(args), ::std::get<1>(args)); } virtual void DescribeTo(::std::ostream* os) const { *os << "are " << GetDesc; @@ -1807,7 +1807,7 @@ class VariadicMatcher { std::vector >*, std::integral_constant) const {} - tuple matchers_; + std::tuple matchers_; GTEST_DISALLOW_ASSIGN_(VariadicMatcher); }; @@ -2220,14 +2220,14 @@ class FloatingEq2Matcher { } template - operator Matcher< ::testing::tuple >() const { + operator Matcher<::std::tuple>() const { return MakeMatcher( - new Impl< ::testing::tuple >(max_abs_error_, nan_eq_nan_)); + new Impl<::std::tuple>(max_abs_error_, nan_eq_nan_)); } template - operator Matcher&>() const { + operator Matcher&>() const { return MakeMatcher( - new Impl&>(max_abs_error_, nan_eq_nan_)); + new Impl&>(max_abs_error_, nan_eq_nan_)); } private: @@ -2245,14 +2245,14 @@ class FloatingEq2Matcher { virtual bool MatchAndExplain(Tuple args, MatchResultListener* listener) const { if (max_abs_error_ == -1) { - FloatingEqMatcher fm(::testing::get<0>(args), nan_eq_nan_); - return static_cast >(fm).MatchAndExplain( - ::testing::get<1>(args), listener); + FloatingEqMatcher fm(::std::get<0>(args), nan_eq_nan_); + return static_cast>(fm).MatchAndExplain( + ::std::get<1>(args), listener); } else { - FloatingEqMatcher fm(::testing::get<0>(args), nan_eq_nan_, + FloatingEqMatcher fm(::std::get<0>(args), nan_eq_nan_, max_abs_error_); - return static_cast >(fm).MatchAndExplain( - ::testing::get<1>(args), listener); + return static_cast>(fm).MatchAndExplain( + ::std::get<1>(args), listener); } } virtual void DescribeTo(::std::ostream* os) const { @@ -2956,7 +2956,7 @@ class WhenSortedByMatcher { }; // Implements Pointwise(tuple_matcher, rhs_container). tuple_matcher -// must be able to be safely cast to Matcher >, where T1 and T2 are the types of elements in the LHS // container and the RHS container respectively. template @@ -3001,7 +3001,7 @@ class PointwiseMatcher { // reference, as they may be expensive to copy. We must use tuple // instead of pair here, as a pair cannot hold references (C++ 98, // 20.2.2 [lib.pairs]). - typedef ::testing::tuple InnerMatcherArg; + typedef ::std::tuple InnerMatcherArg; Impl(const TupleMatcher& tuple_matcher, const RhsStlContainer& rhs) // mono_tuple_matcher_ holds a monomorphic version of the tuple matcher. @@ -3800,7 +3800,7 @@ class UnorderedElementsAreMatcher { typedef typename View::value_type Element; typedef ::std::vector > MatcherVec; MatcherVec matchers; - matchers.reserve(::testing::tuple_size::value); + matchers.reserve(::std::tuple_size::value); TransformTupleValues(CastAndAppendTransform(), matchers_, ::std::back_inserter(matchers)); return MakeMatcher(new UnorderedElementsAreMatcherImpl( @@ -3822,7 +3822,7 @@ class ElementsAreMatcher { operator Matcher() const { GTEST_COMPILE_ASSERT_( !IsHashTable::value || - ::testing::tuple_size::value < 2, + ::std::tuple_size::value < 2, use_UnorderedElementsAre_with_hash_tables); typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; @@ -3830,7 +3830,7 @@ class ElementsAreMatcher { typedef typename View::value_type Element; typedef ::std::vector > MatcherVec; MatcherVec matchers; - matchers.reserve(::testing::tuple_size::value); + matchers.reserve(::std::tuple_size::value); TransformTupleValues(CastAndAppendTransform(), matchers_, ::std::back_inserter(matchers)); return MakeMatcher(new ElementsAreMatcherImpl( @@ -3923,7 +3923,7 @@ class BoundSecondMatcher { template class Impl : public MatcherInterface { public: - typedef ::testing::tuple ArgTuple; + typedef ::std::tuple ArgTuple; Impl(const Tuple2Matcher& tm, const Second& second) : mono_tuple2_matcher_(SafeMatcherCast(tm)), @@ -4043,6 +4043,7 @@ class VariantMatcher { template bool MatchAndExplain(const Variant& value, ::testing::MatchResultListener* listener) const { + using std::get; if (!listener->IsInterested()) { return holds_alternative(value) && matcher_.Matches(get(value)); } @@ -4817,7 +4818,7 @@ WhenSorted(const ContainerMatcher& container_matcher) { // Matches an STL-style container or a native array that contains the // same number of elements as in rhs, where its i-th element and rhs's // i-th element (as a pair) satisfy the given pair matcher, for all i. -// TupleMatcher must be able to be safely cast to Matcher >, where T1 and T2 are the types of elements in the // LHS container and the RHS container respectively. template @@ -4848,7 +4849,7 @@ inline internal::PointwiseMatcher > Pointwise( // elements as in rhs, where in some permutation of the container, its // i-th element and rhs's i-th element (as a pair) satisfy the given // pair matcher, for all i. Tuple2Matcher must be able to be safely -// cast to Matcher >, where T1 and T2 are +// cast to Matcher >, where T1 and T2 are // the types of elements in the LHS container and the RHS container // respectively. // @@ -5140,20 +5141,21 @@ std::string DescribeMatcher(const M& matcher, bool negation = false) { } template -internal::ElementsAreMatcher::type...>> +internal::ElementsAreMatcher< + std::tuple::type...>> ElementsAre(const Args&... matchers) { return internal::ElementsAreMatcher< - tuple::type...>>( - make_tuple(matchers...)); + std::tuple::type...>>( + std::make_tuple(matchers...)); } template internal::UnorderedElementsAreMatcher< - tuple::type...>> + std::tuple::type...>> UnorderedElementsAre(const Args&... matchers) { return internal::UnorderedElementsAreMatcher< - tuple::type...>>( - make_tuple(matchers...)); + std::tuple::type...>>( + std::make_tuple(matchers...)); } // Define variadic matcher versions. diff --git a/googlemock/include/gmock/gmock-more-actions.h b/googlemock/include/gmock/gmock-more-actions.h index 4d9a28e..5c6dc8b 100644 --- a/googlemock/include/gmock/gmock-more-actions.h +++ b/googlemock/include/gmock/gmock-more-actions.h @@ -162,7 +162,7 @@ WithArg(const InnerAction& action) { ACTION_TEMPLATE(ReturnArg, HAS_1_TEMPLATE_PARAMS(int, k), AND_0_VALUE_PARAMS()) { - return ::testing::get(args); + return ::std::get(args); } // Action SaveArg(pointer) saves the k-th (0-based) argument of the @@ -170,7 +170,7 @@ ACTION_TEMPLATE(ReturnArg, ACTION_TEMPLATE(SaveArg, HAS_1_TEMPLATE_PARAMS(int, k), AND_1_VALUE_PARAMS(pointer)) { - *pointer = ::testing::get(args); + *pointer = ::std::get(args); } // Action SaveArgPointee(pointer) saves the value pointed to @@ -178,7 +178,7 @@ ACTION_TEMPLATE(SaveArg, ACTION_TEMPLATE(SaveArgPointee, HAS_1_TEMPLATE_PARAMS(int, k), AND_1_VALUE_PARAMS(pointer)) { - *pointer = *::testing::get(args); + *pointer = *::std::get(args); } // Action SetArgReferee(value) assigns 'value' to the variable @@ -186,13 +186,13 @@ ACTION_TEMPLATE(SaveArgPointee, ACTION_TEMPLATE(SetArgReferee, HAS_1_TEMPLATE_PARAMS(int, k), AND_1_VALUE_PARAMS(value)) { - typedef typename ::testing::tuple_element::type argk_type; + typedef typename ::std::tuple_element::type argk_type; // Ensures that argument #k is a reference. If you get a compiler // error on the next line, you are using SetArgReferee(value) in // a mock function whose k-th (0-based) argument is not a reference. GTEST_COMPILE_ASSERT_(internal::is_reference::value, SetArgReferee_must_be_used_with_a_reference_argument); - ::testing::get(args) = value; + ::std::get(args) = value; } // Action SetArrayArgument(first, last) copies the elements in @@ -205,9 +205,9 @@ ACTION_TEMPLATE(SetArrayArgument, AND_2_VALUE_PARAMS(first, last)) { // Visual Studio deprecates ::std::copy, so we use our own copy in that case. #ifdef _MSC_VER - internal::CopyElements(first, last, ::testing::get(args)); + internal::CopyElements(first, last, ::std::get(args)); #else - ::std::copy(first, last, ::testing::get(args)); + ::std::copy(first, last, ::std::get(args)); #endif } @@ -216,7 +216,7 @@ ACTION_TEMPLATE(SetArrayArgument, ACTION_TEMPLATE(DeleteArg, HAS_1_TEMPLATE_PARAMS(int, k), AND_0_VALUE_PARAMS()) { - delete ::testing::get(args); + delete ::std::get(args); } // This action returns the value pointed to by 'pointer'. diff --git a/googlemock/include/gmock/internal/gmock-generated-internal-utils.h b/googlemock/include/gmock/internal/gmock-generated-internal-utils.h index eaa56be..efa0462 100644 --- a/googlemock/include/gmock/internal/gmock-generated-internal-utils.h +++ b/googlemock/include/gmock/internal/gmock-generated-internal-utils.h @@ -70,79 +70,71 @@ template struct MatcherTuple; template <> -struct MatcherTuple< ::testing::tuple<> > { - typedef ::testing::tuple< > type; +struct MatcherTuple< ::std::tuple<> > { + typedef ::std::tuple< > type; }; template -struct MatcherTuple< ::testing::tuple > { - typedef ::testing::tuple > type; +struct MatcherTuple< ::std::tuple > { + typedef ::std::tuple > type; }; template -struct MatcherTuple< ::testing::tuple > { - typedef ::testing::tuple, Matcher > type; +struct MatcherTuple< ::std::tuple > { + typedef ::std::tuple, Matcher > type; }; template -struct MatcherTuple< ::testing::tuple > { - typedef ::testing::tuple, Matcher, Matcher > type; +struct MatcherTuple< ::std::tuple > { + typedef ::std::tuple, Matcher, Matcher > type; }; template -struct MatcherTuple< ::testing::tuple > { - typedef ::testing::tuple, Matcher, Matcher, Matcher > - type; +struct MatcherTuple< ::std::tuple > { + typedef ::std::tuple, Matcher, Matcher, + Matcher > type; }; template -struct MatcherTuple< ::testing::tuple > { - typedef ::testing::tuple, Matcher, Matcher, Matcher, - Matcher > - type; +struct MatcherTuple< ::std::tuple > { + typedef ::std::tuple, Matcher, Matcher, Matcher, + Matcher > type; }; template -struct MatcherTuple< ::testing::tuple > { - typedef ::testing::tuple, Matcher, Matcher, Matcher, - Matcher, Matcher > - type; +struct MatcherTuple< ::std::tuple > { + typedef ::std::tuple, Matcher, Matcher, Matcher, + Matcher, Matcher > type; }; template -struct MatcherTuple< ::testing::tuple > { - typedef ::testing::tuple, Matcher, Matcher, Matcher, - Matcher, Matcher, Matcher > - type; +struct MatcherTuple< ::std::tuple > { + typedef ::std::tuple, Matcher, Matcher, Matcher, + Matcher, Matcher, Matcher > type; }; template -struct MatcherTuple< ::testing::tuple > { - typedef ::testing::tuple, Matcher, Matcher, Matcher, - Matcher, Matcher, Matcher, Matcher > - type; +struct MatcherTuple< ::std::tuple > { + typedef ::std::tuple, Matcher, Matcher, Matcher, + Matcher, Matcher, Matcher, Matcher > type; }; template -struct MatcherTuple< ::testing::tuple > { - typedef ::testing::tuple, Matcher, Matcher, Matcher, - Matcher, Matcher, Matcher, Matcher, - Matcher > - type; +struct MatcherTuple< ::std::tuple > { + typedef ::std::tuple, Matcher, Matcher, Matcher, + Matcher, Matcher, Matcher, Matcher, Matcher > type; }; template -struct MatcherTuple< ::testing::tuple > { - typedef ::testing::tuple, Matcher, Matcher, Matcher, - Matcher, Matcher, Matcher, Matcher, - Matcher, Matcher > - type; +struct MatcherTuple< ::std::tuple > { + typedef ::std::tuple, Matcher, Matcher, Matcher, + Matcher, Matcher, Matcher, Matcher, Matcher, + Matcher > type; }; // Template struct Function, where F must be a function type, contains @@ -164,7 +156,7 @@ struct Function; template struct Function { typedef R Result; - typedef ::testing::tuple<> ArgumentTuple; + typedef ::std::tuple<> ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(); typedef IgnoredValue MakeResultIgnoredValue(); @@ -174,7 +166,7 @@ template struct Function : Function { typedef A1 Argument1; - typedef ::testing::tuple ArgumentTuple; + typedef ::std::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1); typedef IgnoredValue MakeResultIgnoredValue(A1); @@ -184,7 +176,7 @@ template struct Function : Function { typedef A2 Argument2; - typedef ::testing::tuple ArgumentTuple; + typedef ::std::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2); typedef IgnoredValue MakeResultIgnoredValue(A1, A2); @@ -194,7 +186,7 @@ template struct Function : Function { typedef A3 Argument3; - typedef ::testing::tuple ArgumentTuple; + typedef ::std::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3); @@ -204,7 +196,7 @@ template struct Function : Function { typedef A4 Argument4; - typedef ::testing::tuple ArgumentTuple; + typedef ::std::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3, A4); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4); @@ -215,7 +207,7 @@ template : Function { typedef A5 Argument5; - typedef ::testing::tuple ArgumentTuple; + typedef ::std::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3, A4, A5); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5); @@ -226,7 +218,7 @@ template : Function { typedef A6 Argument6; - typedef ::testing::tuple ArgumentTuple; + typedef ::std::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6); @@ -237,7 +229,7 @@ template : Function { typedef A7 Argument7; - typedef ::testing::tuple ArgumentTuple; + typedef ::std::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7); @@ -248,7 +240,7 @@ template : Function { typedef A8 Argument8; - typedef ::testing::tuple ArgumentTuple; + typedef ::std::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8); @@ -259,7 +251,7 @@ template : Function { typedef A9 Argument9; - typedef ::testing::tuple ArgumentTuple; + typedef ::std::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8, @@ -272,8 +264,7 @@ template : Function { typedef A10 Argument10; - typedef ::testing::tuple ArgumentTuple; + typedef ::std::tuple ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8, diff --git a/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump b/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump index c103279..9962f6b 100644 --- a/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump +++ b/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump @@ -78,8 +78,8 @@ $var typename_As = [[$for j, [[typename A$j]]]] $var As = [[$for j, [[A$j]]]] $var matcher_As = [[$for j, [[Matcher]]]] template <$typename_As> -struct MatcherTuple< ::testing::tuple<$As> > { - typedef ::testing::tuple<$matcher_As > type; +struct MatcherTuple< ::std::tuple<$As> > { + typedef ::std::tuple<$matcher_As > type; }; @@ -103,7 +103,7 @@ struct Function; template struct Function { typedef R Result; - typedef ::testing::tuple<> ArgumentTuple; + typedef ::std::tuple<> ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid(); typedef IgnoredValue MakeResultIgnoredValue(); @@ -122,7 +122,7 @@ template struct Function : Function { typedef A$i Argument$i; - typedef ::testing::tuple<$As> ArgumentTuple; + typedef ::std::tuple<$As> ArgumentTuple; typedef typename MatcherTuple::type ArgumentMatcherTuple; typedef void MakeResultVoid($As); typedef IgnoredValue MakeResultIgnoredValue($As); diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h index db64c65..fd33c00 100644 --- a/googlemock/include/gmock/internal/gmock-internal-utils.h +++ b/googlemock/include/gmock/internal/gmock-internal-utils.h @@ -493,7 +493,7 @@ class StlContainerView { // This specialization is used when RawContainer is a native array // represented as a (pointer, size) tuple. template -class StlContainerView< ::testing::tuple > { +class StlContainerView< ::std::tuple > { public: typedef GTEST_REMOVE_CONST_( typename internal::PointeeOf::type) RawElement; @@ -501,11 +501,12 @@ class StlContainerView< ::testing::tuple > { typedef const type const_reference; static const_reference ConstReference( - const ::testing::tuple& array) { - return type(get<0>(array), get<1>(array), RelationToSourceReference()); + const ::std::tuple& array) { + return type(std::get<0>(array), std::get<1>(array), + RelationToSourceReference()); } - static type Copy(const ::testing::tuple& array) { - return type(get<0>(array), get<1>(array), RelationToSourceCopy()); + static type Copy(const ::std::tuple& array) { + return type(std::get<0>(array), std::get<1>(array), RelationToSourceCopy()); } }; diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc index 7db5d3c..0de8481 100644 --- a/googlemock/test/gmock-actions_test.cc +++ b/googlemock/test/gmock-actions_test.cc @@ -75,13 +75,9 @@ using testing::SetArgPointee; using testing::SetArgumentPointee; using testing::Unused; using testing::_; -using testing::get; using testing::internal::BuiltInDefaultValue; using testing::internal::Int64; using testing::internal::UInt64; -using testing::make_tuple; -using testing::tuple; -using testing::tuple_element; #if !GTEST_OS_WINDOWS_MOBILE using testing::SetErrnoAndReturn; @@ -382,8 +378,8 @@ typedef int MyGlobalFunction(bool, int); class MyActionImpl : public ActionInterface { public: - virtual int Perform(const tuple& args) { - return get<0>(args) ? get<1>(args) : 0; + virtual int Perform(const std::tuple& args) { + return std::get<0>(args) ? std::get<1>(args) : 0; } }; @@ -399,8 +395,8 @@ TEST(ActionInterfaceTest, MakeAction) { // it a tuple whose size and type are compatible with F's argument // types. For example, if F is int(), then Perform() takes a // 0-tuple; if F is void(bool, int), then Perform() takes a - // tuple, and so on. - EXPECT_EQ(5, action.Perform(make_tuple(true, 5))); + // std::tuple, and so on. + EXPECT_EQ(5, action.Perform(std::make_tuple(true, 5))); } // Tests that Action can be contructed from a pointer to @@ -413,8 +409,8 @@ TEST(ActionTest, CanBeConstructedFromActionInterface) { TEST(ActionTest, DelegatesWorkToActionInterface) { const Action action(new MyActionImpl); - EXPECT_EQ(5, action.Perform(make_tuple(true, 5))); - EXPECT_EQ(0, action.Perform(make_tuple(false, 1))); + EXPECT_EQ(5, action.Perform(std::make_tuple(true, 5))); + EXPECT_EQ(0, action.Perform(std::make_tuple(false, 1))); } // Tests that Action can be copied. @@ -423,22 +419,22 @@ TEST(ActionTest, IsCopyable) { Action a2(a1); // Tests the copy constructor. // a1 should continue to work after being copied from. - EXPECT_EQ(5, a1.Perform(make_tuple(true, 5))); - EXPECT_EQ(0, a1.Perform(make_tuple(false, 1))); + EXPECT_EQ(5, a1.Perform(std::make_tuple(true, 5))); + EXPECT_EQ(0, a1.Perform(std::make_tuple(false, 1))); // a2 should work like the action it was copied from. - EXPECT_EQ(5, a2.Perform(make_tuple(true, 5))); - EXPECT_EQ(0, a2.Perform(make_tuple(false, 1))); + EXPECT_EQ(5, a2.Perform(std::make_tuple(true, 5))); + EXPECT_EQ(0, a2.Perform(std::make_tuple(false, 1))); a2 = a1; // Tests the assignment operator. // a1 should continue to work after being copied from. - EXPECT_EQ(5, a1.Perform(make_tuple(true, 5))); - EXPECT_EQ(0, a1.Perform(make_tuple(false, 1))); + EXPECT_EQ(5, a1.Perform(std::make_tuple(true, 5))); + EXPECT_EQ(0, a1.Perform(std::make_tuple(false, 1))); // a2 should work like the action it was copied from. - EXPECT_EQ(5, a2.Perform(make_tuple(true, 5))); - EXPECT_EQ(0, a2.Perform(make_tuple(false, 1))); + EXPECT_EQ(5, a2.Perform(std::make_tuple(true, 5))); + EXPECT_EQ(0, a2.Perform(std::make_tuple(false, 1))); } // Tests that an Action object can be converted to a @@ -446,8 +442,8 @@ TEST(ActionTest, IsCopyable) { class IsNotZero : public ActionInterface { // NOLINT public: - virtual bool Perform(const tuple& arg) { - return get<0>(arg) != 0; + virtual bool Perform(const std::tuple& arg) { + return std::get<0>(arg) != 0; } }; @@ -460,8 +456,8 @@ class IsNotZero : public ActionInterface { // NOLINT TEST(ActionTest, CanBeConvertedToOtherActionType) { const Action a1(new IsNotZero); // NOLINT const Action a2 = Action(a1); // NOLINT - EXPECT_EQ(1, a2.Perform(make_tuple('a'))); - EXPECT_EQ(0, a2.Perform(make_tuple('\0'))); + EXPECT_EQ(1, a2.Perform(std::make_tuple('a'))); + EXPECT_EQ(0, a2.Perform(std::make_tuple('\0'))); } #endif // !GTEST_OS_SYMBIAN @@ -475,7 +471,9 @@ class ReturnSecondArgumentAction { // polymorphic action whose Perform() method template is either // const or not. This lets us verify the non-const case. template - Result Perform(const ArgumentTuple& args) { return get<1>(args); } + Result Perform(const ArgumentTuple& args) { + return std::get<1>(args); + } }; // Implements a polymorphic action that can be used in a nullary @@ -490,7 +488,9 @@ class ReturnZeroFromNullaryFunctionAction { // polymorphic action whose Perform() method template is either // const or not. This lets us verify the const case. template - Result Perform(const tuple<>&) const { return 0; } + Result Perform(const std::tuple<>&) const { + return 0; + } }; // These functions verify that MakePolymorphicAction() returns a @@ -509,42 +509,42 @@ ReturnZeroFromNullaryFunction() { // implementation class into a polymorphic action. TEST(MakePolymorphicActionTest, ConstructsActionFromImpl) { Action a1 = ReturnSecondArgument(); // NOLINT - EXPECT_EQ(5, a1.Perform(make_tuple(false, 5, 2.0))); + EXPECT_EQ(5, a1.Perform(std::make_tuple(false, 5, 2.0))); } // Tests that MakePolymorphicAction() works when the implementation // class' Perform() method template has only one template parameter. TEST(MakePolymorphicActionTest, WorksWhenPerformHasOneTemplateParameter) { Action a1 = ReturnZeroFromNullaryFunction(); - EXPECT_EQ(0, a1.Perform(make_tuple())); + EXPECT_EQ(0, a1.Perform(std::make_tuple())); Action a2 = ReturnZeroFromNullaryFunction(); - EXPECT_TRUE(a2.Perform(make_tuple()) == nullptr); + EXPECT_TRUE(a2.Perform(std::make_tuple()) == nullptr); } // Tests that Return() works as an action for void-returning // functions. TEST(ReturnTest, WorksForVoid) { const Action ret = Return(); // NOLINT - return ret.Perform(make_tuple(1)); + return ret.Perform(std::make_tuple(1)); } // Tests that Return(v) returns v. TEST(ReturnTest, ReturnsGivenValue) { Action ret = Return(1); // NOLINT - EXPECT_EQ(1, ret.Perform(make_tuple())); + EXPECT_EQ(1, ret.Perform(std::make_tuple())); ret = Return(-5); - EXPECT_EQ(-5, ret.Perform(make_tuple())); + EXPECT_EQ(-5, ret.Perform(std::make_tuple())); } // Tests that Return("string literal") works. TEST(ReturnTest, AcceptsStringLiteral) { Action a1 = Return("Hello"); - EXPECT_STREQ("Hello", a1.Perform(make_tuple())); + EXPECT_STREQ("Hello", a1.Perform(std::make_tuple())); Action a2 = Return("world"); - EXPECT_EQ("world", a2.Perform(make_tuple())); + EXPECT_EQ("world", a2.Perform(std::make_tuple())); } // Test struct which wraps a vector of integers. Used in @@ -563,7 +563,7 @@ TEST(ReturnTest, SupportsWrapperReturnType) { // Return() called with 'v' as argument. The Action will return the same data // as 'v' (copy) but it will be wrapped in an IntegerVectorWrapper. Action a = Return(v); - const std::vector& result = *(a.Perform(make_tuple()).v); + const std::vector& result = *(a.Perform(std::make_tuple()).v); EXPECT_THAT(result, ::testing::ElementsAre(0, 1, 2, 3, 4)); } @@ -581,10 +581,10 @@ TEST(ReturnTest, IsCovariant) { Base base; Derived derived; Action ret = Return(&base); - EXPECT_EQ(&base, ret.Perform(make_tuple())); + EXPECT_EQ(&base, ret.Perform(std::make_tuple())); ret = Return(&derived); - EXPECT_EQ(&derived, ret.Perform(make_tuple())); + EXPECT_EQ(&derived, ret.Perform(std::make_tuple())); } // Tests that the type of the value passed into Return is converted into T @@ -615,7 +615,7 @@ TEST(ReturnTest, ConvertsArgumentWhenConverted) { EXPECT_TRUE(converted) << "Return must convert its argument in its own " << "conversion operator."; converted = false; - action.Perform(tuple<>()); + action.Perform(std::tuple<>()); EXPECT_FALSE(converted) << "Action must NOT convert its argument " << "when performed."; } @@ -636,10 +636,10 @@ TEST(ReturnTest, CanConvertArgumentUsingNonConstTypeCastOperator) { // Tests that ReturnNull() returns NULL in a pointer-returning function. TEST(ReturnNullTest, WorksInPointerReturningFunction) { const Action a1 = ReturnNull(); - EXPECT_TRUE(a1.Perform(make_tuple()) == nullptr); + EXPECT_TRUE(a1.Perform(std::make_tuple()) == nullptr); const Action a2 = ReturnNull(); // NOLINT - EXPECT_TRUE(a2.Perform(make_tuple(true)) == nullptr); + EXPECT_TRUE(a2.Perform(std::make_tuple(true)) == nullptr); } #if GTEST_HAS_STD_UNIQUE_PTR_ @@ -647,10 +647,10 @@ TEST(ReturnNullTest, WorksInPointerReturningFunction) { // functions. TEST(ReturnNullTest, WorksInSmartPointerReturningFunction) { const Action()> a1 = ReturnNull(); - EXPECT_TRUE(a1.Perform(make_tuple()) == nullptr); + EXPECT_TRUE(a1.Perform(std::make_tuple()) == nullptr); const Action(std::string)> a2 = ReturnNull(); - EXPECT_TRUE(a2.Perform(make_tuple("foo")) == nullptr); + EXPECT_TRUE(a2.Perform(std::make_tuple("foo")) == nullptr); } #endif // GTEST_HAS_STD_UNIQUE_PTR_ @@ -659,7 +659,7 @@ TEST(ReturnRefTest, WorksForReference) { const int n = 0; const Action ret = ReturnRef(n); // NOLINT - EXPECT_EQ(&n, &ret.Perform(make_tuple(true))); + EXPECT_EQ(&n, &ret.Perform(std::make_tuple(true))); } // Tests that ReturnRef(v) is covariant. @@ -667,10 +667,10 @@ TEST(ReturnRefTest, IsCovariant) { Base base; Derived derived; Action a = ReturnRef(base); - EXPECT_EQ(&base, &a.Perform(make_tuple())); + EXPECT_EQ(&base, &a.Perform(std::make_tuple())); a = ReturnRef(derived); - EXPECT_EQ(&derived, &a.Perform(make_tuple())); + EXPECT_EQ(&derived, &a.Perform(std::make_tuple())); } // Tests that ReturnRefOfCopy(v) works for reference types. @@ -678,12 +678,12 @@ TEST(ReturnRefOfCopyTest, WorksForReference) { int n = 42; const Action ret = ReturnRefOfCopy(n); - EXPECT_NE(&n, &ret.Perform(make_tuple())); - EXPECT_EQ(42, ret.Perform(make_tuple())); + EXPECT_NE(&n, &ret.Perform(std::make_tuple())); + EXPECT_EQ(42, ret.Perform(std::make_tuple())); n = 43; - EXPECT_NE(&n, &ret.Perform(make_tuple())); - EXPECT_EQ(42, ret.Perform(make_tuple())); + EXPECT_NE(&n, &ret.Perform(std::make_tuple())); + EXPECT_EQ(42, ret.Perform(std::make_tuple())); } // Tests that ReturnRefOfCopy(v) is covariant. @@ -691,10 +691,10 @@ TEST(ReturnRefOfCopyTest, IsCovariant) { Base base; Derived derived; Action a = ReturnRefOfCopy(base); - EXPECT_NE(&base, &a.Perform(make_tuple())); + EXPECT_NE(&base, &a.Perform(std::make_tuple())); a = ReturnRefOfCopy(derived); - EXPECT_NE(&derived, &a.Perform(make_tuple())); + EXPECT_NE(&derived, &a.Perform(std::make_tuple())); } // Tests that DoDefault() does the default action for the mock method. @@ -800,14 +800,14 @@ TEST(SetArgPointeeTest, SetsTheNthPointee) { int n = 0; char ch = '\0'; - a.Perform(make_tuple(true, &n, &ch)); + a.Perform(std::make_tuple(true, &n, &ch)); EXPECT_EQ(2, n); EXPECT_EQ('\0', ch); a = SetArgPointee<2>('a'); n = 0; ch = '\0'; - a.Perform(make_tuple(true, &n, &ch)); + a.Perform(std::make_tuple(true, &n, &ch)); EXPECT_EQ(0, n); EXPECT_EQ('a', ch); } @@ -820,13 +820,13 @@ TEST(SetArgPointeeTest, AcceptsStringLiteral) { Action a = SetArgPointee<0>("hi"); std::string str; const char* ptr = nullptr; - a.Perform(make_tuple(&str, &ptr)); + a.Perform(std::make_tuple(&str, &ptr)); EXPECT_EQ("hi", str); EXPECT_TRUE(ptr == nullptr); a = SetArgPointee<1>("world"); str = ""; - a.Perform(make_tuple(&str, &ptr)); + a.Perform(std::make_tuple(&str, &ptr)); EXPECT_EQ("", str); EXPECT_STREQ("world", ptr); } @@ -835,7 +835,7 @@ TEST(SetArgPointeeTest, AcceptsWideStringLiteral) { typedef void MyFunction(const wchar_t**); Action a = SetArgPointee<0>(L"world"); const wchar_t* ptr = nullptr; - a.Perform(make_tuple(&ptr)); + a.Perform(std::make_tuple(&ptr)); EXPECT_STREQ(L"world", ptr); # if GTEST_HAS_STD_WSTRING @@ -843,7 +843,7 @@ TEST(SetArgPointeeTest, AcceptsWideStringLiteral) { typedef void MyStringFunction(std::wstring*); Action a2 = SetArgPointee<0>(L"world"); std::wstring str = L""; - a2.Perform(make_tuple(&str)); + a2.Perform(std::make_tuple(&str)); EXPECT_EQ(L"world", str); # endif @@ -857,7 +857,7 @@ TEST(SetArgPointeeTest, AcceptsCharPointer) { Action a = SetArgPointee<1>(hi); std::string str; const char* ptr = nullptr; - a.Perform(make_tuple(true, &str, &ptr)); + a.Perform(std::make_tuple(true, &str, &ptr)); EXPECT_EQ("hi", str); EXPECT_TRUE(ptr == nullptr); @@ -865,7 +865,7 @@ TEST(SetArgPointeeTest, AcceptsCharPointer) { char* const world = world_array; a = SetArgPointee<2>(world); str = ""; - a.Perform(make_tuple(true, &str, &ptr)); + a.Perform(std::make_tuple(true, &str, &ptr)); EXPECT_EQ("", str); EXPECT_EQ(world, ptr); } @@ -875,7 +875,7 @@ TEST(SetArgPointeeTest, AcceptsWideCharPointer) { const wchar_t* const hi = L"hi"; Action a = SetArgPointee<1>(hi); const wchar_t* ptr = nullptr; - a.Perform(make_tuple(true, &ptr)); + a.Perform(std::make_tuple(true, &ptr)); EXPECT_EQ(hi, ptr); # if GTEST_HAS_STD_WSTRING @@ -885,7 +885,7 @@ TEST(SetArgPointeeTest, AcceptsWideCharPointer) { wchar_t* const world = world_array; Action a2 = SetArgPointee<1>(world); std::wstring str; - a2.Perform(make_tuple(true, &str)); + a2.Perform(std::make_tuple(true, &str)); EXPECT_EQ(world_array, str); # endif } @@ -898,14 +898,14 @@ TEST(SetArgumentPointeeTest, SetsTheNthPointee) { int n = 0; char ch = '\0'; - a.Perform(make_tuple(true, &n, &ch)); + a.Perform(std::make_tuple(true, &n, &ch)); EXPECT_EQ(2, n); EXPECT_EQ('\0', ch); a = SetArgumentPointee<2>('a'); n = 0; ch = '\0'; - a.Perform(make_tuple(true, &n, &ch)); + a.Perform(std::make_tuple(true, &n, &ch)); EXPECT_EQ(0, n); EXPECT_EQ('a', ch); } @@ -940,16 +940,16 @@ class Foo { TEST(InvokeWithoutArgsTest, Function) { // As an action that takes one argument. Action a = InvokeWithoutArgs(Nullary); // NOLINT - EXPECT_EQ(1, a.Perform(make_tuple(2))); + EXPECT_EQ(1, a.Perform(std::make_tuple(2))); // As an action that takes two arguments. Action a2 = InvokeWithoutArgs(Nullary); // NOLINT - EXPECT_EQ(1, a2.Perform(make_tuple(2, 3.5))); + EXPECT_EQ(1, a2.Perform(std::make_tuple(2, 3.5))); // As an action that returns void. Action a3 = InvokeWithoutArgs(VoidNullary); // NOLINT g_done = false; - a3.Perform(make_tuple(1)); + a3.Perform(std::make_tuple(1)); EXPECT_TRUE(g_done); } @@ -957,17 +957,17 @@ TEST(InvokeWithoutArgsTest, Function) { TEST(InvokeWithoutArgsTest, Functor) { // As an action that takes no argument. Action a = InvokeWithoutArgs(NullaryFunctor()); // NOLINT - EXPECT_EQ(2, a.Perform(make_tuple())); + EXPECT_EQ(2, a.Perform(std::make_tuple())); // As an action that takes three arguments. Action a2 = // NOLINT InvokeWithoutArgs(NullaryFunctor()); - EXPECT_EQ(2, a2.Perform(make_tuple(3, 3.5, 'a'))); + EXPECT_EQ(2, a2.Perform(std::make_tuple(3, 3.5, 'a'))); // As an action that returns void. Action a3 = InvokeWithoutArgs(VoidNullaryFunctor()); g_done = false; - a3.Perform(make_tuple()); + a3.Perform(std::make_tuple()); EXPECT_TRUE(g_done); } @@ -976,13 +976,13 @@ TEST(InvokeWithoutArgsTest, Method) { Foo foo; Action a = // NOLINT InvokeWithoutArgs(&foo, &Foo::Nullary); - EXPECT_EQ(123, a.Perform(make_tuple(true, 'a'))); + EXPECT_EQ(123, a.Perform(std::make_tuple(true, 'a'))); } // Tests using IgnoreResult() on a polymorphic action. TEST(IgnoreResultTest, PolymorphicAction) { Action a = IgnoreResult(Return(5)); // NOLINT - a.Perform(make_tuple(1)); + a.Perform(std::make_tuple(1)); } // Tests using IgnoreResult() on a monomorphic action. @@ -995,7 +995,7 @@ int ReturnOne() { TEST(IgnoreResultTest, MonomorphicAction) { g_done = false; Action a = IgnoreResult(Invoke(ReturnOne)); - a.Perform(make_tuple()); + a.Perform(std::make_tuple()); EXPECT_TRUE(g_done); } @@ -1010,28 +1010,28 @@ TEST(IgnoreResultTest, ActionReturningClass) { g_done = false; Action a = IgnoreResult(Invoke(ReturnMyNonDefaultConstructible)); // NOLINT - a.Perform(make_tuple(2)); + a.Perform(std::make_tuple(2)); EXPECT_TRUE(g_done); } TEST(AssignTest, Int) { int x = 0; Action a = Assign(&x, 5); - a.Perform(make_tuple(0)); + a.Perform(std::make_tuple(0)); EXPECT_EQ(5, x); } TEST(AssignTest, String) { ::std::string x; Action a = Assign(&x, "Hello, world"); - a.Perform(make_tuple()); + a.Perform(std::make_tuple()); EXPECT_EQ("Hello, world", x); } TEST(AssignTest, CompatibleTypes) { double x = 0; Action a = Assign(&x, 5); - a.Perform(make_tuple(0)); + a.Perform(std::make_tuple(0)); EXPECT_DOUBLE_EQ(5, x); } @@ -1045,20 +1045,20 @@ class SetErrnoAndReturnTest : public testing::Test { TEST_F(SetErrnoAndReturnTest, Int) { Action a = SetErrnoAndReturn(ENOTTY, -5); - EXPECT_EQ(-5, a.Perform(make_tuple())); + EXPECT_EQ(-5, a.Perform(std::make_tuple())); EXPECT_EQ(ENOTTY, errno); } TEST_F(SetErrnoAndReturnTest, Ptr) { int x; Action a = SetErrnoAndReturn(ENOTTY, &x); - EXPECT_EQ(&x, a.Perform(make_tuple())); + EXPECT_EQ(&x, a.Perform(std::make_tuple())); EXPECT_EQ(ENOTTY, errno); } TEST_F(SetErrnoAndReturnTest, CompatibleTypes) { Action a = SetErrnoAndReturn(EINVAL, 5); - EXPECT_DOUBLE_EQ(5.0, a.Perform(make_tuple())); + EXPECT_DOUBLE_EQ(5.0, a.Perform(std::make_tuple())); EXPECT_EQ(EINVAL, errno); } @@ -1298,47 +1298,47 @@ TEST(FunctorActionTest, ActionFromFunction) { TEST(FunctorActionTest, ActionFromLambda) { Action a1 = [](bool b, int i) { return b ? i : 0; }; - EXPECT_EQ(5, a1.Perform(make_tuple(true, 5))); - EXPECT_EQ(0, a1.Perform(make_tuple(false, 5))); + EXPECT_EQ(5, a1.Perform(std::make_tuple(true, 5))); + EXPECT_EQ(0, a1.Perform(std::make_tuple(false, 5))); std::unique_ptr saved; Action)> a2 = [&saved](std::unique_ptr p) { saved = std::move(p); }; - a2.Perform(make_tuple(UniqueInt(5))); + a2.Perform(std::make_tuple(UniqueInt(5))); EXPECT_EQ(5, *saved); } TEST(FunctorActionTest, PolymorphicFunctor) { Action ai = Double(); - EXPECT_EQ(2, ai.Perform(make_tuple(1))); + EXPECT_EQ(2, ai.Perform(std::make_tuple(1))); Action ad = Double(); // Double? Double double! - EXPECT_EQ(3.0, ad.Perform(make_tuple(1.5))); + EXPECT_EQ(3.0, ad.Perform(std::make_tuple(1.5))); } TEST(FunctorActionTest, TypeConversion) { // Numeric promotions are allowed. const Action a1 = [](int i) { return i > 1; }; const Action a2 = Action(a1); - EXPECT_EQ(1, a1.Perform(make_tuple(42))); - EXPECT_EQ(0, a2.Perform(make_tuple(42))); + EXPECT_EQ(1, a1.Perform(std::make_tuple(42))); + EXPECT_EQ(0, a2.Perform(std::make_tuple(42))); // Implicit constructors are allowed. const Action s1 = [](std::string s) { return !s.empty(); }; const Action s2 = Action(s1); - EXPECT_EQ(0, s2.Perform(make_tuple(""))); - EXPECT_EQ(1, s2.Perform(make_tuple("hello"))); + EXPECT_EQ(0, s2.Perform(std::make_tuple(""))); + EXPECT_EQ(1, s2.Perform(std::make_tuple("hello"))); // Also between the lambda and the action itself. const Action x = [](Unused) { return 42; }; - EXPECT_TRUE(x.Perform(make_tuple("hello"))); + EXPECT_TRUE(x.Perform(std::make_tuple("hello"))); } TEST(FunctorActionTest, UnusedArguments) { // Verify that users can ignore uninteresting arguments. Action a = [](int i, Unused, Unused) { return 2 * i; }; - tuple dummy = make_tuple(3, 7.3, 9.44); + std::tuple dummy = std::make_tuple(3, 7.3, 9.44); EXPECT_EQ(6, a.Perform(dummy)); } @@ -1349,14 +1349,14 @@ TEST(FunctorActionTest, UnusedArguments) { // so maybe it's better to make users use lambdas instead. TEST(MoveOnlyArgumentsTest, ReturningActions) { Action)> a = Return(1); - EXPECT_EQ(1, a.Perform(make_tuple(nullptr))); + EXPECT_EQ(1, a.Perform(std::make_tuple(nullptr))); a = testing::WithoutArgs([]() { return 7; }); - EXPECT_EQ(7, a.Perform(make_tuple(nullptr))); + EXPECT_EQ(7, a.Perform(std::make_tuple(nullptr))); Action, int*)> a2 = testing::SetArgPointee<1>(3); int x = 0; - a2.Perform(make_tuple(nullptr, &x)); + a2.Perform(std::make_tuple(nullptr, &x)); EXPECT_EQ(x, 3); } diff --git a/googlemock/test/gmock-generated-actions_test.cc b/googlemock/test/gmock-generated-actions_test.cc index a460280..2d663a5 100644 --- a/googlemock/test/gmock-generated-actions_test.cc +++ b/googlemock/test/gmock-generated-actions_test.cc @@ -45,10 +45,6 @@ namespace gmock_generated_actions_test { using ::std::plus; using ::std::string; -using testing::get; -using testing::make_tuple; -using testing::tuple; -using testing::tuple_element; using testing::_; using testing::Action; using testing::ActionInterface; @@ -168,41 +164,41 @@ inline const char* CharPtr(const char* s) { return s; } // Tests using InvokeArgument with a nullary function. TEST(InvokeArgumentTest, Function0) { Action a = InvokeArgument<1>(); // NOLINT - EXPECT_EQ(1, a.Perform(make_tuple(2, &Nullary))); + EXPECT_EQ(1, a.Perform(std::make_tuple(2, &Nullary))); } // Tests using InvokeArgument with a unary function. TEST(InvokeArgumentTest, Functor1) { Action a = InvokeArgument<0>(true); // NOLINT - EXPECT_EQ(1, a.Perform(make_tuple(UnaryFunctor()))); + EXPECT_EQ(1, a.Perform(std::make_tuple(UnaryFunctor()))); } // Tests using InvokeArgument with a 5-ary function. TEST(InvokeArgumentTest, Function5) { Action a = // NOLINT InvokeArgument<0>(10000, 2000, 300, 40, 5); - EXPECT_EQ(12345, a.Perform(make_tuple(&SumOf5))); + EXPECT_EQ(12345, a.Perform(std::make_tuple(&SumOf5))); } // Tests using InvokeArgument with a 5-ary functor. TEST(InvokeArgumentTest, Functor5) { Action a = // NOLINT InvokeArgument<0>(10000, 2000, 300, 40, 5); - EXPECT_EQ(12345, a.Perform(make_tuple(SumOf5Functor()))); + EXPECT_EQ(12345, a.Perform(std::make_tuple(SumOf5Functor()))); } // Tests using InvokeArgument with a 6-ary function. TEST(InvokeArgumentTest, Function6) { Action a = // NOLINT InvokeArgument<0>(100000, 20000, 3000, 400, 50, 6); - EXPECT_EQ(123456, a.Perform(make_tuple(&SumOf6))); + EXPECT_EQ(123456, a.Perform(std::make_tuple(&SumOf6))); } // Tests using InvokeArgument with a 6-ary functor. TEST(InvokeArgumentTest, Functor6) { Action a = // NOLINT InvokeArgument<0>(100000, 20000, 3000, 400, 50, 6); - EXPECT_EQ(123456, a.Perform(make_tuple(SumOf6Functor()))); + EXPECT_EQ(123456, a.Perform(std::make_tuple(SumOf6Functor()))); } // Tests using InvokeArgument with a 7-ary function. @@ -211,7 +207,7 @@ TEST(InvokeArgumentTest, Function7) { const char*, const char*, const char*, const char*))> a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7"); - EXPECT_EQ("1234567", a.Perform(make_tuple(&Concat7))); + EXPECT_EQ("1234567", a.Perform(std::make_tuple(&Concat7))); } // Tests using InvokeArgument with a 8-ary function. @@ -220,7 +216,7 @@ TEST(InvokeArgumentTest, Function8) { const char*, const char*, const char*, const char*, const char*))> a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8"); - EXPECT_EQ("12345678", a.Perform(make_tuple(&Concat8))); + EXPECT_EQ("12345678", a.Perform(std::make_tuple(&Concat8))); } // Tests using InvokeArgument with a 9-ary function. @@ -229,7 +225,7 @@ TEST(InvokeArgumentTest, Function9) { const char*, const char*, const char*, const char*, const char*, const char*))> a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8", "9"); - EXPECT_EQ("123456789", a.Perform(make_tuple(&Concat9))); + EXPECT_EQ("123456789", a.Perform(std::make_tuple(&Concat9))); } // Tests using InvokeArgument with a 10-ary function. @@ -238,14 +234,14 @@ TEST(InvokeArgumentTest, Function10) { const char*, const char*, const char*, const char*, const char*, const char*, const char*, const char*, const char*, const char*))> a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8", "9", "0"); - EXPECT_EQ("1234567890", a.Perform(make_tuple(&Concat10))); + EXPECT_EQ("1234567890", a.Perform(std::make_tuple(&Concat10))); } // Tests using InvokeArgument with a function that takes a pointer argument. TEST(InvokeArgumentTest, ByPointerFunction) { Action a = // NOLINT InvokeArgument<0>(static_cast("Hi"), Short(1)); - EXPECT_STREQ("i", a.Perform(make_tuple(&Binary))); + EXPECT_STREQ("i", a.Perform(std::make_tuple(&Binary))); } // Tests using InvokeArgument with a function that takes a const char* @@ -253,7 +249,7 @@ TEST(InvokeArgumentTest, ByPointerFunction) { TEST(InvokeArgumentTest, FunctionWithCStringLiteral) { Action a = // NOLINT InvokeArgument<0>("Hi", Short(1)); - EXPECT_STREQ("i", a.Perform(make_tuple(&Binary))); + EXPECT_STREQ("i", a.Perform(std::make_tuple(&Binary))); } // Tests using InvokeArgument with a function that takes a const reference. @@ -263,7 +259,7 @@ TEST(InvokeArgumentTest, ByConstReferenceFunction) { // When action 'a' is constructed, it makes a copy of the temporary // string object passed to it, so it's OK to use 'a' later, when the // temporary object has already died. - EXPECT_TRUE(a.Perform(make_tuple(&ByConstRef))); + EXPECT_TRUE(a.Perform(std::make_tuple(&ByConstRef))); } // Tests using InvokeArgument with ByRef() and a function that takes a @@ -272,18 +268,18 @@ TEST(InvokeArgumentTest, ByExplicitConstReferenceFunction) { Action a = // NOLINT InvokeArgument<0>(ByRef(g_double)); // The above line calls ByRef() on a const value. - EXPECT_TRUE(a.Perform(make_tuple(&ReferencesGlobalDouble))); + EXPECT_TRUE(a.Perform(std::make_tuple(&ReferencesGlobalDouble))); double x = 0; a = InvokeArgument<0>(ByRef(x)); // This calls ByRef() on a non-const. - EXPECT_FALSE(a.Perform(make_tuple(&ReferencesGlobalDouble))); + EXPECT_FALSE(a.Perform(std::make_tuple(&ReferencesGlobalDouble))); } // Tests using WithArgs and with an action that takes 1 argument. TEST(WithArgsTest, OneArg) { Action a = WithArgs<1>(Invoke(Unary)); // NOLINT - EXPECT_TRUE(a.Perform(make_tuple(1.5, -1))); - EXPECT_FALSE(a.Perform(make_tuple(1.5, 1))); + EXPECT_TRUE(a.Perform(std::make_tuple(1.5, -1))); + EXPECT_FALSE(a.Perform(std::make_tuple(1.5, 1))); } // Tests using WithArgs with an action that takes 2 arguments. @@ -291,14 +287,14 @@ TEST(WithArgsTest, TwoArgs) { Action a = WithArgs<0, 2>(Invoke(Binary)); const char s[] = "Hello"; - EXPECT_EQ(s + 2, a.Perform(make_tuple(CharPtr(s), 0.5, Short(2)))); + EXPECT_EQ(s + 2, a.Perform(std::make_tuple(CharPtr(s), 0.5, Short(2)))); } // Tests using WithArgs with an action that takes 3 arguments. TEST(WithArgsTest, ThreeArgs) { Action a = // NOLINT WithArgs<0, 2, 3>(Invoke(Ternary)); - EXPECT_EQ(123, a.Perform(make_tuple(100, 6.5, Char(20), Short(3)))); + EXPECT_EQ(123, a.Perform(std::make_tuple(100, 6.5, Char(20), Short(3)))); } // Tests using WithArgs with an action that takes 4 arguments. @@ -306,8 +302,8 @@ TEST(WithArgsTest, FourArgs) { Action a = WithArgs<4, 3, 1, 0>(Invoke(Concat4)); - EXPECT_EQ("4310", a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), 2.5, - CharPtr("3"), CharPtr("4")))); + EXPECT_EQ("4310", a.Perform(std::make_tuple(CharPtr("0"), CharPtr("1"), 2.5, + CharPtr("3"), CharPtr("4")))); } // Tests using WithArgs with an action that takes 5 arguments. @@ -316,34 +312,32 @@ TEST(WithArgsTest, FiveArgs) { const char*)> a = WithArgs<4, 3, 2, 1, 0>(Invoke(Concat5)); EXPECT_EQ("43210", - a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"), - CharPtr("3"), CharPtr("4")))); + a.Perform(std::make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"), + CharPtr("3"), CharPtr("4")))); } // Tests using WithArgs with an action that takes 6 arguments. TEST(WithArgsTest, SixArgs) { Action a = WithArgs<0, 1, 2, 2, 1, 0>(Invoke(Concat6)); - EXPECT_EQ("012210", - a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2")))); + EXPECT_EQ("012210", a.Perform(std::make_tuple(CharPtr("0"), CharPtr("1"), + CharPtr("2")))); } // Tests using WithArgs with an action that takes 7 arguments. TEST(WithArgsTest, SevenArgs) { Action a = WithArgs<0, 1, 2, 3, 2, 1, 0>(Invoke(Concat7)); - EXPECT_EQ("0123210", - a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"), - CharPtr("3")))); + EXPECT_EQ("0123210", a.Perform(std::make_tuple(CharPtr("0"), CharPtr("1"), + CharPtr("2"), CharPtr("3")))); } // Tests using WithArgs with an action that takes 8 arguments. TEST(WithArgsTest, EightArgs) { Action a = WithArgs<0, 1, 2, 3, 0, 1, 2, 3>(Invoke(Concat8)); - EXPECT_EQ("01230123", - a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"), - CharPtr("3")))); + EXPECT_EQ("01230123", a.Perform(std::make_tuple(CharPtr("0"), CharPtr("1"), + CharPtr("2"), CharPtr("3")))); } // Tests using WithArgs with an action that takes 9 arguments. @@ -351,8 +345,8 @@ TEST(WithArgsTest, NineArgs) { Action a = WithArgs<0, 1, 2, 3, 1, 2, 3, 2, 3>(Invoke(Concat9)); EXPECT_EQ("012312323", - a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"), - CharPtr("3")))); + a.Perform(std::make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"), + CharPtr("3")))); } // Tests using WithArgs with an action that takes 10 arguments. @@ -360,22 +354,23 @@ TEST(WithArgsTest, TenArgs) { Action a = WithArgs<0, 1, 2, 3, 2, 1, 0, 1, 2, 3>(Invoke(Concat10)); EXPECT_EQ("0123210123", - a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"), - CharPtr("3")))); + a.Perform(std::make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"), + CharPtr("3")))); } // Tests using WithArgs with an action that is not Invoke(). class SubstractAction : public ActionInterface { // NOLINT public: - virtual int Perform(const tuple& args) { - return get<0>(args) - get<1>(args); + virtual int Perform(const std::tuple& args) { + return std::get<0>(args) - std::get<1>(args); } }; TEST(WithArgsTest, NonInvokeAction) { Action a = // NOLINT WithArgs<2, 1>(MakeAction(new SubstractAction)); - tuple dummy = make_tuple(std::string("hi"), 2, 10); + std::tuple dummy = + std::make_tuple(std::string("hi"), 2, 10); EXPECT_EQ(8, a.Perform(dummy)); } @@ -383,14 +378,14 @@ TEST(WithArgsTest, NonInvokeAction) { TEST(WithArgsTest, Identity) { Action a = // NOLINT WithArgs<0, 1, 2>(Invoke(Ternary)); - EXPECT_EQ(123, a.Perform(make_tuple(100, Char(20), Short(3)))); + EXPECT_EQ(123, a.Perform(std::make_tuple(100, Char(20), Short(3)))); } // Tests using WithArgs with repeated arguments. TEST(WithArgsTest, RepeatedArguments) { Action a = // NOLINT WithArgs<1, 1, 1, 1>(Invoke(SumOf4)); - EXPECT_EQ(4, a.Perform(make_tuple(false, 1, 10))); + EXPECT_EQ(4, a.Perform(std::make_tuple(false, 1, 10))); } // Tests using WithArgs with reversed argument order. @@ -398,21 +393,22 @@ TEST(WithArgsTest, ReversedArgumentOrder) { Action a = // NOLINT WithArgs<1, 0>(Invoke(Binary)); const char s[] = "Hello"; - EXPECT_EQ(s + 2, a.Perform(make_tuple(Short(2), CharPtr(s)))); + EXPECT_EQ(s + 2, a.Perform(std::make_tuple(Short(2), CharPtr(s)))); } // Tests using WithArgs with compatible, but not identical, argument types. TEST(WithArgsTest, ArgsOfCompatibleTypes) { Action a = // NOLINT WithArgs<0, 1, 3>(Invoke(Ternary)); - EXPECT_EQ(123, a.Perform(make_tuple(Short(100), Char(20), 5.6, Char(3)))); + EXPECT_EQ(123, + a.Perform(std::make_tuple(Short(100), Char(20), 5.6, Char(3)))); } // Tests using WithArgs with an action that returns void. TEST(WithArgsTest, VoidAction) { Action a = WithArgs<2, 1>(Invoke(VoidBinary)); g_done = false; - a.Perform(make_tuple(1.5, 'a', 3)); + a.Perform(std::make_tuple(1.5, 'a', 3)); EXPECT_TRUE(g_done); } @@ -421,7 +417,7 @@ TEST(DoAllTest, TwoActions) { int n = 0; Action a = DoAll(SetArgPointee<0>(1), // NOLINT Return(2)); - EXPECT_EQ(2, a.Perform(make_tuple(&n))); + EXPECT_EQ(2, a.Perform(std::make_tuple(&n))); EXPECT_EQ(1, n); } @@ -431,7 +427,7 @@ TEST(DoAllTest, ThreeActions) { Action a = DoAll(SetArgPointee<0>(1), // NOLINT SetArgPointee<1>(2), Return(3)); - EXPECT_EQ(3, a.Perform(make_tuple(&m, &n))); + EXPECT_EQ(3, a.Perform(std::make_tuple(&m, &n))); EXPECT_EQ(1, m); EXPECT_EQ(2, n); } @@ -445,7 +441,7 @@ TEST(DoAllTest, FourActions) { SetArgPointee<1>(2), SetArgPointee<2>('a'), Return(3)); - EXPECT_EQ(3, a.Perform(make_tuple(&m, &n, &ch))); + EXPECT_EQ(3, a.Perform(std::make_tuple(&m, &n, &ch))); EXPECT_EQ(1, m); EXPECT_EQ(2, n); EXPECT_EQ('a', ch); @@ -461,7 +457,7 @@ TEST(DoAllTest, FiveActions) { SetArgPointee<2>('a'), SetArgPointee<3>('b'), Return(3)); - EXPECT_EQ(3, action.Perform(make_tuple(&m, &n, &a, &b))); + EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b))); EXPECT_EQ(1, m); EXPECT_EQ(2, n); EXPECT_EQ('a', a); @@ -479,7 +475,7 @@ TEST(DoAllTest, SixActions) { SetArgPointee<3>('b'), SetArgPointee<4>('c'), Return(3)); - EXPECT_EQ(3, action.Perform(make_tuple(&m, &n, &a, &b, &c))); + EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c))); EXPECT_EQ(1, m); EXPECT_EQ(2, n); EXPECT_EQ('a', a); @@ -499,7 +495,7 @@ TEST(DoAllTest, SevenActions) { SetArgPointee<4>('c'), SetArgPointee<5>('d'), Return(3)); - EXPECT_EQ(3, action.Perform(make_tuple(&m, &n, &a, &b, &c, &d))); + EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c, &d))); EXPECT_EQ(1, m); EXPECT_EQ(2, n); EXPECT_EQ('a', a); @@ -522,7 +518,7 @@ TEST(DoAllTest, EightActions) { SetArgPointee<5>('d'), SetArgPointee<6>('e'), Return(3)); - EXPECT_EQ(3, action.Perform(make_tuple(&m, &n, &a, &b, &c, &d, &e))); + EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c, &d, &e))); EXPECT_EQ(1, m); EXPECT_EQ(2, n); EXPECT_EQ('a', a); @@ -547,7 +543,7 @@ TEST(DoAllTest, NineActions) { SetArgPointee<6>('e'), SetArgPointee<7>('f'), Return(3)); - EXPECT_EQ(3, action.Perform(make_tuple(&m, &n, &a, &b, &c, &d, &e, &f))); + EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c, &d, &e, &f))); EXPECT_EQ(1, m); EXPECT_EQ(2, n); EXPECT_EQ('a', a); @@ -575,7 +571,8 @@ TEST(DoAllTest, TenActions) { SetArgPointee<7>('f'), SetArgPointee<8>('g'), Return(3)); - EXPECT_EQ(3, action.Perform(make_tuple(&m, &n, &a, &b, &c, &d, &e, &f, &g))); + EXPECT_EQ( + 3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c, &d, &e, &f, &g))); EXPECT_EQ(1, m); EXPECT_EQ(2, n); EXPECT_EQ('a', a); @@ -605,10 +602,10 @@ ACTION(Return5) { return 5; } TEST(ActionMacroTest, WorksWhenNotReferencingArguments) { Action a1 = Return5(); - EXPECT_DOUBLE_EQ(5, a1.Perform(make_tuple())); + EXPECT_DOUBLE_EQ(5, a1.Perform(std::make_tuple())); Action a2 = Return5(); - EXPECT_EQ(5, a2.Perform(make_tuple(1, true))); + EXPECT_EQ(5, a2.Perform(std::make_tuple(1, true))); } // Tests that ACTION() can define an action that returns void. @@ -617,7 +614,7 @@ ACTION(IncrementArg1) { (*arg1)++; } TEST(ActionMacroTest, WorksWhenReturningVoid) { Action a1 = IncrementArg1(); int n = 0; - a1.Perform(make_tuple(5, &n)); + a1.Perform(std::make_tuple(5, &n)); EXPECT_EQ(1, n); } @@ -632,22 +629,22 @@ ACTION(IncrementArg2) { TEST(ActionMacroTest, CanReferenceArgumentType) { Action a1 = IncrementArg2(); int n = 0; - a1.Perform(make_tuple(5, false, &n)); + a1.Perform(std::make_tuple(5, false, &n)); EXPECT_EQ(1, n); } // Tests that the body of ACTION() can reference the argument tuple // via args_type and args. ACTION(Sum2) { - StaticAssertTypeEq, args_type>(); + StaticAssertTypeEq, args_type>(); args_type args_copy = args; - return get<0>(args_copy) + get<1>(args_copy); + return std::get<0>(args_copy) + std::get<1>(args_copy); } TEST(ActionMacroTest, CanReferenceArgumentTuple) { Action a1 = Sum2(); int dummy = 0; - EXPECT_EQ(11, a1.Perform(make_tuple(5, Char(6), &dummy))); + EXPECT_EQ(11, a1.Perform(std::make_tuple(5, Char(6), &dummy))); } // Tests that the body of ACTION() can reference the mock function @@ -662,8 +659,8 @@ ACTION(InvokeDummy) { TEST(ActionMacroTest, CanReferenceMockFunctionType) { Action a1 = InvokeDummy(); - EXPECT_EQ(1, a1.Perform(make_tuple(true))); - EXPECT_EQ(1, a1.Perform(make_tuple(false))); + EXPECT_EQ(1, a1.Perform(std::make_tuple(true))); + EXPECT_EQ(1, a1.Perform(std::make_tuple(false))); } // Tests that the body of ACTION() can reference the mock function's @@ -676,8 +673,8 @@ ACTION(InvokeDummy2) { TEST(ActionMacroTest, CanReferenceMockFunctionReturnType) { Action a1 = InvokeDummy2(); - EXPECT_EQ(1, a1.Perform(make_tuple(true))); - EXPECT_EQ(1, a1.Perform(make_tuple(false))); + EXPECT_EQ(1, a1.Perform(std::make_tuple(true))); + EXPECT_EQ(1, a1.Perform(std::make_tuple(false))); } // Tests that ACTION() works for arguments passed by const reference. @@ -689,7 +686,7 @@ ACTION(ReturnAddrOfConstBoolReferenceArg) { TEST(ActionMacroTest, WorksForConstReferenceArg) { Action a = ReturnAddrOfConstBoolReferenceArg(); const bool b = false; - EXPECT_EQ(&b, a.Perform(tuple(0, b))); + EXPECT_EQ(&b, a.Perform(std::tuple(0, b))); } // Tests that ACTION() works for arguments passed by non-const reference. @@ -701,7 +698,7 @@ ACTION(ReturnAddrOfIntReferenceArg) { TEST(ActionMacroTest, WorksForNonConstReferenceArg) { Action a = ReturnAddrOfIntReferenceArg(); int n = 0; - EXPECT_EQ(&n, a.Perform(tuple(n, true, 1))); + EXPECT_EQ(&n, a.Perform(std::tuple(n, true, 1))); } // Tests that ACTION() can be used in a namespace. @@ -711,7 +708,7 @@ ACTION(Sum) { return arg0 + arg1; } TEST(ActionMacroTest, WorksInNamespace) { Action a1 = action_test::Sum(); - EXPECT_EQ(3, a1.Perform(make_tuple(1, 2))); + EXPECT_EQ(3, a1.Perform(std::make_tuple(1, 2))); } // Tests that the same ACTION definition works for mock functions with @@ -720,11 +717,11 @@ ACTION(PlusTwo) { return arg0 + 2; } TEST(ActionMacroTest, WorksForDifferentArgumentNumbers) { Action a1 = PlusTwo(); - EXPECT_EQ(4, a1.Perform(make_tuple(2))); + EXPECT_EQ(4, a1.Perform(std::make_tuple(2))); Action a2 = PlusTwo(); int dummy; - EXPECT_DOUBLE_EQ(6, a2.Perform(make_tuple(4.0f, &dummy))); + EXPECT_DOUBLE_EQ(6, a2.Perform(std::make_tuple(4.0f, &dummy))); } // Tests that ACTION_P can define a parameterized action. @@ -732,7 +729,7 @@ ACTION_P(Plus, n) { return arg0 + n; } TEST(ActionPMacroTest, DefinesParameterizedAction) { Action a1 = Plus(9); - EXPECT_EQ(10, a1.Perform(make_tuple(1, true))); + EXPECT_EQ(10, a1.Perform(std::make_tuple(1, true))); } // Tests that the body of ACTION_P can reference the argument types @@ -745,7 +742,7 @@ ACTION_P(TypedPlus, n) { TEST(ActionPMacroTest, CanReferenceArgumentAndParameterTypes) { Action a1 = TypedPlus(9); - EXPECT_EQ(10, a1.Perform(make_tuple(Char(1), true))); + EXPECT_EQ(10, a1.Perform(std::make_tuple(Char(1), true))); } // Tests that a parameterized action can be used in any mock function @@ -753,7 +750,7 @@ TEST(ActionPMacroTest, CanReferenceArgumentAndParameterTypes) { TEST(ActionPMacroTest, WorksInCompatibleMockFunction) { Action a1 = Plus("tail"); const std::string re = "re"; - tuple dummy = make_tuple(re); + std::tuple dummy = std::make_tuple(re); EXPECT_EQ("retail", a1.Perform(dummy)); } @@ -774,16 +771,16 @@ TEST(ActionMacroTest, CanDefineOverloadedActions) { typedef Action MyAction; const MyAction a1 = OverloadedAction(); - EXPECT_STREQ("hello", a1.Perform(make_tuple(false, CharPtr("world")))); - EXPECT_STREQ("world", a1.Perform(make_tuple(true, CharPtr("world")))); + EXPECT_STREQ("hello", a1.Perform(std::make_tuple(false, CharPtr("world")))); + EXPECT_STREQ("world", a1.Perform(std::make_tuple(true, CharPtr("world")))); const MyAction a2 = OverloadedAction("hi"); - EXPECT_STREQ("hi", a2.Perform(make_tuple(false, CharPtr("world")))); - EXPECT_STREQ("world", a2.Perform(make_tuple(true, CharPtr("world")))); + EXPECT_STREQ("hi", a2.Perform(std::make_tuple(false, CharPtr("world")))); + EXPECT_STREQ("world", a2.Perform(std::make_tuple(true, CharPtr("world")))); const MyAction a3 = OverloadedAction("hi", "you"); - EXPECT_STREQ("hi", a3.Perform(make_tuple(true, CharPtr("world")))); - EXPECT_STREQ("you", a3.Perform(make_tuple(false, CharPtr("world")))); + EXPECT_STREQ("hi", a3.Perform(std::make_tuple(true, CharPtr("world")))); + EXPECT_STREQ("you", a3.Perform(std::make_tuple(false, CharPtr("world")))); } // Tests ACTION_Pn where n >= 3. @@ -792,11 +789,11 @@ ACTION_P3(Plus, m, n, k) { return arg0 + m + n + k; } TEST(ActionPnMacroTest, WorksFor3Parameters) { Action a1 = Plus(100, 20, 3.4); - EXPECT_DOUBLE_EQ(3123.4, a1.Perform(make_tuple(3000, true))); + EXPECT_DOUBLE_EQ(3123.4, a1.Perform(std::make_tuple(3000, true))); Action a2 = Plus("tail", "-", ">"); const std::string re = "re"; - tuple dummy = make_tuple(re); + std::tuple dummy = std::make_tuple(re); EXPECT_EQ("retail->", a2.Perform(dummy)); } @@ -804,14 +801,14 @@ ACTION_P4(Plus, p0, p1, p2, p3) { return arg0 + p0 + p1 + p2 + p3; } TEST(ActionPnMacroTest, WorksFor4Parameters) { Action a1 = Plus(1, 2, 3, 4); - EXPECT_EQ(10 + 1 + 2 + 3 + 4, a1.Perform(make_tuple(10))); + EXPECT_EQ(10 + 1 + 2 + 3 + 4, a1.Perform(std::make_tuple(10))); } ACTION_P5(Plus, p0, p1, p2, p3, p4) { return arg0 + p0 + p1 + p2 + p3 + p4; } TEST(ActionPnMacroTest, WorksFor5Parameters) { Action a1 = Plus(1, 2, 3, 4, 5); - EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5, a1.Perform(make_tuple(10))); + EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5, a1.Perform(std::make_tuple(10))); } ACTION_P6(Plus, p0, p1, p2, p3, p4, p5) { @@ -820,7 +817,7 @@ ACTION_P6(Plus, p0, p1, p2, p3, p4, p5) { TEST(ActionPnMacroTest, WorksFor6Parameters) { Action a1 = Plus(1, 2, 3, 4, 5, 6); - EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6, a1.Perform(make_tuple(10))); + EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6, a1.Perform(std::make_tuple(10))); } ACTION_P7(Plus, p0, p1, p2, p3, p4, p5, p6) { @@ -829,7 +826,7 @@ ACTION_P7(Plus, p0, p1, p2, p3, p4, p5, p6) { TEST(ActionPnMacroTest, WorksFor7Parameters) { Action a1 = Plus(1, 2, 3, 4, 5, 6, 7); - EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7, a1.Perform(make_tuple(10))); + EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7, a1.Perform(std::make_tuple(10))); } ACTION_P8(Plus, p0, p1, p2, p3, p4, p5, p6, p7) { @@ -838,7 +835,8 @@ ACTION_P8(Plus, p0, p1, p2, p3, p4, p5, p6, p7) { TEST(ActionPnMacroTest, WorksFor8Parameters) { Action a1 = Plus(1, 2, 3, 4, 5, 6, 7, 8); - EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8, a1.Perform(make_tuple(10))); + EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8, + a1.Perform(std::make_tuple(10))); } ACTION_P9(Plus, p0, p1, p2, p3, p4, p5, p6, p7, p8) { @@ -847,7 +845,8 @@ ACTION_P9(Plus, p0, p1, p2, p3, p4, p5, p6, p7, p8) { TEST(ActionPnMacroTest, WorksFor9Parameters) { Action a1 = Plus(1, 2, 3, 4, 5, 6, 7, 8, 9); - EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9, a1.Perform(make_tuple(10))); + EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9, + a1.Perform(std::make_tuple(10))); } ACTION_P10(Plus, p0, p1, p2, p3, p4, p5, p6, p7, p8, last_param) { @@ -859,7 +858,7 @@ ACTION_P10(Plus, p0, p1, p2, p3, p4, p5, p6, p7, p8, last_param) { TEST(ActionPnMacroTest, WorksFor10Parameters) { Action a1 = Plus(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10, - a1.Perform(make_tuple(10))); + a1.Perform(std::make_tuple(10))); } // Tests that the action body can promote the parameter types. @@ -876,8 +875,8 @@ TEST(ActionPnMacroTest, SimpleTypePromotion) { PadArgument(std::string("foo"), 'r'); Action promo = PadArgument("foo", static_cast('r')); - EXPECT_EQ("foobar", no_promo.Perform(make_tuple(CharPtr("ba")))); - EXPECT_EQ("foobar", promo.Perform(make_tuple(CharPtr("ba")))); + EXPECT_EQ("foobar", no_promo.Perform(std::make_tuple(CharPtr("ba")))); + EXPECT_EQ("foobar", promo.Perform(std::make_tuple(CharPtr("ba")))); } // Tests that we can partially restrict parameter types using a @@ -926,10 +925,10 @@ Concat(T1 a, int b, T2 c) { TEST(ActionPnMacroTest, CanPartiallyRestrictParameterTypes) { Action a1 = Concat("Hello", "1", 2); - EXPECT_EQ("Hello12", a1.Perform(make_tuple())); + EXPECT_EQ("Hello12", a1.Perform(std::make_tuple())); a1 = Concat(1, 2, 3); - EXPECT_EQ("123", a1.Perform(make_tuple())); + EXPECT_EQ("123", a1.Perform(std::make_tuple())); } // Verifies the type of an ACTION*. @@ -987,7 +986,7 @@ ACTION_P10(Plus10, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) { TEST(ActionPnMacroTest, CanExplicitlyInstantiateWithReferenceTypes) { int x = 1, y = 2, z = 3; - const tuple<> empty = make_tuple(); + const std::tuple<> empty = std::make_tuple(); Action a = Plus1(x); EXPECT_EQ(1, a.Perform(empty)); @@ -1014,7 +1013,7 @@ class NullaryConstructorClass { // Tests using ReturnNew() with a nullary constructor. TEST(ReturnNewTest, NoArgs) { Action a = ReturnNew(); - NullaryConstructorClass* c = a.Perform(make_tuple()); + NullaryConstructorClass* c = a.Perform(std::make_tuple()); EXPECT_EQ(123, c->value_); delete c; } @@ -1028,7 +1027,7 @@ class UnaryConstructorClass { // Tests using ReturnNew() with a unary constructor. TEST(ReturnNewTest, Unary) { Action a = ReturnNew(4000); - UnaryConstructorClass* c = a.Perform(make_tuple()); + UnaryConstructorClass* c = a.Perform(std::make_tuple()); EXPECT_EQ(4000, c->value_); delete c; } @@ -1036,7 +1035,7 @@ TEST(ReturnNewTest, Unary) { TEST(ReturnNewTest, UnaryWorksWhenMockMethodHasArgs) { Action a = ReturnNew(4000); - UnaryConstructorClass* c = a.Perform(make_tuple(false, 5)); + UnaryConstructorClass* c = a.Perform(std::make_tuple(false, 5)); EXPECT_EQ(4000, c->value_); delete c; } @@ -1044,7 +1043,7 @@ TEST(ReturnNewTest, UnaryWorksWhenMockMethodHasArgs) { TEST(ReturnNewTest, UnaryWorksWhenMockMethodReturnsPointerToConst) { Action a = ReturnNew(4000); - const UnaryConstructorClass* c = a.Perform(make_tuple()); + const UnaryConstructorClass* c = a.Perform(std::make_tuple()); EXPECT_EQ(4000, c->value_); delete c; } @@ -1064,7 +1063,7 @@ TEST(ReturnNewTest, ConstructorThatTakes10Arguments) { ReturnNew(1000000000, 200000000, 30000000, 4000000, 500000, 60000, 7000, 800, 90, 0); - TenArgConstructorClass* c = a.Perform(make_tuple()); + TenArgConstructorClass* c = a.Perform(std::make_tuple()); EXPECT_EQ(1234567890, c->value_); delete c; } @@ -1078,7 +1077,7 @@ ACTION_TEMPLATE(CreateNew, TEST(ActionTemplateTest, WorksWithoutValueParam) { const Action a = CreateNew(); - int* p = a.Perform(make_tuple()); + int* p = a.Perform(std::make_tuple()); delete p; } @@ -1091,7 +1090,7 @@ ACTION_TEMPLATE(CreateNew, TEST(ActionTemplateTest, WorksWithValueParams) { const Action a = CreateNew(42); - int* p = a.Perform(make_tuple()); + int* p = a.Perform(std::make_tuple()); EXPECT_EQ(42, *p); delete p; } @@ -1100,7 +1099,7 @@ TEST(ActionTemplateTest, WorksWithValueParams) { ACTION_TEMPLATE(MyDeleteArg, HAS_1_TEMPLATE_PARAMS(int, k), AND_0_VALUE_PARAMS()) { - delete get(args); + delete std::get(args); } // Resets a bool variable in the destructor. @@ -1117,7 +1116,7 @@ TEST(ActionTemplateTest, WorksForIntegralTemplateParams) { int n = 0; bool b = true; BoolResetter* resetter = new BoolResetter(&b); - a.Perform(make_tuple(&n, resetter)); + a.Perform(std::make_tuple(&n, resetter)); EXPECT_FALSE(b); // Verifies that resetter is deleted. } @@ -1132,7 +1131,7 @@ ACTION_TEMPLATE(ReturnSmartPointer, TEST(ActionTemplateTest, WorksForTemplateTemplateParameters) { using ::testing::internal::linked_ptr; const Action()> a = ReturnSmartPointer(42); - linked_ptr p = a.Perform(make_tuple()); + linked_ptr p = a.Perform(std::make_tuple()); EXPECT_EQ(42, *p); } @@ -1167,7 +1166,7 @@ TEST(ActionTemplateTest, WorksFor10TemplateParameters) { true, 6, char, unsigned, int> Giant; const Action a = ReturnGiant< int, bool, double, 5, true, 6, char, unsigned, int, linked_ptr>(42); - Giant giant = a.Perform(make_tuple()); + Giant giant = a.Perform(std::make_tuple()); EXPECT_EQ(42, giant.value); } @@ -1180,7 +1179,7 @@ ACTION_TEMPLATE(ReturnSum, TEST(ActionTemplateTest, WorksFor10ValueParameters) { const Action a = ReturnSum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - EXPECT_EQ(55, a.Perform(make_tuple())); + EXPECT_EQ(55, a.Perform(std::make_tuple())); } // Tests that ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded @@ -1214,11 +1213,11 @@ TEST(ActionTemplateTest, CanBeOverloadedOnNumberOfValueParameters) { const Action a2 = ReturnSum(1, 2); const Action a3 = ReturnSum(1, 2, 3); const Action a4 = ReturnSum(2000, 300, 40, 5); - EXPECT_EQ(0, a0.Perform(make_tuple())); - EXPECT_EQ(1, a1.Perform(make_tuple())); - EXPECT_EQ(3, a2.Perform(make_tuple())); - EXPECT_EQ(6, a3.Perform(make_tuple())); - EXPECT_EQ(12345, a4.Perform(make_tuple())); + EXPECT_EQ(0, a0.Perform(std::make_tuple())); + EXPECT_EQ(1, a1.Perform(std::make_tuple())); + EXPECT_EQ(3, a2.Perform(std::make_tuple())); + EXPECT_EQ(6, a3.Perform(std::make_tuple())); + EXPECT_EQ(12345, a4.Perform(std::make_tuple())); } #ifdef _MSC_VER diff --git a/googlemock/test/gmock-generated-internal-utils_test.cc b/googlemock/test/gmock-generated-internal-utils_test.cc index ae0280f..965cbaa 100644 --- a/googlemock/test/gmock-generated-internal-utils_test.cc +++ b/googlemock/test/gmock-generated-internal-utils_test.cc @@ -38,7 +38,6 @@ namespace { -using ::testing::tuple; using ::testing::Matcher; using ::testing::internal::CompileAssertTypesEqual; using ::testing::internal::MatcherTuple; @@ -48,24 +47,24 @@ using ::testing::internal::IgnoredValue; // Tests the MatcherTuple template struct. TEST(MatcherTupleTest, ForSize0) { - CompileAssertTypesEqual, MatcherTuple >::type>(); + CompileAssertTypesEqual, MatcherTuple >::type>(); } TEST(MatcherTupleTest, ForSize1) { - CompileAssertTypesEqual >, - MatcherTuple >::type>(); + CompileAssertTypesEqual >, + MatcherTuple >::type>(); } TEST(MatcherTupleTest, ForSize2) { - CompileAssertTypesEqual, Matcher >, - MatcherTuple >::type>(); + CompileAssertTypesEqual, Matcher >, + MatcherTuple >::type>(); } TEST(MatcherTupleTest, ForSize5) { CompileAssertTypesEqual< - tuple, Matcher, Matcher, Matcher, - Matcher >, - MatcherTuple >::type>(); + std::tuple, Matcher, Matcher, Matcher, + Matcher >, + MatcherTuple >::type>(); } // Tests the Function template struct. @@ -73,8 +72,8 @@ TEST(MatcherTupleTest, ForSize5) { TEST(FunctionTest, Nullary) { typedef Function F; // NOLINT CompileAssertTypesEqual(); - CompileAssertTypesEqual, F::ArgumentTuple>(); - CompileAssertTypesEqual, F::ArgumentMatcherTuple>(); + CompileAssertTypesEqual, F::ArgumentTuple>(); + CompileAssertTypesEqual, F::ArgumentMatcherTuple>(); CompileAssertTypesEqual(); CompileAssertTypesEqual(); } @@ -83,8 +82,9 @@ TEST(FunctionTest, Unary) { typedef Function F; // NOLINT CompileAssertTypesEqual(); CompileAssertTypesEqual(); - CompileAssertTypesEqual, F::ArgumentTuple>(); - CompileAssertTypesEqual >, F::ArgumentMatcherTuple>(); + CompileAssertTypesEqual, F::ArgumentTuple>(); + CompileAssertTypesEqual >, + F::ArgumentMatcherTuple>(); CompileAssertTypesEqual(); // NOLINT CompileAssertTypesEqual(); @@ -95,9 +95,10 @@ TEST(FunctionTest, Binary) { CompileAssertTypesEqual(); CompileAssertTypesEqual(); CompileAssertTypesEqual(); // NOLINT - CompileAssertTypesEqual, F::ArgumentTuple>(); // NOLINT + CompileAssertTypesEqual, // NOLINT + F::ArgumentTuple>(); CompileAssertTypesEqual< - tuple, Matcher >, // NOLINT + std::tuple, Matcher >, // NOLINT F::ArgumentMatcherTuple>(); CompileAssertTypesEqual(); // NOLINT CompileAssertTypesEqual(); CompileAssertTypesEqual(); CompileAssertTypesEqual(); // NOLINT - CompileAssertTypesEqual, // NOLINT - F::ArgumentTuple>(); CompileAssertTypesEqual< - tuple, Matcher, Matcher, Matcher, - Matcher >, // NOLINT + std::tuple, // NOLINT + F::ArgumentTuple>(); + CompileAssertTypesEqual< + std::tuple, Matcher, Matcher, Matcher, + Matcher >, // NOLINT F::ArgumentMatcherTuple>(); CompileAssertTypesEqual(); diff --git a/googlemock/test/gmock-generated-matchers_test.cc b/googlemock/test/gmock-generated-matchers_test.cc index 10a4ac3..fdbfb54 100644 --- a/googlemock/test/gmock-generated-matchers_test.cc +++ b/googlemock/test/gmock-generated-matchers_test.cc @@ -62,9 +62,6 @@ using std::pair; using std::set; using std::stringstream; using std::vector; -using testing::get; -using testing::make_tuple; -using testing::tuple; using testing::_; using testing::AllOf; using testing::AnyOf; @@ -118,20 +115,20 @@ std::string Explain(const MatcherType& m, const Value& x) { // Tests Args(m). TEST(ArgsTest, AcceptsZeroTemplateArg) { - const tuple t(5, true); - EXPECT_THAT(t, Args<>(Eq(tuple<>()))); - EXPECT_THAT(t, Not(Args<>(Ne(tuple<>())))); + const std::tuple t(5, true); + EXPECT_THAT(t, Args<>(Eq(std::tuple<>()))); + EXPECT_THAT(t, Not(Args<>(Ne(std::tuple<>())))); } TEST(ArgsTest, AcceptsOneTemplateArg) { - const tuple t(5, true); - EXPECT_THAT(t, Args<0>(Eq(make_tuple(5)))); - EXPECT_THAT(t, Args<1>(Eq(make_tuple(true)))); - EXPECT_THAT(t, Not(Args<1>(Eq(make_tuple(false))))); + const std::tuple t(5, true); + EXPECT_THAT(t, Args<0>(Eq(std::make_tuple(5)))); + EXPECT_THAT(t, Args<1>(Eq(std::make_tuple(true)))); + EXPECT_THAT(t, Not(Args<1>(Eq(std::make_tuple(false))))); } TEST(ArgsTest, AcceptsTwoTemplateArgs) { - const tuple t(4, 5, 6L); // NOLINT + const std::tuple t(4, 5, 6L); // NOLINT EXPECT_THAT(t, (Args<0, 1>(Lt()))); EXPECT_THAT(t, (Args<1, 2>(Lt()))); @@ -139,13 +136,13 @@ TEST(ArgsTest, AcceptsTwoTemplateArgs) { } TEST(ArgsTest, AcceptsRepeatedTemplateArgs) { - const tuple t(4, 5, 6L); // NOLINT + const std::tuple t(4, 5, 6L); // NOLINT EXPECT_THAT(t, (Args<0, 0>(Eq()))); EXPECT_THAT(t, Not(Args<1, 1>(Ne()))); } TEST(ArgsTest, AcceptsDecreasingTemplateArgs) { - const tuple t(4, 5, 6L); // NOLINT + const std::tuple t(4, 5, 6L); // NOLINT EXPECT_THAT(t, (Args<2, 0>(Gt()))); EXPECT_THAT(t, Not(Args<2, 1>(Lt()))); } @@ -161,29 +158,29 @@ TEST(ArgsTest, AcceptsDecreasingTemplateArgs) { #endif MATCHER(SumIsZero, "") { - return get<0>(arg) + get<1>(arg) + get<2>(arg) == 0; + return std::get<0>(arg) + std::get<1>(arg) + std::get<2>(arg) == 0; } TEST(ArgsTest, AcceptsMoreTemplateArgsThanArityOfOriginalTuple) { - EXPECT_THAT(make_tuple(-1, 2), (Args<0, 0, 1>(SumIsZero()))); - EXPECT_THAT(make_tuple(1, 2), Not(Args<0, 0, 1>(SumIsZero()))); + EXPECT_THAT(std::make_tuple(-1, 2), (Args<0, 0, 1>(SumIsZero()))); + EXPECT_THAT(std::make_tuple(1, 2), Not(Args<0, 0, 1>(SumIsZero()))); } TEST(ArgsTest, CanBeNested) { - const tuple t(4, 5, 6L, 6); // NOLINT + const std::tuple t(4, 5, 6L, 6); // NOLINT EXPECT_THAT(t, (Args<1, 2, 3>(Args<1, 2>(Eq())))); EXPECT_THAT(t, (Args<0, 1, 3>(Args<0, 2>(Lt())))); } TEST(ArgsTest, CanMatchTupleByValue) { - typedef tuple Tuple3; + typedef std::tuple Tuple3; const Matcher m = Args<1, 2>(Lt()); EXPECT_TRUE(m.Matches(Tuple3('a', 1, 2))); EXPECT_FALSE(m.Matches(Tuple3('b', 2, 2))); } TEST(ArgsTest, CanMatchTupleByReference) { - typedef tuple Tuple3; + typedef std::tuple Tuple3; const Matcher m = Args<0, 1>(Lt()); EXPECT_TRUE(m.Matches(Tuple3('a', 'b', 2))); EXPECT_FALSE(m.Matches(Tuple3('b', 'b', 2))); @@ -195,23 +192,23 @@ MATCHER_P(PrintsAs, str, "") { } TEST(ArgsTest, AcceptsTenTemplateArgs) { - EXPECT_THAT(make_tuple(0, 1L, 2, 3L, 4, 5, 6, 7, 8, 9), + EXPECT_THAT(std::make_tuple(0, 1L, 2, 3L, 4, 5, 6, 7, 8, 9), (Args<9, 8, 7, 6, 5, 4, 3, 2, 1, 0>( PrintsAs("(9, 8, 7, 6, 5, 4, 3, 2, 1, 0)")))); - EXPECT_THAT(make_tuple(0, 1L, 2, 3L, 4, 5, 6, 7, 8, 9), + EXPECT_THAT(std::make_tuple(0, 1L, 2, 3L, 4, 5, 6, 7, 8, 9), Not(Args<9, 8, 7, 6, 5, 4, 3, 2, 1, 0>( - PrintsAs("(0, 8, 7, 6, 5, 4, 3, 2, 1, 0)")))); + PrintsAs("(0, 8, 7, 6, 5, 4, 3, 2, 1, 0)")))); } TEST(ArgsTest, DescirbesSelfCorrectly) { - const Matcher > m = Args<2, 0>(Lt()); + const Matcher > m = Args<2, 0>(Lt()); EXPECT_EQ("are a tuple whose fields (#2, #0) are a pair where " "the first < the second", Describe(m)); } TEST(ArgsTest, DescirbesNestedArgsCorrectly) { - const Matcher&> m = + const Matcher&> m = Args<0, 2, 3>(Args<2, 0>(Lt())); EXPECT_EQ("are a tuple whose fields (#0, #2, #3) are a tuple " "whose fields (#2, #0) are a pair where the first < the second", @@ -219,28 +216,28 @@ TEST(ArgsTest, DescirbesNestedArgsCorrectly) { } TEST(ArgsTest, DescribesNegationCorrectly) { - const Matcher > m = Args<1, 0>(Gt()); + const Matcher > m = Args<1, 0>(Gt()); EXPECT_EQ("are a tuple whose fields (#1, #0) aren't a pair " "where the first > the second", DescribeNegation(m)); } TEST(ArgsTest, ExplainsMatchResultWithoutInnerExplanation) { - const Matcher > m = Args<1, 2>(Eq()); + const Matcher > m = Args<1, 2>(Eq()); EXPECT_EQ("whose fields (#1, #2) are (42, 42)", - Explain(m, make_tuple(false, 42, 42))); + Explain(m, std::make_tuple(false, 42, 42))); EXPECT_EQ("whose fields (#1, #2) are (42, 43)", - Explain(m, make_tuple(false, 42, 43))); + Explain(m, std::make_tuple(false, 42, 43))); } // For testing Args<>'s explanation. -class LessThanMatcher : public MatcherInterface > { +class LessThanMatcher : public MatcherInterface > { public: virtual void DescribeTo(::std::ostream* os) const {} - virtual bool MatchAndExplain(tuple value, + virtual bool MatchAndExplain(std::tuple value, MatchResultListener* listener) const { - const int diff = get<0>(value) - get<1>(value); + const int diff = std::get<0>(value) - std::get<1>(value); if (diff > 0) { *listener << "where the first value is " << diff << " more than the second"; @@ -249,17 +246,18 @@ class LessThanMatcher : public MatcherInterface > { } }; -Matcher > LessThan() { +Matcher > LessThan() { return MakeMatcher(new LessThanMatcher); } TEST(ArgsTest, ExplainsMatchResultWithInnerExplanation) { - const Matcher > m = Args<0, 2>(LessThan()); - EXPECT_EQ("whose fields (#0, #2) are ('a' (97, 0x61), 42), " - "where the first value is 55 more than the second", - Explain(m, make_tuple('a', 42, 42))); + const Matcher > m = Args<0, 2>(LessThan()); + EXPECT_EQ( + "whose fields (#0, #2) are ('a' (97, 0x61), 42), " + "where the first value is 55 more than the second", + Explain(m, std::make_tuple('a', 42, 42))); EXPECT_EQ("whose fields (#0, #2) are ('\\0', 43)", - Explain(m, make_tuple('\0', 42, 43))); + Explain(m, std::make_tuple('\0', 42, 43))); } // For testing ExplainMatchResultTo(). @@ -517,7 +515,7 @@ class NativeArrayPassedAsPointerAndSize { TEST(ElementsAreTest, WorksWithNativeArrayPassedAsPointerAndSize) { int array[] = { 0, 1 }; - ::testing::tuple array_as_tuple(array, 2); + ::std::tuple array_as_tuple(array, 2); EXPECT_THAT(array_as_tuple, ElementsAre(0, 1)); EXPECT_THAT(array_as_tuple, Not(ElementsAre(0))); @@ -571,8 +569,8 @@ TEST(ElementsAreTest, MakesCopyOfArguments) { int x = 1; int y = 2; // This should make a copy of x and y. - ::testing::internal::ElementsAreMatcher > - polymorphic_matcher = ElementsAre(x, y); + ::testing::internal::ElementsAreMatcher > + polymorphic_matcher = ElementsAre(x, y); // Changing x and y now shouldn't affect the meaning of the above matcher. x = y = 0; const int array1[] = { 1, 2 }; @@ -1235,8 +1233,8 @@ TEST(ContainsTest, AcceptsMatcher) { TEST(ContainsTest, WorksForNativeArrayAsTuple) { const int a[] = { 1, 2 }; const int* const pointer = a; - EXPECT_THAT(make_tuple(pointer, 2), Contains(1)); - EXPECT_THAT(make_tuple(pointer, 2), Not(Contains(Gt(3)))); + EXPECT_THAT(std::make_tuple(pointer, 2), Contains(1)); + EXPECT_THAT(std::make_tuple(pointer, 2), Not(Contains(Gt(3)))); } TEST(ContainsTest, WorksForTwoDimensionalNativeArray) { diff --git a/googlemock/test/gmock-internal-utils_test.cc b/googlemock/test/gmock-internal-utils_test.cc index 7116e4f..41498f0 100644 --- a/googlemock/test/gmock-internal-utils_test.cc +++ b/googlemock/test/gmock-internal-utils_test.cc @@ -308,26 +308,23 @@ TEST(LosslessArithmeticConvertibleTest, FloatingPointToFloatingPoint) { // Tests the TupleMatches() template function. TEST(TupleMatchesTest, WorksForSize0) { - tuple<> matchers; - tuple<> values; + std::tuple<> matchers; + std::tuple<> values; EXPECT_TRUE(TupleMatches(matchers, values)); } TEST(TupleMatchesTest, WorksForSize1) { - tuple > matchers(Eq(1)); - tuple values1(1), - values2(2); + std::tuple > matchers(Eq(1)); + std::tuple values1(1), values2(2); EXPECT_TRUE(TupleMatches(matchers, values1)); EXPECT_FALSE(TupleMatches(matchers, values2)); } TEST(TupleMatchesTest, WorksForSize2) { - tuple, Matcher > matchers(Eq(1), Eq('a')); - tuple values1(1, 'a'), - values2(1, 'b'), - values3(2, 'a'), + std::tuple, Matcher > matchers(Eq(1), Eq('a')); + std::tuple values1(1, 'a'), values2(1, 'b'), values3(2, 'a'), values4(2, 'b'); EXPECT_TRUE(TupleMatches(matchers, values1)); @@ -337,10 +334,11 @@ TEST(TupleMatchesTest, WorksForSize2) { } TEST(TupleMatchesTest, WorksForSize5) { - tuple, Matcher, Matcher, Matcher, // NOLINT - Matcher > + std::tuple, Matcher, Matcher, + Matcher, // NOLINT + Matcher > matchers(Eq(1), Eq('a'), Eq(true), Eq(2L), Eq("hi")); - tuple // NOLINT + std::tuple // NOLINT values1(1, 'a', true, 2L, "hi"), values2(1, 'a', true, 2L, "hello"), values3(2, 'a', true, 2L, "hi"); @@ -686,22 +684,25 @@ TEST(StlContainerViewTest, WorksForStaticNativeArray) { TEST(StlContainerViewTest, WorksForDynamicNativeArray) { StaticAssertTypeEq, - StlContainerView >::type>(); - StaticAssertTypeEq, - StlContainerView, int> >::type>(); + StlContainerView >::type>(); + StaticAssertTypeEq< + NativeArray, + StlContainerView, int> >::type>(); - StaticAssertTypeEq, - StlContainerView >::const_reference>(); + StaticAssertTypeEq< + const NativeArray, + StlContainerView >::const_reference>(); int a1[3] = { 0, 1, 2 }; const int* const p1 = a1; - NativeArray a2 = StlContainerView >:: - ConstReference(make_tuple(p1, 3)); + NativeArray a2 = + StlContainerView >::ConstReference( + std::make_tuple(p1, 3)); EXPECT_EQ(3U, a2.size()); EXPECT_EQ(a1, a2.begin()); - const NativeArray a3 = StlContainerView >:: - Copy(make_tuple(static_cast(a1), 3)); + const NativeArray a3 = StlContainerView >::Copy( + std::make_tuple(static_cast(a1), 3)); ASSERT_EQ(3U, a3.size()); EXPECT_EQ(0, a3.begin()[0]); EXPECT_EQ(1, a3.begin()[1]); diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index 6d43234..86ff580 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -136,7 +136,6 @@ using testing::Value; using testing::WhenSorted; using testing::WhenSortedBy; using testing::_; -using testing::get; using testing::internal::DummyMatchResultListener; using testing::internal::ElementMatcherPair; using testing::internal::ElementMatcherPairs; @@ -153,8 +152,6 @@ using testing::internal::Strings; using testing::internal::linked_ptr; using testing::internal::scoped_ptr; using testing::internal::string; -using testing::make_tuple; -using testing::tuple; // For testing ExplainMatchResultTo(). class GreaterThanMatcher : public MatcherInterface { @@ -2239,8 +2236,7 @@ TEST(GlobalWideEndsWithTest, CanDescribeSelf) { #endif // GTEST_HAS_GLOBAL_WSTRING - -typedef ::testing::tuple Tuple2; // NOLINT +typedef ::std::tuple Tuple2; // NOLINT // Tests that Eq() matches a 2-tuple where the first field == the // second field. @@ -2334,7 +2330,7 @@ TEST(Ne2Test, CanDescribeSelf) { // Tests that FloatEq() matches a 2-tuple where // FloatEq(first field) matches the second field. TEST(FloatEq2Test, MatchesEqualArguments) { - typedef ::testing::tuple Tpl; + typedef ::std::tuple Tpl; Matcher m = FloatEq(); EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(0.3f, 0.1f + 0.1f + 0.1f))); @@ -2343,14 +2339,14 @@ TEST(FloatEq2Test, MatchesEqualArguments) { // Tests that FloatEq() describes itself properly. TEST(FloatEq2Test, CanDescribeSelf) { - Matcher&> m = FloatEq(); + Matcher&> m = FloatEq(); EXPECT_EQ("are an almost-equal pair", Describe(m)); } // Tests that NanSensitiveFloatEq() matches a 2-tuple where // NanSensitiveFloatEq(first field) matches the second field. TEST(NanSensitiveFloatEqTest, MatchesEqualArgumentsWithNaN) { - typedef ::testing::tuple Tpl; + typedef ::std::tuple Tpl; Matcher m = NanSensitiveFloatEq(); EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits::quiet_NaN(), @@ -2362,14 +2358,14 @@ TEST(NanSensitiveFloatEqTest, MatchesEqualArgumentsWithNaN) { // Tests that NanSensitiveFloatEq() describes itself properly. TEST(NanSensitiveFloatEqTest, CanDescribeSelfWithNaNs) { - Matcher&> m = NanSensitiveFloatEq(); + Matcher&> m = NanSensitiveFloatEq(); EXPECT_EQ("are an almost-equal pair", Describe(m)); } // Tests that DoubleEq() matches a 2-tuple where // DoubleEq(first field) matches the second field. TEST(DoubleEq2Test, MatchesEqualArguments) { - typedef ::testing::tuple Tpl; + typedef ::std::tuple Tpl; Matcher m = DoubleEq(); EXPECT_TRUE(m.Matches(Tpl(1.0, 1.0))); EXPECT_TRUE(m.Matches(Tpl(0.3, 0.1 + 0.1 + 0.1))); @@ -2378,14 +2374,14 @@ TEST(DoubleEq2Test, MatchesEqualArguments) { // Tests that DoubleEq() describes itself properly. TEST(DoubleEq2Test, CanDescribeSelf) { - Matcher&> m = DoubleEq(); + Matcher&> m = DoubleEq(); EXPECT_EQ("are an almost-equal pair", Describe(m)); } // Tests that NanSensitiveDoubleEq() matches a 2-tuple where // NanSensitiveDoubleEq(first field) matches the second field. TEST(NanSensitiveDoubleEqTest, MatchesEqualArgumentsWithNaN) { - typedef ::testing::tuple Tpl; + typedef ::std::tuple Tpl; Matcher m = NanSensitiveDoubleEq(); EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits::quiet_NaN(), @@ -2397,14 +2393,14 @@ TEST(NanSensitiveDoubleEqTest, MatchesEqualArgumentsWithNaN) { // Tests that DoubleEq() describes itself properly. TEST(NanSensitiveDoubleEqTest, CanDescribeSelfWithNaNs) { - Matcher&> m = NanSensitiveDoubleEq(); + Matcher&> m = NanSensitiveDoubleEq(); EXPECT_EQ("are an almost-equal pair", Describe(m)); } // Tests that FloatEq() matches a 2-tuple where // FloatNear(first field, max_abs_error) matches the second field. TEST(FloatNear2Test, MatchesEqualArguments) { - typedef ::testing::tuple Tpl; + typedef ::std::tuple Tpl; Matcher m = FloatNear(0.5f); EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(1.3f, 1.0f))); @@ -2413,14 +2409,14 @@ TEST(FloatNear2Test, MatchesEqualArguments) { // Tests that FloatNear() describes itself properly. TEST(FloatNear2Test, CanDescribeSelf) { - Matcher&> m = FloatNear(0.5f); + Matcher&> m = FloatNear(0.5f); EXPECT_EQ("are an almost-equal pair", Describe(m)); } // Tests that NanSensitiveFloatNear() matches a 2-tuple where // NanSensitiveFloatNear(first field) matches the second field. TEST(NanSensitiveFloatNearTest, MatchesNearbyArgumentsWithNaN) { - typedef ::testing::tuple Tpl; + typedef ::std::tuple Tpl; Matcher m = NanSensitiveFloatNear(0.5f); EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(1.1f, 1.0f))); @@ -2433,15 +2429,14 @@ TEST(NanSensitiveFloatNearTest, MatchesNearbyArgumentsWithNaN) { // Tests that NanSensitiveFloatNear() describes itself properly. TEST(NanSensitiveFloatNearTest, CanDescribeSelfWithNaNs) { - Matcher&> m = - NanSensitiveFloatNear(0.5f); + Matcher&> m = NanSensitiveFloatNear(0.5f); EXPECT_EQ("are an almost-equal pair", Describe(m)); } // Tests that FloatEq() matches a 2-tuple where // DoubleNear(first field, max_abs_error) matches the second field. TEST(DoubleNear2Test, MatchesEqualArguments) { - typedef ::testing::tuple Tpl; + typedef ::std::tuple Tpl; Matcher m = DoubleNear(0.5); EXPECT_TRUE(m.Matches(Tpl(1.0, 1.0))); EXPECT_TRUE(m.Matches(Tpl(1.3, 1.0))); @@ -2450,14 +2445,14 @@ TEST(DoubleNear2Test, MatchesEqualArguments) { // Tests that DoubleNear() describes itself properly. TEST(DoubleNear2Test, CanDescribeSelf) { - Matcher&> m = DoubleNear(0.5); + Matcher&> m = DoubleNear(0.5); EXPECT_EQ("are an almost-equal pair", Describe(m)); } // Tests that NanSensitiveDoubleNear() matches a 2-tuple where // NanSensitiveDoubleNear(first field) matches the second field. TEST(NanSensitiveDoubleNearTest, MatchesNearbyArgumentsWithNaN) { - typedef ::testing::tuple Tpl; + typedef ::std::tuple Tpl; Matcher m = NanSensitiveDoubleNear(0.5f); EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(1.1f, 1.0f))); @@ -2470,8 +2465,7 @@ TEST(NanSensitiveDoubleNearTest, MatchesNearbyArgumentsWithNaN) { // Tests that NanSensitiveDoubleNear() describes itself properly. TEST(NanSensitiveDoubleNearTest, CanDescribeSelfWithNaNs) { - Matcher&> m = - NanSensitiveDoubleNear(0.5f); + Matcher&> m = NanSensitiveDoubleNear(0.5f); EXPECT_EQ("are an almost-equal pair", Describe(m)); } @@ -3081,8 +3075,8 @@ TEST(DescribeMatcherTest, WorksWithPolymorphicMatcher) { } TEST(AllArgsTest, WorksForTuple) { - EXPECT_THAT(make_tuple(1, 2L), AllArgs(Lt())); - EXPECT_THAT(make_tuple(2L, 1), Not(AllArgs(Lt()))); + EXPECT_THAT(std::make_tuple(1, 2L), AllArgs(Lt())); + EXPECT_THAT(std::make_tuple(2L, 1), Not(AllArgs(Lt()))); } TEST(AllArgsTest, WorksForNonTuple) { @@ -5060,11 +5054,11 @@ TEST(ContainerEqExtraTest, WorksForNativeArrayAsTuple) { const int b[] = {1, 2, 3, 4}; const int* const p1 = a1; - EXPECT_THAT(make_tuple(p1, 3), ContainerEq(a2)); - EXPECT_THAT(make_tuple(p1, 3), Not(ContainerEq(b))); + EXPECT_THAT(std::make_tuple(p1, 3), ContainerEq(a2)); + EXPECT_THAT(std::make_tuple(p1, 3), Not(ContainerEq(b))); const int c[] = {1, 3, 2}; - EXPECT_THAT(make_tuple(p1, 3), Not(ContainerEq(c))); + EXPECT_THAT(std::make_tuple(p1, 3), Not(ContainerEq(c))); } TEST(ContainerEqExtraTest, CopiesNativeArrayParameter) { @@ -6246,13 +6240,15 @@ TEST(PolymorphicMatcherTest, CanAccessImpl) { TEST(MatcherTupleTest, ExplainsMatchFailure) { stringstream ss1; - ExplainMatchFailureTupleTo(make_tuple(Matcher(Eq('a')), GreaterThan(5)), - make_tuple('a', 10), &ss1); + ExplainMatchFailureTupleTo( + std::make_tuple(Matcher(Eq('a')), GreaterThan(5)), + std::make_tuple('a', 10), &ss1); EXPECT_EQ("", ss1.str()); // Successful match. stringstream ss2; - ExplainMatchFailureTupleTo(make_tuple(GreaterThan(5), Matcher(Eq('a'))), - make_tuple(2, 'b'), &ss2); + ExplainMatchFailureTupleTo( + std::make_tuple(GreaterThan(5), Matcher(Eq('a'))), + std::make_tuple(2, 'b'), &ss2); EXPECT_EQ(" Expected arg #0: is > 5\n" " Actual: 2, which is 3 less than 5\n" " Expected arg #1: is equal to 'a' (97, 0x61)\n" @@ -6260,8 +6256,9 @@ TEST(MatcherTupleTest, ExplainsMatchFailure) { ss2.str()); // Failed match where both arguments need explanation. stringstream ss3; - ExplainMatchFailureTupleTo(make_tuple(GreaterThan(5), Matcher(Eq('a'))), - make_tuple(2, 'a'), &ss3); + ExplainMatchFailureTupleTo( + std::make_tuple(GreaterThan(5), Matcher(Eq('a'))), + std::make_tuple(2, 'a'), &ss3); EXPECT_EQ(" Expected arg #0: is > 5\n" " Actual: 2, which is 3 less than 5\n", ss3.str()); // Failed match where only one argument needs @@ -6350,21 +6347,21 @@ TEST(EachTest, AcceptsMatcher) { TEST(EachTest, WorksForNativeArrayAsTuple) { const int a[] = {1, 2}; const int* const pointer = a; - EXPECT_THAT(make_tuple(pointer, 2), Each(Gt(0))); - EXPECT_THAT(make_tuple(pointer, 2), Not(Each(Gt(1)))); + EXPECT_THAT(std::make_tuple(pointer, 2), Each(Gt(0))); + EXPECT_THAT(std::make_tuple(pointer, 2), Not(Each(Gt(1)))); } // For testing Pointwise(). class IsHalfOfMatcher { public: template - bool MatchAndExplain(const tuple& a_pair, + bool MatchAndExplain(const std::tuple& a_pair, MatchResultListener* listener) const { - if (get<0>(a_pair) == get<1>(a_pair)/2) { - *listener << "where the second is " << get<1>(a_pair); + if (std::get<0>(a_pair) == std::get<1>(a_pair) / 2) { + *listener << "where the second is " << std::get<1>(a_pair); return true; } else { - *listener << "where the second/2 is " << get<1>(a_pair)/2; + *listener << "where the second/2 is " << std::get<1>(a_pair) / 2; return false; } } @@ -6481,13 +6478,13 @@ TEST(PointwiseTest, AcceptsCorrectContent) { TEST(PointwiseTest, AllowsMonomorphicInnerMatcher) { const double lhs[3] = {1, 2, 3}; const int rhs[3] = {2, 4, 6}; - const Matcher > m1 = IsHalfOf(); + const Matcher> m1 = IsHalfOf(); EXPECT_THAT(lhs, Pointwise(m1, rhs)); EXPECT_EQ("", Explain(Pointwise(m1, rhs), lhs)); - // This type works as a tuple can be - // implicitly cast to tuple. - const Matcher > m2 = IsHalfOf(); + // This type works as a std::tuple can be + // implicitly cast to std::tuple. + const Matcher> m2 = IsHalfOf(); EXPECT_THAT(lhs, Pointwise(m2, rhs)); EXPECT_EQ("", Explain(Pointwise(m2, rhs), lhs)); } @@ -6597,12 +6594,12 @@ TEST(UnorderedPointwiseTest, AcceptsCorrectContentInDifferentOrder) { TEST(UnorderedPointwiseTest, AllowsMonomorphicInnerMatcher) { const double lhs[3] = {1, 2, 3}; const int rhs[3] = {4, 6, 2}; - const Matcher > m1 = IsHalfOf(); + const Matcher> m1 = IsHalfOf(); EXPECT_THAT(lhs, UnorderedPointwise(m1, rhs)); - // This type works as a tuple can be - // implicitly cast to tuple. - const Matcher > m2 = IsHalfOf(); + // This type works as a std::tuple can be + // implicitly cast to std::tuple. + const Matcher> m2 = IsHalfOf(); EXPECT_THAT(lhs, UnorderedPointwise(m2, rhs)); } diff --git a/googlemock/test/gmock-more-actions_test.cc b/googlemock/test/gmock-more-actions_test.cc index 976b245..521f305 100644 --- a/googlemock/test/gmock-more-actions_test.cc +++ b/googlemock/test/gmock-more-actions_test.cc @@ -46,10 +46,6 @@ namespace gmock_more_actions_test { using ::std::plus; using ::std::string; -using testing::get; -using testing::make_tuple; -using testing::tuple; -using testing::tuple_element; using testing::_; using testing::Action; using testing::ActionInterface; @@ -232,45 +228,46 @@ class Foo { // Tests using Invoke() with a nullary function. TEST(InvokeTest, Nullary) { Action a = Invoke(Nullary); // NOLINT - EXPECT_EQ(1, a.Perform(make_tuple())); + EXPECT_EQ(1, a.Perform(std::make_tuple())); } // Tests using Invoke() with a unary function. TEST(InvokeTest, Unary) { Action a = Invoke(Unary); // NOLINT - EXPECT_FALSE(a.Perform(make_tuple(1))); - EXPECT_TRUE(a.Perform(make_tuple(-1))); + EXPECT_FALSE(a.Perform(std::make_tuple(1))); + EXPECT_TRUE(a.Perform(std::make_tuple(-1))); } // Tests using Invoke() with a binary function. TEST(InvokeTest, Binary) { Action a = Invoke(Binary); // NOLINT const char* p = "Hello"; - EXPECT_EQ(p + 2, a.Perform(make_tuple(p, Short(2)))); + EXPECT_EQ(p + 2, a.Perform(std::make_tuple(p, Short(2)))); } // Tests using Invoke() with a ternary function. TEST(InvokeTest, Ternary) { Action a = Invoke(Ternary); // NOLINT - EXPECT_EQ(6, a.Perform(make_tuple(1, '\2', Short(3)))); + EXPECT_EQ(6, a.Perform(std::make_tuple(1, '\2', Short(3)))); } // Tests using Invoke() with a 4-argument function. TEST(InvokeTest, FunctionThatTakes4Arguments) { Action a = Invoke(SumOf4); // NOLINT - EXPECT_EQ(1234, a.Perform(make_tuple(1000, 200, 30, 4))); + EXPECT_EQ(1234, a.Perform(std::make_tuple(1000, 200, 30, 4))); } // Tests using Invoke() with a 5-argument function. TEST(InvokeTest, FunctionThatTakes5Arguments) { Action a = Invoke(SumOf5); // NOLINT - EXPECT_EQ(12345, a.Perform(make_tuple(10000, 2000, 300, 40, 5))); + EXPECT_EQ(12345, a.Perform(std::make_tuple(10000, 2000, 300, 40, 5))); } // Tests using Invoke() with a 6-argument function. TEST(InvokeTest, FunctionThatTakes6Arguments) { Action a = Invoke(SumOf6); // NOLINT - EXPECT_EQ(123456, a.Perform(make_tuple(100000, 20000, 3000, 400, 50, 6))); + EXPECT_EQ(123456, + a.Perform(std::make_tuple(100000, 20000, 3000, 400, 50, 6))); } // A helper that turns the type of a C-string literal from const @@ -283,9 +280,9 @@ TEST(InvokeTest, FunctionThatTakes7Arguments) { const char*, const char*, const char*)> a = Invoke(Concat7); EXPECT_EQ("1234567", - a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), - CharPtr("4"), CharPtr("5"), CharPtr("6"), - CharPtr("7")))); + a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), + CharPtr("4"), CharPtr("5"), CharPtr("6"), + CharPtr("7")))); } // Tests using Invoke() with a 8-argument function. @@ -294,9 +291,9 @@ TEST(InvokeTest, FunctionThatTakes8Arguments) { const char*, const char*, const char*, const char*)> a = Invoke(Concat8); EXPECT_EQ("12345678", - a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), - CharPtr("4"), CharPtr("5"), CharPtr("6"), - CharPtr("7"), CharPtr("8")))); + a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), + CharPtr("4"), CharPtr("5"), CharPtr("6"), + CharPtr("7"), CharPtr("8")))); } // Tests using Invoke() with a 9-argument function. @@ -305,10 +302,10 @@ TEST(InvokeTest, FunctionThatTakes9Arguments) { const char*, const char*, const char*, const char*, const char*)> a = Invoke(Concat9); - EXPECT_EQ("123456789", - a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), - CharPtr("4"), CharPtr("5"), CharPtr("6"), - CharPtr("7"), CharPtr("8"), CharPtr("9")))); + EXPECT_EQ("123456789", a.Perform(std::make_tuple( + CharPtr("1"), CharPtr("2"), CharPtr("3"), + CharPtr("4"), CharPtr("5"), CharPtr("6"), + CharPtr("7"), CharPtr("8"), CharPtr("9")))); } // Tests using Invoke() with a 10-argument function. @@ -318,46 +315,46 @@ TEST(InvokeTest, FunctionThatTakes10Arguments) { const char*, const char*)> a = Invoke(Concat10); EXPECT_EQ("1234567890", - a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), - CharPtr("4"), CharPtr("5"), CharPtr("6"), - CharPtr("7"), CharPtr("8"), CharPtr("9"), - CharPtr("0")))); + a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), + CharPtr("4"), CharPtr("5"), CharPtr("6"), + CharPtr("7"), CharPtr("8"), CharPtr("9"), + CharPtr("0")))); } // Tests using Invoke() with functions with parameters declared as Unused. TEST(InvokeTest, FunctionWithUnusedParameters) { Action a1 = Invoke(SumOfFirst2); - tuple dummy = - make_tuple(10, 2, 5.6, std::string("hi")); + std::tuple dummy = + std::make_tuple(10, 2, 5.6, std::string("hi")); EXPECT_EQ(12, a1.Perform(dummy)); Action a2 = Invoke(SumOfFirst2); - EXPECT_EQ(23, - a2.Perform(make_tuple(20, 3, true, static_cast(nullptr)))); + EXPECT_EQ( + 23, a2.Perform(std::make_tuple(20, 3, true, static_cast(nullptr)))); } // Tests using Invoke() with methods with parameters declared as Unused. TEST(InvokeTest, MethodWithUnusedParameters) { Foo foo; Action a1 = Invoke(&foo, &Foo::SumOfLast2); - EXPECT_EQ(12, a1.Perform(make_tuple(CharPtr("hi"), true, 10, 2))); + EXPECT_EQ(12, a1.Perform(std::make_tuple(CharPtr("hi"), true, 10, 2))); Action a2 = Invoke(&foo, &Foo::SumOfLast2); - EXPECT_EQ(23, a2.Perform(make_tuple('a', 2.5, 20, 3))); + EXPECT_EQ(23, a2.Perform(std::make_tuple('a', 2.5, 20, 3))); } // Tests using Invoke() with a functor. TEST(InvokeTest, Functor) { Action a = Invoke(plus()); // NOLINT - EXPECT_EQ(3L, a.Perform(make_tuple(1, 2))); + EXPECT_EQ(3L, a.Perform(std::make_tuple(1, 2))); } // Tests using Invoke(f) as an action of a compatible type. TEST(InvokeTest, FunctionWithCompatibleType) { Action a = Invoke(SumOf4); // NOLINT - EXPECT_EQ(4321, a.Perform(make_tuple(4000, Short(300), Char(20), true))); + EXPECT_EQ(4321, a.Perform(std::make_tuple(4000, Short(300), Char(20), true))); } // Tests using Invoke() with an object pointer and a method pointer. @@ -366,14 +363,14 @@ TEST(InvokeTest, FunctionWithCompatibleType) { TEST(InvokeMethodTest, Nullary) { Foo foo; Action a = Invoke(&foo, &Foo::Nullary); // NOLINT - EXPECT_EQ(123, a.Perform(make_tuple())); + EXPECT_EQ(123, a.Perform(std::make_tuple())); } // Tests using Invoke() with a unary method. TEST(InvokeMethodTest, Unary) { Foo foo; Action a = Invoke(&foo, &Foo::Unary); // NOLINT - EXPECT_EQ(4123, a.Perform(make_tuple(4000))); + EXPECT_EQ(4123, a.Perform(std::make_tuple(4000))); } // Tests using Invoke() with a binary method. @@ -381,7 +378,7 @@ TEST(InvokeMethodTest, Binary) { Foo foo; Action a = Invoke(&foo, &Foo::Binary); std::string s("Hell"); - tuple dummy = make_tuple(s, 'o'); + std::tuple dummy = std::make_tuple(s, 'o'); EXPECT_EQ("Hello", a.Perform(dummy)); } @@ -389,21 +386,21 @@ TEST(InvokeMethodTest, Binary) { TEST(InvokeMethodTest, Ternary) { Foo foo; Action a = Invoke(&foo, &Foo::Ternary); // NOLINT - EXPECT_EQ(1124, a.Perform(make_tuple(1000, true, Char(1)))); + EXPECT_EQ(1124, a.Perform(std::make_tuple(1000, true, Char(1)))); } // Tests using Invoke() with a 4-argument method. TEST(InvokeMethodTest, MethodThatTakes4Arguments) { Foo foo; Action a = Invoke(&foo, &Foo::SumOf4); // NOLINT - EXPECT_EQ(1357, a.Perform(make_tuple(1000, 200, 30, 4))); + EXPECT_EQ(1357, a.Perform(std::make_tuple(1000, 200, 30, 4))); } // Tests using Invoke() with a 5-argument method. TEST(InvokeMethodTest, MethodThatTakes5Arguments) { Foo foo; Action a = Invoke(&foo, &Foo::SumOf5); // NOLINT - EXPECT_EQ(12345, a.Perform(make_tuple(10000, 2000, 300, 40, 5))); + EXPECT_EQ(12345, a.Perform(std::make_tuple(10000, 2000, 300, 40, 5))); } // Tests using Invoke() with a 6-argument method. @@ -411,7 +408,8 @@ TEST(InvokeMethodTest, MethodThatTakes6Arguments) { Foo foo; Action a = // NOLINT Invoke(&foo, &Foo::SumOf6); - EXPECT_EQ(123456, a.Perform(make_tuple(100000, 20000, 3000, 400, 50, 6))); + EXPECT_EQ(123456, + a.Perform(std::make_tuple(100000, 20000, 3000, 400, 50, 6))); } // Tests using Invoke() with a 7-argument method. @@ -421,9 +419,9 @@ TEST(InvokeMethodTest, MethodThatTakes7Arguments) { const char*, const char*, const char*)> a = Invoke(&foo, &Foo::Concat7); EXPECT_EQ("1234567", - a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), - CharPtr("4"), CharPtr("5"), CharPtr("6"), - CharPtr("7")))); + a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), + CharPtr("4"), CharPtr("5"), CharPtr("6"), + CharPtr("7")))); } // Tests using Invoke() with a 8-argument method. @@ -433,9 +431,9 @@ TEST(InvokeMethodTest, MethodThatTakes8Arguments) { const char*, const char*, const char*, const char*)> a = Invoke(&foo, &Foo::Concat8); EXPECT_EQ("12345678", - a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), - CharPtr("4"), CharPtr("5"), CharPtr("6"), - CharPtr("7"), CharPtr("8")))); + a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), + CharPtr("4"), CharPtr("5"), CharPtr("6"), + CharPtr("7"), CharPtr("8")))); } // Tests using Invoke() with a 9-argument method. @@ -445,10 +443,10 @@ TEST(InvokeMethodTest, MethodThatTakes9Arguments) { const char*, const char*, const char*, const char*, const char*)> a = Invoke(&foo, &Foo::Concat9); - EXPECT_EQ("123456789", - a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), - CharPtr("4"), CharPtr("5"), CharPtr("6"), - CharPtr("7"), CharPtr("8"), CharPtr("9")))); + EXPECT_EQ("123456789", a.Perform(std::make_tuple( + CharPtr("1"), CharPtr("2"), CharPtr("3"), + CharPtr("4"), CharPtr("5"), CharPtr("6"), + CharPtr("7"), CharPtr("8"), CharPtr("9")))); } // Tests using Invoke() with a 10-argument method. @@ -459,10 +457,10 @@ TEST(InvokeMethodTest, MethodThatTakes10Arguments) { const char*, const char*)> a = Invoke(&foo, &Foo::Concat10); EXPECT_EQ("1234567890", - a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), - CharPtr("4"), CharPtr("5"), CharPtr("6"), - CharPtr("7"), CharPtr("8"), CharPtr("9"), - CharPtr("0")))); + a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), + CharPtr("4"), CharPtr("5"), CharPtr("6"), + CharPtr("7"), CharPtr("8"), CharPtr("9"), + CharPtr("0")))); } // Tests using Invoke(f) as an action of a compatible type. @@ -470,48 +468,48 @@ TEST(InvokeMethodTest, MethodWithCompatibleType) { Foo foo; Action a = // NOLINT Invoke(&foo, &Foo::SumOf4); - EXPECT_EQ(4444, a.Perform(make_tuple(4000, Short(300), Char(20), true))); + EXPECT_EQ(4444, a.Perform(std::make_tuple(4000, Short(300), Char(20), true))); } // Tests using WithoutArgs with an action that takes no argument. TEST(WithoutArgsTest, NoArg) { Action a = WithoutArgs(Invoke(Nullary)); // NOLINT - EXPECT_EQ(1, a.Perform(make_tuple(2))); + EXPECT_EQ(1, a.Perform(std::make_tuple(2))); } // Tests using WithArg with an action that takes 1 argument. TEST(WithArgTest, OneArg) { Action b = WithArg<1>(Invoke(Unary)); // NOLINT - EXPECT_TRUE(b.Perform(make_tuple(1.5, -1))); - EXPECT_FALSE(b.Perform(make_tuple(1.5, 1))); + EXPECT_TRUE(b.Perform(std::make_tuple(1.5, -1))); + EXPECT_FALSE(b.Perform(std::make_tuple(1.5, 1))); } TEST(ReturnArgActionTest, WorksForOneArgIntArg0) { const Action a = ReturnArg<0>(); - EXPECT_EQ(5, a.Perform(make_tuple(5))); + EXPECT_EQ(5, a.Perform(std::make_tuple(5))); } TEST(ReturnArgActionTest, WorksForMultiArgBoolArg0) { const Action a = ReturnArg<0>(); - EXPECT_TRUE(a.Perform(make_tuple(true, false, false))); + EXPECT_TRUE(a.Perform(std::make_tuple(true, false, false))); } TEST(ReturnArgActionTest, WorksForMultiArgStringArg2) { const Action a = ReturnArg<2>(); - EXPECT_EQ("seven", a.Perform(make_tuple(5, 6, std::string("seven"), 8))); + EXPECT_EQ("seven", a.Perform(std::make_tuple(5, 6, std::string("seven"), 8))); } TEST(SaveArgActionTest, WorksForSameType) { int result = 0; const Action a1 = SaveArg<0>(&result); - a1.Perform(make_tuple(5)); + a1.Perform(std::make_tuple(5)); EXPECT_EQ(5, result); } TEST(SaveArgActionTest, WorksForCompatibleType) { int result = 0; const Action a1 = SaveArg<1>(&result); - a1.Perform(make_tuple(true, 'a')); + a1.Perform(std::make_tuple(true, 'a')); EXPECT_EQ('a', result); } @@ -519,7 +517,7 @@ TEST(SaveArgPointeeActionTest, WorksForSameType) { int result = 0; const int value = 5; const Action a1 = SaveArgPointee<0>(&result); - a1.Perform(make_tuple(&value)); + a1.Perform(std::make_tuple(&value)); EXPECT_EQ(5, result); } @@ -527,7 +525,7 @@ TEST(SaveArgPointeeActionTest, WorksForCompatibleType) { int result = 0; char value = 'a'; const Action a1 = SaveArgPointee<1>(&result); - a1.Perform(make_tuple(true, &value)); + a1.Perform(std::make_tuple(true, &value)); EXPECT_EQ('a', result); } @@ -535,28 +533,28 @@ TEST(SaveArgPointeeActionTest, WorksForLinkedPtr) { int result = 0; linked_ptr value(new int(5)); const Action)> a1 = SaveArgPointee<0>(&result); - a1.Perform(make_tuple(value)); + a1.Perform(std::make_tuple(value)); EXPECT_EQ(5, result); } TEST(SetArgRefereeActionTest, WorksForSameType) { int value = 0; const Action a1 = SetArgReferee<0>(1); - a1.Perform(tuple(value)); + a1.Perform(std::tuple(value)); EXPECT_EQ(1, value); } TEST(SetArgRefereeActionTest, WorksForCompatibleType) { int value = 0; const Action a1 = SetArgReferee<1>('a'); - a1.Perform(tuple(0, value)); + a1.Perform(std::tuple(0, value)); EXPECT_EQ('a', value); } TEST(SetArgRefereeActionTest, WorksWithExtraArguments) { int value = 0; const Action a1 = SetArgReferee<2>('a'); - a1.Perform(tuple(true, 0, value, "hi")); + a1.Perform(std::tuple(true, 0, value, "hi")); EXPECT_EQ('a', value); } @@ -583,7 +581,7 @@ TEST(DeleteArgActionTest, OneArg) { DeletionTester* t = new DeletionTester(&is_deleted); const Action a1 = DeleteArg<0>(); // NOLINT EXPECT_FALSE(is_deleted); - a1.Perform(make_tuple(t)); + a1.Perform(std::make_tuple(t)); EXPECT_TRUE(is_deleted); } @@ -593,7 +591,7 @@ TEST(DeleteArgActionTest, TenArgs) { const Action a1 = DeleteArg<9>(); EXPECT_FALSE(is_deleted); - a1.Perform(make_tuple(true, 5, 6, CharPtr("hi"), false, 7, 8, 9, 10, t)); + a1.Perform(std::make_tuple(true, 5, 6, CharPtr("hi"), false, 7, 8, 9, 10, t)); EXPECT_TRUE(is_deleted); } @@ -601,19 +599,19 @@ TEST(DeleteArgActionTest, TenArgs) { TEST(ThrowActionTest, ThrowsGivenExceptionInVoidFunction) { const Action a = Throw('a'); - EXPECT_THROW(a.Perform(make_tuple(0)), char); + EXPECT_THROW(a.Perform(std::make_tuple(0)), char); } class MyException {}; TEST(ThrowActionTest, ThrowsGivenExceptionInNonVoidFunction) { const Action a = Throw(MyException()); - EXPECT_THROW(a.Perform(make_tuple('0')), MyException); + EXPECT_THROW(a.Perform(std::make_tuple('0')), MyException); } TEST(ThrowActionTest, ThrowsGivenExceptionInNullaryFunction) { const Action a = Throw(MyException()); - EXPECT_THROW(a.Perform(make_tuple()), MyException); + EXPECT_THROW(a.Perform(std::make_tuple()), MyException); } #endif // GTEST_HAS_EXCEPTIONS @@ -629,7 +627,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArray) { int* pn = n; char ch[4] = {}; char* pch = ch; - a.Perform(make_tuple(true, pn, pch)); + a.Perform(std::make_tuple(true, pn, pch)); EXPECT_EQ(1, n[0]); EXPECT_EQ(2, n[1]); EXPECT_EQ(3, n[2]); @@ -644,7 +642,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArray) { a = SetArrayArgument<2>(letters.begin(), letters.end()); std::fill_n(n, 4, 0); std::fill_n(ch, 4, '\0'); - a.Perform(make_tuple(true, pn, pch)); + a.Perform(std::make_tuple(true, pn, pch)); EXPECT_EQ(0, n[0]); EXPECT_EQ(0, n[1]); EXPECT_EQ(0, n[2]); @@ -663,7 +661,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithEmptyRange) { int n[4] = {}; int* pn = n; - a.Perform(make_tuple(true, pn)); + a.Perform(std::make_tuple(true, pn)); EXPECT_EQ(0, n[0]); EXPECT_EQ(0, n[1]); EXPECT_EQ(0, n[2]); @@ -679,7 +677,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithConvertibleType) { int codes[4] = { 111, 222, 333, 444 }; int* pcodes = codes; - a.Perform(make_tuple(true, pcodes)); + a.Perform(std::make_tuple(true, pcodes)); EXPECT_EQ(97, codes[0]); EXPECT_EQ(98, codes[1]); EXPECT_EQ(99, codes[2]); @@ -693,17 +691,17 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithIteratorArgument) { Action a = SetArrayArgument<1>(letters.begin(), letters.end()); std::string s; - a.Perform(make_tuple(true, back_inserter(s))); + a.Perform(std::make_tuple(true, back_inserter(s))); EXPECT_EQ(letters, s); } TEST(ReturnPointeeTest, Works) { int n = 42; const Action a = ReturnPointee(&n); - EXPECT_EQ(42, a.Perform(make_tuple())); + EXPECT_EQ(42, a.Perform(std::make_tuple())); n = 43; - EXPECT_EQ(43, a.Perform(make_tuple())); + EXPECT_EQ(43, a.Perform(std::make_tuple())); } } // namespace gmock_generated_actions_test diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index 925f9c2..4c0d648 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -110,18 +110,6 @@ set(gtest_build_include_dirs "${gtest_SOURCE_DIR}") include_directories(${gtest_build_include_dirs}) -# Summary of tuple support for Microsoft Visual Studio: -# Compiler version(MS) version(cmake) Support -# ---------- ----------- -------------- ----------------------------- -# <= VS 2010 <= 10 <= 1600 Use Google Tests's own tuple. -# VS 2012 11 1700 std::tr1::tuple + _VARIADIC_MAX=10 -# VS 2013 12 1800 std::tr1::tuple -# VS 2015 14 1900 std::tuple -# VS 2017 15 >= 1910 std::tuple -if (MSVC AND MSVC_VERSION EQUAL 1700) - add_definitions(/D _VARIADIC_MAX=10) -endif() - ######################################################################## # # Defines the gtest & gtest_main libraries. User tests should link @@ -265,21 +253,6 @@ $env:Path = \"$project_bin;$env:Path\" PROPERTIES COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") - if (NOT MSVC OR MSVC_VERSION LESS 1600) # 1600 is Visual Studio 2010. - # Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that - # conflict with our own definitions. Therefore using our own tuple does not - # work on those compilers. - cxx_library(gtest_main_use_own_tuple "${cxx_use_own_tuple}" - src/gtest-all.cc src/gtest_main.cc) - - cxx_test_with_flags(googletest-tuple-test "${cxx_use_own_tuple}" - gtest_main_use_own_tuple test/googletest-tuple-test.cc) - - cxx_test_with_flags(gtest_use_own_tuple_test "${cxx_use_own_tuple}" - gtest_main_use_own_tuple - test/googletest-param-test-test.cc test/googletest-param-test2-test.cc) - endif() - ############################################################ # Python tests. diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index d1883b2..9117406 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -148,7 +148,6 @@ macro(config_compiler_and_linker) "${CMAKE_CXX_FLAGS} ${cxx_base_flags} ${cxx_no_exception_flags}") set(cxx_default "${cxx_exception}") set(cxx_no_rtti "${cxx_default} ${cxx_no_rtti_flags}") - set(cxx_use_own_tuple "${cxx_default} -DGTEST_USE_OWN_TR1_TUPLE=1") # For building the gtest libraries. set(cxx_strict "${cxx_default} ${cxx_strict_flags}") diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h index 3e95e43..093e6e6 100644 --- a/googletest/include/gtest/gtest-param-test.h +++ b/googletest/include/gtest/gtest-param-test.h @@ -1215,7 +1215,6 @@ inline internal::ParamGenerator Bool() { return Values(false, true); } -# if GTEST_HAS_COMBINE // Combine() allows the user to combine two or more sequences to produce // values of a Cartesian product of those sequences' elements. // @@ -1224,12 +1223,10 @@ inline internal::ParamGenerator Bool() { // - returns a generator producing sequences with elements coming from // the Cartesian product of elements from the sequences generated by // gen1, gen2, ..., genN. The sequence elements will have a type of -// tuple where T1, T2, ..., TN are the types +// std::tuple where T1, T2, ..., TN are the types // of elements from sequences produces by gen1, gen2, ..., genN. // -// Combine can have up to 10 arguments. This number is currently limited -// by the maximum number of elements in the tuple implementation used by Google -// Test. +// Combine can have up to 10 arguments. // // Example: // @@ -1239,7 +1236,7 @@ inline internal::ParamGenerator Bool() { // // enum Color { BLACK, GRAY, WHITE }; // class AnimalTest -// : public testing::TestWithParam > {...}; +// : public testing::TestWithParam > {...}; // // TEST_P(AnimalTest, AnimalLooksNice) {...} // @@ -1251,10 +1248,10 @@ inline internal::ParamGenerator Bool() { // Boolean flags: // // class FlagDependentTest -// : public testing::TestWithParam > { +// : public testing::TestWithParam > { // virtual void SetUp() { // // Assigns external_flag_1 and external_flag_2 values from the tuple. -// tie(external_flag_1, external_flag_2) = GetParam(); +// std::tie(external_flag_1, external_flag_2) = GetParam(); // } // }; // @@ -1367,7 +1364,6 @@ internal::CartesianProductHolder10( g1, g2, g3, g4, g5, g6, g7, g8, g9, g10); } -# endif // GTEST_HAS_COMBINE # define TEST_P(test_case_name, test_name) \ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \ diff --git a/googletest/include/gtest/gtest-param-test.h.pump b/googletest/include/gtest/gtest-param-test.h.pump index 274f2b3..63c31c2 100644 --- a/googletest/include/gtest/gtest-param-test.h.pump +++ b/googletest/include/gtest/gtest-param-test.h.pump @@ -372,7 +372,6 @@ inline internal::ParamGenerator Bool() { return Values(false, true); } -# if GTEST_HAS_COMBINE // Combine() allows the user to combine two or more sequences to produce // values of a Cartesian product of those sequences' elements. // @@ -381,12 +380,10 @@ inline internal::ParamGenerator Bool() { // - returns a generator producing sequences with elements coming from // the Cartesian product of elements from the sequences generated by // gen1, gen2, ..., genN. The sequence elements will have a type of -// tuple where T1, T2, ..., TN are the types +// std::tuple where T1, T2, ..., TN are the types // of elements from sequences produces by gen1, gen2, ..., genN. // -// Combine can have up to $maxtuple arguments. This number is currently limited -// by the maximum number of elements in the tuple implementation used by Google -// Test. +// Combine can have up to $maxtuple arguments. // // Example: // @@ -396,7 +393,7 @@ inline internal::ParamGenerator Bool() { // // enum Color { BLACK, GRAY, WHITE }; // class AnimalTest -// : public testing::TestWithParam > {...}; +// : public testing::TestWithParam > {...}; // // TEST_P(AnimalTest, AnimalLooksNice) {...} // @@ -408,10 +405,10 @@ inline internal::ParamGenerator Bool() { // Boolean flags: // // class FlagDependentTest -// : public testing::TestWithParam > { +// : public testing::TestWithParam > { // virtual void SetUp() { // // Assigns external_flag_1 and external_flag_2 values from the tuple. -// tie(external_flag_1, external_flag_2) = GetParam(); +// std::tie(external_flag_1, external_flag_2) = GetParam(); // } // }; // @@ -433,7 +430,6 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine( } ]] -# endif // GTEST_HAS_COMBINE # define TEST_P(test_case_name, test_name) \ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \ diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index fad4e69..5467469 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -104,14 +104,12 @@ #include // NOLINT #include #include +#include +#include #include #include -#include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-internal.h" - -#if GTEST_HAS_STD_TUPLE_ -# include -#endif +#include "gtest/internal/gtest-port.h" #if GTEST_HAS_ABSL #include "absl/strings/string_view.h" @@ -643,95 +641,31 @@ void PrintTo(std::reference_wrapper ref, ::std::ostream* os) { PrintTo(ref.get(), os); } -#if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ // Helper function for printing a tuple. T must be instantiated with // a tuple type. template -void PrintTupleTo(const T& t, ::std::ostream* os); -#endif // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ - -#if GTEST_HAS_TR1_TUPLE -// Overload for ::std::tr1::tuple. Needed for printing function arguments, -// which are packed as tuples. - -// Overloaded PrintTo() for tuples of various arities. We support -// tuples of up-to 10 fields. The following implementation works -// regardless of whether tr1::tuple is implemented using the -// non-standard variadic template feature or not. - -inline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) { - PrintTupleTo(t, os); -} - -template -void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { - PrintTupleTo(t, os); -} - -template -void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { - PrintTupleTo(t, os); -} - -template -void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { - PrintTupleTo(t, os); -} - -template -void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { - PrintTupleTo(t, os); -} - -template -void PrintTo(const ::std::tr1::tuple& t, - ::std::ostream* os) { - PrintTupleTo(t, os); -} - -template -void PrintTo(const ::std::tr1::tuple& t, - ::std::ostream* os) { - PrintTupleTo(t, os); -} - -template -void PrintTo(const ::std::tr1::tuple& t, - ::std::ostream* os) { - PrintTupleTo(t, os); -} - -template -void PrintTo(const ::std::tr1::tuple& t, - ::std::ostream* os) { - PrintTupleTo(t, os); -} - -template -void PrintTo(const ::std::tr1::tuple& t, - ::std::ostream* os) { - PrintTupleTo(t, os); -} - -template -void PrintTo( - const ::std::tr1::tuple& t, - ::std::ostream* os) { - PrintTupleTo(t, os); +void PrintTupleTo(const T&, std::integral_constant, + ::std::ostream*) {} + +template +void PrintTupleTo(const T& t, std::integral_constant, + ::std::ostream* os) { + PrintTupleTo(t, std::integral_constant(), os); + GTEST_INTENTIONAL_CONST_COND_PUSH_() + if (I > 1) { + GTEST_INTENTIONAL_CONST_COND_POP_() + *os << ", "; + } + UniversalPrinter::type>::Print( + std::get(t), os); } -#endif // GTEST_HAS_TR1_TUPLE -#if GTEST_HAS_STD_TUPLE_ template void PrintTo(const ::std::tuple& t, ::std::ostream* os) { - PrintTupleTo(t, os); + *os << "("; + PrintTupleTo(t, std::integral_constant(), os); + *os << ")"; } -#endif // GTEST_HAS_STD_TUPLE_ // Overload for std::pair. template @@ -962,109 +896,20 @@ void UniversalPrint(const T& value, ::std::ostream* os) { typedef ::std::vector< ::std::string> Strings; -// TuplePolicy must provide: -// - tuple_size -// size of tuple TupleT. -// - get(const TupleT& t) -// static function extracting element I of tuple TupleT. -// - tuple_element::type -// type of element I of tuple TupleT. -template -struct TuplePolicy; - -#if GTEST_HAS_TR1_TUPLE -template -struct TuplePolicy { - typedef TupleT Tuple; - static const size_t tuple_size = ::std::tr1::tuple_size::value; - - template - struct tuple_element : ::std::tr1::tuple_element(I), Tuple> { - }; - - template - static typename AddReference(I), Tuple>::type>::type - get(const Tuple& tuple) { - return ::std::tr1::get(tuple); - } -}; -template -const size_t TuplePolicy::tuple_size; -#endif // GTEST_HAS_TR1_TUPLE - -#if GTEST_HAS_STD_TUPLE_ -template -struct TuplePolicy< ::std::tuple > { - typedef ::std::tuple Tuple; - static const size_t tuple_size = ::std::tuple_size::value; - - template - struct tuple_element : ::std::tuple_element {}; - - template - static const typename ::std::tuple_element::type& get( - const Tuple& tuple) { - return ::std::get(tuple); - } -}; -template -const size_t TuplePolicy< ::std::tuple >::tuple_size; -#endif // GTEST_HAS_STD_TUPLE_ - -#if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ -// This helper template allows PrintTo() for tuples and -// UniversalTersePrintTupleFieldsToStrings() to be defined by -// induction on the number of tuple fields. The idea is that -// TuplePrefixPrinter::PrintPrefixTo(t, os) prints the first N -// fields in tuple t, and can be defined in terms of -// TuplePrefixPrinter. -// -// The inductive case. -template -struct TuplePrefixPrinter { - // Prints the first N fields of a tuple. - template - static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) { - TuplePrefixPrinter::PrintPrefixTo(t, os); - GTEST_INTENTIONAL_CONST_COND_PUSH_() - if (N > 1) { - GTEST_INTENTIONAL_CONST_COND_POP_() - *os << ", "; - } - UniversalPrinter< - typename TuplePolicy::template tuple_element::type> - ::Print(TuplePolicy::template get(t), os); - } - // Tersely prints the first N fields of a tuple to a string vector, // one element for each field. - template - static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) { - TuplePrefixPrinter::TersePrintPrefixToStrings(t, strings); - ::std::stringstream ss; - UniversalTersePrint(TuplePolicy::template get(t), &ss); - strings->push_back(ss.str()); - } -}; - -// Base case. -template <> -struct TuplePrefixPrinter<0> { - template - static void PrintPrefixTo(const Tuple&, ::std::ostream*) {} - - template - static void TersePrintPrefixToStrings(const Tuple&, Strings*) {} -}; - -// Helper function for printing a tuple. -// Tuple must be either std::tr1::tuple or std::tuple type. template -void PrintTupleTo(const Tuple& t, ::std::ostream* os) { - *os << "("; - TuplePrefixPrinter::tuple_size>::PrintPrefixTo(t, os); - *os << ")"; +void TersePrintPrefixToStrings(const Tuple&, std::integral_constant, + Strings*) {} +template +void TersePrintPrefixToStrings(const Tuple& t, + std::integral_constant, + Strings* strings) { + TersePrintPrefixToStrings(t, std::integral_constant(), + strings); + ::std::stringstream ss; + UniversalTersePrint(std::get(t), &ss); + strings->push_back(ss.str()); } // Prints the fields of a tuple tersely to a string vector, one @@ -1073,11 +918,11 @@ void PrintTupleTo(const Tuple& t, ::std::ostream* os) { template Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) { Strings result; - TuplePrefixPrinter::tuple_size>:: - TersePrintPrefixToStrings(value, &result); + TersePrintPrefixToStrings( + value, std::integral_constant::value>(), + &result); return result; } -#endif // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ } // namespace internal diff --git a/googletest/include/gtest/internal/gtest-param-util-generated.h b/googletest/include/gtest/internal/gtest-param-util-generated.h index 4fac8c0..d9d20c4 100644 --- a/googletest/include/gtest/internal/gtest-param-util-generated.h +++ b/googletest/include/gtest/internal/gtest-param-util-generated.h @@ -3560,7 +3560,6 @@ class ValueArray50 { const T50 v50_; }; -# if GTEST_HAS_COMBINE // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Generates values from the Cartesian product of values produced @@ -3568,9 +3567,9 @@ class ValueArray50 { // template class CartesianProductGenerator2 - : public ParamGeneratorInterface< ::testing::tuple > { + : public ParamGeneratorInterface< ::std::tuple > { public: - typedef ::testing::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator2(const ParamGenerator& g1, const ParamGenerator& g2) @@ -3683,9 +3682,9 @@ class CartesianProductGenerator2 template class CartesianProductGenerator3 - : public ParamGeneratorInterface< ::testing::tuple > { + : public ParamGeneratorInterface< ::std::tuple > { public: - typedef ::testing::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator3(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3) @@ -3815,9 +3814,9 @@ class CartesianProductGenerator3 template class CartesianProductGenerator4 - : public ParamGeneratorInterface< ::testing::tuple > { + : public ParamGeneratorInterface< ::std::tuple > { public: - typedef ::testing::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator4(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, @@ -3966,9 +3965,9 @@ class CartesianProductGenerator4 template class CartesianProductGenerator5 - : public ParamGeneratorInterface< ::testing::tuple > { + : public ParamGeneratorInterface< ::std::tuple > { public: - typedef ::testing::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator5(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, @@ -4134,10 +4133,9 @@ class CartesianProductGenerator5 template class CartesianProductGenerator6 - : public ParamGeneratorInterface< ::testing::tuple > { + : public ParamGeneratorInterface< ::std::tuple > { public: - typedef ::testing::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator6(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, @@ -4320,10 +4318,10 @@ class CartesianProductGenerator6 template class CartesianProductGenerator7 - : public ParamGeneratorInterface< ::testing::tuple > { public: - typedef ::testing::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator7(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, @@ -4523,10 +4521,10 @@ class CartesianProductGenerator7 template class CartesianProductGenerator8 - : public ParamGeneratorInterface< ::testing::tuple > { + : public ParamGeneratorInterface< ::std::tuple > { public: - typedef ::testing::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator8(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, @@ -4745,10 +4743,10 @@ class CartesianProductGenerator8 template class CartesianProductGenerator9 - : public ParamGeneratorInterface< ::testing::tuple > { + : public ParamGeneratorInterface< ::std::tuple > { public: - typedef ::testing::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator9(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, @@ -4984,10 +4982,10 @@ class CartesianProductGenerator9 template class CartesianProductGenerator10 - : public ParamGeneratorInterface< ::testing::tuple > { + : public ParamGeneratorInterface< ::std::tuple > { public: - typedef ::testing::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator10(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, @@ -5249,8 +5247,8 @@ class CartesianProductHolder2 { CartesianProductHolder2(const Generator1& g1, const Generator2& g2) : g1_(g1), g2_(g2) {} template - operator ParamGenerator< ::testing::tuple >() const { - return ParamGenerator< ::testing::tuple >( + operator ParamGenerator< ::std::tuple >() const { + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator2( static_cast >(g1_), static_cast >(g2_))); @@ -5271,8 +5269,8 @@ CartesianProductHolder3(const Generator1& g1, const Generator2& g2, const Generator3& g3) : g1_(g1), g2_(g2), g3_(g3) {} template - operator ParamGenerator< ::testing::tuple >() const { - return ParamGenerator< ::testing::tuple >( + operator ParamGenerator< ::std::tuple >() const { + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator3( static_cast >(g1_), static_cast >(g2_), @@ -5296,8 +5294,8 @@ CartesianProductHolder4(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4) : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {} template - operator ParamGenerator< ::testing::tuple >() const { - return ParamGenerator< ::testing::tuple >( + operator ParamGenerator< ::std::tuple >() const { + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator4( static_cast >(g1_), static_cast >(g2_), @@ -5323,8 +5321,8 @@ CartesianProductHolder5(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {} template - operator ParamGenerator< ::testing::tuple >() const { - return ParamGenerator< ::testing::tuple >( + operator ParamGenerator< ::std::tuple >() const { + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator5( static_cast >(g1_), static_cast >(g2_), @@ -5354,8 +5352,8 @@ CartesianProductHolder6(const Generator1& g1, const Generator2& g2, : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {} template - operator ParamGenerator< ::testing::tuple >() const { - return ParamGenerator< ::testing::tuple >( + operator ParamGenerator< ::std::tuple >() const { + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator6( static_cast >(g1_), static_cast >(g2_), @@ -5387,9 +5385,8 @@ CartesianProductHolder7(const Generator1& g1, const Generator2& g2, : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {} template - operator ParamGenerator< ::testing::tuple >() const { - return ParamGenerator< ::testing::tuple >( + operator ParamGenerator< ::std::tuple >() const { + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator7( static_cast >(g1_), static_cast >(g2_), @@ -5425,9 +5422,9 @@ CartesianProductHolder8(const Generator1& g1, const Generator2& g2, g8_(g8) {} template - operator ParamGenerator< ::testing::tuple >() const { - return ParamGenerator< ::testing::tuple >( + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator8( static_cast >(g1_), static_cast >(g2_), @@ -5466,10 +5463,9 @@ CartesianProductHolder9(const Generator1& g1, const Generator2& g2, g9_(g9) {} template - operator ParamGenerator< ::testing::tuple >() const { - return ParamGenerator< ::testing::tuple >( + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator9( static_cast >(g1_), static_cast >(g2_), @@ -5510,9 +5506,9 @@ CartesianProductHolder10(const Generator1& g1, const Generator2& g2, g9_(g9), g10_(g10) {} template - operator ParamGenerator< ::testing::tuple >() const { - return ParamGenerator< ::testing::tuple >( new CartesianProductGenerator10( @@ -5544,8 +5540,6 @@ CartesianProductHolder10(const Generator1& g1, const Generator2& g2, const Generator10 g10_; }; // class CartesianProductHolder10 -# endif // GTEST_HAS_COMBINE - } // namespace internal } // namespace testing diff --git a/googletest/include/gtest/internal/gtest-param-util-generated.h.pump b/googletest/include/gtest/internal/gtest-param-util-generated.h.pump index 30dffe4..5f88260 100644 --- a/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +++ b/googletest/include/gtest/internal/gtest-param-util-generated.h.pump @@ -98,7 +98,6 @@ $for j [[ ]] -# if GTEST_HAS_COMBINE // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Generates values from the Cartesian product of values produced @@ -111,9 +110,9 @@ $range k 2..i template <$for j, [[typename T$j]]> class CartesianProductGenerator$i - : public ParamGeneratorInterface< ::testing::tuple<$for j, [[T$j]]> > { + : public ParamGeneratorInterface< ::std::tuple<$for j, [[T$j]]> > { public: - typedef ::testing::tuple<$for j, [[T$j]]> ParamType; + typedef ::std::tuple<$for j, [[T$j]]> ParamType; CartesianProductGenerator$i($for j, [[const ParamGenerator& g$j]]) : $for j, [[g$(j)_(g$j)]] {} @@ -252,8 +251,8 @@ class CartesianProductHolder$i { CartesianProductHolder$i($for j, [[const Generator$j& g$j]]) : $for j, [[g$(j)_(g$j)]] {} template <$for j, [[typename T$j]]> - operator ParamGenerator< ::testing::tuple<$for j, [[T$j]]> >() const { - return ParamGenerator< ::testing::tuple<$for j, [[T$j]]> >( + operator ParamGenerator< ::std::tuple<$for j, [[T$j]]> >() const { + return ParamGenerator< ::std::tuple<$for j, [[T$j]]> >( new CartesianProductGenerator$i<$for j, [[T$j]]>( $for j,[[ @@ -274,8 +273,6 @@ $for j [[ ]] -# endif // GTEST_HAS_COMBINE - } // namespace internal } // namespace testing diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 1e40811..b0008b0 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -85,8 +85,6 @@ // GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that // std::wstring does/doesn't work (Google Test can // be used where std::wstring is unavailable). -// GTEST_HAS_TR1_TUPLE - Define it to 1/0 to indicate tr1::tuple -// is/isn't available. // GTEST_HAS_SEH - Define it to 1/0 to indicate whether the // compiler supports Microsoft's "Structured // Exception Handling". @@ -94,10 +92,6 @@ // - Define it to 1/0 to indicate whether the // platform supports I/O stream redirection using // dup() and dup2(). -// GTEST_USE_OWN_TR1_TUPLE - Define it to 1/0 to indicate whether Google -// Test's own tr1 tuple implementation should be -// used. Unused when the user sets -// GTEST_HAS_TR1_TUPLE to 0. // GTEST_LANG_CXX11 - Define it to 1/0 to indicate that Google Test // is building in C++11/C++98 mode. // GTEST_LINKED_AS_SHARED_LIBRARY @@ -172,8 +166,6 @@ // EXPECT_DEATH(DoSomethingDeadly()); // #endif // -// GTEST_HAS_COMBINE - the Combine() function (for value-parameterized -// tests) // GTEST_HAS_DEATH_TEST - death tests // GTEST_HAS_TYPED_TEST - typed tests // GTEST_HAS_TYPED_TEST_P - type-parameterized tests @@ -280,10 +272,11 @@ // Brings in the definition of HAS_GLOBAL_STRING. This must be done // BEFORE we test HAS_GLOBAL_STRING. -#include // NOLINT +#include // NOLINT #include // NOLINT -#include // NOLINT -#include // NOLINT +#include // NOLINT +#include // NOLINT +#include #include #include // NOLINT @@ -381,31 +374,6 @@ # define GTEST_HAS_UNORDERED_SET_ 1 #endif -// C++11 specifies that provides std::tuple. -// Some platforms still might not have it, however. -#if GTEST_LANG_CXX11 -# define GTEST_HAS_STD_TUPLE_ 1 -# if defined(__clang__) -// Inspired by -// https://clang.llvm.org/docs/LanguageExtensions.html#include-file-checking-macros -# if defined(__has_include) && !__has_include() -# undef GTEST_HAS_STD_TUPLE_ -# endif -# elif defined(_MSC_VER) -// Inspired by boost/config/stdlib/dinkumware.hpp -# if defined(_CPPLIB_VER) && _CPPLIB_VER < 520 -# undef GTEST_HAS_STD_TUPLE_ -# endif -# elif defined(__GLIBCXX__) -// Inspired by boost/config/stdlib/libstdcpp3.hpp, -// http://gcc.gnu.org/gcc-4.2/changes.html and -// https://web.archive.org/web/20140227044429/gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt01ch01.html#manual.intro.status.standard.200x -# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2) -# undef GTEST_HAS_STD_TUPLE_ -# endif -# endif -#endif - // Brings in definitions for functions used in the testing::internal::posix // namespace (read, write, close, chdir, isatty, stat). We do not currently // use them on Windows Mobile. @@ -647,127 +615,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; # endif // _MSC_VER #endif // !defined(GTEST_HAS_HASH_MAP_) -// Determines whether Google Test can use tr1/tuple. You can define -// this macro to 0 to prevent Google Test from using tuple (any -// feature depending on tuple with be disabled in this mode). -#ifndef GTEST_HAS_TR1_TUPLE -# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) -// STLport, provided with the Android NDK, has neither or . -# define GTEST_HAS_TR1_TUPLE 0 -# elif defined(_MSC_VER) && (_MSC_VER >= 1910) -// Prevent `warning C4996: 'std::tr1': warning STL4002: -// The non-Standard std::tr1 namespace and TR1-only machinery -// are deprecated and will be REMOVED.` -# define GTEST_HAS_TR1_TUPLE 0 -# elif GTEST_LANG_CXX11 && defined(_LIBCPP_VERSION) -// libc++ doesn't support TR1. -# define GTEST_HAS_TR1_TUPLE 0 -# else -// The user didn't tell us not to do it, so we assume it's OK. -# define GTEST_HAS_TR1_TUPLE 1 -# endif -#endif // GTEST_HAS_TR1_TUPLE - -// Determines whether Google Test's own tr1 tuple implementation -// should be used. -#ifndef GTEST_USE_OWN_TR1_TUPLE -// We use our own tuple implementation on Symbian. -# if GTEST_OS_SYMBIAN -# define GTEST_USE_OWN_TR1_TUPLE 1 -# else -// The user didn't tell us, so we need to figure it out. - -// We use our own TR1 tuple if we aren't sure the user has an -// implementation of it already. At this time, libstdc++ 4.0.0+ and -// MSVC 2010 are the only mainstream standard libraries that come -// with a TR1 tuple implementation. NVIDIA's CUDA NVCC compiler -// pretends to be GCC by defining __GNUC__ and friends, but cannot -// compile GCC's tuple implementation. MSVC 2008 (9.0) provides TR1 -// tuple in a 323 MB Feature Pack download, which we cannot assume the -// user has. QNX's QCC compiler is a modified GCC but it doesn't -// support TR1 tuple. libc++ only provides std::tuple, in C++11 mode, -// and it can be used with some compilers that define __GNUC__. -# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \ - && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) \ - || (_MSC_VER >= 1600 && _MSC_VER < 1900) -# define GTEST_ENV_HAS_TR1_TUPLE_ 1 -# endif - -// C++11 specifies that provides std::tuple. Use that if gtest is used -// in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6 -// can build with clang but need to use gcc4.2's libstdc++). -# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325) -# define GTEST_ENV_HAS_STD_TUPLE_ 1 -# endif - -# if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_ -# define GTEST_USE_OWN_TR1_TUPLE 0 -# else -# define GTEST_USE_OWN_TR1_TUPLE 1 -# endif -# endif // GTEST_OS_SYMBIAN -#endif // GTEST_USE_OWN_TR1_TUPLE - -// To avoid conditional compilation we make it gtest-port.h's responsibility -// to #include the header implementing tuple. -#if GTEST_HAS_STD_TUPLE_ -# include // IWYU pragma: export -# define GTEST_TUPLE_NAMESPACE_ ::std -#endif // GTEST_HAS_STD_TUPLE_ - -// We include tr1::tuple even if std::tuple is available to define printers for -// them. -#if GTEST_HAS_TR1_TUPLE -# ifndef GTEST_TUPLE_NAMESPACE_ -# define GTEST_TUPLE_NAMESPACE_ ::std::tr1 -# endif // GTEST_TUPLE_NAMESPACE_ - -# if GTEST_USE_OWN_TR1_TUPLE -# include "third_party/googletest/googletest/include/gtest/internal/gtest-tuple.h" // IWYU pragma: export // NOLINT -# elif GTEST_OS_SYMBIAN - -// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to -// use STLport's tuple implementation, which unfortunately doesn't -// work as the copy of STLport distributed with Symbian is incomplete. -// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to -// use its own tuple implementation. -# ifdef BOOST_HAS_TR1_TUPLE -# undef BOOST_HAS_TR1_TUPLE -# endif // BOOST_HAS_TR1_TUPLE - -// This prevents , which defines -// BOOST_HAS_TR1_TUPLE, from being #included by Boost's . -# define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED -# include // IWYU pragma: export // NOLINT - -# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000) -// GCC 4.0+ implements tr1/tuple in the header. This does -// not conform to the TR1 spec, which requires the header to be . - -# if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 -// Until version 4.3.2, gcc has a bug that causes , -// which is #included by , to not compile when RTTI is -// disabled. _TR1_FUNCTIONAL is the header guard for -// . Hence the following #define is used to prevent -// from being included. -# define _TR1_FUNCTIONAL 1 -# include -# undef _TR1_FUNCTIONAL // Allows the user to #include - // if they choose to. -# else -# include // NOLINT -# endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 - -// VS 2010 now has tr1 support. -# elif _MSC_VER >= 1600 -# include // IWYU pragma: export // NOLINT - -# else // GTEST_USE_OWN_TR1_TUPLE -# include // IWYU pragma: export // NOLINT -# endif // GTEST_USE_OWN_TR1_TUPLE - -#endif // GTEST_HAS_TR1_TUPLE - // Determines whether clone(2) is supported. // Usually it will only be available on Linux, excluding // Linux on the Itanium architecture. @@ -832,14 +679,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; # define GTEST_HAS_TYPED_TEST_P 1 #endif -// Determines whether to support Combine(). This only makes sense when -// value-parameterized tests are enabled. The implementation doesn't -// work on Sun Studio since it doesn't understand templated conversion -// operators. -#if (GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_) && !defined(__SUNPRO_CC) -# define GTEST_HAS_COMBINE 1 -#endif - // Determines whether the system compiler uses UTF-16 for encoding wide strings. #define GTEST_WIDE_STRING_USES_UTF16_ \ (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX) @@ -1049,16 +888,13 @@ namespace testing { class Message; -#if defined(GTEST_TUPLE_NAMESPACE_) -// Import tuple and friends into the ::testing namespace. -// It is part of our interface, having them in ::testing allows us to change -// their types as needed. -using GTEST_TUPLE_NAMESPACE_::get; -using GTEST_TUPLE_NAMESPACE_::make_tuple; -using GTEST_TUPLE_NAMESPACE_::tuple; -using GTEST_TUPLE_NAMESPACE_::tuple_size; -using GTEST_TUPLE_NAMESPACE_::tuple_element; -#endif // defined(GTEST_TUPLE_NAMESPACE_) +// Legacy imports for backwards compatibility. +// New code should use std:: names directly. +using std::get; +using std::make_tuple; +using std::tuple; +using std::tuple_element; +using std::tuple_size; namespace internal { diff --git a/googletest/include/gtest/internal/gtest-tuple.h b/googletest/include/gtest/internal/gtest-tuple.h deleted file mode 100644 index 78a3a6a..0000000 --- a/googletest/include/gtest/internal/gtest-tuple.h +++ /dev/null @@ -1,1021 +0,0 @@ -// This file was GENERATED by command: -// pump.py gtest-tuple.h.pump -// DO NOT EDIT BY HAND!!! - -// Copyright 2009 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. - - -// Implements a subset of TR1 tuple needed by Google Test and Google Mock. - -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ - -#include // For ::std::pair. - -// The compiler used in Symbian has a bug that prevents us from declaring the -// tuple template as a friend (it complains that tuple is redefined). This -// bypasses the bug by declaring the members that should otherwise be -// private as public. -// Sun Studio versions < 12 also have the above bug. -#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) -# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public: -#else -# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \ - template friend class tuple; \ - private: -#endif - -// Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that conflict -// with our own definitions. Therefore using our own tuple does not work on -// those compilers. -#if defined(_MSC_VER) && _MSC_VER >= 1600 /* 1600 is Visual Studio 2010 */ -# error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \ -GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers." -#endif - -// GTEST_n_TUPLE_(T) is the type of an n-tuple. -#define GTEST_0_TUPLE_(T) tuple<> -#define GTEST_1_TUPLE_(T) tuple -#define GTEST_2_TUPLE_(T) tuple -#define GTEST_3_TUPLE_(T) tuple -#define GTEST_4_TUPLE_(T) tuple -#define GTEST_5_TUPLE_(T) tuple -#define GTEST_6_TUPLE_(T) tuple -#define GTEST_7_TUPLE_(T) tuple -#define GTEST_8_TUPLE_(T) tuple -#define GTEST_9_TUPLE_(T) tuple -#define GTEST_10_TUPLE_(T) tuple - -// GTEST_n_TYPENAMES_(T) declares a list of n typenames. -#define GTEST_0_TYPENAMES_(T) -#define GTEST_1_TYPENAMES_(T) typename T##0 -#define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1 -#define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2 -#define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ - typename T##3 -#define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ - typename T##3, typename T##4 -#define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ - typename T##3, typename T##4, typename T##5 -#define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ - typename T##3, typename T##4, typename T##5, typename T##6 -#define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ - typename T##3, typename T##4, typename T##5, typename T##6, typename T##7 -#define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ - typename T##3, typename T##4, typename T##5, typename T##6, \ - typename T##7, typename T##8 -#define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ - typename T##3, typename T##4, typename T##5, typename T##6, \ - typename T##7, typename T##8, typename T##9 - -// In theory, defining stuff in the ::std namespace is undefined -// behavior. We can do this as we are playing the role of a standard -// library vendor. -namespace std { -namespace tr1 { - -template -class tuple; - -// Anything in namespace gtest_internal is Google Test's INTERNAL -// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code. -namespace gtest_internal { - -// ByRef::type is T if T is a reference; otherwise it's const T&. -template -struct ByRef { typedef const T& type; }; // NOLINT -template -struct ByRef { typedef T& type; }; // NOLINT - -// A handy wrapper for ByRef. -#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef::type - -// AddRef::type is T if T is a reference; otherwise it's T&. This -// is the same as tr1::add_reference::type. -template -struct AddRef { typedef T& type; }; // NOLINT -template -struct AddRef { typedef T& type; }; // NOLINT - -// A handy wrapper for AddRef. -#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef::type - -// A helper for implementing get(). -template class Get; - -// A helper for implementing tuple_element. kIndexValid is true -// iff k < the number of fields in tuple type T. -template -struct TupleElement; - -template -struct TupleElement { - typedef T0 type; -}; - -template -struct TupleElement { - typedef T1 type; -}; - -template -struct TupleElement { - typedef T2 type; -}; - -template -struct TupleElement { - typedef T3 type; -}; - -template -struct TupleElement { - typedef T4 type; -}; - -template -struct TupleElement { - typedef T5 type; -}; - -template -struct TupleElement { - typedef T6 type; -}; - -template -struct TupleElement { - typedef T7 type; -}; - -template -struct TupleElement { - typedef T8 type; -}; - -template -struct TupleElement { - typedef T9 type; -}; - -} // namespace gtest_internal - -template <> -class tuple<> { - public: - tuple() {} - tuple(const tuple& /* t */) {} - tuple& operator=(const tuple& /* t */) { return *this; } -}; - -template -class GTEST_1_TUPLE_(T) { - public: - template friend class gtest_internal::Get; - - tuple() : f0_() {} - - explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {} - - tuple(const tuple& t) : f0_(t.f0_) {} - - template - tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {} - - tuple& operator=(const tuple& t) { return CopyFrom(t); } - - template - tuple& operator=(const GTEST_1_TUPLE_(U)& t) { - return CopyFrom(t); - } - - GTEST_DECLARE_TUPLE_AS_FRIEND_ - - template - tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) { - f0_ = t.f0_; - return *this; - } - - T0 f0_; -}; - -template -class GTEST_2_TUPLE_(T) { - public: - template friend class gtest_internal::Get; - - tuple() : f0_(), f1_() {} - - explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0), - f1_(f1) {} - - tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {} - - template - tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {} - template - tuple(const ::std::pair& p) : f0_(p.first), f1_(p.second) {} - - tuple& operator=(const tuple& t) { return CopyFrom(t); } - - template - tuple& operator=(const GTEST_2_TUPLE_(U)& t) { - return CopyFrom(t); - } - template - tuple& operator=(const ::std::pair& p) { - f0_ = p.first; - f1_ = p.second; - return *this; - } - - GTEST_DECLARE_TUPLE_AS_FRIEND_ - - template - tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) { - f0_ = t.f0_; - f1_ = t.f1_; - return *this; - } - - T0 f0_; - T1 f1_; -}; - -template -class GTEST_3_TUPLE_(T) { - public: - template friend class gtest_internal::Get; - - tuple() : f0_(), f1_(), f2_() {} - - explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, - GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {} - - tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {} - - template - tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {} - - tuple& operator=(const tuple& t) { return CopyFrom(t); } - - template - tuple& operator=(const GTEST_3_TUPLE_(U)& t) { - return CopyFrom(t); - } - - GTEST_DECLARE_TUPLE_AS_FRIEND_ - - template - tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) { - f0_ = t.f0_; - f1_ = t.f1_; - f2_ = t.f2_; - return *this; - } - - T0 f0_; - T1 f1_; - T2 f2_; -}; - -template -class GTEST_4_TUPLE_(T) { - public: - template friend class gtest_internal::Get; - - tuple() : f0_(), f1_(), f2_(), f3_() {} - - explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, - GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2), - f3_(f3) {} - - tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {} - - template - tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), - f3_(t.f3_) {} - - tuple& operator=(const tuple& t) { return CopyFrom(t); } - - template - tuple& operator=(const GTEST_4_TUPLE_(U)& t) { - return CopyFrom(t); - } - - GTEST_DECLARE_TUPLE_AS_FRIEND_ - - template - tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) { - f0_ = t.f0_; - f1_ = t.f1_; - f2_ = t.f2_; - f3_ = t.f3_; - return *this; - } - - T0 f0_; - T1 f1_; - T2 f2_; - T3 f3_; -}; - -template -class GTEST_5_TUPLE_(T) { - public: - template friend class gtest_internal::Get; - - tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {} - - explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, - GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, - GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {} - - tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), - f4_(t.f4_) {} - - template - tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), - f3_(t.f3_), f4_(t.f4_) {} - - tuple& operator=(const tuple& t) { return CopyFrom(t); } - - template - tuple& operator=(const GTEST_5_TUPLE_(U)& t) { - return CopyFrom(t); - } - - GTEST_DECLARE_TUPLE_AS_FRIEND_ - - template - tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) { - f0_ = t.f0_; - f1_ = t.f1_; - f2_ = t.f2_; - f3_ = t.f3_; - f4_ = t.f4_; - return *this; - } - - T0 f0_; - T1 f1_; - T2 f2_; - T3 f3_; - T4 f4_; -}; - -template -class GTEST_6_TUPLE_(T) { - public: - template friend class gtest_internal::Get; - - tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {} - - explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, - GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, - GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), - f5_(f5) {} - - tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), - f4_(t.f4_), f5_(t.f5_) {} - - template - tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), - f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {} - - tuple& operator=(const tuple& t) { return CopyFrom(t); } - - template - tuple& operator=(const GTEST_6_TUPLE_(U)& t) { - return CopyFrom(t); - } - - GTEST_DECLARE_TUPLE_AS_FRIEND_ - - template - tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) { - f0_ = t.f0_; - f1_ = t.f1_; - f2_ = t.f2_; - f3_ = t.f3_; - f4_ = t.f4_; - f5_ = t.f5_; - return *this; - } - - T0 f0_; - T1 f1_; - T2 f2_; - T3 f3_; - T4 f4_; - T5 f5_; -}; - -template -class GTEST_7_TUPLE_(T) { - public: - template friend class gtest_internal::Get; - - tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {} - - explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, - GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, - GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2), - f3_(f3), f4_(f4), f5_(f5), f6_(f6) {} - - tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), - f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {} - - template - tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), - f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {} - - tuple& operator=(const tuple& t) { return CopyFrom(t); } - - template - tuple& operator=(const GTEST_7_TUPLE_(U)& t) { - return CopyFrom(t); - } - - GTEST_DECLARE_TUPLE_AS_FRIEND_ - - template - tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) { - f0_ = t.f0_; - f1_ = t.f1_; - f2_ = t.f2_; - f3_ = t.f3_; - f4_ = t.f4_; - f5_ = t.f5_; - f6_ = t.f6_; - return *this; - } - - T0 f0_; - T1 f1_; - T2 f2_; - T3 f3_; - T4 f4_; - T5 f5_; - T6 f6_; -}; - -template -class GTEST_8_TUPLE_(T) { - public: - template friend class gtest_internal::Get; - - tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {} - - explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, - GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, - GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, - GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), - f5_(f5), f6_(f6), f7_(f7) {} - - tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), - f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {} - - template - tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), - f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {} - - tuple& operator=(const tuple& t) { return CopyFrom(t); } - - template - tuple& operator=(const GTEST_8_TUPLE_(U)& t) { - return CopyFrom(t); - } - - GTEST_DECLARE_TUPLE_AS_FRIEND_ - - template - tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) { - f0_ = t.f0_; - f1_ = t.f1_; - f2_ = t.f2_; - f3_ = t.f3_; - f4_ = t.f4_; - f5_ = t.f5_; - f6_ = t.f6_; - f7_ = t.f7_; - return *this; - } - - T0 f0_; - T1 f1_; - T2 f2_; - T3 f3_; - T4 f4_; - T5 f5_; - T6 f6_; - T7 f7_; -}; - -template -class GTEST_9_TUPLE_(T) { - public: - template friend class gtest_internal::Get; - - tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {} - - explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, - GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, - GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7, - GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), - f5_(f5), f6_(f6), f7_(f7), f8_(f8) {} - - tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), - f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {} - - template - tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), - f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {} - - tuple& operator=(const tuple& t) { return CopyFrom(t); } - - template - tuple& operator=(const GTEST_9_TUPLE_(U)& t) { - return CopyFrom(t); - } - - GTEST_DECLARE_TUPLE_AS_FRIEND_ - - template - tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) { - f0_ = t.f0_; - f1_ = t.f1_; - f2_ = t.f2_; - f3_ = t.f3_; - f4_ = t.f4_; - f5_ = t.f5_; - f6_ = t.f6_; - f7_ = t.f7_; - f8_ = t.f8_; - return *this; - } - - T0 f0_; - T1 f1_; - T2 f2_; - T3 f3_; - T4 f4_; - T5 f5_; - T6 f6_; - T7 f7_; - T8 f8_; -}; - -template -class tuple { - public: - template friend class gtest_internal::Get; - - tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(), - f9_() {} - - explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, - GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, - GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7, - GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2), - f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {} - - tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), - f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {} - - template - tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), - f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), - f9_(t.f9_) {} - - tuple& operator=(const tuple& t) { return CopyFrom(t); } - - template - tuple& operator=(const GTEST_10_TUPLE_(U)& t) { - return CopyFrom(t); - } - - GTEST_DECLARE_TUPLE_AS_FRIEND_ - - template - tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) { - f0_ = t.f0_; - f1_ = t.f1_; - f2_ = t.f2_; - f3_ = t.f3_; - f4_ = t.f4_; - f5_ = t.f5_; - f6_ = t.f6_; - f7_ = t.f7_; - f8_ = t.f8_; - f9_ = t.f9_; - return *this; - } - - T0 f0_; - T1 f1_; - T2 f2_; - T3 f3_; - T4 f4_; - T5 f5_; - T6 f6_; - T7 f7_; - T8 f8_; - T9 f9_; -}; - -// 6.1.3.2 Tuple creation functions. - -// Known limitations: we don't support passing an -// std::tr1::reference_wrapper to make_tuple(). And we don't -// implement tie(). - -inline tuple<> make_tuple() { return tuple<>(); } - -template -inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) { - return GTEST_1_TUPLE_(T)(f0); -} - -template -inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) { - return GTEST_2_TUPLE_(T)(f0, f1); -} - -template -inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) { - return GTEST_3_TUPLE_(T)(f0, f1, f2); -} - -template -inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, - const T3& f3) { - return GTEST_4_TUPLE_(T)(f0, f1, f2, f3); -} - -template -inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, - const T3& f3, const T4& f4) { - return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4); -} - -template -inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, - const T3& f3, const T4& f4, const T5& f5) { - return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5); -} - -template -inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, - const T3& f3, const T4& f4, const T5& f5, const T6& f6) { - return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6); -} - -template -inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, - const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) { - return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7); -} - -template -inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, - const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7, - const T8& f8) { - return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8); -} - -template -inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, - const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7, - const T8& f8, const T9& f9) { - return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9); -} - -// 6.1.3.3 Tuple helper classes. - -template struct tuple_size; - -template -struct tuple_size { - static const int value = 0; -}; - -template -struct tuple_size { - static const int value = 1; -}; - -template -struct tuple_size { - static const int value = 2; -}; - -template -struct tuple_size { - static const int value = 3; -}; - -template -struct tuple_size { - static const int value = 4; -}; - -template -struct tuple_size { - static const int value = 5; -}; - -template -struct tuple_size { - static const int value = 6; -}; - -template -struct tuple_size { - static const int value = 7; -}; - -template -struct tuple_size { - static const int value = 8; -}; - -template -struct tuple_size { - static const int value = 9; -}; - -template -struct tuple_size { - static const int value = 10; -}; - -template -struct tuple_element { - typedef typename gtest_internal::TupleElement< - k < (tuple_size::value), k, Tuple>::type type; -}; - -#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element::type - -// 6.1.3.4 Element access. - -namespace gtest_internal { - -template <> -class Get<0> { - public: - template - static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple)) - Field(Tuple& t) { return t.f0_; } // NOLINT - - template - static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple)) - ConstField(const Tuple& t) { return t.f0_; } -}; - -template <> -class Get<1> { - public: - template - static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple)) - Field(Tuple& t) { return t.f1_; } // NOLINT - - template - static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple)) - ConstField(const Tuple& t) { return t.f1_; } -}; - -template <> -class Get<2> { - public: - template - static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple)) - Field(Tuple& t) { return t.f2_; } // NOLINT - - template - static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple)) - ConstField(const Tuple& t) { return t.f2_; } -}; - -template <> -class Get<3> { - public: - template - static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple)) - Field(Tuple& t) { return t.f3_; } // NOLINT - - template - static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple)) - ConstField(const Tuple& t) { return t.f3_; } -}; - -template <> -class Get<4> { - public: - template - static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple)) - Field(Tuple& t) { return t.f4_; } // NOLINT - - template - static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple)) - ConstField(const Tuple& t) { return t.f4_; } -}; - -template <> -class Get<5> { - public: - template - static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple)) - Field(Tuple& t) { return t.f5_; } // NOLINT - - template - static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple)) - ConstField(const Tuple& t) { return t.f5_; } -}; - -template <> -class Get<6> { - public: - template - static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple)) - Field(Tuple& t) { return t.f6_; } // NOLINT - - template - static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple)) - ConstField(const Tuple& t) { return t.f6_; } -}; - -template <> -class Get<7> { - public: - template - static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple)) - Field(Tuple& t) { return t.f7_; } // NOLINT - - template - static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple)) - ConstField(const Tuple& t) { return t.f7_; } -}; - -template <> -class Get<8> { - public: - template - static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple)) - Field(Tuple& t) { return t.f8_; } // NOLINT - - template - static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple)) - ConstField(const Tuple& t) { return t.f8_; } -}; - -template <> -class Get<9> { - public: - template - static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple)) - Field(Tuple& t) { return t.f9_; } // NOLINT - - template - static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple)) - ConstField(const Tuple& t) { return t.f9_; } -}; - -} // namespace gtest_internal - -template -GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T))) -get(GTEST_10_TUPLE_(T)& t) { - return gtest_internal::Get::Field(t); -} - -template -GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T))) -get(const GTEST_10_TUPLE_(T)& t) { - return gtest_internal::Get::ConstField(t); -} - -// 6.1.3.5 Relational operators - -// We only implement == and !=, as we don't have a need for the rest yet. - -namespace gtest_internal { - -// SameSizeTuplePrefixComparator::Eq(t1, t2) returns true if the -// first k fields of t1 equals the first k fields of t2. -// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if -// k1 != k2. -template -struct SameSizeTuplePrefixComparator; - -template <> -struct SameSizeTuplePrefixComparator<0, 0> { - template - static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) { - return true; - } -}; - -template -struct SameSizeTuplePrefixComparator { - template - static bool Eq(const Tuple1& t1, const Tuple2& t2) { - return SameSizeTuplePrefixComparator::Eq(t1, t2) && - ::std::tr1::get(t1) == ::std::tr1::get(t2); - } -}; - -} // namespace gtest_internal - -template -inline bool operator==(const GTEST_10_TUPLE_(T)& t, - const GTEST_10_TUPLE_(U)& u) { - return gtest_internal::SameSizeTuplePrefixComparator< - tuple_size::value, - tuple_size::value>::Eq(t, u); -} - -template -inline bool operator!=(const GTEST_10_TUPLE_(T)& t, - const GTEST_10_TUPLE_(U)& u) { return !(t == u); } - -// 6.1.4 Pairs. -// Unimplemented. - -} // namespace tr1 -} // namespace std - -#undef GTEST_0_TUPLE_ -#undef GTEST_1_TUPLE_ -#undef GTEST_2_TUPLE_ -#undef GTEST_3_TUPLE_ -#undef GTEST_4_TUPLE_ -#undef GTEST_5_TUPLE_ -#undef GTEST_6_TUPLE_ -#undef GTEST_7_TUPLE_ -#undef GTEST_8_TUPLE_ -#undef GTEST_9_TUPLE_ -#undef GTEST_10_TUPLE_ - -#undef GTEST_0_TYPENAMES_ -#undef GTEST_1_TYPENAMES_ -#undef GTEST_2_TYPENAMES_ -#undef GTEST_3_TYPENAMES_ -#undef GTEST_4_TYPENAMES_ -#undef GTEST_5_TYPENAMES_ -#undef GTEST_6_TYPENAMES_ -#undef GTEST_7_TYPENAMES_ -#undef GTEST_8_TYPENAMES_ -#undef GTEST_9_TYPENAMES_ -#undef GTEST_10_TYPENAMES_ - -#undef GTEST_DECLARE_TUPLE_AS_FRIEND_ -#undef GTEST_BY_REF_ -#undef GTEST_ADD_REF_ -#undef GTEST_TUPLE_ELEMENT_ - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ diff --git a/googletest/include/gtest/internal/gtest-tuple.h.pump b/googletest/include/gtest/internal/gtest-tuple.h.pump deleted file mode 100644 index bb626e0..0000000 --- a/googletest/include/gtest/internal/gtest-tuple.h.pump +++ /dev/null @@ -1,348 +0,0 @@ -$$ -*- mode: c++; -*- -$var n = 10 $$ Maximum number of tuple fields we want to support. -$$ This meta comment fixes auto-indentation in Emacs. }} -// Copyright 2009 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. - - -// Implements a subset of TR1 tuple needed by Google Test and Google Mock. - -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ - -#include // For ::std::pair. - -// The compiler used in Symbian has a bug that prevents us from declaring the -// tuple template as a friend (it complains that tuple is redefined). This -// bypasses the bug by declaring the members that should otherwise be -// private as public. -// Sun Studio versions < 12 also have the above bug. -#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) -# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public: -#else -# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \ - template friend class tuple; \ - private: -#endif - -// Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that conflict -// with our own definitions. Therefore using our own tuple does not work on -// those compilers. -#if defined(_MSC_VER) && _MSC_VER >= 1600 /* 1600 is Visual Studio 2010 */ -# error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \ -GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers." -#endif - - -$range i 0..n-1 -$range j 0..n -$range k 1..n -// GTEST_n_TUPLE_(T) is the type of an n-tuple. -#define GTEST_0_TUPLE_(T) tuple<> - -$for k [[ -$range m 0..k-1 -$range m2 k..n-1 -#define GTEST_$(k)_TUPLE_(T) tuple<$for m, [[T##$m]]$for m2 [[, void]]> - -]] - -// GTEST_n_TYPENAMES_(T) declares a list of n typenames. - -$for j [[ -$range m 0..j-1 -#define GTEST_$(j)_TYPENAMES_(T) $for m, [[typename T##$m]] - - -]] - -// In theory, defining stuff in the ::std namespace is undefined -// behavior. We can do this as we are playing the role of a standard -// library vendor. -namespace std { -namespace tr1 { - -template <$for i, [[typename T$i = void]]> -class tuple; - -// Anything in namespace gtest_internal is Google Test's INTERNAL -// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code. -namespace gtest_internal { - -// ByRef::type is T if T is a reference; otherwise it's const T&. -template -struct ByRef { typedef const T& type; }; // NOLINT -template -struct ByRef { typedef T& type; }; // NOLINT - -// A handy wrapper for ByRef. -#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef::type - -// AddRef::type is T if T is a reference; otherwise it's T&. This -// is the same as tr1::add_reference::type. -template -struct AddRef { typedef T& type; }; // NOLINT -template -struct AddRef { typedef T& type; }; // NOLINT - -// A handy wrapper for AddRef. -#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef::type - -// A helper for implementing get(). -template class Get; - -// A helper for implementing tuple_element. kIndexValid is true -// iff k < the number of fields in tuple type T. -template -struct TupleElement; - - -$for i [[ -template -struct TupleElement { - typedef T$i type; -}; - - -]] -} // namespace gtest_internal - -template <> -class tuple<> { - public: - tuple() {} - tuple(const tuple& /* t */) {} - tuple& operator=(const tuple& /* t */) { return *this; } -}; - - -$for k [[ -$range m 0..k-1 -template -class $if k < n [[GTEST_$(k)_TUPLE_(T)]] $else [[tuple]] { - public: - template friend class gtest_internal::Get; - - tuple() : $for m, [[f$(m)_()]] {} - - explicit tuple($for m, [[GTEST_BY_REF_(T$m) f$m]]) : [[]] -$for m, [[f$(m)_(f$m)]] {} - - tuple(const tuple& t) : $for m, [[f$(m)_(t.f$(m)_)]] {} - - template - tuple(const GTEST_$(k)_TUPLE_(U)& t) : $for m, [[f$(m)_(t.f$(m)_)]] {} - -$if k == 2 [[ - template - tuple(const ::std::pair& p) : f0_(p.first), f1_(p.second) {} - -]] - - tuple& operator=(const tuple& t) { return CopyFrom(t); } - - template - tuple& operator=(const GTEST_$(k)_TUPLE_(U)& t) { - return CopyFrom(t); - } - -$if k == 2 [[ - template - tuple& operator=(const ::std::pair& p) { - f0_ = p.first; - f1_ = p.second; - return *this; - } - -]] - - GTEST_DECLARE_TUPLE_AS_FRIEND_ - - template - tuple& CopyFrom(const GTEST_$(k)_TUPLE_(U)& t) { - -$for m [[ - f$(m)_ = t.f$(m)_; - -]] - return *this; - } - - -$for m [[ - T$m f$(m)_; - -]] -}; - - -]] -// 6.1.3.2 Tuple creation functions. - -// Known limitations: we don't support passing an -// std::tr1::reference_wrapper to make_tuple(). And we don't -// implement tie(). - -inline tuple<> make_tuple() { return tuple<>(); } - -$for k [[ -$range m 0..k-1 - -template -inline GTEST_$(k)_TUPLE_(T) make_tuple($for m, [[const T$m& f$m]]) { - return GTEST_$(k)_TUPLE_(T)($for m, [[f$m]]); -} - -]] - -// 6.1.3.3 Tuple helper classes. - -template struct tuple_size; - - -$for j [[ -template -struct tuple_size { - static const int value = $j; -}; - - -]] -template -struct tuple_element { - typedef typename gtest_internal::TupleElement< - k < (tuple_size::value), k, Tuple>::type type; -}; - -#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element::type - -// 6.1.3.4 Element access. - -namespace gtest_internal { - - -$for i [[ -template <> -class Get<$i> { - public: - template - static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple)) - Field(Tuple& t) { return t.f$(i)_; } // NOLINT - - template - static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple)) - ConstField(const Tuple& t) { return t.f$(i)_; } -}; - - -]] -} // namespace gtest_internal - -template -GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T))) -get(GTEST_$(n)_TUPLE_(T)& t) { - return gtest_internal::Get::Field(t); -} - -template -GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T))) -get(const GTEST_$(n)_TUPLE_(T)& t) { - return gtest_internal::Get::ConstField(t); -} - -// 6.1.3.5 Relational operators - -// We only implement == and !=, as we don't have a need for the rest yet. - -namespace gtest_internal { - -// SameSizeTuplePrefixComparator::Eq(t1, t2) returns true if the -// first k fields of t1 equals the first k fields of t2. -// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if -// k1 != k2. -template -struct SameSizeTuplePrefixComparator; - -template <> -struct SameSizeTuplePrefixComparator<0, 0> { - template - static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) { - return true; - } -}; - -template -struct SameSizeTuplePrefixComparator { - template - static bool Eq(const Tuple1& t1, const Tuple2& t2) { - return SameSizeTuplePrefixComparator::Eq(t1, t2) && - ::std::tr1::get(t1) == ::std::tr1::get(t2); - } -}; - -} // namespace gtest_internal - -template -inline bool operator==(const GTEST_$(n)_TUPLE_(T)& t, - const GTEST_$(n)_TUPLE_(U)& u) { - return gtest_internal::SameSizeTuplePrefixComparator< - tuple_size::value, - tuple_size::value>::Eq(t, u); -} - -template -inline bool operator!=(const GTEST_$(n)_TUPLE_(T)& t, - const GTEST_$(n)_TUPLE_(U)& u) { return !(t == u); } - -// 6.1.4 Pairs. -// Unimplemented. - -} // namespace tr1 -} // namespace std - - -$for j [[ -#undef GTEST_$(j)_TUPLE_ - -]] - - -$for j [[ -#undef GTEST_$(j)_TYPENAMES_ - -]] - -#undef GTEST_DECLARE_TUPLE_AS_FRIEND_ -#undef GTEST_BY_REF_ -#undef GTEST_ADD_REF_ -#undef GTEST_TUPLE_ELEMENT_ - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ diff --git a/googletest/samples/sample8_unittest.cc b/googletest/samples/sample8_unittest.cc index ccf5aed..a3eacc7 100644 --- a/googletest/samples/sample8_unittest.cc +++ b/googletest/samples/sample8_unittest.cc @@ -37,7 +37,6 @@ #include "gtest/gtest.h" namespace { -#if GTEST_HAS_COMBINE // Suppose we want to introduce a new, improved implementation of PrimeTable // which combines speed of PrecalcPrimeTable and versatility of @@ -90,19 +89,12 @@ using ::testing::Combine; // PreCalculatedPrimeTable disabled. We do this by defining fixture which will // accept different combinations of parameters for instantiating a // HybridPrimeTable instance. -class PrimeTableTest : public TestWithParam< ::testing::tuple > { +class PrimeTableTest : public TestWithParam< ::std::tuple > { protected: virtual void SetUp() { - // This can be written as - // - // bool force_on_the_fly; - // int max_precalculated; - // tie(force_on_the_fly, max_precalculated) = GetParam(); - // - // once the Google C++ Style Guide allows use of ::std::tr1::tie. - // - bool force_on_the_fly = ::testing::get<0>(GetParam()); - int max_precalculated = ::testing::get<1>(GetParam()); + bool force_on_the_fly; + int max_precalculated; + std::tie(force_on_the_fly, max_precalculated) = GetParam(); table_ = new HybridPrimeTable(force_on_the_fly, max_precalculated); } virtual void TearDown() { @@ -160,15 +152,4 @@ INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters, PrimeTableTest, Combine(Bool(), Values(1, 10))); -#else - -// Google Test may not support Combine() with some compilers. If we -// use conditional compilation to compile out all code referring to -// the gtest_main library, MSVC linker will not link that library at -// all and consequently complain about missing entry point defined in -// that library (fatal error LNK1561: entry point must be -// defined). This dummy test keeps gtest_main linked in. -TEST(DummyTest, CombineIsNotSupportedOnThisPlatform) {} - -#endif // GTEST_HAS_COMBINE } // namespace diff --git a/googletest/test/googletest-param-test-test.cc b/googletest/test/googletest-param-test-test.cc index be9548e..05e0b23 100644 --- a/googletest/test/googletest-param-test-test.cc +++ b/googletest/test/googletest-param-test-test.cc @@ -49,19 +49,13 @@ using ::std::sort; using ::testing::AddGlobalTestEnvironment; using ::testing::Bool; +using ::testing::Combine; using ::testing::Message; using ::testing::Range; using ::testing::TestWithParam; using ::testing::Values; using ::testing::ValuesIn; -# if GTEST_HAS_COMBINE -using ::testing::Combine; -using ::testing::get; -using ::testing::make_tuple; -using ::testing::tuple; -# endif // GTEST_HAS_COMBINE - using ::testing::internal::ParamGenerator; using ::testing::internal::UnitTestOptions; @@ -78,8 +72,6 @@ template return stream.str(); } -# if GTEST_HAS_COMBINE - // These overloads allow printing tuples in our tests. We cannot // define an operator<< for tuples, as that definition needs to be in // the std namespace in order to be picked up by Google Test via @@ -87,35 +79,33 @@ template // namespace in non-STL code is undefined behavior. template -::std::string PrintValue(const tuple& value) { +::std::string PrintValue(const std::tuple& value) { ::std::stringstream stream; - stream << "(" << get<0>(value) << ", " << get<1>(value) << ")"; + stream << "(" << std::get<0>(value) << ", " << std::get<1>(value) << ")"; return stream.str(); } template -::std::string PrintValue(const tuple& value) { +::std::string PrintValue(const std::tuple& value) { ::std::stringstream stream; - stream << "(" << get<0>(value) << ", " << get<1>(value) - << ", "<< get<2>(value) << ")"; + stream << "(" << std::get<0>(value) << ", " << std::get<1>(value) << ", " + << std::get<2>(value) << ")"; return stream.str(); } template ::std::string PrintValue( - const tuple& value) { + const std::tuple& value) { ::std::stringstream stream; - stream << "(" << get<0>(value) << ", " << get<1>(value) - << ", "<< get<2>(value) << ", " << get<3>(value) - << ", "<< get<4>(value) << ", " << get<5>(value) - << ", "<< get<6>(value) << ", " << get<7>(value) - << ", "<< get<8>(value) << ", " << get<9>(value) << ")"; + stream << "(" << std::get<0>(value) << ", " << std::get<1>(value) << ", " + << std::get<2>(value) << ", " << std::get<3>(value) << ", " + << std::get<4>(value) << ", " << std::get<5>(value) << ", " + << std::get<6>(value) << ", " << std::get<7>(value) << ", " + << std::get<8>(value) << ", " << std::get<9>(value) << ")"; return stream.str(); } -# endif // GTEST_HAS_COMBINE - // Verifies that a sequence generated by the generator and accessed // via the iterator object matches the expected one using Google Test // assertions. @@ -450,31 +440,28 @@ TEST(BoolTest, BoolWorks) { VerifyGenerator(gen, expected_values); } -# if GTEST_HAS_COMBINE - // Tests that Combine() with two parameters generates the expected sequence. TEST(CombineTest, CombineWithTwoParameters) { const char* foo = "foo"; const char* bar = "bar"; - const ParamGenerator > gen = + const ParamGenerator > gen = Combine(Values(foo, bar), Values(3, 4)); - tuple expected_values[] = { - make_tuple(foo, 3), make_tuple(foo, 4), - make_tuple(bar, 3), make_tuple(bar, 4)}; + std::tuple expected_values[] = { + std::make_tuple(foo, 3), std::make_tuple(foo, 4), std::make_tuple(bar, 3), + std::make_tuple(bar, 4)}; VerifyGenerator(gen, expected_values); } // Tests that Combine() with three parameters generates the expected sequence. TEST(CombineTest, CombineWithThreeParameters) { - const ParamGenerator > gen = Combine(Values(0, 1), - Values(3, 4), - Values(5, 6)); - tuple expected_values[] = { - make_tuple(0, 3, 5), make_tuple(0, 3, 6), - make_tuple(0, 4, 5), make_tuple(0, 4, 6), - make_tuple(1, 3, 5), make_tuple(1, 3, 6), - make_tuple(1, 4, 5), make_tuple(1, 4, 6)}; + const ParamGenerator > gen = + Combine(Values(0, 1), Values(3, 4), Values(5, 6)); + std::tuple expected_values[] = { + std::make_tuple(0, 3, 5), std::make_tuple(0, 3, 6), + std::make_tuple(0, 4, 5), std::make_tuple(0, 4, 6), + std::make_tuple(1, 3, 5), std::make_tuple(1, 3, 6), + std::make_tuple(1, 4, 5), std::make_tuple(1, 4, 6)}; VerifyGenerator(gen, expected_values); } @@ -482,10 +469,11 @@ TEST(CombineTest, CombineWithThreeParameters) { // sequence generates a sequence with the number of elements equal to the // number of elements in the sequence generated by the second parameter. TEST(CombineTest, CombineWithFirstParameterSingleValue) { - const ParamGenerator > gen = Combine(Values(42), - Values(0, 1)); + const ParamGenerator > gen = + Combine(Values(42), Values(0, 1)); - tuple expected_values[] = {make_tuple(42, 0), make_tuple(42, 1)}; + std::tuple expected_values[] = {std::make_tuple(42, 0), + std::make_tuple(42, 1)}; VerifyGenerator(gen, expected_values); } @@ -493,26 +481,27 @@ TEST(CombineTest, CombineWithFirstParameterSingleValue) { // sequence generates a sequence with the number of elements equal to the // number of elements in the sequence generated by the first parameter. TEST(CombineTest, CombineWithSecondParameterSingleValue) { - const ParamGenerator > gen = Combine(Values(0, 1), - Values(42)); + const ParamGenerator > gen = + Combine(Values(0, 1), Values(42)); - tuple expected_values[] = {make_tuple(0, 42), make_tuple(1, 42)}; + std::tuple expected_values[] = {std::make_tuple(0, 42), + std::make_tuple(1, 42)}; VerifyGenerator(gen, expected_values); } // Tests that when the first parameter produces an empty sequence, // Combine() produces an empty sequence, too. TEST(CombineTest, CombineWithFirstParameterEmptyRange) { - const ParamGenerator > gen = Combine(Range(0, 0), - Values(0, 1)); + const ParamGenerator > gen = + Combine(Range(0, 0), Values(0, 1)); VerifyGeneratorIsEmpty(gen); } // Tests that when the second parameter produces an empty sequence, // Combine() produces an empty sequence, too. TEST(CombineTest, CombineWithSecondParameterEmptyRange) { - const ParamGenerator > gen = Combine(Values(0, 1), - Range(1, 1)); + const ParamGenerator > gen = + Combine(Values(0, 1), Range(1, 1)); VerifyGeneratorIsEmpty(gen); } @@ -521,17 +510,15 @@ TEST(CombineTest, CombineWithSecondParameterEmptyRange) { TEST(CombineTest, CombineWithMaxNumberOfParameters) { const char* foo = "foo"; const char* bar = "bar"; - const ParamGenerator > gen = Combine(Values(foo, bar), - Values(1), Values(2), - Values(3), Values(4), - Values(5), Values(6), - Values(7), Values(8), - Values(9)); - - tuple - expected_values[] = {make_tuple(foo, 1, 2, 3, 4, 5, 6, 7, 8, 9), - make_tuple(bar, 1, 2, 3, 4, 5, 6, 7, 8, 9)}; + const ParamGenerator< + std::tuple > + gen = + Combine(Values(foo, bar), Values(1), Values(2), Values(3), Values(4), + Values(5), Values(6), Values(7), Values(8), Values(9)); + + std::tuple + expected_values[] = {std::make_tuple(foo, 1, 2, 3, 4, 5, 6, 7, 8, 9), + std::make_tuple(bar, 1, 2, 3, 4, 5, 6, 7, 8, 9)}; VerifyGenerator(gen, expected_values); } @@ -551,12 +538,12 @@ class NonDefaultConstructAssignString { }; TEST(CombineTest, NonDefaultConstructAssign) { - const ParamGenerator > gen = + const ParamGenerator > gen = Combine(Values(0, 1), Values(NonDefaultConstructAssignString("A"), NonDefaultConstructAssignString("B"))); - ParamGenerator >::iterator it = - gen.begin(); + ParamGenerator >::iterator + it = gen.begin(); EXPECT_EQ(0, std::get<0>(*it)); EXPECT_EQ("A", std::get<1>(*it).str()); @@ -577,7 +564,6 @@ TEST(CombineTest, NonDefaultConstructAssign) { EXPECT_TRUE(it == gen.end()); } -# endif // GTEST_HAS_COMBINE // Tests that an generator produces correct sequence after being // assigned from another generator. diff --git a/googletest/test/googletest-printers-test.cc b/googletest/test/googletest-printers-test.cc index ce7806c..ed66fa2 100644 --- a/googletest/test/googletest-printers-test.cc +++ b/googletest/test/googletest-printers-test.cc @@ -228,9 +228,7 @@ using ::testing::internal::Strings; using ::testing::internal::UniversalPrint; using ::testing::internal::UniversalPrinter; using ::testing::internal::UniversalTersePrint; -#if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ using ::testing::internal::UniversalTersePrintTupleFieldsToStrings; -#endif // Prints a value to a string using the universal value printer. This // is a helper for testing UniversalPrinter::Print() for various types. @@ -991,67 +989,6 @@ TEST(PrintStlContainerTest, ConstIterator) { EXPECT_EQ("1-byte object <00>", Print(it)); } -#if GTEST_HAS_TR1_TUPLE -// Tests printing ::std::tr1::tuples. - -// Tuples of various arities. -TEST(PrintTr1TupleTest, VariousSizes) { - ::std::tr1::tuple<> t0; - EXPECT_EQ("()", Print(t0)); - - ::std::tr1::tuple t1(5); - EXPECT_EQ("(5)", Print(t1)); - - ::std::tr1::tuple t2('a', true); - EXPECT_EQ("('a' (97, 0x61), true)", Print(t2)); - - ::std::tr1::tuple t3(false, 2, 3); - EXPECT_EQ("(false, 2, 3)", Print(t3)); - - ::std::tr1::tuple t4(false, 2, 3, 4); - EXPECT_EQ("(false, 2, 3, 4)", Print(t4)); - - ::std::tr1::tuple t5(false, 2, 3, 4, true); - EXPECT_EQ("(false, 2, 3, 4, true)", Print(t5)); - - ::std::tr1::tuple t6(false, 2, 3, 4, true, 6); - EXPECT_EQ("(false, 2, 3, 4, true, 6)", Print(t6)); - - ::std::tr1::tuple t7( - false, 2, 3, 4, true, 6, 7); - EXPECT_EQ("(false, 2, 3, 4, true, 6, 7)", Print(t7)); - - ::std::tr1::tuple t8( - false, 2, 3, 4, true, 6, 7, true); - EXPECT_EQ("(false, 2, 3, 4, true, 6, 7, true)", Print(t8)); - - ::std::tr1::tuple t9( - false, 2, 3, 4, true, 6, 7, true, 9); - EXPECT_EQ("(false, 2, 3, 4, true, 6, 7, true, 9)", Print(t9)); - - const char* const str = "8"; - // VC++ 2010's implementation of tuple of C++0x is deficient, requiring - // an explicit type cast of NULL to be used. - ::std::tr1::tuple - t10(false, 'a', static_cast(3), 4, 5, 1.5F, -2.5, str, // NOLINT - ImplicitCast_(NULL), "10"); - EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + - " pointing to \"8\", NULL, \"10\")", - Print(t10)); -} - -// Nested tuples. -TEST(PrintTr1TupleTest, NestedTuple) { - ::std::tr1::tuple< ::std::tr1::tuple, char> nested( - ::std::tr1::make_tuple(5, true), 'a'); - EXPECT_EQ("((5, true), 'a' (97, 0x61))", Print(nested)); -} - -#endif // GTEST_HAS_TR1_TUPLE - -#if GTEST_HAS_STD_TUPLE_ // Tests printing ::std::tuples. // Tuples of various arities. @@ -1071,32 +1008,12 @@ TEST(PrintStdTupleTest, VariousSizes) { ::std::tuple t4(false, 2, 3, 4); EXPECT_EQ("(false, 2, 3, 4)", Print(t4)); - ::std::tuple t5(false, 2, 3, 4, true); - EXPECT_EQ("(false, 2, 3, 4, true)", Print(t5)); - - ::std::tuple t6(false, 2, 3, 4, true, 6); - EXPECT_EQ("(false, 2, 3, 4, true, 6)", Print(t6)); - - ::std::tuple t7( - false, 2, 3, 4, true, 6, 7); - EXPECT_EQ("(false, 2, 3, 4, true, 6, 7)", Print(t7)); - - ::std::tuple t8( - false, 2, 3, 4, true, 6, 7, true); - EXPECT_EQ("(false, 2, 3, 4, true, 6, 7, true)", Print(t8)); - - ::std::tuple t9( - false, 2, 3, 4, true, 6, 7, true, 9); - EXPECT_EQ("(false, 2, 3, 4, true, 6, 7, true, 9)", Print(t9)); - const char* const str = "8"; - // VC++ 2010's implementation of tuple of C++0x is deficient, requiring - // an explicit type cast of NULL to be used. ::std::tuple t10(false, 'a', static_cast(3), 4, 5, 1.5F, -2.5, str, // NOLINT - ImplicitCast_(NULL), "10"); + nullptr, "10"); EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + " pointing to \"8\", NULL, \"10\")", Print(t10)); @@ -1109,8 +1026,6 @@ TEST(PrintStdTupleTest, NestedTuple) { EXPECT_EQ("((5, true), 'a' (97, 0x61))", Print(nested)); } -#endif // GTEST_HAS_TR1_TUPLE - TEST(PrintNullptrT, Basic) { EXPECT_EQ("(nullptr)", Print(nullptr)); } @@ -1662,42 +1577,6 @@ TEST(UniversalPrintTest, WorksForCharArray) { EXPECT_EQ("\"\\\"Line\\0 1\\\"\\nLine 2\"", ss2.str()); } -#if GTEST_HAS_TR1_TUPLE - -TEST(UniversalTersePrintTupleFieldsToStringsTestWithTr1, PrintsEmptyTuple) { - Strings result = UniversalTersePrintTupleFieldsToStrings( - ::std::tr1::make_tuple()); - EXPECT_EQ(0u, result.size()); -} - -TEST(UniversalTersePrintTupleFieldsToStringsTestWithTr1, PrintsOneTuple) { - Strings result = UniversalTersePrintTupleFieldsToStrings( - ::std::tr1::make_tuple(1)); - ASSERT_EQ(1u, result.size()); - EXPECT_EQ("1", result[0]); -} - -TEST(UniversalTersePrintTupleFieldsToStringsTestWithTr1, PrintsTwoTuple) { - Strings result = UniversalTersePrintTupleFieldsToStrings( - ::std::tr1::make_tuple(1, 'a')); - ASSERT_EQ(2u, result.size()); - EXPECT_EQ("1", result[0]); - EXPECT_EQ("'a' (97, 0x61)", result[1]); -} - -TEST(UniversalTersePrintTupleFieldsToStringsTestWithTr1, PrintsTersely) { - const int n = 1; - Strings result = UniversalTersePrintTupleFieldsToStrings( - ::std::tr1::tuple(n, "a")); - ASSERT_EQ(2u, result.size()); - EXPECT_EQ("1", result[0]); - EXPECT_EQ("\"a\"", result[1]); -} - -#endif // GTEST_HAS_TR1_TUPLE - -#if GTEST_HAS_STD_TUPLE_ - TEST(UniversalTersePrintTupleFieldsToStringsTestWithStd, PrintsEmptyTuple) { Strings result = UniversalTersePrintTupleFieldsToStrings(::std::make_tuple()); EXPECT_EQ(0u, result.size()); @@ -1727,8 +1606,6 @@ TEST(UniversalTersePrintTupleFieldsToStringsTestWithStd, PrintsTersely) { EXPECT_EQ("\"a\"", result[1]); } -#endif // GTEST_HAS_STD_TUPLE_ - #if GTEST_HAS_ABSL TEST(PrintOptionalTest, Basic) { diff --git a/googletest/test/googletest-tuple-test.cc b/googletest/test/googletest-tuple-test.cc deleted file mode 100644 index 7a5bf42..0000000 --- a/googletest/test/googletest-tuple-test.cc +++ /dev/null @@ -1,319 +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. - - -#include "gtest/internal/gtest-tuple.h" -#include -#include "gtest/gtest.h" - -namespace { - -using ::std::tr1::get; -using ::std::tr1::make_tuple; -using ::std::tr1::tuple; -using ::std::tr1::tuple_element; -using ::std::tr1::tuple_size; -using ::testing::StaticAssertTypeEq; - -// Tests that tuple_element >::type returns TK. -TEST(tuple_element_Test, ReturnsElementType) { - StaticAssertTypeEq >::type>(); - StaticAssertTypeEq >::type>(); - StaticAssertTypeEq >::type>(); -} - -// Tests that tuple_size::value gives the number of fields in tuple -// type T. -TEST(tuple_size_Test, ReturnsNumberOfFields) { - EXPECT_EQ(0, +tuple_size >::value); - EXPECT_EQ(1, +tuple_size >::value); - EXPECT_EQ(1, +tuple_size >::value); - EXPECT_EQ(1, +(tuple_size > >::value)); - EXPECT_EQ(2, +(tuple_size >::value)); - EXPECT_EQ(3, +(tuple_size >::value)); -} - -// Tests comparing a tuple with itself. -TEST(ComparisonTest, ComparesWithSelf) { - const tuple a(5, 'a', false); - - EXPECT_TRUE(a == a); - EXPECT_FALSE(a != a); -} - -// Tests comparing two tuples with the same value. -TEST(ComparisonTest, ComparesEqualTuples) { - const tuple a(5, true), b(5, true); - - EXPECT_TRUE(a == b); - EXPECT_FALSE(a != b); -} - -// Tests comparing two different tuples that have no reference fields. -TEST(ComparisonTest, ComparesUnequalTuplesWithoutReferenceFields) { - typedef tuple FooTuple; - - const FooTuple a(0, 'x'); - const FooTuple b(1, 'a'); - - EXPECT_TRUE(a != b); - EXPECT_FALSE(a == b); - - const FooTuple c(1, 'b'); - - EXPECT_TRUE(b != c); - EXPECT_FALSE(b == c); -} - -// Tests comparing two different tuples that have reference fields. -TEST(ComparisonTest, ComparesUnequalTuplesWithReferenceFields) { - typedef tuple FooTuple; - - int i = 5; - const char ch = 'a'; - const FooTuple a(i, ch); - - int j = 6; - const FooTuple b(j, ch); - - EXPECT_TRUE(a != b); - EXPECT_FALSE(a == b); - - j = 5; - const char ch2 = 'b'; - const FooTuple c(j, ch2); - - EXPECT_TRUE(b != c); - EXPECT_FALSE(b == c); -} - -// Tests that a tuple field with a reference type is an alias of the -// variable it's supposed to reference. -TEST(ReferenceFieldTest, IsAliasOfReferencedVariable) { - int n = 0; - tuple t(true, n); - - n = 1; - EXPECT_EQ(n, get<1>(t)) - << "Changing a underlying variable should update the reference field."; - - // Makes sure that the implementation doesn't do anything funny with - // the & operator for the return type of get<>(). - EXPECT_EQ(&n, &(get<1>(t))) - << "The address of a reference field should equal the address of " - << "the underlying variable."; - - get<1>(t) = 2; - EXPECT_EQ(2, n) - << "Changing a reference field should update the underlying variable."; -} - -// Tests that tuple's default constructor default initializes each field. -// This test needs to compile without generating warnings. -TEST(TupleConstructorTest, DefaultConstructorDefaultInitializesEachField) { - // The TR1 report requires that tuple's default constructor default - // initializes each field, even if it's a primitive type. If the - // implementation forgets to do this, this test will catch it by - // generating warnings about using uninitialized variables (assuming - // a decent compiler). - - tuple<> empty; - - tuple a1, b1; - b1 = a1; - EXPECT_EQ(0, get<0>(b1)); - - tuple a2, b2; - b2 = a2; - EXPECT_EQ(0, get<0>(b2)); - EXPECT_EQ(0.0, get<1>(b2)); - - tuple a3, b3; - b3 = a3; - EXPECT_EQ(0.0, get<0>(b3)); - EXPECT_EQ('\0', get<1>(b3)); - EXPECT_TRUE(get<2>(b3) == nullptr); - - tuple a10, b10; - b10 = a10; - EXPECT_EQ(0, get<0>(b10)); - EXPECT_EQ(0, get<1>(b10)); - EXPECT_EQ(0, get<2>(b10)); - EXPECT_EQ(0, get<3>(b10)); - EXPECT_EQ(0, get<4>(b10)); - EXPECT_EQ(0, get<5>(b10)); - EXPECT_EQ(0, get<6>(b10)); - EXPECT_EQ(0, get<7>(b10)); - EXPECT_EQ(0, get<8>(b10)); - EXPECT_EQ(0, get<9>(b10)); -} - -// Tests constructing a tuple from its fields. -TEST(TupleConstructorTest, ConstructsFromFields) { - int n = 1; - // Reference field. - tuple a(n); - EXPECT_EQ(&n, &(get<0>(a))); - - // Non-reference fields. - tuple b(5, 'a'); - EXPECT_EQ(5, get<0>(b)); - EXPECT_EQ('a', get<1>(b)); - - // Const reference field. - const int m = 2; - tuple c(true, m); - EXPECT_TRUE(get<0>(c)); - EXPECT_EQ(&m, &(get<1>(c))); -} - -// Tests tuple's copy constructor. -TEST(TupleConstructorTest, CopyConstructor) { - tuple a(0.0, true); - tuple b(a); - - EXPECT_DOUBLE_EQ(0.0, get<0>(b)); - EXPECT_TRUE(get<1>(b)); -} - -// Tests constructing a tuple from another tuple that has a compatible -// but different type. -TEST(TupleConstructorTest, ConstructsFromDifferentTupleType) { - tuple a(0, 1, 'a'); - tuple b(a); - - EXPECT_DOUBLE_EQ(0.0, get<0>(b)); - EXPECT_EQ(1, get<1>(b)); - EXPECT_EQ('a', get<2>(b)); -} - -// Tests constructing a 2-tuple from an std::pair. -TEST(TupleConstructorTest, ConstructsFromPair) { - ::std::pair a(1, 'a'); - tuple b(a); - tuple c(a); -} - -// Tests assigning a tuple to another tuple with the same type. -TEST(TupleAssignmentTest, AssignsToSameTupleType) { - const tuple a(5, 7L); - tuple b; - b = a; - EXPECT_EQ(5, get<0>(b)); - EXPECT_EQ(7L, get<1>(b)); -} - -// Tests assigning a tuple to another tuple with a different but -// compatible type. -TEST(TupleAssignmentTest, AssignsToDifferentTupleType) { - const tuple a(1, 7L, true); - tuple b; - b = a; - EXPECT_EQ(1L, get<0>(b)); - EXPECT_EQ(7, get<1>(b)); - EXPECT_TRUE(get<2>(b)); -} - -// Tests assigning an std::pair to a 2-tuple. -TEST(TupleAssignmentTest, AssignsFromPair) { - const ::std::pair a(5, true); - tuple b; - b = a; - EXPECT_EQ(5, get<0>(b)); - EXPECT_TRUE(get<1>(b)); - - tuple c; - c = a; - EXPECT_EQ(5L, get<0>(c)); - EXPECT_TRUE(get<1>(c)); -} - -// A fixture for testing big tuples. -class BigTupleTest : public testing::Test { - protected: - typedef tuple BigTuple; - - BigTupleTest() : - a_(1, 0, 0, 0, 0, 0, 0, 0, 0, 2), - b_(1, 0, 0, 0, 0, 0, 0, 0, 0, 3) {} - - BigTuple a_, b_; -}; - -// Tests constructing big tuples. -TEST_F(BigTupleTest, Construction) { - BigTuple a; - BigTuple b(b_); -} - -// Tests that get(t) returns the N-th (0-based) field of tuple t. -TEST_F(BigTupleTest, get) { - EXPECT_EQ(1, get<0>(a_)); - EXPECT_EQ(2, get<9>(a_)); - - // Tests that get() works on a const tuple too. - const BigTuple a(a_); - EXPECT_EQ(1, get<0>(a)); - EXPECT_EQ(2, get<9>(a)); -} - -// Tests comparing big tuples. -TEST_F(BigTupleTest, Comparisons) { - EXPECT_TRUE(a_ == a_); - EXPECT_FALSE(a_ != a_); - - EXPECT_TRUE(a_ != b_); - EXPECT_FALSE(a_ == b_); -} - -TEST(MakeTupleTest, WorksForScalarTypes) { - tuple a; - a = make_tuple(true, 5); - EXPECT_TRUE(get<0>(a)); - EXPECT_EQ(5, get<1>(a)); - - tuple b; - b = make_tuple('a', 'b', 5); - EXPECT_EQ('a', get<0>(b)); - EXPECT_EQ('b', get<1>(b)); - EXPECT_EQ(5, get<2>(b)); -} - -TEST(MakeTupleTest, WorksForPointers) { - int a[] = { 1, 2, 3, 4 }; - const char* const str = "hi"; - int* const p = a; - - tuple t; - t = make_tuple(str, p); - EXPECT_EQ(str, get<0>(t)); - EXPECT_EQ(p, get<1>(t)); -} - -} // namespace -- cgit v0.12