mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Fix
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@264 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
f0dd37cb39
commit
581635e910
3 changed files with 98 additions and 6 deletions
|
|
@ -143,13 +143,13 @@ namespace detail
|
||||||
const T* t_;
|
const T* t_;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct any
|
struct data
|
||||||
{
|
{
|
||||||
template< typename T >
|
template< typename T >
|
||||||
any( const T& t )
|
data( const T& t )
|
||||||
: h_( new holder_imp< T >( t ) )
|
: h_( new holder_imp< T >( t ) )
|
||||||
{}
|
{}
|
||||||
~any()
|
~data()
|
||||||
{
|
{
|
||||||
delete h_;
|
delete h_;
|
||||||
}
|
}
|
||||||
|
|
@ -157,7 +157,7 @@ namespace detail
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
stream& operator<<( stream& s, const detail::any& d )
|
stream& operator<<( stream& s, const detail::data& d )
|
||||||
{
|
{
|
||||||
d.h_->serialize( *s.s_ );
|
d.h_->serialize( *s.s_ );
|
||||||
return s;
|
return s;
|
||||||
|
|
@ -165,7 +165,7 @@ namespace detail
|
||||||
|
|
||||||
#else // MOCK_LOG_CONVERSIONS
|
#else // MOCK_LOG_CONVERSIONS
|
||||||
|
|
||||||
namespace detail
|
namespace detail4
|
||||||
{
|
{
|
||||||
template< typename S, typename T >
|
template< typename S, typename T >
|
||||||
S& operator<<( S &s, const T& )
|
S& operator<<( S &s, const T& )
|
||||||
|
|
@ -177,7 +177,7 @@ namespace detail
|
||||||
template< typename T >
|
template< typename T >
|
||||||
void serialize( std::ostream& s, const T& t )
|
void serialize( std::ostream& s, const T& t )
|
||||||
{
|
{
|
||||||
using namespace detail;
|
using namespace detail4;
|
||||||
s << t;
|
s << t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -470,3 +470,49 @@ BOOST_AUTO_TEST_CASE( type_can_use_format_when_streamed_with_conversions )
|
||||||
{
|
{
|
||||||
BOOST_CHECK_EQUAL( "\"string\"", to_string( streamed_using_format() ) );
|
BOOST_CHECK_EQUAL( "\"string\"", to_string( streamed_using_format() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace mock
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct template_serializable
|
||||||
|
{};
|
||||||
|
template< typename T >
|
||||||
|
std::ostream& operator<<( std::ostream& s, const template_serializable< T >& )
|
||||||
|
{
|
||||||
|
return s << "mock::detail::template_serializable";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE( mock_detail_template_type_serializable_yields_its_value_when_serialized_with_conversions )
|
||||||
|
{
|
||||||
|
BOOST_CHECK_EQUAL( "mock::detail::template_serializable", to_string( mock::detail::template_serializable< int >() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace mock
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct template_streamable
|
||||||
|
{};
|
||||||
|
template< typename T >
|
||||||
|
std::ostream& operator<<( std::ostream& s, const template_streamable< T >& )
|
||||||
|
{
|
||||||
|
BOOST_FAIL( "should not have been called" );
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
template< typename T >
|
||||||
|
mock::stream& operator<<( mock::stream& s, const template_streamable< T >& )
|
||||||
|
{
|
||||||
|
return s << "mock::detail::template_streamable";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE( mock_detail_template_template_streamable_yields_its_value_when_serialized_with_conversions )
|
||||||
|
{
|
||||||
|
BOOST_CHECK_EQUAL( "mock::detail::template_streamable", to_string( mock::detail::template_streamable< int >() ) );
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -466,3 +466,49 @@ BOOST_AUTO_TEST_CASE( type_can_use_format_when_streamed_without_conversions )
|
||||||
{
|
{
|
||||||
BOOST_CHECK_EQUAL( "\"string\"", to_string( streamed_using_format() ) );
|
BOOST_CHECK_EQUAL( "\"string\"", to_string( streamed_using_format() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace mock
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct template_serializable
|
||||||
|
{};
|
||||||
|
template< typename T >
|
||||||
|
std::ostream& operator<<( std::ostream& s, const template_serializable< T >& )
|
||||||
|
{
|
||||||
|
return s << "mock::detail::template_serializable";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE( mock_detail_template_type_serializable_yields_its_value_when_serialized_without_conversions )
|
||||||
|
{
|
||||||
|
BOOST_CHECK_EQUAL( "mock::detail::template_serializable", to_string( mock::detail::template_serializable< int >() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace mock
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct template_streamable
|
||||||
|
{};
|
||||||
|
template< typename T >
|
||||||
|
std::ostream& operator<<( std::ostream& s, const template_streamable< T >& )
|
||||||
|
{
|
||||||
|
BOOST_FAIL( "should not have been called" );
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
template< typename T >
|
||||||
|
mock::stream& operator<<( mock::stream& s, const template_streamable< T >& )
|
||||||
|
{
|
||||||
|
return s << "mock::detail::template_streamable";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE( mock_detail_template_template_streamable_yields_its_value_when_serialized_without_conversions )
|
||||||
|
{
|
||||||
|
BOOST_CHECK_EQUAL( "mock::detail::template_streamable", to_string( mock::detail::template_streamable< int >() ) );
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue