mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Print not matched values with full precision
This commit is contained in:
parent
14d0ca4cd3
commit
ef5a5ef43f
@ -20,22 +20,62 @@ namespace DetourNavigator
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
template <class T>
|
||||
struct Wrapper {
|
||||
const T& mValue;
|
||||
};
|
||||
|
||||
template <class Range>
|
||||
inline testing::Message& writeRange(testing::Message& message, const Range& range)
|
||||
{
|
||||
message << "{\n";
|
||||
for (const auto& v : range)
|
||||
message << Wrapper<typename std::decay<decltype(v)>::type> {v} << ",\n";
|
||||
return message << "}";
|
||||
}
|
||||
}
|
||||
|
||||
namespace testing
|
||||
{
|
||||
template <>
|
||||
inline testing::Message& Message::operator <<(const osg::Vec3f& value)
|
||||
{
|
||||
return (*this) << "osg::Vec3f(" << std::setprecision(std::numeric_limits<float>::max_exponent10) << value.x()
|
||||
<< ", " << std::setprecision(std::numeric_limits<float>::max_exponent10) << value.y()
|
||||
<< ", " << std::setprecision(std::numeric_limits<float>::max_exponent10) << value.z()
|
||||
<< ')';
|
||||
}
|
||||
|
||||
template <>
|
||||
inline testing::Message& Message::operator <<(const Wrapper<osg::Vec3f>& value)
|
||||
{
|
||||
return (*this) << value.mValue;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline testing::Message& Message::operator <<(const Wrapper<float>& value)
|
||||
{
|
||||
return (*this) << std::setprecision(std::numeric_limits<float>::max_exponent10) << value.mValue;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline testing::Message& Message::operator <<(const std::deque<osg::Vec3f>& value)
|
||||
{
|
||||
(*this) << "{\n";
|
||||
for (const auto& v : value)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "osg::Vec3f("
|
||||
<< std::setprecision(std::numeric_limits<float>::max_exponent10) << v.x() << ", "
|
||||
<< std::setprecision(std::numeric_limits<float>::max_exponent10) << v.y() << ", "
|
||||
<< std::setprecision(std::numeric_limits<float>::max_exponent10) << v.z() << ")";
|
||||
(*this) << stream.str() << ",\n";
|
||||
}
|
||||
return (*this) << "}";
|
||||
return writeRange(*this, value);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline testing::Message& Message::operator <<(const std::vector<osg::Vec3f>& value)
|
||||
{
|
||||
return writeRange(*this, value);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline testing::Message& Message::operator <<(const std::vector<float>& value)
|
||||
{
|
||||
return writeRange(*this, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user