Added specialization to log unsigned chars as integers

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@412 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2012-02-26 11:20:18 +00:00
parent f66e06f4fe
commit 47cf8b3e47
2 changed files with 9 additions and 0 deletions

View file

@ -140,6 +140,10 @@ namespace detail2
{ {
s << '"' << str << '"'; s << '"' << str << '"';
} }
inline void serialize( stream& s, unsigned char c )
{
s << static_cast< int >( c );
}
template< typename T > template< typename T >
struct formatter struct formatter

View file

@ -558,3 +558,8 @@ BOOST_AUTO_TEST_CASE( mock_detail_template_template_streamable_yields_its_value_
{ {
BOOST_CHECK_EQUAL( "mock::detail::template_streamable", to_string( mock::detail::template_streamable< int >() ) ); BOOST_CHECK_EQUAL( "mock::detail::template_streamable", to_string( mock::detail::template_streamable< int >() ) );
} }
BOOST_AUTO_TEST_CASE( unsigned_char_is_serialized_as_int )
{
BOOST_CHECK_EQUAL( boost::lexical_cast< std::string >( int( 'a' ) ), to_string( unsigned char( 'a' ) ) );
}