diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index 42f91dd..725c247 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -27,9 +27,12 @@ #include #include #include +#include #include #include #include +#include +#include #if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG) # include @@ -188,6 +191,30 @@ inline unsigned long test_output_impl( char16_t const& v ) { return v; } inline unsigned long test_output_impl( char32_t const& v ) { return v; } #endif +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable: 4996) +#endif + +inline std::string test_output_impl( char const& v ) +{ + if( std::isprint( static_cast( v ) ) ) + { + return std::string( 1, v ); + } + else + { + char buffer[ 8 ]; + std::sprintf( buffer, "\\x%02X", static_cast( v ) ); + + return buffer; + } +} + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + // predicates struct lw_test_eq