mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Added test to check that a template class conversion operator can be mocked using MOCK_CONVERSION_OPERATOR
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@417 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
c830e13c83
commit
27f76b9d01
1 changed files with 17 additions and 2 deletions
|
|
@ -79,8 +79,23 @@ BOOST_AUTO_TEST_CASE( mock_conversion_operator )
|
|||
{
|
||||
mock_class_with_conversion_operator m;
|
||||
MOCK_EXPECT( m.conversion ).once().returns( 42 );
|
||||
int i = m;
|
||||
BOOST_CHECK_EQUAL( 42, i );
|
||||
BOOST_CHECK_EQUAL( 42, static_cast< int >( m ) );
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
template< typename T >
|
||||
MOCK_CLASS( mock_template_class_with_conversion_operator )
|
||||
{
|
||||
MOCK_CONVERSION_OPERATOR( T, conversion )
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( mock_template_conversion_operator )
|
||||
{
|
||||
mock_template_class_with_conversion_operator< int > m;
|
||||
MOCK_EXPECT( m.conversion ).once().returns( 42 );
|
||||
BOOST_CHECK_EQUAL( 42, static_cast< int >( m ) );
|
||||
}
|
||||
|
||||
namespace
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue