From bfab83e7c2859ceaab222cb0c3d7b08247be9eb1 Mon Sep 17 00:00:00 2001 From: mat007 Date: Fri, 23 Mar 2012 07:58:27 +0000 Subject: [PATCH] Added test for serialization of bind, phoenix and lambda functors git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@431 860be788-9bd5-4423-9f1e-828f051e677b --- src/tests/turtle_test/log_test.cpp | 42 ++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/src/tests/turtle_test/log_test.cpp b/src/tests/turtle_test/log_test.cpp index af8add0..14a65b1 100644 --- a/src/tests/turtle_test/log_test.cpp +++ b/src/tests/turtle_test/log_test.cpp @@ -12,6 +12,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -66,7 +69,7 @@ namespace {}; } -BOOST_AUTO_TEST_CASE( non_serializable_type_yields_an_interrogation_mark_when_serialized ) +BOOST_AUTO_TEST_CASE( non_serializable_type_yields_an_question_mark_when_serialized ) { BOOST_CHECK_EQUAL( "?", to_string( non_serializable() ) ); } @@ -135,7 +138,7 @@ namespace {}; } -BOOST_AUTO_TEST_CASE( type_derived_from_serializable_yields_an_interrogation_mark_when_serialized ) +BOOST_AUTO_TEST_CASE( type_derived_from_serializable_yields_an_question_mark_when_serialized ) { #ifdef MOCK_USE_CONVERSIONS BOOST_CHECK_EQUAL( "serializable", to_string( derived_from_serializable() ) ); @@ -150,7 +153,7 @@ namespace {}; } -BOOST_AUTO_TEST_CASE( type_derived_from_streamable_yields_an_interrogation_mark_when_serialized ) +BOOST_AUTO_TEST_CASE( type_derived_from_streamable_yields_an_question_mark_when_serialized ) { #ifdef MOCK_USE_CONVERSIONS BOOST_CHECK_EQUAL( "streamable", to_string( derived_from_streamable() ) ); @@ -169,7 +172,7 @@ namespace }; } -BOOST_AUTO_TEST_CASE( type_convertible_to_base_yields_an_interrogation_mark_when_serialized ) +BOOST_AUTO_TEST_CASE( type_convertible_to_base_yields_an_question_mark_when_serialized ) { BOOST_CHECK_EQUAL( "?", to_string( convertible_to_base() ) ); } @@ -182,7 +185,7 @@ namespace }; } -BOOST_AUTO_TEST_CASE( type_convertible_to_serializable_yields_an_interrogation_mark_when_serialized ) +BOOST_AUTO_TEST_CASE( type_convertible_to_serializable_yields_an_question_mark_when_serialized ) { BOOST_CHECK_EQUAL( "?", to_string( convertible_to_serializable() ) ); } @@ -195,7 +198,7 @@ namespace }; } -BOOST_AUTO_TEST_CASE( type_convertible_to_streamable_yields_an_interrogation_mark_when_serialized ) +BOOST_AUTO_TEST_CASE( type_convertible_to_streamable_yields_an_question_mark_when_serialized ) { BOOST_CHECK_EQUAL( "?", to_string( convertible_to_streamable() ) ); } @@ -212,7 +215,7 @@ namespace }; } -BOOST_AUTO_TEST_CASE( type_ambiguous_convertible_yields_an_interrogation_mark_when_serialized ) +BOOST_AUTO_TEST_CASE( type_ambiguous_convertible_yields_an_question_mark_when_serialized ) { BOOST_CHECK_EQUAL( "?", to_string( ambiguous_convertible() ) ); } @@ -462,7 +465,7 @@ namespace {} } -BOOST_AUTO_TEST_CASE( callable_builtin_yields_an_interrogation_mark_when_serialized ) +BOOST_AUTO_TEST_CASE( callable_builtin_yields_an_question_mark_when_serialized ) { BOOST_CHECK_EQUAL( "?", to_string( callable_builtin ) ); BOOST_CHECK_EQUAL( "?", to_string( &callable_builtin ) ); @@ -563,3 +566,26 @@ BOOST_AUTO_TEST_CASE( unsigned_char_is_serialized_as_int ) { BOOST_CHECK_EQUAL( boost::lexical_cast< std::string >( static_cast< int >( 'a' ) ), to_string< unsigned char >( 'a' ) ); } + +namespace +{ + bool some_function() + { + return false; + } +} + +BOOST_AUTO_TEST_CASE( boost_phoenix_functor_yields_question_mark_when_serialized ) +{ + BOOST_CHECK_EQUAL( "?", to_string( boost::phoenix::bind( &some_function ) ) ); +} + +BOOST_AUTO_TEST_CASE( boost_bind_functor_yields_question_mark_when_serialized ) +{ + BOOST_CHECK_EQUAL( "?", to_string( boost::bind( &some_function ) ) ); +} + +BOOST_AUTO_TEST_CASE( boost_lambda_functor_yields_question_mark_when_serialized ) +{ + BOOST_CHECK_EQUAL( "?", to_string( boost::lambda::bind( &some_function ) ) ); +}