"docs/v1_6/CookBook.md" did not exist on "3b6c87d41309acb92a4daabc279e0ba00222b7b2"
Commit 7d3b73c8 authored by Abseil Team's avatar Abseil Team Committed by Gennadiy Civil
Browse files

Unconditionally use std::tuple.

Remove all mention of TR1 tuple and our own implementation of tuple.

PiperOrigin-RevId: 216395043
parent 5434989d
...@@ -75,18 +75,6 @@ set(gmock_build_include_dirs ...@@ -75,18 +75,6 @@ set(gmock_build_include_dirs
"${gtest_SOURCE_DIR}") "${gtest_SOURCE_DIR}")
include_directories(${gmock_build_include_dirs}) 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 # Defines the gmock & gmock_main libraries. User tests should link
...@@ -199,25 +187,12 @@ $env:Path = \"$project_bin;$env:Path\" ...@@ -199,25 +187,12 @@ $env:Path = \"$project_bin;$env:Path\"
cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" cxx_library(gmock_main_no_rtti "${cxx_no_rtti}"
"${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) "${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() else()
cxx_library(gmock_main_no_exception "${cxx_no_exception}" src/gmock_main.cc) cxx_library(gmock_main_no_exception "${cxx_no_exception}" src/gmock_main.cc)
target_link_libraries(gmock_main_no_exception PUBLIC gmock) target_link_libraries(gmock_main_no_exception PUBLIC gmock)
cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" src/gmock_main.cc) cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" src/gmock_main.cc)
target_link_libraries(gmock_main_no_rtti PUBLIC gmock) 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() endif()
cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}" cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}"
gmock_main_no_exception test/gmock-more-actions_test.cc) gmock_main_no_exception test/gmock-more-actions_test.cc)
......
...@@ -439,7 +439,7 @@ class Action { ...@@ -439,7 +439,7 @@ class Action {
// template <typename Result, typename ArgumentTuple> // template <typename Result, typename ArgumentTuple>
// Result Perform(const ArgumentTuple& args) const { // Result Perform(const ArgumentTuple& args) const {
// // Processes the arguments and returns a result, using // // Processes the arguments and returns a result, using
// // tr1::get<N>(args) to get the N-th (0-based) argument in the tuple. // // std::get<N>(args) to get the N-th (0-based) argument in the tuple.
// } // }
// ... // ...
// }; // };
...@@ -838,7 +838,7 @@ class SetArgumentPointeeAction { ...@@ -838,7 +838,7 @@ class SetArgumentPointeeAction {
template <typename Result, typename ArgumentTuple> template <typename Result, typename ArgumentTuple>
void Perform(const ArgumentTuple& args) const { void Perform(const ArgumentTuple& args) const {
CompileAssertTypesEqual<void, Result>(); CompileAssertTypesEqual<void, Result>();
*::testing::get<N>(args) = value_; *::std::get<N>(args) = value_;
} }
private: private:
...@@ -861,7 +861,7 @@ class SetArgumentPointeeAction<N, Proto, true> { ...@@ -861,7 +861,7 @@ class SetArgumentPointeeAction<N, Proto, true> {
template <typename Result, typename ArgumentTuple> template <typename Result, typename ArgumentTuple>
void Perform(const ArgumentTuple& args) const { void Perform(const ArgumentTuple& args) const {
CompileAssertTypesEqual<void, Result>(); CompileAssertTypesEqual<void, Result>();
::testing::get<N>(args)->CopyFrom(*proto_); ::std::get<N>(args)->CopyFrom(*proto_);
} }
private: private:
......
...@@ -63,19 +63,19 @@ $range j 1..i ...@@ -63,19 +63,19 @@ $range j 1..i
$var types = [[$for j [[, typename A$j]]]] $var types = [[$for j [[, typename A$j]]]]
$var as = [[$for j, [[A$j]]]] $var as = [[$for j, [[A$j]]]]
$var args = [[$if i==0 [[]] $else [[ args]]]] $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 <typename R$types> template <typename R$types>
class InvokeHelper<R, ::testing::tuple<$as> > { class InvokeHelper<R, ::std::tuple<$as> > {
public: public:
template <typename Function> template <typename Function>
static R Invoke(Function function, const ::testing::tuple<$as>&$args) { static R Invoke(Function function, const ::std::tuple<$as>&$args) {
return function($gets); return function($gets);
} }
template <class Class, typename MethodPtr> template <class Class, typename MethodPtr>
static R InvokeMethod(Class* obj_ptr, static R InvokeMethod(Class* obj_ptr,
MethodPtr method_ptr, MethodPtr method_ptr,
const ::testing::tuple<$as>&$args) { const ::std::tuple<$as>&$args) {
return (obj_ptr->*method_ptr)($gets); return (obj_ptr->*method_ptr)($gets);
} }
...@@ -83,7 +83,7 @@ class InvokeHelper<R, ::testing::tuple<$as> > { ...@@ -83,7 +83,7 @@ class InvokeHelper<R, ::testing::tuple<$as> > {
$if i <= max_callback_arity [[ $if i <= max_callback_arity [[
template <typename CallbackType> template <typename CallbackType>
static R InvokeCallback(CallbackType* callback, static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<$as>&$args) { const ::std::tuple<$as>&$args) {
return callback->Run($gets); return callback->Run($gets);
} }
]] $else [[ ]] $else [[
...@@ -122,7 +122,7 @@ class InvokeCallbackAction { ...@@ -122,7 +122,7 @@ class InvokeCallbackAction {
// An INTERNAL macro for extracting the type of a tuple field. It's // An INTERNAL macro for extracting the type of a tuple field. It's
// subject to change without notice - DO NOT USE IN USER CODE! // subject to change without notice - DO NOT USE IN USER CODE!
#define GMOCK_FIELD_(Tuple, N) \ #define GMOCK_FIELD_(Tuple, N) \
typename ::testing::tuple_element<N, Tuple>::type typename ::std::tuple_element<N, Tuple>::type
$range i 1..n $range i 1..n
...@@ -130,14 +130,14 @@ $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 // type of an n-ary function whose i-th (1-based) argument type is the
// k{i}-th (0-based) field of ArgumentTuple, which must be a tuple // k{i}-th (0-based) field of ArgumentTuple, which must be a tuple
// type, and whose return type is Result. For example, // type, and whose return type is Result. For example,
// SelectArgs<int, ::testing::tuple<bool, char, double, long>, 0, 3>::type // SelectArgs<int, ::std::tuple<bool, char, double, long>, 0, 3>::type
// is int(bool, long). // is int(bool, long).
// //
// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args) // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args)
// returns the selected fields (k1, k2, ..., k_n) of args as a tuple. // returns the selected fields (k1, k2, ..., k_n) of args as a tuple.
// For example, // For example,
// SelectArgs<int, tuple<bool, char, double>, 2, 0>::Select( // SelectArgs<int, std::tuple<bool, char, double>, 2, 0>::Select(
// ::testing::make_tuple(true, 'a', 2.5)) // ::std::make_tuple(true, 'a', 2.5))
// returns tuple (2.5, true). // returns tuple (2.5, true).
// //
// The numbers in list k1, k2, ..., k_n must be >= 0, where n can be // The numbers in list k1, k2, ..., k_n must be >= 0, where n can be
...@@ -150,7 +150,7 @@ class SelectArgs { ...@@ -150,7 +150,7 @@ class SelectArgs {
typedef Result type($for i, [[GMOCK_FIELD_(ArgumentTuple, k$i)]]); typedef Result type($for i, [[GMOCK_FIELD_(ArgumentTuple, k$i)]]);
typedef typename Function<type>::ArgumentTuple SelectedArgs; typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& args) { static SelectedArgs Select(const ArgumentTuple& args) {
return SelectedArgs($for i, [[get<k$i>(args)]]); return SelectedArgs($for i, [[std::get<k$i>(args)]]);
} }
}; };
...@@ -166,7 +166,7 @@ class SelectArgs<Result, ArgumentTuple, ...@@ -166,7 +166,7 @@ class SelectArgs<Result, ArgumentTuple,
typedef typename Function<type>::ArgumentTuple SelectedArgs; typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& [[]] static SelectedArgs Select(const ArgumentTuple& [[]]
$if i == 1 [[/* args */]] $else [[args]]) { $if i == 1 [[/* args */]] $else [[args]]) {
return SelectedArgs($for j1, [[get<k$j1>(args)]]); return SelectedArgs($for j1, [[std::get<k$j1>(args)]]);
} }
}; };
...@@ -240,12 +240,12 @@ $range j 0..i-1 ...@@ -240,12 +240,12 @@ $range j 0..i-1
]]]] ]]]]
$range j 0..i-1 $range j 0..i-1
$var As = [[$for j, [[A$j]]]] $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 $range k 1..n-i
$var eas = [[$for k, [[ExcessiveArg()]]]] $var eas = [[$for k, [[ExcessiveArg()]]]]
$var arg_list = [[$if (i==0) | (i==n) [[$as$eas]] $else [[$as, $eas]]]] $var arg_list = [[$if (i==0) | (i==n) [[$as$eas]] $else [[$as, $eas]]]]
$template $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); return impl->template gmock_PerformImpl<$As>(args, $arg_list);
} }
...@@ -395,8 +395,8 @@ $range j2 2..i ...@@ -395,8 +395,8 @@ $range j2 2..i
// //
// MORE INFORMATION: // MORE INFORMATION:
// //
// To learn more about using these macros, please search for 'ACTION' // To learn more about using these macros, please search for 'ACTION' on
// on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md // https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md
$range i 0..n $range i 0..n
$range k 0..n-1 $range k 0..n-1
...@@ -432,7 +432,7 @@ $for k [[, \ ...@@ -432,7 +432,7 @@ $for k [[, \
// ACTION_TEMPLATE(DuplicateArg, // ACTION_TEMPLATE(DuplicateArg,
// HAS_2_TEMPLATE_PARAMS(int, k, typename, T), // HAS_2_TEMPLATE_PARAMS(int, k, typename, T),
// AND_1_VALUE_PARAMS(output)) { // AND_1_VALUE_PARAMS(output)) {
// *output = T(::testing::get<k>(args)); // *output = T(::std::get<k>(args));
// } // }
// ... // ...
// int n; // int n;
...@@ -796,7 +796,7 @@ ACTION_TEMPLATE(InvokeArgument, ...@@ -796,7 +796,7 @@ ACTION_TEMPLATE(InvokeArgument,
using internal::invoke_argument::InvokeArgumentAdl; using internal::invoke_argument::InvokeArgumentAdl;
return InvokeArgumentAdl<return_type>( return InvokeArgumentAdl<return_type>(
internal::invoke_argument::AdlTag(), internal::invoke_argument::AdlTag(),
::testing::get<k>(args)$for j [[, p$j]]); ::std::get<k>(args)$for j [[, p$j]]);
} }
]] ]]
......
...@@ -81,7 +81,7 @@ class FunctionMocker<R($As)> : public ...@@ -81,7 +81,7 @@ class FunctionMocker<R($As)> : public
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
MockSpec<F> With($matchers) { MockSpec<F> With($matchers) {
return MockSpec<F>(this, ::testing::make_tuple($ms)); return MockSpec<F>(this, ::std::make_tuple($ms));
} }
R Invoke($Aas) { R Invoke($Aas) {
...@@ -194,7 +194,7 @@ $var anything_matchers = [[$for j, \ ...@@ -194,7 +194,7 @@ $var anything_matchers = [[$for j, \
#define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, ...) \ #define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
$arg_as) constness { \ $arg_as) constness { \
GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ GTEST_COMPILE_ASSERT_((::std::tuple_size< \
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value == $i), \ tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value == $i), \
this_method_does_not_take_$i[[]]_argument[[$if i != 1 [[s]]]]); \ this_method_does_not_take_$i[[]]_argument[[$if i != 1 [[s]]]]); \
GMOCK_MOCKER_($i, constness, Method).SetOwnerAndName(this, #Method); \ GMOCK_MOCKER_($i, constness, Method).SetOwnerAndName(this, #Method); \
......
...@@ -51,7 +51,7 @@ namespace internal { ...@@ -51,7 +51,7 @@ namespace internal {
// The type of the i-th (0-based) field of Tuple. // The type of the i-th (0-based) field of Tuple.
#define GMOCK_FIELD_TYPE_(Tuple, i) \ #define GMOCK_FIELD_TYPE_(Tuple, i) \
typename ::testing::tuple_element<i, Tuple>::type typename ::std::tuple_element<i, Tuple>::type
// TupleFields<Tuple, k0, ..., kn> is for selecting fields from a // TupleFields<Tuple, k0, ..., kn> is for selecting fields from a
// tuple of type Tuple. It has two members: // tuple of type Tuple. It has two members:
...@@ -59,10 +59,11 @@ namespace internal { ...@@ -59,10 +59,11 @@ namespace internal {
// type: a tuple type whose i-th field is the ki-th field of Tuple. // 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. // GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple.
// //
// For example, in class TupleFields<tuple<bool, char, int>, 2, 0>, we have: // For example, in class TupleFields<std::tuple<bool, char, int>, 2, 0>,
// we have:
// //
// type is tuple<int, bool>, and // type is std::tuple<int, bool>, and
// GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true). // GetSelectedFields(std::make_tuple(true, 'a', 42)) is (42, true).
template <class Tuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1, template <class Tuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1,
int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1, int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
...@@ -74,15 +75,15 @@ template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6, ...@@ -74,15 +75,15 @@ template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
int k7, int k8, int k9> int k7, int k8, int k9>
class TupleFields { class TupleFields {
public: public:
typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), typedef ::std::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), GMOCK_FIELD_TYPE_(Tuple,
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), k1), GMOCK_FIELD_TYPE_(Tuple, k2), GMOCK_FIELD_TYPE_(Tuple, k3),
GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), GMOCK_FIELD_TYPE_(Tuple, k4), GMOCK_FIELD_TYPE_(Tuple, k5),
GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6), GMOCK_FIELD_TYPE_(Tuple, k6), GMOCK_FIELD_TYPE_(Tuple, k7),
GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8), GMOCK_FIELD_TYPE_(Tuple, k8), GMOCK_FIELD_TYPE_(Tuple, k9)> type;
GMOCK_FIELD_TYPE_(Tuple, k9)> type;
static type GetSelectedFields(const Tuple& t) { static type GetSelectedFields(const Tuple& t) {
return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), return type(std::get<k0>(t), std::get<k1>(t), std::get<k2>(t),
get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t), get<k9>(t)); std::get<k3>(t), std::get<k4>(t), std::get<k5>(t), std::get<k6>(t),
std::get<k7>(t), std::get<k8>(t), std::get<k9>(t));
} }
}; };
...@@ -91,7 +92,7 @@ class TupleFields { ...@@ -91,7 +92,7 @@ class TupleFields {
template <class Tuple> template <class Tuple>
class TupleFields<Tuple, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> { class TupleFields<Tuple, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
public: public:
typedef ::testing::tuple<> type; typedef ::std::tuple<> type;
static type GetSelectedFields(const Tuple& /* t */) { static type GetSelectedFields(const Tuple& /* t */) {
return type(); return type();
} }
...@@ -100,77 +101,77 @@ class TupleFields<Tuple, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> { ...@@ -100,77 +101,77 @@ class TupleFields<Tuple, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
template <class Tuple, int k0> template <class Tuple, int k0>
class TupleFields<Tuple, k0, -1, -1, -1, -1, -1, -1, -1, -1, -1> { class TupleFields<Tuple, k0, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
public: public:
typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0)> type; typedef ::std::tuple<GMOCK_FIELD_TYPE_(Tuple, k0)> type;
static type GetSelectedFields(const Tuple& t) { static type GetSelectedFields(const Tuple& t) {
return type(get<k0>(t)); return type(std::get<k0>(t));
} }
}; };
template <class Tuple, int k0, int k1> template <class Tuple, int k0, int k1>
class TupleFields<Tuple, k0, k1, -1, -1, -1, -1, -1, -1, -1, -1> { class TupleFields<Tuple, k0, k1, -1, -1, -1, -1, -1, -1, -1, -1> {
public: public:
typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), typedef ::std::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), GMOCK_FIELD_TYPE_(Tuple,
GMOCK_FIELD_TYPE_(Tuple, k1)> type; k1)> type;
static type GetSelectedFields(const Tuple& t) { static type GetSelectedFields(const Tuple& t) {
return type(get<k0>(t), get<k1>(t)); return type(std::get<k0>(t), std::get<k1>(t));
} }
}; };
template <class Tuple, int k0, int k1, int k2> template <class Tuple, int k0, int k1, int k2>
class TupleFields<Tuple, k0, k1, k2, -1, -1, -1, -1, -1, -1, -1> { class TupleFields<Tuple, k0, k1, k2, -1, -1, -1, -1, -1, -1, -1> {
public: public:
typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), typedef ::std::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), GMOCK_FIELD_TYPE_(Tuple,
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2)> type; k1), GMOCK_FIELD_TYPE_(Tuple, k2)> type;
static type GetSelectedFields(const Tuple& t) { static type GetSelectedFields(const Tuple& t) {
return type(get<k0>(t), get<k1>(t), get<k2>(t)); return type(std::get<k0>(t), std::get<k1>(t), std::get<k2>(t));
} }
}; };
template <class Tuple, int k0, int k1, int k2, int k3> template <class Tuple, int k0, int k1, int k2, int k3>
class TupleFields<Tuple, k0, k1, k2, k3, -1, -1, -1, -1, -1, -1> { class TupleFields<Tuple, k0, k1, k2, k3, -1, -1, -1, -1, -1, -1> {
public: public:
typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), typedef ::std::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), GMOCK_FIELD_TYPE_(Tuple,
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), k1), GMOCK_FIELD_TYPE_(Tuple, k2), GMOCK_FIELD_TYPE_(Tuple, k3)> type;
GMOCK_FIELD_TYPE_(Tuple, k3)> type;
static type GetSelectedFields(const Tuple& t) { static type GetSelectedFields(const Tuple& t) {
return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t)); return type(std::get<k0>(t), std::get<k1>(t), std::get<k2>(t),
std::get<k3>(t));
} }
}; };
template <class Tuple, int k0, int k1, int k2, int k3, int k4> template <class Tuple, int k0, int k1, int k2, int k3, int k4>
class TupleFields<Tuple, k0, k1, k2, k3, k4, -1, -1, -1, -1, -1> { class TupleFields<Tuple, k0, k1, k2, k3, k4, -1, -1, -1, -1, -1> {
public: public:
typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), typedef ::std::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), GMOCK_FIELD_TYPE_(Tuple,
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), k1), GMOCK_FIELD_TYPE_(Tuple, k2), GMOCK_FIELD_TYPE_(Tuple, k3),
GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4)> type; GMOCK_FIELD_TYPE_(Tuple, k4)> type;
static type GetSelectedFields(const Tuple& t) { static type GetSelectedFields(const Tuple& t) {
return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t)); return type(std::get<k0>(t), std::get<k1>(t), std::get<k2>(t),
std::get<k3>(t), std::get<k4>(t));
} }
}; };
template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5> template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5>
class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, -1, -1, -1, -1> { class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, -1, -1, -1, -1> {
public: public:
typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), typedef ::std::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), GMOCK_FIELD_TYPE_(Tuple,
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), k1), GMOCK_FIELD_TYPE_(Tuple, k2), GMOCK_FIELD_TYPE_(Tuple, k3),
GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), GMOCK_FIELD_TYPE_(Tuple, k4), GMOCK_FIELD_TYPE_(Tuple, k5)> type;
GMOCK_FIELD_TYPE_(Tuple, k5)> type;
static type GetSelectedFields(const Tuple& t) { static type GetSelectedFields(const Tuple& t) {
return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), return type(std::get<k0>(t), std::get<k1>(t), std::get<k2>(t),
get<k5>(t)); std::get<k3>(t), std::get<k4>(t), std::get<k5>(t));
} }
}; };
template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6> template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6>
class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, -1, -1, -1> { class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, -1, -1, -1> {
public: public:
typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), typedef ::std::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), GMOCK_FIELD_TYPE_(Tuple,
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), k1), GMOCK_FIELD_TYPE_(Tuple, k2), GMOCK_FIELD_TYPE_(Tuple, k3),
GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), GMOCK_FIELD_TYPE_(Tuple, k4), GMOCK_FIELD_TYPE_(Tuple, k5),
GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6)> type; GMOCK_FIELD_TYPE_(Tuple, k6)> type;
static type GetSelectedFields(const Tuple& t) { static type GetSelectedFields(const Tuple& t) {
return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), return type(std::get<k0>(t), std::get<k1>(t), std::get<k2>(t),
get<k5>(t), get<k6>(t)); std::get<k3>(t), std::get<k4>(t), std::get<k5>(t), std::get<k6>(t));
} }
}; };
...@@ -178,14 +179,14 @@ template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6, ...@@ -178,14 +179,14 @@ template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
int k7> int k7>
class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, -1, -1> { class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, -1, -1> {
public: public:
typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), typedef ::std::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), GMOCK_FIELD_TYPE_(Tuple,
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), k1), GMOCK_FIELD_TYPE_(Tuple, k2), GMOCK_FIELD_TYPE_(Tuple, k3),
GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), GMOCK_FIELD_TYPE_(Tuple, k4), GMOCK_FIELD_TYPE_(Tuple, k5),
GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6), GMOCK_FIELD_TYPE_(Tuple, k6), GMOCK_FIELD_TYPE_(Tuple, k7)> type;
GMOCK_FIELD_TYPE_(Tuple, k7)> type;
static type GetSelectedFields(const Tuple& t) { static type GetSelectedFields(const Tuple& t) {
return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), return type(std::get<k0>(t), std::get<k1>(t), std::get<k2>(t),
get<k5>(t), get<k6>(t), get<k7>(t)); std::get<k3>(t), std::get<k4>(t), std::get<k5>(t), std::get<k6>(t),
std::get<k7>(t));
} }
}; };
...@@ -193,14 +194,15 @@ template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6, ...@@ -193,14 +194,15 @@ template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
int k7, int k8> int k7, int k8>
class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, k8, -1> { class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, k8, -1> {
public: public:
typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), typedef ::std::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), GMOCK_FIELD_TYPE_(Tuple,
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), k1), GMOCK_FIELD_TYPE_(Tuple, k2), GMOCK_FIELD_TYPE_(Tuple, k3),
GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), GMOCK_FIELD_TYPE_(Tuple, k4), GMOCK_FIELD_TYPE_(Tuple, k5),
GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6), GMOCK_FIELD_TYPE_(Tuple, k6), GMOCK_FIELD_TYPE_(Tuple, k7),
GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8)> type; GMOCK_FIELD_TYPE_(Tuple, k8)> type;
static type GetSelectedFields(const Tuple& t) { static type GetSelectedFields(const Tuple& t) {
return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), return type(std::get<k0>(t), std::get<k1>(t), std::get<k2>(t),
get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t)); std::get<k3>(t), std::get<k4>(t), std::get<k5>(t), std::get<k6>(t),
std::get<k7>(t), std::get<k8>(t));
} }
}; };
...@@ -466,6 +468,7 @@ Args(const InnerMatcher& matcher) { ...@@ -466,6 +468,7 @@ Args(const InnerMatcher& matcher) {
} }
// AnyOf(m1, m2, ..., mk) matches any value that matches any of the given // AnyOf(m1, m2, ..., mk) matches any value that matches any of the given
// sub-matchers. AnyOf is called fully qualified to prevent ADL from firing. // 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) { ...@@ -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(\ return ::testing::internal::FormatMatcherDescription(\
negation, #name, \ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<>()));\ ::std::tuple<>()));\
}\ }\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
...@@ -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) { ...@@ -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(\ return ::testing::internal::FormatMatcherDescription(\
negation, #name, \ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<p0##_type>(p0)));\ ::std::tuple<p0##_type>(p0)));\
}\ }\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
...@@ -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) { ...@@ -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(\ return ::testing::internal::FormatMatcherDescription(\
negation, #name, \ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<p0##_type, p1##_type>(p0, p1)));\ ::std::tuple<p0##_type, p1##_type>(p0, p1)));\
}\ }\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
...@@ -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) { ...@@ -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(\ return ::testing::internal::FormatMatcherDescription(\
negation, #name, \ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \ ::std::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, p2)));\
p2)));\
}\ }\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
...@@ -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) { ...@@ -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(\ return ::testing::internal::FormatMatcherDescription(\
negation, #name, \ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<p0##_type, p1##_type, p2##_type, \ ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type>(p0, \
p3##_type>(p0, p1, p2, p3)));\ p1, p2, p3)));\
}\ }\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
...@@ -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) { ...@@ -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(\ return ::testing::internal::FormatMatcherDescription(\
negation, #name, \ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type>(p0, p1, p2, p3, p4)));\ p4##_type>(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) { ...@@ -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(\ return ::testing::internal::FormatMatcherDescription(\
negation, #name, \ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\ p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\
}\ }\
};\ };\
...@@ -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) { ...@@ -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(\ return ::testing::internal::FormatMatcherDescription(\
negation, #name, \ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \ p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \
p6)));\ p6)));\
}\ }\
...@@ -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) { ...@@ -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(\ return ::testing::internal::FormatMatcherDescription(\
negation, #name, \ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \ p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \
p3, p4, p5, p6, p7)));\ p3, p4, p5, p6, p7)));\
}\ }\
...@@ -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) { ...@@ -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(\ return ::testing::internal::FormatMatcherDescription(\
negation, #name, \ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type, p5##_type, p6##_type, p7##_type, \ p4##_type, p5##_type, p6##_type, p7##_type, \
p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\ p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\
}\ }\
...@@ -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) { ...@@ -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(\ return ::testing::internal::FormatMatcherDescription(\
negation, #name, \ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\ p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\
}\ }\
......
...@@ -55,7 +55,7 @@ $range i 0..n-1 ...@@ -55,7 +55,7 @@ $range i 0..n-1
// The type of the i-th (0-based) field of Tuple. // The type of the i-th (0-based) field of Tuple.
#define GMOCK_FIELD_TYPE_(Tuple, i) \ #define GMOCK_FIELD_TYPE_(Tuple, i) \
typename ::testing::tuple_element<i, Tuple>::type typename ::std::tuple_element<i, Tuple>::type
// TupleFields<Tuple, k0, ..., kn> is for selecting fields from a // TupleFields<Tuple, k0, ..., kn> is for selecting fields from a
// tuple of type Tuple. It has two members: // tuple of type Tuple. It has two members:
...@@ -63,10 +63,11 @@ $range i 0..n-1 ...@@ -63,10 +63,11 @@ $range i 0..n-1
// type: a tuple type whose i-th field is the ki-th field of Tuple. // 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. // GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple.
// //
// For example, in class TupleFields<tuple<bool, char, int>, 2, 0>, we have: // For example, in class TupleFields<std::tuple<bool, char, int>, 2, 0>,
// we have:
// //
// type is tuple<int, bool>, and // type is std::tuple<int, bool>, and
// GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true). // GetSelectedFields(std::make_tuple(true, 'a', 42)) is (42, true).
template <class Tuple$for i [[, int k$i = -1]]> template <class Tuple$for i [[, int k$i = -1]]>
class TupleFields; class TupleFields;
...@@ -75,9 +76,9 @@ class TupleFields; ...@@ -75,9 +76,9 @@ class TupleFields;
template <class Tuple$for i [[, int k$i]]> template <class Tuple$for i [[, int k$i]]>
class TupleFields { class TupleFields {
public: 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) { static type GetSelectedFields(const Tuple& t) {
return type($for i, [[get<k$i>(t)]]); return type($for i, [[std::get<k$i>(t)]]);
} }
}; };
...@@ -91,9 +92,9 @@ $range k 0..n-1 ...@@ -91,9 +92,9 @@ $range k 0..n-1
template <class Tuple$for j [[, int k$j]]> template <class Tuple$for j [[, int k$j]]>
class TupleFields<Tuple, $for k, [[$if k < i [[k$k]] $else [[-1]]]]> { class TupleFields<Tuple, $for k, [[$if k < i [[k$k]] $else [[-1]]]]> {
public: public:
typedef ::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]]) { static type GetSelectedFields(const Tuple& $if i==0 [[/* t */]] $else [[t]]) {
return type($for j, [[get<k$j>(t)]]); return type($for j, [[std::get<k$j>(t)]]);
} }
}; };
...@@ -534,7 +535,7 @@ $var param_field_decls2 = [[$for j ...@@ -534,7 +535,7 @@ $var param_field_decls2 = [[$for j
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
negation, #name, \ negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::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 <typename arg_type>\ template <typename arg_type>\
......
...@@ -905,8 +905,8 @@ class TuplePrefix { ...@@ -905,8 +905,8 @@ class TuplePrefix {
template <typename MatcherTuple, typename ValueTuple> template <typename MatcherTuple, typename ValueTuple>
static bool Matches(const MatcherTuple& matcher_tuple, static bool Matches(const MatcherTuple& matcher_tuple,
const ValueTuple& value_tuple) { const ValueTuple& value_tuple) {
return TuplePrefix<N - 1>::Matches(matcher_tuple, value_tuple) return TuplePrefix<N - 1>::Matches(matcher_tuple, value_tuple) &&
&& get<N - 1>(matcher_tuple).Matches(get<N - 1>(value_tuple)); std::get<N - 1>(matcher_tuple).Matches(std::get<N - 1>(value_tuple));
} }
// TuplePrefix<N>::ExplainMatchFailuresTo(matchers, values, os) // TuplePrefix<N>::ExplainMatchFailuresTo(matchers, values, os)
...@@ -922,16 +922,16 @@ class TuplePrefix { ...@@ -922,16 +922,16 @@ class TuplePrefix {
// Then describes the failure (if any) in the (N - 1)-th (0-based) // Then describes the failure (if any) in the (N - 1)-th (0-based)
// field. // field.
typename tuple_element<N - 1, MatcherTuple>::type matcher = typename std::tuple_element<N - 1, MatcherTuple>::type matcher =
get<N - 1>(matchers); std::get<N - 1>(matchers);
typedef typename tuple_element<N - 1, ValueTuple>::type Value; typedef typename std::tuple_element<N - 1, ValueTuple>::type Value;
GTEST_REFERENCE_TO_CONST_(Value) value = get<N - 1>(values); GTEST_REFERENCE_TO_CONST_(Value) value = std::get<N - 1>(values);
StringMatchResultListener listener; StringMatchResultListener listener;
if (!matcher.MatchAndExplain(value, &listener)) { if (!matcher.MatchAndExplain(value, &listener)) {
// FIXME: include in the message the name of the parameter // FIXME: include in the message the name of the parameter
// as used in MOCK_METHOD*() when possible. // as used in MOCK_METHOD*() when possible.
*os << " Expected arg #" << N - 1 << ": "; *os << " Expected arg #" << N - 1 << ": ";
get<N - 1>(matchers).DescribeTo(os); std::get<N - 1>(matchers).DescribeTo(os);
*os << "\n Actual: "; *os << "\n Actual: ";
// We remove the reference in type Value to prevent the // We remove the reference in type Value to prevent the
// universal printer from printing the address of value, which // universal printer from printing the address of value, which
...@@ -971,11 +971,11 @@ bool TupleMatches(const MatcherTuple& matcher_tuple, ...@@ -971,11 +971,11 @@ bool TupleMatches(const MatcherTuple& matcher_tuple,
const ValueTuple& value_tuple) { const ValueTuple& value_tuple) {
// Makes sure that matcher_tuple and value_tuple have the same // Makes sure that matcher_tuple and value_tuple have the same
// number of fields. // number of fields.
GTEST_COMPILE_ASSERT_(tuple_size<MatcherTuple>::value == GTEST_COMPILE_ASSERT_(std::tuple_size<MatcherTuple>::value ==
tuple_size<ValueTuple>::value, std::tuple_size<ValueTuple>::value,
matcher_and_value_have_different_numbers_of_fields); matcher_and_value_have_different_numbers_of_fields);
return TuplePrefix<tuple_size<ValueTuple>::value>:: return TuplePrefix<std::tuple_size<ValueTuple>::value>::Matches(matcher_tuple,
Matches(matcher_tuple, value_tuple); value_tuple);
} }
// Describes failures in matching matchers against values. If there // Describes failures in matching matchers against values. If there
...@@ -984,7 +984,7 @@ template <typename MatcherTuple, typename ValueTuple> ...@@ -984,7 +984,7 @@ template <typename MatcherTuple, typename ValueTuple>
void ExplainMatchFailureTupleTo(const MatcherTuple& matchers, void ExplainMatchFailureTupleTo(const MatcherTuple& matchers,
const ValueTuple& values, const ValueTuple& values,
::std::ostream* os) { ::std::ostream* os) {
TuplePrefix<tuple_size<MatcherTuple>::value>::ExplainMatchFailuresTo( TuplePrefix<std::tuple_size<MatcherTuple>::value>::ExplainMatchFailuresTo(
matchers, values, os); matchers, values, os);
} }
...@@ -995,7 +995,7 @@ void ExplainMatchFailureTupleTo(const MatcherTuple& matchers, ...@@ -995,7 +995,7 @@ void ExplainMatchFailureTupleTo(const MatcherTuple& matchers,
template <typename Tuple, typename Func, typename OutIter> template <typename Tuple, typename Func, typename OutIter>
class TransformTupleValuesHelper { class TransformTupleValuesHelper {
private: private:
typedef ::testing::tuple_size<Tuple> TupleSize; typedef ::std::tuple_size<Tuple> TupleSize;
public: public:
// For each member of tuple 't', taken in order, evaluates '*out++ = f(t)'. // For each member of tuple 't', taken in order, evaluates '*out++ = f(t)'.
...@@ -1008,7 +1008,7 @@ class TransformTupleValuesHelper { ...@@ -1008,7 +1008,7 @@ class TransformTupleValuesHelper {
template <typename Tup, size_t kRemainingSize> template <typename Tup, size_t kRemainingSize>
struct IterateOverTuple { struct IterateOverTuple {
OutIter operator() (Func f, const Tup& t, OutIter out) const { OutIter operator() (Func f, const Tup& t, OutIter out) const {
*out++ = f(::testing::get<TupleSize::value - kRemainingSize>(t)); *out++ = f(::std::get<TupleSize::value - kRemainingSize>(t));
return IterateOverTuple<Tup, kRemainingSize - 1>()(f, t, out); return IterateOverTuple<Tup, kRemainingSize - 1>()(f, t, out);
} }
}; };
...@@ -1597,19 +1597,19 @@ class MatchesRegexMatcher { ...@@ -1597,19 +1597,19 @@ class MatchesRegexMatcher {
// compared don't have to have the same type. // compared don't have to have the same type.
// //
// The matcher defined here is polymorphic (for example, Eq() can be // The matcher defined here is polymorphic (for example, Eq() can be
// used to match a tuple<int, short>, a tuple<const long&, double>, // used to match a std::tuple<int, short>, a std::tuple<const long&, double>,
// etc). Therefore we use a template type conversion operator in the // etc). Therefore we use a template type conversion operator in the
// implementation. // implementation.
template <typename D, typename Op> template <typename D, typename Op>
class PairMatchBase { class PairMatchBase {
public: public:
template <typename T1, typename T2> template <typename T1, typename T2>
operator Matcher< ::testing::tuple<T1, T2> >() const { operator Matcher<::std::tuple<T1, T2>>() const {
return MakeMatcher(new Impl< ::testing::tuple<T1, T2> >); return MakeMatcher(new Impl<::std::tuple<T1, T2>>);
} }
template <typename T1, typename T2> template <typename T1, typename T2>
operator Matcher<const ::testing::tuple<T1, T2>&>() const { operator Matcher<const ::std::tuple<T1, T2>&>() const {
return MakeMatcher(new Impl<const ::testing::tuple<T1, T2>&>); return MakeMatcher(new Impl<const ::std::tuple<T1, T2>&>);
} }
private: private:
...@@ -1623,7 +1623,7 @@ class PairMatchBase { ...@@ -1623,7 +1623,7 @@ class PairMatchBase {
virtual bool MatchAndExplain( virtual bool MatchAndExplain(
Tuple args, Tuple args,
MatchResultListener* /* listener */) const { 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 { virtual void DescribeTo(::std::ostream* os) const {
*os << "are " << GetDesc; *os << "are " << GetDesc;
...@@ -1807,7 +1807,7 @@ class VariadicMatcher { ...@@ -1807,7 +1807,7 @@ class VariadicMatcher {
std::vector<Matcher<T> >*, std::vector<Matcher<T> >*,
std::integral_constant<size_t, sizeof...(Args)>) const {} std::integral_constant<size_t, sizeof...(Args)>) const {}
tuple<Args...> matchers_; std::tuple<Args...> matchers_;
GTEST_DISALLOW_ASSIGN_(VariadicMatcher); GTEST_DISALLOW_ASSIGN_(VariadicMatcher);
}; };
...@@ -2220,14 +2220,14 @@ class FloatingEq2Matcher { ...@@ -2220,14 +2220,14 @@ class FloatingEq2Matcher {
} }
template <typename T1, typename T2> template <typename T1, typename T2>
operator Matcher< ::testing::tuple<T1, T2> >() const { operator Matcher<::std::tuple<T1, T2>>() const {
return MakeMatcher( return MakeMatcher(
new Impl< ::testing::tuple<T1, T2> >(max_abs_error_, nan_eq_nan_)); new Impl<::std::tuple<T1, T2>>(max_abs_error_, nan_eq_nan_));
} }
template <typename T1, typename T2> template <typename T1, typename T2>
operator Matcher<const ::testing::tuple<T1, T2>&>() const { operator Matcher<const ::std::tuple<T1, T2>&>() const {
return MakeMatcher( return MakeMatcher(
new Impl<const ::testing::tuple<T1, T2>&>(max_abs_error_, nan_eq_nan_)); new Impl<const ::std::tuple<T1, T2>&>(max_abs_error_, nan_eq_nan_));
} }
private: private:
...@@ -2245,14 +2245,14 @@ class FloatingEq2Matcher { ...@@ -2245,14 +2245,14 @@ class FloatingEq2Matcher {
virtual bool MatchAndExplain(Tuple args, virtual bool MatchAndExplain(Tuple args,
MatchResultListener* listener) const { MatchResultListener* listener) const {
if (max_abs_error_ == -1) { if (max_abs_error_ == -1) {
FloatingEqMatcher<FloatType> fm(::testing::get<0>(args), nan_eq_nan_); FloatingEqMatcher<FloatType> fm(::std::get<0>(args), nan_eq_nan_);
return static_cast<Matcher<FloatType> >(fm).MatchAndExplain( return static_cast<Matcher<FloatType>>(fm).MatchAndExplain(
::testing::get<1>(args), listener); ::std::get<1>(args), listener);
} else { } else {
FloatingEqMatcher<FloatType> fm(::testing::get<0>(args), nan_eq_nan_, FloatingEqMatcher<FloatType> fm(::std::get<0>(args), nan_eq_nan_,
max_abs_error_); max_abs_error_);
return static_cast<Matcher<FloatType> >(fm).MatchAndExplain( return static_cast<Matcher<FloatType>>(fm).MatchAndExplain(
::testing::get<1>(args), listener); ::std::get<1>(args), listener);
} }
} }
virtual void DescribeTo(::std::ostream* os) const { virtual void DescribeTo(::std::ostream* os) const {
...@@ -2956,7 +2956,7 @@ class WhenSortedByMatcher { ...@@ -2956,7 +2956,7 @@ class WhenSortedByMatcher {
}; };
// Implements Pointwise(tuple_matcher, rhs_container). tuple_matcher // Implements Pointwise(tuple_matcher, rhs_container). tuple_matcher
// must be able to be safely cast to Matcher<tuple<const T1&, const // must be able to be safely cast to Matcher<std::tuple<const T1&, const
// T2&> >, where T1 and T2 are the types of elements in the LHS // T2&> >, where T1 and T2 are the types of elements in the LHS
// container and the RHS container respectively. // container and the RHS container respectively.
template <typename TupleMatcher, typename RhsContainer> template <typename TupleMatcher, typename RhsContainer>
...@@ -3001,7 +3001,7 @@ class PointwiseMatcher { ...@@ -3001,7 +3001,7 @@ class PointwiseMatcher {
// reference, as they may be expensive to copy. We must use tuple // reference, as they may be expensive to copy. We must use tuple
// instead of pair here, as a pair cannot hold references (C++ 98, // instead of pair here, as a pair cannot hold references (C++ 98,
// 20.2.2 [lib.pairs]). // 20.2.2 [lib.pairs]).
typedef ::testing::tuple<const LhsValue&, const RhsValue&> InnerMatcherArg; typedef ::std::tuple<const LhsValue&, const RhsValue&> InnerMatcherArg;
Impl(const TupleMatcher& tuple_matcher, const RhsStlContainer& rhs) Impl(const TupleMatcher& tuple_matcher, const RhsStlContainer& rhs)
// mono_tuple_matcher_ holds a monomorphic version of the tuple matcher. // mono_tuple_matcher_ holds a monomorphic version of the tuple matcher.
...@@ -3800,7 +3800,7 @@ class UnorderedElementsAreMatcher { ...@@ -3800,7 +3800,7 @@ class UnorderedElementsAreMatcher {
typedef typename View::value_type Element; typedef typename View::value_type Element;
typedef ::std::vector<Matcher<const Element&> > MatcherVec; typedef ::std::vector<Matcher<const Element&> > MatcherVec;
MatcherVec matchers; MatcherVec matchers;
matchers.reserve(::testing::tuple_size<MatcherTuple>::value); matchers.reserve(::std::tuple_size<MatcherTuple>::value);
TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_, TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_,
::std::back_inserter(matchers)); ::std::back_inserter(matchers));
return MakeMatcher(new UnorderedElementsAreMatcherImpl<Container>( return MakeMatcher(new UnorderedElementsAreMatcherImpl<Container>(
...@@ -3822,7 +3822,7 @@ class ElementsAreMatcher { ...@@ -3822,7 +3822,7 @@ class ElementsAreMatcher {
operator Matcher<Container>() const { operator Matcher<Container>() const {
GTEST_COMPILE_ASSERT_( GTEST_COMPILE_ASSERT_(
!IsHashTable<GTEST_REMOVE_REFERENCE_AND_CONST_(Container)>::value || !IsHashTable<GTEST_REMOVE_REFERENCE_AND_CONST_(Container)>::value ||
::testing::tuple_size<MatcherTuple>::value < 2, ::std::tuple_size<MatcherTuple>::value < 2,
use_UnorderedElementsAre_with_hash_tables); use_UnorderedElementsAre_with_hash_tables);
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
...@@ -3830,7 +3830,7 @@ class ElementsAreMatcher { ...@@ -3830,7 +3830,7 @@ class ElementsAreMatcher {
typedef typename View::value_type Element; typedef typename View::value_type Element;
typedef ::std::vector<Matcher<const Element&> > MatcherVec; typedef ::std::vector<Matcher<const Element&> > MatcherVec;
MatcherVec matchers; MatcherVec matchers;
matchers.reserve(::testing::tuple_size<MatcherTuple>::value); matchers.reserve(::std::tuple_size<MatcherTuple>::value);
TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_, TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_,
::std::back_inserter(matchers)); ::std::back_inserter(matchers));
return MakeMatcher(new ElementsAreMatcherImpl<Container>( return MakeMatcher(new ElementsAreMatcherImpl<Container>(
...@@ -3923,7 +3923,7 @@ class BoundSecondMatcher { ...@@ -3923,7 +3923,7 @@ class BoundSecondMatcher {
template <typename T> template <typename T>
class Impl : public MatcherInterface<T> { class Impl : public MatcherInterface<T> {
public: public:
typedef ::testing::tuple<T, Second> ArgTuple; typedef ::std::tuple<T, Second> ArgTuple;
Impl(const Tuple2Matcher& tm, const Second& second) Impl(const Tuple2Matcher& tm, const Second& second)
: mono_tuple2_matcher_(SafeMatcherCast<const ArgTuple&>(tm)), : mono_tuple2_matcher_(SafeMatcherCast<const ArgTuple&>(tm)),
...@@ -4043,6 +4043,7 @@ class VariantMatcher { ...@@ -4043,6 +4043,7 @@ class VariantMatcher {
template <typename Variant> template <typename Variant>
bool MatchAndExplain(const Variant& value, bool MatchAndExplain(const Variant& value,
::testing::MatchResultListener* listener) const { ::testing::MatchResultListener* listener) const {
using std::get;
if (!listener->IsInterested()) { if (!listener->IsInterested()) {
return holds_alternative<T>(value) && matcher_.Matches(get<T>(value)); return holds_alternative<T>(value) && matcher_.Matches(get<T>(value));
} }
...@@ -4817,7 +4818,7 @@ WhenSorted(const ContainerMatcher& container_matcher) { ...@@ -4817,7 +4818,7 @@ WhenSorted(const ContainerMatcher& container_matcher) {
// Matches an STL-style container or a native array that contains the // Matches an STL-style container or a native array that contains the
// same number of elements as in rhs, where its i-th element and rhs's // same number of elements as in rhs, where its i-th element and rhs's
// i-th element (as a pair) satisfy the given pair matcher, for all i. // i-th element (as a pair) satisfy the given pair matcher, for all i.
// TupleMatcher must be able to be safely cast to Matcher<tuple<const // TupleMatcher must be able to be safely cast to Matcher<std::tuple<const
// T1&, const T2&> >, where T1 and T2 are the types of elements in the // T1&, const T2&> >, where T1 and T2 are the types of elements in the
// LHS container and the RHS container respectively. // LHS container and the RHS container respectively.
template <typename TupleMatcher, typename Container> template <typename TupleMatcher, typename Container>
...@@ -4848,7 +4849,7 @@ inline internal::PointwiseMatcher<TupleMatcher, std::vector<T> > Pointwise( ...@@ -4848,7 +4849,7 @@ inline internal::PointwiseMatcher<TupleMatcher, std::vector<T> > Pointwise(
// elements as in rhs, where in some permutation of the container, its // 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 // 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 // pair matcher, for all i. Tuple2Matcher must be able to be safely
// cast to Matcher<tuple<const T1&, const T2&> >, where T1 and T2 are // cast to Matcher<std::tuple<const T1&, const T2&> >, where T1 and T2 are
// the types of elements in the LHS container and the RHS container // the types of elements in the LHS container and the RHS container
// respectively. // respectively.
// //
...@@ -5140,20 +5141,21 @@ std::string DescribeMatcher(const M& matcher, bool negation = false) { ...@@ -5140,20 +5141,21 @@ std::string DescribeMatcher(const M& matcher, bool negation = false) {
} }
template <typename... Args> template <typename... Args>
internal::ElementsAreMatcher<tuple<typename std::decay<const Args&>::type...>> internal::ElementsAreMatcher<
std::tuple<typename std::decay<const Args&>::type...>>
ElementsAre(const Args&... matchers) { ElementsAre(const Args&... matchers) {
return internal::ElementsAreMatcher< return internal::ElementsAreMatcher<
tuple<typename std::decay<const Args&>::type...>>( std::tuple<typename std::decay<const Args&>::type...>>(
make_tuple(matchers...)); std::make_tuple(matchers...));
} }
template <typename... Args> template <typename... Args>
internal::UnorderedElementsAreMatcher< internal::UnorderedElementsAreMatcher<
tuple<typename std::decay<const Args&>::type...>> std::tuple<typename std::decay<const Args&>::type...>>
UnorderedElementsAre(const Args&... matchers) { UnorderedElementsAre(const Args&... matchers) {
return internal::UnorderedElementsAreMatcher< return internal::UnorderedElementsAreMatcher<
tuple<typename std::decay<const Args&>::type...>>( std::tuple<typename std::decay<const Args&>::type...>>(
make_tuple(matchers...)); std::make_tuple(matchers...));
} }
// Define variadic matcher versions. // Define variadic matcher versions.
......
...@@ -162,7 +162,7 @@ WithArg(const InnerAction& action) { ...@@ -162,7 +162,7 @@ WithArg(const InnerAction& action) {
ACTION_TEMPLATE(ReturnArg, ACTION_TEMPLATE(ReturnArg,
HAS_1_TEMPLATE_PARAMS(int, k), HAS_1_TEMPLATE_PARAMS(int, k),
AND_0_VALUE_PARAMS()) { AND_0_VALUE_PARAMS()) {
return ::testing::get<k>(args); return ::std::get<k>(args);
} }
// Action SaveArg<k>(pointer) saves the k-th (0-based) argument of the // Action SaveArg<k>(pointer) saves the k-th (0-based) argument of the
...@@ -170,7 +170,7 @@ ACTION_TEMPLATE(ReturnArg, ...@@ -170,7 +170,7 @@ ACTION_TEMPLATE(ReturnArg,
ACTION_TEMPLATE(SaveArg, ACTION_TEMPLATE(SaveArg,
HAS_1_TEMPLATE_PARAMS(int, k), HAS_1_TEMPLATE_PARAMS(int, k),
AND_1_VALUE_PARAMS(pointer)) { AND_1_VALUE_PARAMS(pointer)) {
*pointer = ::testing::get<k>(args); *pointer = ::std::get<k>(args);
} }
// Action SaveArgPointee<k>(pointer) saves the value pointed to // Action SaveArgPointee<k>(pointer) saves the value pointed to
...@@ -178,7 +178,7 @@ ACTION_TEMPLATE(SaveArg, ...@@ -178,7 +178,7 @@ ACTION_TEMPLATE(SaveArg,
ACTION_TEMPLATE(SaveArgPointee, ACTION_TEMPLATE(SaveArgPointee,
HAS_1_TEMPLATE_PARAMS(int, k), HAS_1_TEMPLATE_PARAMS(int, k),
AND_1_VALUE_PARAMS(pointer)) { AND_1_VALUE_PARAMS(pointer)) {
*pointer = *::testing::get<k>(args); *pointer = *::std::get<k>(args);
} }
// Action SetArgReferee<k>(value) assigns 'value' to the variable // Action SetArgReferee<k>(value) assigns 'value' to the variable
...@@ -186,13 +186,13 @@ ACTION_TEMPLATE(SaveArgPointee, ...@@ -186,13 +186,13 @@ ACTION_TEMPLATE(SaveArgPointee,
ACTION_TEMPLATE(SetArgReferee, ACTION_TEMPLATE(SetArgReferee,
HAS_1_TEMPLATE_PARAMS(int, k), HAS_1_TEMPLATE_PARAMS(int, k),
AND_1_VALUE_PARAMS(value)) { AND_1_VALUE_PARAMS(value)) {
typedef typename ::testing::tuple_element<k, args_type>::type argk_type; typedef typename ::std::tuple_element<k, args_type>::type argk_type;
// Ensures that argument #k is a reference. If you get a compiler // Ensures that argument #k is a reference. If you get a compiler
// error on the next line, you are using SetArgReferee<k>(value) in // error on the next line, you are using SetArgReferee<k>(value) in
// a mock function whose k-th (0-based) argument is not a reference. // a mock function whose k-th (0-based) argument is not a reference.
GTEST_COMPILE_ASSERT_(internal::is_reference<argk_type>::value, GTEST_COMPILE_ASSERT_(internal::is_reference<argk_type>::value,
SetArgReferee_must_be_used_with_a_reference_argument); SetArgReferee_must_be_used_with_a_reference_argument);
::testing::get<k>(args) = value; ::std::get<k>(args) = value;
} }
// Action SetArrayArgument<k>(first, last) copies the elements in // Action SetArrayArgument<k>(first, last) copies the elements in
...@@ -205,9 +205,9 @@ ACTION_TEMPLATE(SetArrayArgument, ...@@ -205,9 +205,9 @@ ACTION_TEMPLATE(SetArrayArgument,
AND_2_VALUE_PARAMS(first, last)) { AND_2_VALUE_PARAMS(first, last)) {
// Visual Studio deprecates ::std::copy, so we use our own copy in that case. // Visual Studio deprecates ::std::copy, so we use our own copy in that case.
#ifdef _MSC_VER #ifdef _MSC_VER
internal::CopyElements(first, last, ::testing::get<k>(args)); internal::CopyElements(first, last, ::std::get<k>(args));
#else #else
::std::copy(first, last, ::testing::get<k>(args)); ::std::copy(first, last, ::std::get<k>(args));
#endif #endif
} }
...@@ -216,7 +216,7 @@ ACTION_TEMPLATE(SetArrayArgument, ...@@ -216,7 +216,7 @@ ACTION_TEMPLATE(SetArrayArgument,
ACTION_TEMPLATE(DeleteArg, ACTION_TEMPLATE(DeleteArg,
HAS_1_TEMPLATE_PARAMS(int, k), HAS_1_TEMPLATE_PARAMS(int, k),
AND_0_VALUE_PARAMS()) { AND_0_VALUE_PARAMS()) {
delete ::testing::get<k>(args); delete ::std::get<k>(args);
} }
// This action returns the value pointed to by 'pointer'. // This action returns the value pointed to by 'pointer'.
......
...@@ -70,79 +70,71 @@ template <typename Tuple> ...@@ -70,79 +70,71 @@ template <typename Tuple>
struct MatcherTuple; struct MatcherTuple;
template <> template <>
struct MatcherTuple< ::testing::tuple<> > { struct MatcherTuple< ::std::tuple<> > {
typedef ::testing::tuple< > type; typedef ::std::tuple< > type;
}; };
template <typename A1> template <typename A1>
struct MatcherTuple< ::testing::tuple<A1> > { struct MatcherTuple< ::std::tuple<A1> > {
typedef ::testing::tuple<Matcher<A1> > type; typedef ::std::tuple<Matcher<A1> > type;
}; };
template <typename A1, typename A2> template <typename A1, typename A2>
struct MatcherTuple< ::testing::tuple<A1, A2> > { struct MatcherTuple< ::std::tuple<A1, A2> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2> > type; typedef ::std::tuple<Matcher<A1>, Matcher<A2> > type;
}; };
template <typename A1, typename A2, typename A3> template <typename A1, typename A2, typename A3>
struct MatcherTuple< ::testing::tuple<A1, A2, A3> > { struct MatcherTuple< ::std::tuple<A1, A2, A3> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3> > type; typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3> > type;
}; };
template <typename A1, typename A2, typename A3, typename A4> template <typename A1, typename A2, typename A3, typename A4>
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4> > { struct MatcherTuple< ::std::tuple<A1, A2, A3, A4> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4> > typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>,
type; Matcher<A4> > type;
}; };
template <typename A1, typename A2, typename A3, typename A4, typename A5> template <typename A1, typename A2, typename A3, typename A4, typename A5>
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5> > { struct MatcherTuple< ::std::tuple<A1, A2, A3, A4, A5> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
Matcher<A5> > Matcher<A5> > type;
type;
}; };
template <typename A1, typename A2, typename A3, typename A4, typename A5, template <typename A1, typename A2, typename A3, typename A4, typename A5,
typename A6> typename A6>
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6> > { struct MatcherTuple< ::std::tuple<A1, A2, A3, A4, A5, A6> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
Matcher<A5>, Matcher<A6> > Matcher<A5>, Matcher<A6> > type;
type;
}; };
template <typename A1, typename A2, typename A3, typename A4, typename A5, template <typename A1, typename A2, typename A3, typename A4, typename A5,
typename A6, typename A7> typename A6, typename A7>
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > { struct MatcherTuple< ::std::tuple<A1, A2, A3, A4, A5, A6, A7> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
Matcher<A5>, Matcher<A6>, Matcher<A7> > Matcher<A5>, Matcher<A6>, Matcher<A7> > type;
type;
}; };
template <typename A1, typename A2, typename A3, typename A4, typename A5, template <typename A1, typename A2, typename A3, typename A4, typename A5,
typename A6, typename A7, typename A8> typename A6, typename A7, typename A8>
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > { struct MatcherTuple< ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8> > Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8> > type;
type;
}; };
template <typename A1, typename A2, typename A3, typename A4, typename A5, template <typename A1, typename A2, typename A3, typename A4, typename A5,
typename A6, typename A7, typename A8, typename A9> typename A6, typename A7, typename A8, typename A9>
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > { struct MatcherTuple< ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9> > type;
Matcher<A9> >
type;
}; };
template <typename A1, typename A2, typename A3, typename A4, typename A5, template <typename A1, typename A2, typename A3, typename A4, typename A5,
typename A6, typename A7, typename A8, typename A9, typename A10> typename A6, typename A7, typename A8, typename A9, typename A10>
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9, struct MatcherTuple< ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> > {
A10> > { typedef ::std::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9>,
Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A10> > type;
Matcher<A9>, Matcher<A10> >
type;
}; };
// Template struct Function<F>, where F must be a function type, contains // Template struct Function<F>, where F must be a function type, contains
...@@ -164,7 +156,7 @@ struct Function; ...@@ -164,7 +156,7 @@ struct Function;
template <typename R> template <typename R>
struct Function<R()> { struct Function<R()> {
typedef R Result; typedef R Result;
typedef ::testing::tuple<> ArgumentTuple; typedef ::std::tuple<> ArgumentTuple;
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
typedef void MakeResultVoid(); typedef void MakeResultVoid();
typedef IgnoredValue MakeResultIgnoredValue(); typedef IgnoredValue MakeResultIgnoredValue();
...@@ -174,7 +166,7 @@ template <typename R, typename A1> ...@@ -174,7 +166,7 @@ template <typename R, typename A1>
struct Function<R(A1)> struct Function<R(A1)>
: Function<R()> { : Function<R()> {
typedef A1 Argument1; typedef A1 Argument1;
typedef ::testing::tuple<A1> ArgumentTuple; typedef ::std::tuple<A1> ArgumentTuple;
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
typedef void MakeResultVoid(A1); typedef void MakeResultVoid(A1);
typedef IgnoredValue MakeResultIgnoredValue(A1); typedef IgnoredValue MakeResultIgnoredValue(A1);
...@@ -184,7 +176,7 @@ template <typename R, typename A1, typename A2> ...@@ -184,7 +176,7 @@ template <typename R, typename A1, typename A2>
struct Function<R(A1, A2)> struct Function<R(A1, A2)>
: Function<R(A1)> { : Function<R(A1)> {
typedef A2 Argument2; typedef A2 Argument2;
typedef ::testing::tuple<A1, A2> ArgumentTuple; typedef ::std::tuple<A1, A2> ArgumentTuple;
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
typedef void MakeResultVoid(A1, A2); typedef void MakeResultVoid(A1, A2);
typedef IgnoredValue MakeResultIgnoredValue(A1, A2); typedef IgnoredValue MakeResultIgnoredValue(A1, A2);
...@@ -194,7 +186,7 @@ template <typename R, typename A1, typename A2, typename A3> ...@@ -194,7 +186,7 @@ template <typename R, typename A1, typename A2, typename A3>
struct Function<R(A1, A2, A3)> struct Function<R(A1, A2, A3)>
: Function<R(A1, A2)> { : Function<R(A1, A2)> {
typedef A3 Argument3; typedef A3 Argument3;
typedef ::testing::tuple<A1, A2, A3> ArgumentTuple; typedef ::std::tuple<A1, A2, A3> ArgumentTuple;
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
typedef void MakeResultVoid(A1, A2, A3); typedef void MakeResultVoid(A1, A2, A3);
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3);
...@@ -204,7 +196,7 @@ template <typename R, typename A1, typename A2, typename A3, typename A4> ...@@ -204,7 +196,7 @@ template <typename R, typename A1, typename A2, typename A3, typename A4>
struct Function<R(A1, A2, A3, A4)> struct Function<R(A1, A2, A3, A4)>
: Function<R(A1, A2, A3)> { : Function<R(A1, A2, A3)> {
typedef A4 Argument4; typedef A4 Argument4;
typedef ::testing::tuple<A1, A2, A3, A4> ArgumentTuple; typedef ::std::tuple<A1, A2, A3, A4> ArgumentTuple;
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
typedef void MakeResultVoid(A1, A2, A3, A4); typedef void MakeResultVoid(A1, A2, A3, A4);
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4);
...@@ -215,7 +207,7 @@ template <typename R, typename A1, typename A2, typename A3, typename A4, ...@@ -215,7 +207,7 @@ template <typename R, typename A1, typename A2, typename A3, typename A4,
struct Function<R(A1, A2, A3, A4, A5)> struct Function<R(A1, A2, A3, A4, A5)>
: Function<R(A1, A2, A3, A4)> { : Function<R(A1, A2, A3, A4)> {
typedef A5 Argument5; typedef A5 Argument5;
typedef ::testing::tuple<A1, A2, A3, A4, A5> ArgumentTuple; typedef ::std::tuple<A1, A2, A3, A4, A5> ArgumentTuple;
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
typedef void MakeResultVoid(A1, A2, A3, A4, A5); typedef void MakeResultVoid(A1, A2, A3, A4, A5);
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5);
...@@ -226,7 +218,7 @@ template <typename R, typename A1, typename A2, typename A3, typename A4, ...@@ -226,7 +218,7 @@ template <typename R, typename A1, typename A2, typename A3, typename A4,
struct Function<R(A1, A2, A3, A4, A5, A6)> struct Function<R(A1, A2, A3, A4, A5, A6)>
: Function<R(A1, A2, A3, A4, A5)> { : Function<R(A1, A2, A3, A4, A5)> {
typedef A6 Argument6; typedef A6 Argument6;
typedef ::testing::tuple<A1, A2, A3, A4, A5, A6> ArgumentTuple; typedef ::std::tuple<A1, A2, A3, A4, A5, A6> ArgumentTuple;
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6); typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6);
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6);
...@@ -237,7 +229,7 @@ template <typename R, typename A1, typename A2, typename A3, typename A4, ...@@ -237,7 +229,7 @@ template <typename R, typename A1, typename A2, typename A3, typename A4,
struct Function<R(A1, A2, A3, A4, A5, A6, A7)> struct Function<R(A1, A2, A3, A4, A5, A6, A7)>
: Function<R(A1, A2, A3, A4, A5, A6)> { : Function<R(A1, A2, A3, A4, A5, A6)> {
typedef A7 Argument7; typedef A7 Argument7;
typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> ArgumentTuple; typedef ::std::tuple<A1, A2, A3, A4, A5, A6, A7> ArgumentTuple;
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7); typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7);
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7);
...@@ -248,7 +240,7 @@ template <typename R, typename A1, typename A2, typename A3, typename A4, ...@@ -248,7 +240,7 @@ template <typename R, typename A1, typename A2, typename A3, typename A4,
struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8)> struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8)>
: Function<R(A1, A2, A3, A4, A5, A6, A7)> { : Function<R(A1, A2, A3, A4, A5, A6, A7)> {
typedef A8 Argument8; typedef A8 Argument8;
typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> ArgumentTuple; typedef ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8> ArgumentTuple;
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8); typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8);
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8); typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8);
...@@ -259,7 +251,7 @@ template <typename R, typename A1, typename A2, typename A3, typename A4, ...@@ -259,7 +251,7 @@ template <typename R, typename A1, typename A2, typename A3, typename A4,
struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
: Function<R(A1, A2, A3, A4, A5, A6, A7, A8)> { : Function<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
typedef A9 Argument9; typedef A9 Argument9;
typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> ArgumentTuple; typedef ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> ArgumentTuple;
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9); typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9);
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8, typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
...@@ -272,8 +264,7 @@ template <typename R, typename A1, typename A2, typename A3, typename A4, ...@@ -272,8 +264,7 @@ template <typename R, typename A1, typename A2, typename A3, typename A4,
struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
: Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> { : Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
typedef A10 Argument10; typedef A10 Argument10;
typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9, typedef ::std::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> ArgumentTuple;
A10> ArgumentTuple;
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8, typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
......
...@@ -78,8 +78,8 @@ $var typename_As = [[$for j, [[typename A$j]]]] ...@@ -78,8 +78,8 @@ $var typename_As = [[$for j, [[typename A$j]]]]
$var As = [[$for j, [[A$j]]]] $var As = [[$for j, [[A$j]]]]
$var matcher_As = [[$for j, [[Matcher<A$j>]]]] $var matcher_As = [[$for j, [[Matcher<A$j>]]]]
template <$typename_As> template <$typename_As>
struct MatcherTuple< ::testing::tuple<$As> > { struct MatcherTuple< ::std::tuple<$As> > {
typedef ::testing::tuple<$matcher_As > type; typedef ::std::tuple<$matcher_As > type;
}; };
...@@ -103,7 +103,7 @@ struct Function; ...@@ -103,7 +103,7 @@ struct Function;
template <typename R> template <typename R>
struct Function<R()> { struct Function<R()> {
typedef R Result; typedef R Result;
typedef ::testing::tuple<> ArgumentTuple; typedef ::std::tuple<> ArgumentTuple;
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
typedef void MakeResultVoid(); typedef void MakeResultVoid();
typedef IgnoredValue MakeResultIgnoredValue(); typedef IgnoredValue MakeResultIgnoredValue();
...@@ -122,7 +122,7 @@ template <typename R$typename_As> ...@@ -122,7 +122,7 @@ template <typename R$typename_As>
struct Function<R($As)> struct Function<R($As)>
: Function<R($prev_As)> { : Function<R($prev_As)> {
typedef A$i Argument$i; typedef A$i Argument$i;
typedef ::testing::tuple<$As> ArgumentTuple; typedef ::std::tuple<$As> ArgumentTuple;
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
typedef void MakeResultVoid($As); typedef void MakeResultVoid($As);
typedef IgnoredValue MakeResultIgnoredValue($As); typedef IgnoredValue MakeResultIgnoredValue($As);
......
...@@ -493,7 +493,7 @@ class StlContainerView<Element[N]> { ...@@ -493,7 +493,7 @@ class StlContainerView<Element[N]> {
// This specialization is used when RawContainer is a native array // This specialization is used when RawContainer is a native array
// represented as a (pointer, size) tuple. // represented as a (pointer, size) tuple.
template <typename ElementPointer, typename Size> template <typename ElementPointer, typename Size>
class StlContainerView< ::testing::tuple<ElementPointer, Size> > { class StlContainerView< ::std::tuple<ElementPointer, Size> > {
public: public:
typedef GTEST_REMOVE_CONST_( typedef GTEST_REMOVE_CONST_(
typename internal::PointeeOf<ElementPointer>::type) RawElement; typename internal::PointeeOf<ElementPointer>::type) RawElement;
...@@ -501,11 +501,12 @@ class StlContainerView< ::testing::tuple<ElementPointer, Size> > { ...@@ -501,11 +501,12 @@ class StlContainerView< ::testing::tuple<ElementPointer, Size> > {
typedef const type const_reference; typedef const type const_reference;
static const_reference ConstReference( static const_reference ConstReference(
const ::testing::tuple<ElementPointer, Size>& array) { const ::std::tuple<ElementPointer, Size>& array) {
return type(get<0>(array), get<1>(array), RelationToSourceReference()); return type(std::get<0>(array), std::get<1>(array),
RelationToSourceReference());
} }
static type Copy(const ::testing::tuple<ElementPointer, Size>& array) { static type Copy(const ::std::tuple<ElementPointer, Size>& array) {
return type(get<0>(array), get<1>(array), RelationToSourceCopy()); return type(std::get<0>(array), std::get<1>(array), RelationToSourceCopy());
} }
}; };
......
This diff is collapsed.
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
namespace { namespace {
using ::testing::tuple;
using ::testing::Matcher; using ::testing::Matcher;
using ::testing::internal::CompileAssertTypesEqual; using ::testing::internal::CompileAssertTypesEqual;
using ::testing::internal::MatcherTuple; using ::testing::internal::MatcherTuple;
...@@ -48,24 +47,24 @@ using ::testing::internal::IgnoredValue; ...@@ -48,24 +47,24 @@ using ::testing::internal::IgnoredValue;
// Tests the MatcherTuple template struct. // Tests the MatcherTuple template struct.
TEST(MatcherTupleTest, ForSize0) { TEST(MatcherTupleTest, ForSize0) {
CompileAssertTypesEqual<tuple<>, MatcherTuple<tuple<> >::type>(); CompileAssertTypesEqual<std::tuple<>, MatcherTuple<std::tuple<> >::type>();
} }
TEST(MatcherTupleTest, ForSize1) { TEST(MatcherTupleTest, ForSize1) {
CompileAssertTypesEqual<tuple<Matcher<int> >, CompileAssertTypesEqual<std::tuple<Matcher<int> >,
MatcherTuple<tuple<int> >::type>(); MatcherTuple<std::tuple<int> >::type>();
} }
TEST(MatcherTupleTest, ForSize2) { TEST(MatcherTupleTest, ForSize2) {
CompileAssertTypesEqual<tuple<Matcher<int>, Matcher<char> >, CompileAssertTypesEqual<std::tuple<Matcher<int>, Matcher<char> >,
MatcherTuple<tuple<int, char> >::type>(); MatcherTuple<std::tuple<int, char> >::type>();
} }
TEST(MatcherTupleTest, ForSize5) { TEST(MatcherTupleTest, ForSize5) {
CompileAssertTypesEqual< CompileAssertTypesEqual<
tuple<Matcher<int>, Matcher<char>, Matcher<bool>, Matcher<double>, std::tuple<Matcher<int>, Matcher<char>, Matcher<bool>, Matcher<double>,
Matcher<char*> >, Matcher<char*> >,
MatcherTuple<tuple<int, char, bool, double, char*> >::type>(); MatcherTuple<std::tuple<int, char, bool, double, char*> >::type>();
} }
// Tests the Function template struct. // Tests the Function template struct.
...@@ -73,8 +72,8 @@ TEST(MatcherTupleTest, ForSize5) { ...@@ -73,8 +72,8 @@ TEST(MatcherTupleTest, ForSize5) {
TEST(FunctionTest, Nullary) { TEST(FunctionTest, Nullary) {
typedef Function<int()> F; // NOLINT typedef Function<int()> F; // NOLINT
CompileAssertTypesEqual<int, F::Result>(); CompileAssertTypesEqual<int, F::Result>();
CompileAssertTypesEqual<tuple<>, F::ArgumentTuple>(); CompileAssertTypesEqual<std::tuple<>, F::ArgumentTuple>();
CompileAssertTypesEqual<tuple<>, F::ArgumentMatcherTuple>(); CompileAssertTypesEqual<std::tuple<>, F::ArgumentMatcherTuple>();
CompileAssertTypesEqual<void(), F::MakeResultVoid>(); CompileAssertTypesEqual<void(), F::MakeResultVoid>();
CompileAssertTypesEqual<IgnoredValue(), F::MakeResultIgnoredValue>(); CompileAssertTypesEqual<IgnoredValue(), F::MakeResultIgnoredValue>();
} }
...@@ -83,8 +82,9 @@ TEST(FunctionTest, Unary) { ...@@ -83,8 +82,9 @@ TEST(FunctionTest, Unary) {
typedef Function<int(bool)> F; // NOLINT typedef Function<int(bool)> F; // NOLINT
CompileAssertTypesEqual<int, F::Result>(); CompileAssertTypesEqual<int, F::Result>();
CompileAssertTypesEqual<bool, F::Argument1>(); CompileAssertTypesEqual<bool, F::Argument1>();
CompileAssertTypesEqual<tuple<bool>, F::ArgumentTuple>(); CompileAssertTypesEqual<std::tuple<bool>, F::ArgumentTuple>();
CompileAssertTypesEqual<tuple<Matcher<bool> >, F::ArgumentMatcherTuple>(); CompileAssertTypesEqual<std::tuple<Matcher<bool> >,
F::ArgumentMatcherTuple>();
CompileAssertTypesEqual<void(bool), F::MakeResultVoid>(); // NOLINT CompileAssertTypesEqual<void(bool), F::MakeResultVoid>(); // NOLINT
CompileAssertTypesEqual<IgnoredValue(bool), // NOLINT CompileAssertTypesEqual<IgnoredValue(bool), // NOLINT
F::MakeResultIgnoredValue>(); F::MakeResultIgnoredValue>();
...@@ -95,9 +95,10 @@ TEST(FunctionTest, Binary) { ...@@ -95,9 +95,10 @@ TEST(FunctionTest, Binary) {
CompileAssertTypesEqual<int, F::Result>(); CompileAssertTypesEqual<int, F::Result>();
CompileAssertTypesEqual<bool, F::Argument1>(); CompileAssertTypesEqual<bool, F::Argument1>();
CompileAssertTypesEqual<const long&, F::Argument2>(); // NOLINT CompileAssertTypesEqual<const long&, F::Argument2>(); // NOLINT
CompileAssertTypesEqual<tuple<bool, const long&>, F::ArgumentTuple>(); // NOLINT CompileAssertTypesEqual<std::tuple<bool, const long&>, // NOLINT
F::ArgumentTuple>();
CompileAssertTypesEqual< CompileAssertTypesEqual<
tuple<Matcher<bool>, Matcher<const long&> >, // NOLINT std::tuple<Matcher<bool>, Matcher<const long&> >, // NOLINT
F::ArgumentMatcherTuple>(); F::ArgumentMatcherTuple>();
CompileAssertTypesEqual<void(bool, const long&), F::MakeResultVoid>(); // NOLINT CompileAssertTypesEqual<void(bool, const long&), F::MakeResultVoid>(); // NOLINT
CompileAssertTypesEqual<IgnoredValue(bool, const long&), // NOLINT CompileAssertTypesEqual<IgnoredValue(bool, const long&), // NOLINT
...@@ -112,10 +113,11 @@ TEST(FunctionTest, LongArgumentList) { ...@@ -112,10 +113,11 @@ TEST(FunctionTest, LongArgumentList) {
CompileAssertTypesEqual<char*, F::Argument3>(); CompileAssertTypesEqual<char*, F::Argument3>();
CompileAssertTypesEqual<int&, F::Argument4>(); CompileAssertTypesEqual<int&, F::Argument4>();
CompileAssertTypesEqual<const long&, F::Argument5>(); // NOLINT CompileAssertTypesEqual<const long&, F::Argument5>(); // NOLINT
CompileAssertTypesEqual<tuple<bool, int, char*, int&, const long&>, // NOLINT CompileAssertTypesEqual<
std::tuple<bool, int, char*, int&, const long&>, // NOLINT
F::ArgumentTuple>(); F::ArgumentTuple>();
CompileAssertTypesEqual< CompileAssertTypesEqual<
tuple<Matcher<bool>, Matcher<int>, Matcher<char*>, Matcher<int&>, std::tuple<Matcher<bool>, Matcher<int>, Matcher<char*>, Matcher<int&>,
Matcher<const long&> >, // NOLINT Matcher<const long&> >, // NOLINT
F::ArgumentMatcherTuple>(); F::ArgumentMatcherTuple>();
CompileAssertTypesEqual<void(bool, int, char*, int&, const long&), // NOLINT CompileAssertTypesEqual<void(bool, int, char*, int&, const long&), // NOLINT
......
...@@ -62,9 +62,6 @@ using std::pair; ...@@ -62,9 +62,6 @@ using std::pair;
using std::set; using std::set;
using std::stringstream; using std::stringstream;
using std::vector; using std::vector;
using testing::get;
using testing::make_tuple;
using testing::tuple;
using testing::_; using testing::_;
using testing::AllOf; using testing::AllOf;
using testing::AnyOf; using testing::AnyOf;
...@@ -118,20 +115,20 @@ std::string Explain(const MatcherType& m, const Value& x) { ...@@ -118,20 +115,20 @@ std::string Explain(const MatcherType& m, const Value& x) {
// Tests Args<k0, ..., kn>(m). // Tests Args<k0, ..., kn>(m).
TEST(ArgsTest, AcceptsZeroTemplateArg) { TEST(ArgsTest, AcceptsZeroTemplateArg) {
const tuple<int, bool> t(5, true); const std::tuple<int, bool> t(5, true);
EXPECT_THAT(t, Args<>(Eq(tuple<>()))); EXPECT_THAT(t, Args<>(Eq(std::tuple<>())));
EXPECT_THAT(t, Not(Args<>(Ne(tuple<>())))); EXPECT_THAT(t, Not(Args<>(Ne(std::tuple<>()))));
} }
TEST(ArgsTest, AcceptsOneTemplateArg) { TEST(ArgsTest, AcceptsOneTemplateArg) {
const tuple<int, bool> t(5, true); const std::tuple<int, bool> t(5, true);
EXPECT_THAT(t, Args<0>(Eq(make_tuple(5)))); EXPECT_THAT(t, Args<0>(Eq(std::make_tuple(5))));
EXPECT_THAT(t, Args<1>(Eq(make_tuple(true)))); EXPECT_THAT(t, Args<1>(Eq(std::make_tuple(true))));
EXPECT_THAT(t, Not(Args<1>(Eq(make_tuple(false))))); EXPECT_THAT(t, Not(Args<1>(Eq(std::make_tuple(false)))));
} }
TEST(ArgsTest, AcceptsTwoTemplateArgs) { TEST(ArgsTest, AcceptsTwoTemplateArgs) {
const tuple<short, int, long> t(4, 5, 6L); // NOLINT const std::tuple<short, int, long> t(4, 5, 6L); // NOLINT
EXPECT_THAT(t, (Args<0, 1>(Lt()))); EXPECT_THAT(t, (Args<0, 1>(Lt())));
EXPECT_THAT(t, (Args<1, 2>(Lt()))); EXPECT_THAT(t, (Args<1, 2>(Lt())));
...@@ -139,13 +136,13 @@ TEST(ArgsTest, AcceptsTwoTemplateArgs) { ...@@ -139,13 +136,13 @@ TEST(ArgsTest, AcceptsTwoTemplateArgs) {
} }
TEST(ArgsTest, AcceptsRepeatedTemplateArgs) { TEST(ArgsTest, AcceptsRepeatedTemplateArgs) {
const tuple<short, int, long> t(4, 5, 6L); // NOLINT const std::tuple<short, int, long> t(4, 5, 6L); // NOLINT
EXPECT_THAT(t, (Args<0, 0>(Eq()))); EXPECT_THAT(t, (Args<0, 0>(Eq())));
EXPECT_THAT(t, Not(Args<1, 1>(Ne()))); EXPECT_THAT(t, Not(Args<1, 1>(Ne())));
} }
TEST(ArgsTest, AcceptsDecreasingTemplateArgs) { TEST(ArgsTest, AcceptsDecreasingTemplateArgs) {
const tuple<short, int, long> t(4, 5, 6L); // NOLINT const std::tuple<short, int, long> t(4, 5, 6L); // NOLINT
EXPECT_THAT(t, (Args<2, 0>(Gt()))); EXPECT_THAT(t, (Args<2, 0>(Gt())));
EXPECT_THAT(t, Not(Args<2, 1>(Lt()))); EXPECT_THAT(t, Not(Args<2, 1>(Lt())));
} }
...@@ -161,29 +158,29 @@ TEST(ArgsTest, AcceptsDecreasingTemplateArgs) { ...@@ -161,29 +158,29 @@ TEST(ArgsTest, AcceptsDecreasingTemplateArgs) {
#endif #endif
MATCHER(SumIsZero, "") { 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) { TEST(ArgsTest, AcceptsMoreTemplateArgsThanArityOfOriginalTuple) {
EXPECT_THAT(make_tuple(-1, 2), (Args<0, 0, 1>(SumIsZero()))); EXPECT_THAT(std::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), Not(Args<0, 0, 1>(SumIsZero())));
} }
TEST(ArgsTest, CanBeNested) { TEST(ArgsTest, CanBeNested) {
const tuple<short, int, long, int> t(4, 5, 6L, 6); // NOLINT const std::tuple<short, int, long, int> t(4, 5, 6L, 6); // NOLINT
EXPECT_THAT(t, (Args<1, 2, 3>(Args<1, 2>(Eq())))); EXPECT_THAT(t, (Args<1, 2, 3>(Args<1, 2>(Eq()))));
EXPECT_THAT(t, (Args<0, 1, 3>(Args<0, 2>(Lt())))); EXPECT_THAT(t, (Args<0, 1, 3>(Args<0, 2>(Lt()))));
} }
TEST(ArgsTest, CanMatchTupleByValue) { TEST(ArgsTest, CanMatchTupleByValue) {
typedef tuple<char, int, int> Tuple3; typedef std::tuple<char, int, int> Tuple3;
const Matcher<Tuple3> m = Args<1, 2>(Lt()); const Matcher<Tuple3> m = Args<1, 2>(Lt());
EXPECT_TRUE(m.Matches(Tuple3('a', 1, 2))); EXPECT_TRUE(m.Matches(Tuple3('a', 1, 2)));
EXPECT_FALSE(m.Matches(Tuple3('b', 2, 2))); EXPECT_FALSE(m.Matches(Tuple3('b', 2, 2)));
} }
TEST(ArgsTest, CanMatchTupleByReference) { TEST(ArgsTest, CanMatchTupleByReference) {
typedef tuple<char, char, int> Tuple3; typedef std::tuple<char, char, int> Tuple3;
const Matcher<const Tuple3&> m = Args<0, 1>(Lt()); const Matcher<const Tuple3&> m = Args<0, 1>(Lt());
EXPECT_TRUE(m.Matches(Tuple3('a', 'b', 2))); EXPECT_TRUE(m.Matches(Tuple3('a', 'b', 2)));
EXPECT_FALSE(m.Matches(Tuple3('b', 'b', 2))); EXPECT_FALSE(m.Matches(Tuple3('b', 'b', 2)));
...@@ -195,23 +192,23 @@ MATCHER_P(PrintsAs, str, "") { ...@@ -195,23 +192,23 @@ MATCHER_P(PrintsAs, str, "") {
} }
TEST(ArgsTest, AcceptsTenTemplateArgs) { 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>( (Args<9, 8, 7, 6, 5, 4, 3, 2, 1, 0>(
PrintsAs("(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>( 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) { TEST(ArgsTest, DescirbesSelfCorrectly) {
const Matcher<tuple<int, bool, char> > m = Args<2, 0>(Lt()); const Matcher<std::tuple<int, bool, char> > m = Args<2, 0>(Lt());
EXPECT_EQ("are a tuple whose fields (#2, #0) are a pair where " EXPECT_EQ("are a tuple whose fields (#2, #0) are a pair where "
"the first < the second", "the first < the second",
Describe(m)); Describe(m));
} }
TEST(ArgsTest, DescirbesNestedArgsCorrectly) { TEST(ArgsTest, DescirbesNestedArgsCorrectly) {
const Matcher<const tuple<int, bool, char, int>&> m = const Matcher<const std::tuple<int, bool, char, int>&> m =
Args<0, 2, 3>(Args<2, 0>(Lt())); Args<0, 2, 3>(Args<2, 0>(Lt()));
EXPECT_EQ("are a tuple whose fields (#0, #2, #3) are a tuple " 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", "whose fields (#2, #0) are a pair where the first < the second",
...@@ -219,28 +216,28 @@ TEST(ArgsTest, DescirbesNestedArgsCorrectly) { ...@@ -219,28 +216,28 @@ TEST(ArgsTest, DescirbesNestedArgsCorrectly) {
} }
TEST(ArgsTest, DescribesNegationCorrectly) { TEST(ArgsTest, DescribesNegationCorrectly) {
const Matcher<tuple<int, char> > m = Args<1, 0>(Gt()); const Matcher<std::tuple<int, char> > m = Args<1, 0>(Gt());
EXPECT_EQ("are a tuple whose fields (#1, #0) aren't a pair " EXPECT_EQ("are a tuple whose fields (#1, #0) aren't a pair "
"where the first > the second", "where the first > the second",
DescribeNegation(m)); DescribeNegation(m));
} }
TEST(ArgsTest, ExplainsMatchResultWithoutInnerExplanation) { TEST(ArgsTest, ExplainsMatchResultWithoutInnerExplanation) {
const Matcher<tuple<bool, int, int> > m = Args<1, 2>(Eq()); const Matcher<std::tuple<bool, int, int> > m = Args<1, 2>(Eq());
EXPECT_EQ("whose fields (#1, #2) are (42, 42)", 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)", 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. // For testing Args<>'s explanation.
class LessThanMatcher : public MatcherInterface<tuple<char, int> > { class LessThanMatcher : public MatcherInterface<std::tuple<char, int> > {
public: public:
virtual void DescribeTo(::std::ostream* os) const {} virtual void DescribeTo(::std::ostream* os) const {}
virtual bool MatchAndExplain(tuple<char, int> value, virtual bool MatchAndExplain(std::tuple<char, int> value,
MatchResultListener* listener) const { 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) { if (diff > 0) {
*listener << "where the first value is " << diff *listener << "where the first value is " << diff
<< " more than the second"; << " more than the second";
...@@ -249,17 +246,18 @@ class LessThanMatcher : public MatcherInterface<tuple<char, int> > { ...@@ -249,17 +246,18 @@ class LessThanMatcher : public MatcherInterface<tuple<char, int> > {
} }
}; };
Matcher<tuple<char, int> > LessThan() { Matcher<std::tuple<char, int> > LessThan() {
return MakeMatcher(new LessThanMatcher); return MakeMatcher(new LessThanMatcher);
} }
TEST(ArgsTest, ExplainsMatchResultWithInnerExplanation) { TEST(ArgsTest, ExplainsMatchResultWithInnerExplanation) {
const Matcher<tuple<char, int, int> > m = Args<0, 2>(LessThan()); const Matcher<std::tuple<char, int, int> > m = Args<0, 2>(LessThan());
EXPECT_EQ("whose fields (#0, #2) are ('a' (97, 0x61), 42), " EXPECT_EQ(
"whose fields (#0, #2) are ('a' (97, 0x61), 42), "
"where the first value is 55 more than the second", "where the first value is 55 more than the second",
Explain(m, make_tuple('a', 42, 42))); Explain(m, std::make_tuple('a', 42, 42)));
EXPECT_EQ("whose fields (#0, #2) are ('\\0', 43)", 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(). // For testing ExplainMatchResultTo().
...@@ -517,7 +515,7 @@ class NativeArrayPassedAsPointerAndSize { ...@@ -517,7 +515,7 @@ class NativeArrayPassedAsPointerAndSize {
TEST(ElementsAreTest, WorksWithNativeArrayPassedAsPointerAndSize) { TEST(ElementsAreTest, WorksWithNativeArrayPassedAsPointerAndSize) {
int array[] = { 0, 1 }; int array[] = { 0, 1 };
::testing::tuple<int*, size_t> array_as_tuple(array, 2); ::std::tuple<int*, size_t> array_as_tuple(array, 2);
EXPECT_THAT(array_as_tuple, ElementsAre(0, 1)); EXPECT_THAT(array_as_tuple, ElementsAre(0, 1));
EXPECT_THAT(array_as_tuple, Not(ElementsAre(0))); EXPECT_THAT(array_as_tuple, Not(ElementsAre(0)));
...@@ -571,7 +569,7 @@ TEST(ElementsAreTest, MakesCopyOfArguments) { ...@@ -571,7 +569,7 @@ TEST(ElementsAreTest, MakesCopyOfArguments) {
int x = 1; int x = 1;
int y = 2; int y = 2;
// This should make a copy of x and y. // This should make a copy of x and y.
::testing::internal::ElementsAreMatcher<testing::tuple<int, int> > ::testing::internal::ElementsAreMatcher<std::tuple<int, int> >
polymorphic_matcher = ElementsAre(x, y); polymorphic_matcher = ElementsAre(x, y);
// Changing x and y now shouldn't affect the meaning of the above matcher. // Changing x and y now shouldn't affect the meaning of the above matcher.
x = y = 0; x = y = 0;
...@@ -1235,8 +1233,8 @@ TEST(ContainsTest, AcceptsMatcher) { ...@@ -1235,8 +1233,8 @@ TEST(ContainsTest, AcceptsMatcher) {
TEST(ContainsTest, WorksForNativeArrayAsTuple) { TEST(ContainsTest, WorksForNativeArrayAsTuple) {
const int a[] = { 1, 2 }; const int a[] = { 1, 2 };
const int* const pointer = a; const int* const pointer = a;
EXPECT_THAT(make_tuple(pointer, 2), Contains(1)); EXPECT_THAT(std::make_tuple(pointer, 2), Contains(1));
EXPECT_THAT(make_tuple(pointer, 2), Not(Contains(Gt(3)))); EXPECT_THAT(std::make_tuple(pointer, 2), Not(Contains(Gt(3))));
} }
TEST(ContainsTest, WorksForTwoDimensionalNativeArray) { TEST(ContainsTest, WorksForTwoDimensionalNativeArray) {
......
...@@ -308,26 +308,23 @@ TEST(LosslessArithmeticConvertibleTest, FloatingPointToFloatingPoint) { ...@@ -308,26 +308,23 @@ TEST(LosslessArithmeticConvertibleTest, FloatingPointToFloatingPoint) {
// Tests the TupleMatches() template function. // Tests the TupleMatches() template function.
TEST(TupleMatchesTest, WorksForSize0) { TEST(TupleMatchesTest, WorksForSize0) {
tuple<> matchers; std::tuple<> matchers;
tuple<> values; std::tuple<> values;
EXPECT_TRUE(TupleMatches(matchers, values)); EXPECT_TRUE(TupleMatches(matchers, values));
} }
TEST(TupleMatchesTest, WorksForSize1) { TEST(TupleMatchesTest, WorksForSize1) {
tuple<Matcher<int> > matchers(Eq(1)); std::tuple<Matcher<int> > matchers(Eq(1));
tuple<int> values1(1), std::tuple<int> values1(1), values2(2);
values2(2);
EXPECT_TRUE(TupleMatches(matchers, values1)); EXPECT_TRUE(TupleMatches(matchers, values1));
EXPECT_FALSE(TupleMatches(matchers, values2)); EXPECT_FALSE(TupleMatches(matchers, values2));
} }
TEST(TupleMatchesTest, WorksForSize2) { TEST(TupleMatchesTest, WorksForSize2) {
tuple<Matcher<int>, Matcher<char> > matchers(Eq(1), Eq('a')); std::tuple<Matcher<int>, Matcher<char> > matchers(Eq(1), Eq('a'));
tuple<int, char> values1(1, 'a'), std::tuple<int, char> values1(1, 'a'), values2(1, 'b'), values3(2, 'a'),
values2(1, 'b'),
values3(2, 'a'),
values4(2, 'b'); values4(2, 'b');
EXPECT_TRUE(TupleMatches(matchers, values1)); EXPECT_TRUE(TupleMatches(matchers, values1));
...@@ -337,10 +334,11 @@ TEST(TupleMatchesTest, WorksForSize2) { ...@@ -337,10 +334,11 @@ TEST(TupleMatchesTest, WorksForSize2) {
} }
TEST(TupleMatchesTest, WorksForSize5) { TEST(TupleMatchesTest, WorksForSize5) {
tuple<Matcher<int>, Matcher<char>, Matcher<bool>, Matcher<long>, // NOLINT std::tuple<Matcher<int>, Matcher<char>, Matcher<bool>,
Matcher<long>, // NOLINT
Matcher<std::string> > Matcher<std::string> >
matchers(Eq(1), Eq('a'), Eq(true), Eq(2L), Eq("hi")); matchers(Eq(1), Eq('a'), Eq(true), Eq(2L), Eq("hi"));
tuple<int, char, bool, long, std::string> // NOLINT std::tuple<int, char, bool, long, std::string> // NOLINT
values1(1, 'a', true, 2L, "hi"), values2(1, 'a', true, 2L, "hello"), values1(1, 'a', true, 2L, "hi"), values2(1, 'a', true, 2L, "hello"),
values3(2, 'a', true, 2L, "hi"); values3(2, 'a', true, 2L, "hi");
...@@ -686,22 +684,25 @@ TEST(StlContainerViewTest, WorksForStaticNativeArray) { ...@@ -686,22 +684,25 @@ TEST(StlContainerViewTest, WorksForStaticNativeArray) {
TEST(StlContainerViewTest, WorksForDynamicNativeArray) { TEST(StlContainerViewTest, WorksForDynamicNativeArray) {
StaticAssertTypeEq<NativeArray<int>, StaticAssertTypeEq<NativeArray<int>,
StlContainerView<tuple<const int*, size_t> >::type>(); StlContainerView<std::tuple<const int*, size_t> >::type>();
StaticAssertTypeEq<NativeArray<double>, StaticAssertTypeEq<
StlContainerView<tuple<linked_ptr<double>, int> >::type>(); NativeArray<double>,
StlContainerView<std::tuple<linked_ptr<double>, int> >::type>();
StaticAssertTypeEq<const NativeArray<int>, StaticAssertTypeEq<
StlContainerView<tuple<const int*, int> >::const_reference>(); const NativeArray<int>,
StlContainerView<std::tuple<const int*, int> >::const_reference>();
int a1[3] = { 0, 1, 2 }; int a1[3] = { 0, 1, 2 };
const int* const p1 = a1; const int* const p1 = a1;
NativeArray<int> a2 = StlContainerView<tuple<const int*, int> >:: NativeArray<int> a2 =
ConstReference(make_tuple(p1, 3)); StlContainerView<std::tuple<const int*, int> >::ConstReference(
std::make_tuple(p1, 3));
EXPECT_EQ(3U, a2.size()); EXPECT_EQ(3U, a2.size());
EXPECT_EQ(a1, a2.begin()); EXPECT_EQ(a1, a2.begin());
const NativeArray<int> a3 = StlContainerView<tuple<int*, size_t> >:: const NativeArray<int> a3 = StlContainerView<std::tuple<int*, size_t> >::Copy(
Copy(make_tuple(static_cast<int*>(a1), 3)); std::make_tuple(static_cast<int*>(a1), 3));
ASSERT_EQ(3U, a3.size()); ASSERT_EQ(3U, a3.size());
EXPECT_EQ(0, a3.begin()[0]); EXPECT_EQ(0, a3.begin()[0]);
EXPECT_EQ(1, a3.begin()[1]); EXPECT_EQ(1, a3.begin()[1]);
......
...@@ -136,7 +136,6 @@ using testing::Value; ...@@ -136,7 +136,6 @@ using testing::Value;
using testing::WhenSorted; using testing::WhenSorted;
using testing::WhenSortedBy; using testing::WhenSortedBy;
using testing::_; using testing::_;
using testing::get;
using testing::internal::DummyMatchResultListener; using testing::internal::DummyMatchResultListener;
using testing::internal::ElementMatcherPair; using testing::internal::ElementMatcherPair;
using testing::internal::ElementMatcherPairs; using testing::internal::ElementMatcherPairs;
...@@ -153,8 +152,6 @@ using testing::internal::Strings; ...@@ -153,8 +152,6 @@ using testing::internal::Strings;
using testing::internal::linked_ptr; using testing::internal::linked_ptr;
using testing::internal::scoped_ptr; using testing::internal::scoped_ptr;
using testing::internal::string; using testing::internal::string;
using testing::make_tuple;
using testing::tuple;
// For testing ExplainMatchResultTo(). // For testing ExplainMatchResultTo().
class GreaterThanMatcher : public MatcherInterface<int> { class GreaterThanMatcher : public MatcherInterface<int> {
...@@ -2239,8 +2236,7 @@ TEST(GlobalWideEndsWithTest, CanDescribeSelf) { ...@@ -2239,8 +2236,7 @@ TEST(GlobalWideEndsWithTest, CanDescribeSelf) {
#endif // GTEST_HAS_GLOBAL_WSTRING #endif // GTEST_HAS_GLOBAL_WSTRING
typedef ::std::tuple<long, int> Tuple2; // NOLINT
typedef ::testing::tuple<long, int> Tuple2; // NOLINT
// Tests that Eq() matches a 2-tuple where the first field == the // Tests that Eq() matches a 2-tuple where the first field == the
// second field. // second field.
...@@ -2334,7 +2330,7 @@ TEST(Ne2Test, CanDescribeSelf) { ...@@ -2334,7 +2330,7 @@ TEST(Ne2Test, CanDescribeSelf) {
// Tests that FloatEq() matches a 2-tuple where // Tests that FloatEq() matches a 2-tuple where
// FloatEq(first field) matches the second field. // FloatEq(first field) matches the second field.
TEST(FloatEq2Test, MatchesEqualArguments) { TEST(FloatEq2Test, MatchesEqualArguments) {
typedef ::testing::tuple<float, float> Tpl; typedef ::std::tuple<float, float> Tpl;
Matcher<const Tpl&> m = FloatEq(); Matcher<const Tpl&> m = FloatEq();
EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
EXPECT_TRUE(m.Matches(Tpl(0.3f, 0.1f + 0.1f + 0.1f))); EXPECT_TRUE(m.Matches(Tpl(0.3f, 0.1f + 0.1f + 0.1f)));
...@@ -2343,14 +2339,14 @@ TEST(FloatEq2Test, MatchesEqualArguments) { ...@@ -2343,14 +2339,14 @@ TEST(FloatEq2Test, MatchesEqualArguments) {
// Tests that FloatEq() describes itself properly. // Tests that FloatEq() describes itself properly.
TEST(FloatEq2Test, CanDescribeSelf) { TEST(FloatEq2Test, CanDescribeSelf) {
Matcher<const ::testing::tuple<float, float>&> m = FloatEq(); Matcher<const ::std::tuple<float, float>&> m = FloatEq();
EXPECT_EQ("are an almost-equal pair", Describe(m)); EXPECT_EQ("are an almost-equal pair", Describe(m));
} }
// Tests that NanSensitiveFloatEq() matches a 2-tuple where // Tests that NanSensitiveFloatEq() matches a 2-tuple where
// NanSensitiveFloatEq(first field) matches the second field. // NanSensitiveFloatEq(first field) matches the second field.
TEST(NanSensitiveFloatEqTest, MatchesEqualArgumentsWithNaN) { TEST(NanSensitiveFloatEqTest, MatchesEqualArgumentsWithNaN) {
typedef ::testing::tuple<float, float> Tpl; typedef ::std::tuple<float, float> Tpl;
Matcher<const Tpl&> m = NanSensitiveFloatEq(); Matcher<const Tpl&> m = NanSensitiveFloatEq();
EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(), EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(),
...@@ -2362,14 +2358,14 @@ TEST(NanSensitiveFloatEqTest, MatchesEqualArgumentsWithNaN) { ...@@ -2362,14 +2358,14 @@ TEST(NanSensitiveFloatEqTest, MatchesEqualArgumentsWithNaN) {
// Tests that NanSensitiveFloatEq() describes itself properly. // Tests that NanSensitiveFloatEq() describes itself properly.
TEST(NanSensitiveFloatEqTest, CanDescribeSelfWithNaNs) { TEST(NanSensitiveFloatEqTest, CanDescribeSelfWithNaNs) {
Matcher<const ::testing::tuple<float, float>&> m = NanSensitiveFloatEq(); Matcher<const ::std::tuple<float, float>&> m = NanSensitiveFloatEq();
EXPECT_EQ("are an almost-equal pair", Describe(m)); EXPECT_EQ("are an almost-equal pair", Describe(m));
} }
// Tests that DoubleEq() matches a 2-tuple where // Tests that DoubleEq() matches a 2-tuple where
// DoubleEq(first field) matches the second field. // DoubleEq(first field) matches the second field.
TEST(DoubleEq2Test, MatchesEqualArguments) { TEST(DoubleEq2Test, MatchesEqualArguments) {
typedef ::testing::tuple<double, double> Tpl; typedef ::std::tuple<double, double> Tpl;
Matcher<const Tpl&> m = DoubleEq(); Matcher<const Tpl&> m = DoubleEq();
EXPECT_TRUE(m.Matches(Tpl(1.0, 1.0))); EXPECT_TRUE(m.Matches(Tpl(1.0, 1.0)));
EXPECT_TRUE(m.Matches(Tpl(0.3, 0.1 + 0.1 + 0.1))); EXPECT_TRUE(m.Matches(Tpl(0.3, 0.1 + 0.1 + 0.1)));
...@@ -2378,14 +2374,14 @@ TEST(DoubleEq2Test, MatchesEqualArguments) { ...@@ -2378,14 +2374,14 @@ TEST(DoubleEq2Test, MatchesEqualArguments) {
// Tests that DoubleEq() describes itself properly. // Tests that DoubleEq() describes itself properly.
TEST(DoubleEq2Test, CanDescribeSelf) { TEST(DoubleEq2Test, CanDescribeSelf) {
Matcher<const ::testing::tuple<double, double>&> m = DoubleEq(); Matcher<const ::std::tuple<double, double>&> m = DoubleEq();
EXPECT_EQ("are an almost-equal pair", Describe(m)); EXPECT_EQ("are an almost-equal pair", Describe(m));
} }
// Tests that NanSensitiveDoubleEq() matches a 2-tuple where // Tests that NanSensitiveDoubleEq() matches a 2-tuple where
// NanSensitiveDoubleEq(first field) matches the second field. // NanSensitiveDoubleEq(first field) matches the second field.
TEST(NanSensitiveDoubleEqTest, MatchesEqualArgumentsWithNaN) { TEST(NanSensitiveDoubleEqTest, MatchesEqualArgumentsWithNaN) {
typedef ::testing::tuple<double, double> Tpl; typedef ::std::tuple<double, double> Tpl;
Matcher<const Tpl&> m = NanSensitiveDoubleEq(); Matcher<const Tpl&> m = NanSensitiveDoubleEq();
EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(), EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(),
...@@ -2397,14 +2393,14 @@ TEST(NanSensitiveDoubleEqTest, MatchesEqualArgumentsWithNaN) { ...@@ -2397,14 +2393,14 @@ TEST(NanSensitiveDoubleEqTest, MatchesEqualArgumentsWithNaN) {
// Tests that DoubleEq() describes itself properly. // Tests that DoubleEq() describes itself properly.
TEST(NanSensitiveDoubleEqTest, CanDescribeSelfWithNaNs) { TEST(NanSensitiveDoubleEqTest, CanDescribeSelfWithNaNs) {
Matcher<const ::testing::tuple<double, double>&> m = NanSensitiveDoubleEq(); Matcher<const ::std::tuple<double, double>&> m = NanSensitiveDoubleEq();
EXPECT_EQ("are an almost-equal pair", Describe(m)); EXPECT_EQ("are an almost-equal pair", Describe(m));
} }
// Tests that FloatEq() matches a 2-tuple where // Tests that FloatEq() matches a 2-tuple where
// FloatNear(first field, max_abs_error) matches the second field. // FloatNear(first field, max_abs_error) matches the second field.
TEST(FloatNear2Test, MatchesEqualArguments) { TEST(FloatNear2Test, MatchesEqualArguments) {
typedef ::testing::tuple<float, float> Tpl; typedef ::std::tuple<float, float> Tpl;
Matcher<const Tpl&> m = FloatNear(0.5f); Matcher<const Tpl&> m = FloatNear(0.5f);
EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
EXPECT_TRUE(m.Matches(Tpl(1.3f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(1.3f, 1.0f)));
...@@ -2413,14 +2409,14 @@ TEST(FloatNear2Test, MatchesEqualArguments) { ...@@ -2413,14 +2409,14 @@ TEST(FloatNear2Test, MatchesEqualArguments) {
// Tests that FloatNear() describes itself properly. // Tests that FloatNear() describes itself properly.
TEST(FloatNear2Test, CanDescribeSelf) { TEST(FloatNear2Test, CanDescribeSelf) {
Matcher<const ::testing::tuple<float, float>&> m = FloatNear(0.5f); Matcher<const ::std::tuple<float, float>&> m = FloatNear(0.5f);
EXPECT_EQ("are an almost-equal pair", Describe(m)); EXPECT_EQ("are an almost-equal pair", Describe(m));
} }
// Tests that NanSensitiveFloatNear() matches a 2-tuple where // Tests that NanSensitiveFloatNear() matches a 2-tuple where
// NanSensitiveFloatNear(first field) matches the second field. // NanSensitiveFloatNear(first field) matches the second field.
TEST(NanSensitiveFloatNearTest, MatchesNearbyArgumentsWithNaN) { TEST(NanSensitiveFloatNearTest, MatchesNearbyArgumentsWithNaN) {
typedef ::testing::tuple<float, float> Tpl; typedef ::std::tuple<float, float> Tpl;
Matcher<const Tpl&> m = NanSensitiveFloatNear(0.5f); Matcher<const Tpl&> m = NanSensitiveFloatNear(0.5f);
EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
EXPECT_TRUE(m.Matches(Tpl(1.1f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(1.1f, 1.0f)));
...@@ -2433,15 +2429,14 @@ TEST(NanSensitiveFloatNearTest, MatchesNearbyArgumentsWithNaN) { ...@@ -2433,15 +2429,14 @@ TEST(NanSensitiveFloatNearTest, MatchesNearbyArgumentsWithNaN) {
// Tests that NanSensitiveFloatNear() describes itself properly. // Tests that NanSensitiveFloatNear() describes itself properly.
TEST(NanSensitiveFloatNearTest, CanDescribeSelfWithNaNs) { TEST(NanSensitiveFloatNearTest, CanDescribeSelfWithNaNs) {
Matcher<const ::testing::tuple<float, float>&> m = Matcher<const ::std::tuple<float, float>&> m = NanSensitiveFloatNear(0.5f);
NanSensitiveFloatNear(0.5f);
EXPECT_EQ("are an almost-equal pair", Describe(m)); EXPECT_EQ("are an almost-equal pair", Describe(m));
} }
// Tests that FloatEq() matches a 2-tuple where // Tests that FloatEq() matches a 2-tuple where
// DoubleNear(first field, max_abs_error) matches the second field. // DoubleNear(first field, max_abs_error) matches the second field.
TEST(DoubleNear2Test, MatchesEqualArguments) { TEST(DoubleNear2Test, MatchesEqualArguments) {
typedef ::testing::tuple<double, double> Tpl; typedef ::std::tuple<double, double> Tpl;
Matcher<const Tpl&> m = DoubleNear(0.5); Matcher<const Tpl&> m = DoubleNear(0.5);
EXPECT_TRUE(m.Matches(Tpl(1.0, 1.0))); EXPECT_TRUE(m.Matches(Tpl(1.0, 1.0)));
EXPECT_TRUE(m.Matches(Tpl(1.3, 1.0))); EXPECT_TRUE(m.Matches(Tpl(1.3, 1.0)));
...@@ -2450,14 +2445,14 @@ TEST(DoubleNear2Test, MatchesEqualArguments) { ...@@ -2450,14 +2445,14 @@ TEST(DoubleNear2Test, MatchesEqualArguments) {
// Tests that DoubleNear() describes itself properly. // Tests that DoubleNear() describes itself properly.
TEST(DoubleNear2Test, CanDescribeSelf) { TEST(DoubleNear2Test, CanDescribeSelf) {
Matcher<const ::testing::tuple<double, double>&> m = DoubleNear(0.5); Matcher<const ::std::tuple<double, double>&> m = DoubleNear(0.5);
EXPECT_EQ("are an almost-equal pair", Describe(m)); EXPECT_EQ("are an almost-equal pair", Describe(m));
} }
// Tests that NanSensitiveDoubleNear() matches a 2-tuple where // Tests that NanSensitiveDoubleNear() matches a 2-tuple where
// NanSensitiveDoubleNear(first field) matches the second field. // NanSensitiveDoubleNear(first field) matches the second field.
TEST(NanSensitiveDoubleNearTest, MatchesNearbyArgumentsWithNaN) { TEST(NanSensitiveDoubleNearTest, MatchesNearbyArgumentsWithNaN) {
typedef ::testing::tuple<double, double> Tpl; typedef ::std::tuple<double, double> Tpl;
Matcher<const Tpl&> m = NanSensitiveDoubleNear(0.5f); Matcher<const Tpl&> m = NanSensitiveDoubleNear(0.5f);
EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
EXPECT_TRUE(m.Matches(Tpl(1.1f, 1.0f))); EXPECT_TRUE(m.Matches(Tpl(1.1f, 1.0f)));
...@@ -2470,8 +2465,7 @@ TEST(NanSensitiveDoubleNearTest, MatchesNearbyArgumentsWithNaN) { ...@@ -2470,8 +2465,7 @@ TEST(NanSensitiveDoubleNearTest, MatchesNearbyArgumentsWithNaN) {
// Tests that NanSensitiveDoubleNear() describes itself properly. // Tests that NanSensitiveDoubleNear() describes itself properly.
TEST(NanSensitiveDoubleNearTest, CanDescribeSelfWithNaNs) { TEST(NanSensitiveDoubleNearTest, CanDescribeSelfWithNaNs) {
Matcher<const ::testing::tuple<double, double>&> m = Matcher<const ::std::tuple<double, double>&> m = NanSensitiveDoubleNear(0.5f);
NanSensitiveDoubleNear(0.5f);
EXPECT_EQ("are an almost-equal pair", Describe(m)); EXPECT_EQ("are an almost-equal pair", Describe(m));
} }
...@@ -3081,8 +3075,8 @@ TEST(DescribeMatcherTest, WorksWithPolymorphicMatcher) { ...@@ -3081,8 +3075,8 @@ TEST(DescribeMatcherTest, WorksWithPolymorphicMatcher) {
} }
TEST(AllArgsTest, WorksForTuple) { TEST(AllArgsTest, WorksForTuple) {
EXPECT_THAT(make_tuple(1, 2L), AllArgs(Lt())); EXPECT_THAT(std::make_tuple(1, 2L), AllArgs(Lt()));
EXPECT_THAT(make_tuple(2L, 1), Not(AllArgs(Lt()))); EXPECT_THAT(std::make_tuple(2L, 1), Not(AllArgs(Lt())));
} }
TEST(AllArgsTest, WorksForNonTuple) { TEST(AllArgsTest, WorksForNonTuple) {
...@@ -5060,11 +5054,11 @@ TEST(ContainerEqExtraTest, WorksForNativeArrayAsTuple) { ...@@ -5060,11 +5054,11 @@ TEST(ContainerEqExtraTest, WorksForNativeArrayAsTuple) {
const int b[] = {1, 2, 3, 4}; const int b[] = {1, 2, 3, 4};
const int* const p1 = a1; const int* const p1 = a1;
EXPECT_THAT(make_tuple(p1, 3), ContainerEq(a2)); EXPECT_THAT(std::make_tuple(p1, 3), ContainerEq(a2));
EXPECT_THAT(make_tuple(p1, 3), Not(ContainerEq(b))); EXPECT_THAT(std::make_tuple(p1, 3), Not(ContainerEq(b)));
const int c[] = {1, 3, 2}; 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) { TEST(ContainerEqExtraTest, CopiesNativeArrayParameter) {
...@@ -6246,13 +6240,15 @@ TEST(PolymorphicMatcherTest, CanAccessImpl) { ...@@ -6246,13 +6240,15 @@ TEST(PolymorphicMatcherTest, CanAccessImpl) {
TEST(MatcherTupleTest, ExplainsMatchFailure) { TEST(MatcherTupleTest, ExplainsMatchFailure) {
stringstream ss1; stringstream ss1;
ExplainMatchFailureTupleTo(make_tuple(Matcher<char>(Eq('a')), GreaterThan(5)), ExplainMatchFailureTupleTo(
make_tuple('a', 10), &ss1); std::make_tuple(Matcher<char>(Eq('a')), GreaterThan(5)),
std::make_tuple('a', 10), &ss1);
EXPECT_EQ("", ss1.str()); // Successful match. EXPECT_EQ("", ss1.str()); // Successful match.
stringstream ss2; stringstream ss2;
ExplainMatchFailureTupleTo(make_tuple(GreaterThan(5), Matcher<char>(Eq('a'))), ExplainMatchFailureTupleTo(
make_tuple(2, 'b'), &ss2); std::make_tuple(GreaterThan(5), Matcher<char>(Eq('a'))),
std::make_tuple(2, 'b'), &ss2);
EXPECT_EQ(" Expected arg #0: is > 5\n" EXPECT_EQ(" Expected arg #0: is > 5\n"
" Actual: 2, which is 3 less than 5\n" " Actual: 2, which is 3 less than 5\n"
" Expected arg #1: is equal to 'a' (97, 0x61)\n" " Expected arg #1: is equal to 'a' (97, 0x61)\n"
...@@ -6260,8 +6256,9 @@ TEST(MatcherTupleTest, ExplainsMatchFailure) { ...@@ -6260,8 +6256,9 @@ TEST(MatcherTupleTest, ExplainsMatchFailure) {
ss2.str()); // Failed match where both arguments need explanation. ss2.str()); // Failed match where both arguments need explanation.
stringstream ss3; stringstream ss3;
ExplainMatchFailureTupleTo(make_tuple(GreaterThan(5), Matcher<char>(Eq('a'))), ExplainMatchFailureTupleTo(
make_tuple(2, 'a'), &ss3); std::make_tuple(GreaterThan(5), Matcher<char>(Eq('a'))),
std::make_tuple(2, 'a'), &ss3);
EXPECT_EQ(" Expected arg #0: is > 5\n" EXPECT_EQ(" Expected arg #0: is > 5\n"
" Actual: 2, which is 3 less than 5\n", " Actual: 2, which is 3 less than 5\n",
ss3.str()); // Failed match where only one argument needs ss3.str()); // Failed match where only one argument needs
...@@ -6350,21 +6347,21 @@ TEST(EachTest, AcceptsMatcher) { ...@@ -6350,21 +6347,21 @@ TEST(EachTest, AcceptsMatcher) {
TEST(EachTest, WorksForNativeArrayAsTuple) { TEST(EachTest, WorksForNativeArrayAsTuple) {
const int a[] = {1, 2}; const int a[] = {1, 2};
const int* const pointer = a; const int* const pointer = a;
EXPECT_THAT(make_tuple(pointer, 2), Each(Gt(0))); EXPECT_THAT(std::make_tuple(pointer, 2), Each(Gt(0)));
EXPECT_THAT(make_tuple(pointer, 2), Not(Each(Gt(1)))); EXPECT_THAT(std::make_tuple(pointer, 2), Not(Each(Gt(1))));
} }
// For testing Pointwise(). // For testing Pointwise().
class IsHalfOfMatcher { class IsHalfOfMatcher {
public: public:
template <typename T1, typename T2> template <typename T1, typename T2>
bool MatchAndExplain(const tuple<T1, T2>& a_pair, bool MatchAndExplain(const std::tuple<T1, T2>& a_pair,
MatchResultListener* listener) const { MatchResultListener* listener) const {
if (get<0>(a_pair) == get<1>(a_pair)/2) { if (std::get<0>(a_pair) == std::get<1>(a_pair) / 2) {
*listener << "where the second is " << get<1>(a_pair); *listener << "where the second is " << std::get<1>(a_pair);
return true; return true;
} else { } 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; return false;
} }
} }
...@@ -6481,13 +6478,13 @@ TEST(PointwiseTest, AcceptsCorrectContent) { ...@@ -6481,13 +6478,13 @@ TEST(PointwiseTest, AcceptsCorrectContent) {
TEST(PointwiseTest, AllowsMonomorphicInnerMatcher) { TEST(PointwiseTest, AllowsMonomorphicInnerMatcher) {
const double lhs[3] = {1, 2, 3}; const double lhs[3] = {1, 2, 3};
const int rhs[3] = {2, 4, 6}; const int rhs[3] = {2, 4, 6};
const Matcher<tuple<const double&, const int&> > m1 = IsHalfOf(); const Matcher<std::tuple<const double&, const int&>> m1 = IsHalfOf();
EXPECT_THAT(lhs, Pointwise(m1, rhs)); EXPECT_THAT(lhs, Pointwise(m1, rhs));
EXPECT_EQ("", Explain(Pointwise(m1, rhs), lhs)); EXPECT_EQ("", Explain(Pointwise(m1, rhs), lhs));
// This type works as a tuple<const double&, const int&> can be // This type works as a std::tuple<const double&, const int&> can be
// implicitly cast to tuple<double, int>. // implicitly cast to std::tuple<double, int>.
const Matcher<tuple<double, int> > m2 = IsHalfOf(); const Matcher<std::tuple<double, int>> m2 = IsHalfOf();
EXPECT_THAT(lhs, Pointwise(m2, rhs)); EXPECT_THAT(lhs, Pointwise(m2, rhs));
EXPECT_EQ("", Explain(Pointwise(m2, rhs), lhs)); EXPECT_EQ("", Explain(Pointwise(m2, rhs), lhs));
} }
...@@ -6597,12 +6594,12 @@ TEST(UnorderedPointwiseTest, AcceptsCorrectContentInDifferentOrder) { ...@@ -6597,12 +6594,12 @@ TEST(UnorderedPointwiseTest, AcceptsCorrectContentInDifferentOrder) {
TEST(UnorderedPointwiseTest, AllowsMonomorphicInnerMatcher) { TEST(UnorderedPointwiseTest, AllowsMonomorphicInnerMatcher) {
const double lhs[3] = {1, 2, 3}; const double lhs[3] = {1, 2, 3};
const int rhs[3] = {4, 6, 2}; const int rhs[3] = {4, 6, 2};
const Matcher<tuple<const double&, const int&> > m1 = IsHalfOf(); const Matcher<std::tuple<const double&, const int&>> m1 = IsHalfOf();
EXPECT_THAT(lhs, UnorderedPointwise(m1, rhs)); EXPECT_THAT(lhs, UnorderedPointwise(m1, rhs));
// This type works as a tuple<const double&, const int&> can be // This type works as a std::tuple<const double&, const int&> can be
// implicitly cast to tuple<double, int>. // implicitly cast to std::tuple<double, int>.
const Matcher<tuple<double, int> > m2 = IsHalfOf(); const Matcher<std::tuple<double, int>> m2 = IsHalfOf();
EXPECT_THAT(lhs, UnorderedPointwise(m2, rhs)); EXPECT_THAT(lhs, UnorderedPointwise(m2, rhs));
} }
......
...@@ -46,10 +46,6 @@ namespace gmock_more_actions_test { ...@@ -46,10 +46,6 @@ namespace gmock_more_actions_test {
using ::std::plus; using ::std::plus;
using ::std::string; using ::std::string;
using testing::get;
using testing::make_tuple;
using testing::tuple;
using testing::tuple_element;
using testing::_; using testing::_;
using testing::Action; using testing::Action;
using testing::ActionInterface; using testing::ActionInterface;
...@@ -232,45 +228,46 @@ class Foo { ...@@ -232,45 +228,46 @@ class Foo {
// Tests using Invoke() with a nullary function. // Tests using Invoke() with a nullary function.
TEST(InvokeTest, Nullary) { TEST(InvokeTest, Nullary) {
Action<int()> a = Invoke(Nullary); // NOLINT Action<int()> 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. // Tests using Invoke() with a unary function.
TEST(InvokeTest, Unary) { TEST(InvokeTest, Unary) {
Action<bool(int)> a = Invoke(Unary); // NOLINT Action<bool(int)> a = Invoke(Unary); // NOLINT
EXPECT_FALSE(a.Perform(make_tuple(1))); EXPECT_FALSE(a.Perform(std::make_tuple(1)));
EXPECT_TRUE(a.Perform(make_tuple(-1))); EXPECT_TRUE(a.Perform(std::make_tuple(-1)));
} }
// Tests using Invoke() with a binary function. // Tests using Invoke() with a binary function.
TEST(InvokeTest, Binary) { TEST(InvokeTest, Binary) {
Action<const char*(const char*, short)> a = Invoke(Binary); // NOLINT Action<const char*(const char*, short)> a = Invoke(Binary); // NOLINT
const char* p = "Hello"; const char* p = "Hello";
EXPECT_EQ(p + 2, a.Perform(make_tuple(p, Short(2)))); EXPECT_EQ(p + 2, a.Perform(std::make_tuple(p, Short(2))));
} }
// Tests using Invoke() with a ternary function. // Tests using Invoke() with a ternary function.
TEST(InvokeTest, Ternary) { TEST(InvokeTest, Ternary) {
Action<int(int, char, short)> a = Invoke(Ternary); // NOLINT Action<int(int, char, short)> a = Invoke(Ternary); // NOLINT
EXPECT_EQ(6, a.Perform(make_tuple(1, '\2', Short(3)))); EXPECT_EQ(6, a.Perform(std::make_tuple(1, '\2', Short(3))));
} }
// Tests using Invoke() with a 4-argument function. // Tests using Invoke() with a 4-argument function.
TEST(InvokeTest, FunctionThatTakes4Arguments) { TEST(InvokeTest, FunctionThatTakes4Arguments) {
Action<int(int, int, int, int)> a = Invoke(SumOf4); // NOLINT Action<int(int, int, int, int)> 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. // Tests using Invoke() with a 5-argument function.
TEST(InvokeTest, FunctionThatTakes5Arguments) { TEST(InvokeTest, FunctionThatTakes5Arguments) {
Action<int(int, int, int, int, int)> a = Invoke(SumOf5); // NOLINT Action<int(int, int, int, int, int)> 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. // Tests using Invoke() with a 6-argument function.
TEST(InvokeTest, FunctionThatTakes6Arguments) { TEST(InvokeTest, FunctionThatTakes6Arguments) {
Action<int(int, int, int, int, int, int)> a = Invoke(SumOf6); // NOLINT Action<int(int, int, int, int, int, int)> 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 // A helper that turns the type of a C-string literal from const
...@@ -283,7 +280,7 @@ TEST(InvokeTest, FunctionThatTakes7Arguments) { ...@@ -283,7 +280,7 @@ TEST(InvokeTest, FunctionThatTakes7Arguments) {
const char*, const char*, const char*)> const char*, const char*, const char*)>
a = Invoke(Concat7); a = Invoke(Concat7);
EXPECT_EQ("1234567", EXPECT_EQ("1234567",
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"), CharPtr("4"), CharPtr("5"), CharPtr("6"),
CharPtr("7")))); CharPtr("7"))));
} }
...@@ -294,7 +291,7 @@ TEST(InvokeTest, FunctionThatTakes8Arguments) { ...@@ -294,7 +291,7 @@ TEST(InvokeTest, FunctionThatTakes8Arguments) {
const char*, const char*, const char*, const char*)> const char*, const char*, const char*, const char*)>
a = Invoke(Concat8); a = Invoke(Concat8);
EXPECT_EQ("12345678", EXPECT_EQ("12345678",
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"), CharPtr("4"), CharPtr("5"), CharPtr("6"),
CharPtr("7"), CharPtr("8")))); CharPtr("7"), CharPtr("8"))));
} }
...@@ -305,8 +302,8 @@ TEST(InvokeTest, FunctionThatTakes9Arguments) { ...@@ -305,8 +302,8 @@ TEST(InvokeTest, FunctionThatTakes9Arguments) {
const char*, const char*, const char*, const char*, const char*, const char*, const char*, const char*,
const char*)> const char*)>
a = Invoke(Concat9); a = Invoke(Concat9);
EXPECT_EQ("123456789", EXPECT_EQ("123456789", a.Perform(std::make_tuple(
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"), CharPtr("4"), CharPtr("5"), CharPtr("6"),
CharPtr("7"), CharPtr("8"), CharPtr("9")))); CharPtr("7"), CharPtr("8"), CharPtr("9"))));
} }
...@@ -318,7 +315,7 @@ TEST(InvokeTest, FunctionThatTakes10Arguments) { ...@@ -318,7 +315,7 @@ TEST(InvokeTest, FunctionThatTakes10Arguments) {
const char*, const char*)> const char*, const char*)>
a = Invoke(Concat10); a = Invoke(Concat10);
EXPECT_EQ("1234567890", EXPECT_EQ("1234567890",
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"), CharPtr("4"), CharPtr("5"), CharPtr("6"),
CharPtr("7"), CharPtr("8"), CharPtr("9"), CharPtr("7"), CharPtr("8"), CharPtr("9"),
CharPtr("0")))); CharPtr("0"))));
...@@ -327,37 +324,37 @@ TEST(InvokeTest, FunctionThatTakes10Arguments) { ...@@ -327,37 +324,37 @@ TEST(InvokeTest, FunctionThatTakes10Arguments) {
// Tests using Invoke() with functions with parameters declared as Unused. // Tests using Invoke() with functions with parameters declared as Unused.
TEST(InvokeTest, FunctionWithUnusedParameters) { TEST(InvokeTest, FunctionWithUnusedParameters) {
Action<int(int, int, double, const std::string&)> a1 = Invoke(SumOfFirst2); Action<int(int, int, double, const std::string&)> a1 = Invoke(SumOfFirst2);
tuple<int, int, double, std::string> dummy = std::tuple<int, int, double, std::string> dummy =
make_tuple(10, 2, 5.6, std::string("hi")); std::make_tuple(10, 2, 5.6, std::string("hi"));
EXPECT_EQ(12, a1.Perform(dummy)); EXPECT_EQ(12, a1.Perform(dummy));
Action<int(int, int, bool, int*)> a2 = Action<int(int, int, bool, int*)> a2 =
Invoke(SumOfFirst2); Invoke(SumOfFirst2);
EXPECT_EQ(23, EXPECT_EQ(
a2.Perform(make_tuple(20, 3, true, static_cast<int*>(nullptr)))); 23, a2.Perform(std::make_tuple(20, 3, true, static_cast<int*>(nullptr))));
} }
// Tests using Invoke() with methods with parameters declared as Unused. // Tests using Invoke() with methods with parameters declared as Unused.
TEST(InvokeTest, MethodWithUnusedParameters) { TEST(InvokeTest, MethodWithUnusedParameters) {
Foo foo; Foo foo;
Action<int(std::string, bool, int, int)> a1 = Invoke(&foo, &Foo::SumOfLast2); Action<int(std::string, bool, int, int)> 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<int(char, double, int, int)> a2 = Action<int(char, double, int, int)> a2 =
Invoke(&foo, &Foo::SumOfLast2); 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. // Tests using Invoke() with a functor.
TEST(InvokeTest, Functor) { TEST(InvokeTest, Functor) {
Action<long(long, int)> a = Invoke(plus<long>()); // NOLINT Action<long(long, int)> a = Invoke(plus<long>()); // 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. // Tests using Invoke(f) as an action of a compatible type.
TEST(InvokeTest, FunctionWithCompatibleType) { TEST(InvokeTest, FunctionWithCompatibleType) {
Action<long(int, short, char, bool)> a = Invoke(SumOf4); // NOLINT Action<long(int, short, char, bool)> a = Invoke(SumOf4); // NOLINT
EXPECT_EQ(4321, a.Perform(make_tuple(4000, 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. // Tests using Invoke() with an object pointer and a method pointer.
...@@ -366,14 +363,14 @@ TEST(InvokeTest, FunctionWithCompatibleType) { ...@@ -366,14 +363,14 @@ TEST(InvokeTest, FunctionWithCompatibleType) {
TEST(InvokeMethodTest, Nullary) { TEST(InvokeMethodTest, Nullary) {
Foo foo; Foo foo;
Action<int()> a = Invoke(&foo, &Foo::Nullary); // NOLINT Action<int()> 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. // Tests using Invoke() with a unary method.
TEST(InvokeMethodTest, Unary) { TEST(InvokeMethodTest, Unary) {
Foo foo; Foo foo;
Action<short(long)> a = Invoke(&foo, &Foo::Unary); // NOLINT Action<short(long)> 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. // Tests using Invoke() with a binary method.
...@@ -381,7 +378,7 @@ TEST(InvokeMethodTest, Binary) { ...@@ -381,7 +378,7 @@ TEST(InvokeMethodTest, Binary) {
Foo foo; Foo foo;
Action<std::string(const std::string&, char)> a = Invoke(&foo, &Foo::Binary); Action<std::string(const std::string&, char)> a = Invoke(&foo, &Foo::Binary);
std::string s("Hell"); std::string s("Hell");
tuple<std::string, char> dummy = make_tuple(s, 'o'); std::tuple<std::string, char> dummy = std::make_tuple(s, 'o');
EXPECT_EQ("Hello", a.Perform(dummy)); EXPECT_EQ("Hello", a.Perform(dummy));
} }
...@@ -389,21 +386,21 @@ TEST(InvokeMethodTest, Binary) { ...@@ -389,21 +386,21 @@ TEST(InvokeMethodTest, Binary) {
TEST(InvokeMethodTest, Ternary) { TEST(InvokeMethodTest, Ternary) {
Foo foo; Foo foo;
Action<int(int, bool, char)> a = Invoke(&foo, &Foo::Ternary); // NOLINT Action<int(int, bool, char)> a = Invoke(&foo, &Foo::Ternary); // NOLINT
EXPECT_EQ(1124, a.Perform(make_tuple(1000, true, Char(1)))); EXPECT_EQ(1124, a.Perform(std::make_tuple(1000, true, Char(1))));
} }
// Tests using Invoke() with a 4-argument method. // Tests using Invoke() with a 4-argument method.
TEST(InvokeMethodTest, MethodThatTakes4Arguments) { TEST(InvokeMethodTest, MethodThatTakes4Arguments) {
Foo foo; Foo foo;
Action<int(int, int, int, int)> a = Invoke(&foo, &Foo::SumOf4); // NOLINT Action<int(int, int, int, int)> 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. // Tests using Invoke() with a 5-argument method.
TEST(InvokeMethodTest, MethodThatTakes5Arguments) { TEST(InvokeMethodTest, MethodThatTakes5Arguments) {
Foo foo; Foo foo;
Action<int(int, int, int, int, int)> a = Invoke(&foo, &Foo::SumOf5); // NOLINT Action<int(int, int, int, int, int)> 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. // Tests using Invoke() with a 6-argument method.
...@@ -411,7 +408,8 @@ TEST(InvokeMethodTest, MethodThatTakes6Arguments) { ...@@ -411,7 +408,8 @@ TEST(InvokeMethodTest, MethodThatTakes6Arguments) {
Foo foo; Foo foo;
Action<int(int, int, int, int, int, int)> a = // NOLINT Action<int(int, int, int, int, int, int)> a = // NOLINT
Invoke(&foo, &Foo::SumOf6); 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. // Tests using Invoke() with a 7-argument method.
...@@ -421,7 +419,7 @@ TEST(InvokeMethodTest, MethodThatTakes7Arguments) { ...@@ -421,7 +419,7 @@ TEST(InvokeMethodTest, MethodThatTakes7Arguments) {
const char*, const char*, const char*)> const char*, const char*, const char*)>
a = Invoke(&foo, &Foo::Concat7); a = Invoke(&foo, &Foo::Concat7);
EXPECT_EQ("1234567", EXPECT_EQ("1234567",
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"), CharPtr("4"), CharPtr("5"), CharPtr("6"),
CharPtr("7")))); CharPtr("7"))));
} }
...@@ -433,7 +431,7 @@ TEST(InvokeMethodTest, MethodThatTakes8Arguments) { ...@@ -433,7 +431,7 @@ TEST(InvokeMethodTest, MethodThatTakes8Arguments) {
const char*, const char*, const char*, const char*)> const char*, const char*, const char*, const char*)>
a = Invoke(&foo, &Foo::Concat8); a = Invoke(&foo, &Foo::Concat8);
EXPECT_EQ("12345678", EXPECT_EQ("12345678",
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"), CharPtr("4"), CharPtr("5"), CharPtr("6"),
CharPtr("7"), CharPtr("8")))); CharPtr("7"), CharPtr("8"))));
} }
...@@ -445,8 +443,8 @@ TEST(InvokeMethodTest, MethodThatTakes9Arguments) { ...@@ -445,8 +443,8 @@ TEST(InvokeMethodTest, MethodThatTakes9Arguments) {
const char*, const char*, const char*, const char*, const char*, const char*, const char*, const char*,
const char*)> const char*)>
a = Invoke(&foo, &Foo::Concat9); a = Invoke(&foo, &Foo::Concat9);
EXPECT_EQ("123456789", EXPECT_EQ("123456789", a.Perform(std::make_tuple(
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"), CharPtr("4"), CharPtr("5"), CharPtr("6"),
CharPtr("7"), CharPtr("8"), CharPtr("9")))); CharPtr("7"), CharPtr("8"), CharPtr("9"))));
} }
...@@ -459,7 +457,7 @@ TEST(InvokeMethodTest, MethodThatTakes10Arguments) { ...@@ -459,7 +457,7 @@ TEST(InvokeMethodTest, MethodThatTakes10Arguments) {
const char*, const char*)> const char*, const char*)>
a = Invoke(&foo, &Foo::Concat10); a = Invoke(&foo, &Foo::Concat10);
EXPECT_EQ("1234567890", EXPECT_EQ("1234567890",
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"), a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"), CharPtr("4"), CharPtr("5"), CharPtr("6"),
CharPtr("7"), CharPtr("8"), CharPtr("9"), CharPtr("7"), CharPtr("8"), CharPtr("9"),
CharPtr("0")))); CharPtr("0"))));
...@@ -470,48 +468,48 @@ TEST(InvokeMethodTest, MethodWithCompatibleType) { ...@@ -470,48 +468,48 @@ TEST(InvokeMethodTest, MethodWithCompatibleType) {
Foo foo; Foo foo;
Action<long(int, short, char, bool)> a = // NOLINT Action<long(int, short, char, bool)> a = // NOLINT
Invoke(&foo, &Foo::SumOf4); Invoke(&foo, &Foo::SumOf4);
EXPECT_EQ(4444, a.Perform(make_tuple(4000, 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. // Tests using WithoutArgs with an action that takes no argument.
TEST(WithoutArgsTest, NoArg) { TEST(WithoutArgsTest, NoArg) {
Action<int(int n)> a = WithoutArgs(Invoke(Nullary)); // NOLINT Action<int(int n)> 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. // Tests using WithArg with an action that takes 1 argument.
TEST(WithArgTest, OneArg) { TEST(WithArgTest, OneArg) {
Action<bool(double x, int n)> b = WithArg<1>(Invoke(Unary)); // NOLINT Action<bool(double x, int n)> b = WithArg<1>(Invoke(Unary)); // NOLINT
EXPECT_TRUE(b.Perform(make_tuple(1.5, -1))); EXPECT_TRUE(b.Perform(std::make_tuple(1.5, -1)));
EXPECT_FALSE(b.Perform(make_tuple(1.5, 1))); EXPECT_FALSE(b.Perform(std::make_tuple(1.5, 1)));
} }
TEST(ReturnArgActionTest, WorksForOneArgIntArg0) { TEST(ReturnArgActionTest, WorksForOneArgIntArg0) {
const Action<int(int)> a = ReturnArg<0>(); const Action<int(int)> a = ReturnArg<0>();
EXPECT_EQ(5, a.Perform(make_tuple(5))); EXPECT_EQ(5, a.Perform(std::make_tuple(5)));
} }
TEST(ReturnArgActionTest, WorksForMultiArgBoolArg0) { TEST(ReturnArgActionTest, WorksForMultiArgBoolArg0) {
const Action<bool(bool, bool, bool)> a = ReturnArg<0>(); const Action<bool(bool, bool, bool)> 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) { TEST(ReturnArgActionTest, WorksForMultiArgStringArg2) {
const Action<std::string(int, int, std::string, int)> a = ReturnArg<2>(); const Action<std::string(int, int, std::string, int)> 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) { TEST(SaveArgActionTest, WorksForSameType) {
int result = 0; int result = 0;
const Action<void(int n)> a1 = SaveArg<0>(&result); const Action<void(int n)> a1 = SaveArg<0>(&result);
a1.Perform(make_tuple(5)); a1.Perform(std::make_tuple(5));
EXPECT_EQ(5, result); EXPECT_EQ(5, result);
} }
TEST(SaveArgActionTest, WorksForCompatibleType) { TEST(SaveArgActionTest, WorksForCompatibleType) {
int result = 0; int result = 0;
const Action<void(bool, char)> a1 = SaveArg<1>(&result); const Action<void(bool, char)> a1 = SaveArg<1>(&result);
a1.Perform(make_tuple(true, 'a')); a1.Perform(std::make_tuple(true, 'a'));
EXPECT_EQ('a', result); EXPECT_EQ('a', result);
} }
...@@ -519,7 +517,7 @@ TEST(SaveArgPointeeActionTest, WorksForSameType) { ...@@ -519,7 +517,7 @@ TEST(SaveArgPointeeActionTest, WorksForSameType) {
int result = 0; int result = 0;
const int value = 5; const int value = 5;
const Action<void(const int*)> a1 = SaveArgPointee<0>(&result); const Action<void(const int*)> a1 = SaveArgPointee<0>(&result);
a1.Perform(make_tuple(&value)); a1.Perform(std::make_tuple(&value));
EXPECT_EQ(5, result); EXPECT_EQ(5, result);
} }
...@@ -527,7 +525,7 @@ TEST(SaveArgPointeeActionTest, WorksForCompatibleType) { ...@@ -527,7 +525,7 @@ TEST(SaveArgPointeeActionTest, WorksForCompatibleType) {
int result = 0; int result = 0;
char value = 'a'; char value = 'a';
const Action<void(bool, char*)> a1 = SaveArgPointee<1>(&result); const Action<void(bool, char*)> a1 = SaveArgPointee<1>(&result);
a1.Perform(make_tuple(true, &value)); a1.Perform(std::make_tuple(true, &value));
EXPECT_EQ('a', result); EXPECT_EQ('a', result);
} }
...@@ -535,28 +533,28 @@ TEST(SaveArgPointeeActionTest, WorksForLinkedPtr) { ...@@ -535,28 +533,28 @@ TEST(SaveArgPointeeActionTest, WorksForLinkedPtr) {
int result = 0; int result = 0;
linked_ptr<int> value(new int(5)); linked_ptr<int> value(new int(5));
const Action<void(linked_ptr<int>)> a1 = SaveArgPointee<0>(&result); const Action<void(linked_ptr<int>)> a1 = SaveArgPointee<0>(&result);
a1.Perform(make_tuple(value)); a1.Perform(std::make_tuple(value));
EXPECT_EQ(5, result); EXPECT_EQ(5, result);
} }
TEST(SetArgRefereeActionTest, WorksForSameType) { TEST(SetArgRefereeActionTest, WorksForSameType) {
int value = 0; int value = 0;
const Action<void(int&)> a1 = SetArgReferee<0>(1); const Action<void(int&)> a1 = SetArgReferee<0>(1);
a1.Perform(tuple<int&>(value)); a1.Perform(std::tuple<int&>(value));
EXPECT_EQ(1, value); EXPECT_EQ(1, value);
} }
TEST(SetArgRefereeActionTest, WorksForCompatibleType) { TEST(SetArgRefereeActionTest, WorksForCompatibleType) {
int value = 0; int value = 0;
const Action<void(int, int&)> a1 = SetArgReferee<1>('a'); const Action<void(int, int&)> a1 = SetArgReferee<1>('a');
a1.Perform(tuple<int, int&>(0, value)); a1.Perform(std::tuple<int, int&>(0, value));
EXPECT_EQ('a', value); EXPECT_EQ('a', value);
} }
TEST(SetArgRefereeActionTest, WorksWithExtraArguments) { TEST(SetArgRefereeActionTest, WorksWithExtraArguments) {
int value = 0; int value = 0;
const Action<void(bool, int, int&, const char*)> a1 = SetArgReferee<2>('a'); const Action<void(bool, int, int&, const char*)> a1 = SetArgReferee<2>('a');
a1.Perform(tuple<bool, int, int&, const char*>(true, 0, value, "hi")); a1.Perform(std::tuple<bool, int, int&, const char*>(true, 0, value, "hi"));
EXPECT_EQ('a', value); EXPECT_EQ('a', value);
} }
...@@ -583,7 +581,7 @@ TEST(DeleteArgActionTest, OneArg) { ...@@ -583,7 +581,7 @@ TEST(DeleteArgActionTest, OneArg) {
DeletionTester* t = new DeletionTester(&is_deleted); DeletionTester* t = new DeletionTester(&is_deleted);
const Action<void(DeletionTester*)> a1 = DeleteArg<0>(); // NOLINT const Action<void(DeletionTester*)> a1 = DeleteArg<0>(); // NOLINT
EXPECT_FALSE(is_deleted); EXPECT_FALSE(is_deleted);
a1.Perform(make_tuple(t)); a1.Perform(std::make_tuple(t));
EXPECT_TRUE(is_deleted); EXPECT_TRUE(is_deleted);
} }
...@@ -593,7 +591,7 @@ TEST(DeleteArgActionTest, TenArgs) { ...@@ -593,7 +591,7 @@ TEST(DeleteArgActionTest, TenArgs) {
const Action<void(bool, int, int, const char*, bool, const Action<void(bool, int, int, const char*, bool,
int, int, int, int, DeletionTester*)> a1 = DeleteArg<9>(); int, int, int, int, DeletionTester*)> a1 = DeleteArg<9>();
EXPECT_FALSE(is_deleted); 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); EXPECT_TRUE(is_deleted);
} }
...@@ -601,19 +599,19 @@ TEST(DeleteArgActionTest, TenArgs) { ...@@ -601,19 +599,19 @@ TEST(DeleteArgActionTest, TenArgs) {
TEST(ThrowActionTest, ThrowsGivenExceptionInVoidFunction) { TEST(ThrowActionTest, ThrowsGivenExceptionInVoidFunction) {
const Action<void(int n)> a = Throw('a'); const Action<void(int n)> a = Throw('a');
EXPECT_THROW(a.Perform(make_tuple(0)), char); EXPECT_THROW(a.Perform(std::make_tuple(0)), char);
} }
class MyException {}; class MyException {};
TEST(ThrowActionTest, ThrowsGivenExceptionInNonVoidFunction) { TEST(ThrowActionTest, ThrowsGivenExceptionInNonVoidFunction) {
const Action<double(char ch)> a = Throw(MyException()); const Action<double(char ch)> a = Throw(MyException());
EXPECT_THROW(a.Perform(make_tuple('0')), MyException); EXPECT_THROW(a.Perform(std::make_tuple('0')), MyException);
} }
TEST(ThrowActionTest, ThrowsGivenExceptionInNullaryFunction) { TEST(ThrowActionTest, ThrowsGivenExceptionInNullaryFunction) {
const Action<double()> a = Throw(MyException()); const Action<double()> a = Throw(MyException());
EXPECT_THROW(a.Perform(make_tuple()), MyException); EXPECT_THROW(a.Perform(std::make_tuple()), MyException);
} }
#endif // GTEST_HAS_EXCEPTIONS #endif // GTEST_HAS_EXCEPTIONS
...@@ -629,7 +627,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArray) { ...@@ -629,7 +627,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArray) {
int* pn = n; int* pn = n;
char ch[4] = {}; char ch[4] = {};
char* pch = ch; 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(1, n[0]);
EXPECT_EQ(2, n[1]); EXPECT_EQ(2, n[1]);
EXPECT_EQ(3, n[2]); EXPECT_EQ(3, n[2]);
...@@ -644,7 +642,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArray) { ...@@ -644,7 +642,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArray) {
a = SetArrayArgument<2>(letters.begin(), letters.end()); a = SetArrayArgument<2>(letters.begin(), letters.end());
std::fill_n(n, 4, 0); std::fill_n(n, 4, 0);
std::fill_n(ch, 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[0]);
EXPECT_EQ(0, n[1]); EXPECT_EQ(0, n[1]);
EXPECT_EQ(0, n[2]); EXPECT_EQ(0, n[2]);
...@@ -663,7 +661,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithEmptyRange) { ...@@ -663,7 +661,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithEmptyRange) {
int n[4] = {}; int n[4] = {};
int* pn = n; 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[0]);
EXPECT_EQ(0, n[1]); EXPECT_EQ(0, n[1]);
EXPECT_EQ(0, n[2]); EXPECT_EQ(0, n[2]);
...@@ -679,7 +677,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithConvertibleType) { ...@@ -679,7 +677,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithConvertibleType) {
int codes[4] = { 111, 222, 333, 444 }; int codes[4] = { 111, 222, 333, 444 };
int* pcodes = codes; int* pcodes = codes;
a.Perform(make_tuple(true, pcodes)); a.Perform(std::make_tuple(true, pcodes));
EXPECT_EQ(97, codes[0]); EXPECT_EQ(97, codes[0]);
EXPECT_EQ(98, codes[1]); EXPECT_EQ(98, codes[1]);
EXPECT_EQ(99, codes[2]); EXPECT_EQ(99, codes[2]);
...@@ -693,17 +691,17 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithIteratorArgument) { ...@@ -693,17 +691,17 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithIteratorArgument) {
Action<MyFunction> a = SetArrayArgument<1>(letters.begin(), letters.end()); Action<MyFunction> a = SetArrayArgument<1>(letters.begin(), letters.end());
std::string s; std::string s;
a.Perform(make_tuple(true, back_inserter(s))); a.Perform(std::make_tuple(true, back_inserter(s)));
EXPECT_EQ(letters, s); EXPECT_EQ(letters, s);
} }
TEST(ReturnPointeeTest, Works) { TEST(ReturnPointeeTest, Works) {
int n = 42; int n = 42;
const Action<int()> a = ReturnPointee(&n); const Action<int()> a = ReturnPointee(&n);
EXPECT_EQ(42, a.Perform(make_tuple())); EXPECT_EQ(42, a.Perform(std::make_tuple()));
n = 43; n = 43;
EXPECT_EQ(43, a.Perform(make_tuple())); EXPECT_EQ(43, a.Perform(std::make_tuple()));
} }
} // namespace gmock_generated_actions_test } // namespace gmock_generated_actions_test
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment