Added MOCK_CONVERSION_OPERATOR_TPL

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@603 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2013-03-08 08:00:58 +00:00
parent 87ea27b96c
commit 51abd10847
2 changed files with 70 additions and 27 deletions

View file

@ -67,7 +67,7 @@ namespace
template< typename T >
MOCK_CLASS( mock_template_class_with_conversion_operator )
{
MOCK_CONVERSION_OPERATOR( T, conversion )
MOCK_CONVERSION_OPERATOR_TPL( T, conversion )
};
}
@ -110,6 +110,38 @@ BOOST_AUTO_TEST_CASE( mock_non_const_conversion_operator )
BOOST_CHECK_EQUAL( 42, i );
}
namespace
{
template< typename T >
MOCK_CLASS( mock_template_class_with_const_conversion_operator )
{
MOCK_CONST_CONVERSION_OPERATOR_TPL( T, conversion )
};
}
BOOST_AUTO_TEST_CASE( mock_template_const_conversion_operator )
{
mock_template_class_with_const_conversion_operator< int > m;
MOCK_EXPECT( m.conversion ).once().returns( 42 );
BOOST_CHECK_EQUAL( 42, static_cast< int >( m ) );
}
namespace
{
template< typename T >
MOCK_CLASS( mock_template_class_with_non_const_conversion_operator )
{
MOCK_NON_CONST_CONVERSION_OPERATOR_TPL( T, conversion )
};
}
BOOST_AUTO_TEST_CASE( mock_template_non_const_conversion_operator )
{
mock_template_class_with_non_const_conversion_operator< int > m;
MOCK_EXPECT( m.conversion ).once().returns( 42 );
BOOST_CHECK_EQUAL( 42, static_cast< int >( m ) );
}
namespace
{
MOCK_CLASS( my_mock )