Commit 5df87d70 by kosak

Export tuple and friends in the ::testing namespace.

parent a6340420
...@@ -39,7 +39,7 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support. ...@@ -39,7 +39,7 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
// and at most $maxtuple arguments in Combine. Please contact // and at most $maxtuple arguments in Combine. Please contact
// googletestframework@googlegroups.com if you need more. // googletestframework@googlegroups.com if you need more.
// Please note that the number of arguments to Combine is limited // Please note that the number of arguments to Combine is limited
// by the maximum arity of the implementation of tr1::tuple which is // by the maximum arity of the implementation of tuple which is
// currently set at $maxtuple. // currently set at $maxtuple.
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
...@@ -128,9 +128,9 @@ $range k 2..i ...@@ -128,9 +128,9 @@ $range k 2..i
template <$for j, [[typename T$j]]> template <$for j, [[typename T$j]]>
class CartesianProductGenerator$i class CartesianProductGenerator$i
: public ParamGeneratorInterface< ::std::tr1::tuple<$for j, [[T$j]]> > { : public ParamGeneratorInterface< ::testing::tuple<$for j, [[T$j]]> > {
public: public:
typedef ::std::tr1::tuple<$for j, [[T$j]]> ParamType; typedef ::testing::tuple<$for j, [[T$j]]> ParamType;
CartesianProductGenerator$i($for j, [[const ParamGenerator<T$j>& g$j]]) CartesianProductGenerator$i($for j, [[const ParamGenerator<T$j>& g$j]])
: $for j, [[g$(j)_(g$j)]] {} : $for j, [[g$(j)_(g$j)]] {}
...@@ -269,8 +269,8 @@ class CartesianProductHolder$i { ...@@ -269,8 +269,8 @@ class CartesianProductHolder$i {
CartesianProductHolder$i($for j, [[const Generator$j& g$j]]) CartesianProductHolder$i($for j, [[const Generator$j& g$j]])
: $for j, [[g$(j)_(g$j)]] {} : $for j, [[g$(j)_(g$j)]] {}
template <$for j, [[typename T$j]]> template <$for j, [[typename T$j]]>
operator ParamGenerator< ::std::tr1::tuple<$for j, [[T$j]]> >() const { operator ParamGenerator< ::testing::tuple<$for j, [[T$j]]> >() const {
return ParamGenerator< ::std::tr1::tuple<$for j, [[T$j]]> >( return ParamGenerator< ::testing::tuple<$for j, [[T$j]]> >(
new CartesianProductGenerator$i<$for j, [[T$j]]>( new CartesianProductGenerator$i<$for j, [[T$j]]>(
$for j,[[ $for j,[[
......
...@@ -640,8 +640,18 @@ struct _RTL_CRITICAL_SECTION; ...@@ -640,8 +640,18 @@ struct _RTL_CRITICAL_SECTION;
// To avoid conditional compilation everywhere, we make it // To avoid conditional compilation everywhere, we make it
// gtest-port.h's responsibility to #include the header implementing // gtest-port.h's responsibility to #include the header implementing
// tr1/tuple. // tuple.
// TODO(sbenza): Enable this block to start using std::tuple instead of
// std::tr1::tuple.
#if 0 && GTEST_HAS_STD_TUPLE_
# include <tuple>
# define GTEST_TUPLE_NAMESPACE_ ::std
#endif
#if GTEST_HAS_TR1_TUPLE #if GTEST_HAS_TR1_TUPLE
# ifndef GTEST_TUPLE_NAMESPACE_
# define GTEST_TUPLE_NAMESPACE_ ::std::tr1
# endif // GTEST_TUPLE_NAMESPACE_
# if GTEST_USE_OWN_TR1_TUPLE # if GTEST_USE_OWN_TR1_TUPLE
# include "gtest/internal/gtest-tuple.h" # include "gtest/internal/gtest-tuple.h"
...@@ -952,6 +962,15 @@ namespace testing { ...@@ -952,6 +962,15 @@ namespace testing {
class Message; class Message;
// Import tuple and friends into the ::testing namespace.
// It is part of our interface, having them in ::testing allows us to change
// their types as needed.
using GTEST_TUPLE_NAMESPACE_::get;
using GTEST_TUPLE_NAMESPACE_::make_tuple;
using GTEST_TUPLE_NAMESPACE_::tuple;
using GTEST_TUPLE_NAMESPACE_::tuple_size;
using GTEST_TUPLE_NAMESPACE_::tuple_element;
namespace internal { namespace internal {
// A secret type that Google Test users don't know about. It has no // A secret type that Google Test users don't know about. It has no
......
...@@ -90,7 +90,7 @@ using ::testing::Combine; ...@@ -90,7 +90,7 @@ using ::testing::Combine;
// PreCalculatedPrimeTable disabled. We do this by defining fixture which will // PreCalculatedPrimeTable disabled. We do this by defining fixture which will
// accept different combinations of parameters for instantiating a // accept different combinations of parameters for instantiating a
// HybridPrimeTable instance. // HybridPrimeTable instance.
class PrimeTableTest : public TestWithParam< ::std::tr1::tuple<bool, int> > { class PrimeTableTest : public TestWithParam< ::testing::tuple<bool, int> > {
protected: protected:
virtual void SetUp() { virtual void SetUp() {
// This can be written as // This can be written as
...@@ -101,8 +101,8 @@ class PrimeTableTest : public TestWithParam< ::std::tr1::tuple<bool, int> > { ...@@ -101,8 +101,8 @@ class PrimeTableTest : public TestWithParam< ::std::tr1::tuple<bool, int> > {
// //
// once the Google C++ Style Guide allows use of ::std::tr1::tie. // once the Google C++ Style Guide allows use of ::std::tr1::tie.
// //
bool force_on_the_fly = ::std::tr1::get<0>(GetParam()); bool force_on_the_fly = ::testing::get<0>(GetParam());
int max_precalculated = ::std::tr1::get<1>(GetParam()); int max_precalculated = ::testing::get<1>(GetParam());
table_ = new HybridPrimeTable(force_on_the_fly, max_precalculated); table_ = new HybridPrimeTable(force_on_the_fly, max_precalculated);
} }
virtual void TearDown() { virtual void TearDown() {
......
...@@ -64,9 +64,9 @@ using ::testing::ValuesIn; ...@@ -64,9 +64,9 @@ using ::testing::ValuesIn;
# if GTEST_HAS_COMBINE # if GTEST_HAS_COMBINE
using ::testing::Combine; using ::testing::Combine;
using ::std::tr1::get; using ::testing::get;
using ::std::tr1::make_tuple; using ::testing::make_tuple;
using ::std::tr1::tuple; using ::testing::tuple;
# endif // GTEST_HAS_COMBINE # endif // GTEST_HAS_COMBINE
using ::testing::internal::ParamGenerator; using ::testing::internal::ParamGenerator;
......
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