catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
Added some specialisations for toString
- Commit
1172d26705a2af9ef1724f04e186f28f2f439dba- Author
- Phil Nash ·
- Parents
263c046b847c
Changes
internal/catch_capture.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/internal/catch_capture.hpp b/internal/catch_capture.hpp index 8238788a..b220a4f8 100644 --- a/internal/catch_capture.hpp +++ b/internal/catch_capture.hpp @@ -83,6 +83,28 @@ std::string toString( const T& value ) return Detail::StringMaker<T, Detail::IsStreamable<T>::value>::apply( value ); } +template<> +inline std::string toString<std::string>( const std::string& value ) +{ + return value; +} + +template<> +inline std::string toString<int>( const int& value ) +{ + std::ostringstream oss; + oss << value; + return oss.str(); +} + +template<> +inline std::string toString<double>( const double& value ) +{ + std::ostringstream oss; + oss << value; + return oss.str(); +} + class TestFailureException { };