Refactoring

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@425 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2012-03-15 21:43:09 +00:00
parent 209ffa986f
commit f09c5540d0

View file

@ -183,6 +183,7 @@ BOOST_AUTO_TEST_CASE( mocking_a_template_class_method_is_supported )
my_template_mock< int > m;
MOCK_EXPECT( m.my_method_t ).with( 3, "" );
m.my_method( 3, "" );
BOOST_CHECK( MOCK_VERIFY( m.my_method_t ) );
}
namespace
@ -208,6 +209,7 @@ BOOST_AUTO_TEST_CASE( mocking_a_template_base_class_method_is_supported )
my_template_base_class_mock< int > m;
MOCK_EXPECT( m.my_method ).once().with( 3 );
m.my_method( 3 );
BOOST_CHECK( MOCK_VERIFY( m.my_method ) );
}
namespace
@ -454,20 +456,23 @@ BOOST_AUTO_TEST_CASE( member_pointer_on_mock_method_is_valid )
namespace
{
MOCK_FUNCTION( free_function, 1, float( int ), free_function )
MOCK_FUNCTION( free_function, 1, void( int ), free_function )
}
BOOST_AUTO_TEST_CASE( a_free_function_can_be_mocked )
{
MOCK_EXPECT( free_function ).once();
BOOST_CHECK( ! MOCK_VERIFY( free_function ) );
free_function( 42 );
BOOST_CHECK( MOCK_VERIFY( free_function ) );
MOCK_RESET( free_function );
}
namespace
{
struct some_class
{
MOCK_STATIC_METHOD( some_static_method, 1, float( int ), some_static_method )
MOCK_STATIC_METHOD( some_static_method, 1, void( int ), some_static_method )
};
}
@ -475,8 +480,9 @@ BOOST_AUTO_TEST_CASE( a_static_method_can_be_mocked )
{
MOCK_EXPECT( some_class::some_static_method ).once();
BOOST_CHECK( ! MOCK_VERIFY( some_class::some_static_method ) );
MOCK_RESET( some_class::some_static_method );
some_class::some_static_method( 42 );
BOOST_CHECK( MOCK_VERIFY( some_class::some_static_method ) );
MOCK_RESET( some_class::some_static_method );
}
namespace
@ -484,7 +490,7 @@ namespace
template< typename T >
struct some_template_class
{
MOCK_STATIC_METHOD_TPL( some_static_method, 1, float( T ), some_static_method )
MOCK_STATIC_METHOD_TPL( some_static_method, 1, void( T ), some_static_method )
};
}
@ -492,6 +498,8 @@ BOOST_AUTO_TEST_CASE( a_static_method_in_a_template_class_can_be_mocked )
{
MOCK_EXPECT( some_template_class< int >::some_static_method ).once();
BOOST_CHECK( ! MOCK_VERIFY( some_template_class< int >::some_static_method ) );
MOCK_RESET( some_template_class< int >::some_static_method );
some_template_class< int >::some_static_method( 42 );
BOOST_CHECK( mock::verify() );
BOOST_CHECK( MOCK_VERIFY( some_template_class< int >::some_static_method ) );
MOCK_RESET( some_template_class< int >::some_static_method );
}