Remove duplicate functionality PrintValue (in googletest-param-test-test.cc), use testing::PrintToString

PiperOrigin-RevId: 216733373
This commit is contained in:
misterg 2018-10-11 14:40:25 -04:00 committed by Gennadiy Civil
parent b3b19a796c
commit 864b6c2d35

View File

@ -67,43 +67,7 @@ using ::testing::internal::UnitTestOptions;
// EXPECT_THAT() and the matchers know how to print tuples.
template <typename T>
::std::string PrintValue(const T& value) {
::std::stringstream stream;
stream << value;
return stream.str();
}
// These overloads allow printing tuples in our tests. We cannot
// define an operator<< for tuples, as that definition needs to be in
// the std namespace in order to be picked up by Google Test via
// Argument-Dependent Lookup, yet defining anything in the std
// namespace in non-STL code is undefined behavior.
template <typename T1, typename T2>
::std::string PrintValue(const std::tuple<T1, T2>& value) {
::std::stringstream stream;
stream << "(" << std::get<0>(value) << ", " << std::get<1>(value) << ")";
return stream.str();
}
template <typename T1, typename T2, typename T3>
::std::string PrintValue(const std::tuple<T1, T2, T3>& value) {
::std::stringstream stream;
stream << "(" << std::get<0>(value) << ", " << std::get<1>(value) << ", "
<< std::get<2>(value) << ")";
return stream.str();
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10>
::std::string PrintValue(
const std::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& value) {
::std::stringstream stream;
stream << "(" << std::get<0>(value) << ", " << std::get<1>(value) << ", "
<< std::get<2>(value) << ", " << std::get<3>(value) << ", "
<< std::get<4>(value) << ", " << std::get<5>(value) << ", "
<< std::get<6>(value) << ", " << std::get<7>(value) << ", "
<< std::get<8>(value) << ", " << std::get<9>(value) << ")";
return stream.str();
return testing::PrintToString(value);
}
// Verifies that a sequence generated by the generator and accessed