Moved some components into a detail sub-directory

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@489 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2012-07-22 07:03:54 +00:00
parent 435dadf89d
commit bd30f8c492
6 changed files with 97 additions and 94 deletions

View file

@ -72,13 +72,13 @@ namespace
BOOST_FIXTURE_TEST_CASE( a_function_can_be_passed_as_functor, error_fixture )
{
mock::function< void() > f;
mock::detail::function< void() > f;
boost::function< void() > functor = f;
}
BOOST_FIXTURE_TEST_CASE( a_function_can_be_passed_as_functor_using_boost_bind_and_boost_ref, error_fixture )
{
mock::function< void() > f;
mock::detail::function< void() > f;
boost::function< void() > functor = boost::bind( boost::ref( f ) );
}
@ -87,11 +87,11 @@ BOOST_FIXTURE_TEST_CASE( a_function_can_be_passed_as_functor_using_boost_bind_an
BOOST_FIXTURE_TEST_CASE( triggering_an_unconfigured_function_calls_unexpected_call_error, error_fixture )
{
{
mock::function< void() > f;
mock::detail::function< void() > f;
CHECK_ERROR( f(), unexpected_call, 0, "?()" );
}
{
mock::function< int( int, const std::string& ) > f;
mock::detail::function< int( int, const std::string& ) > f;
CHECK_ERROR( f( 1, "s" ), unexpected_call, 0, "?( 1, \"s\" )" );
}
}
@ -99,12 +99,12 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_unconfigured_function_calls_unexpected_ca
BOOST_FIXTURE_TEST_CASE( triggering_a_never_expectation_calls_unexpected_call_error, error_fixture )
{
{
mock::function< void() > f;
mock::detail::function< void() > f;
f.expect().never();
CHECK_ERROR( f(), unexpected_call, 0, "?()\nv never()" );
}
{
mock::function< int( int, const std::string& ) > f;
mock::detail::function< int( int, const std::string& ) > f;
f.expect().never();
CHECK_ERROR( f( 1, "s" ), unexpected_call, 0, "?( 1, \"s\" )\nv never().with( any, any )" );
}
@ -113,14 +113,14 @@ BOOST_FIXTURE_TEST_CASE( triggering_a_never_expectation_calls_unexpected_call_er
BOOST_FIXTURE_TEST_CASE( triggering_an_unlimited_expectation_is_valid, error_fixture )
{
{
mock::function< void() > f;
mock::detail::function< void() > f;
f.expect();
f();
f();
CHECK_CALLS( 2 );
}
{
mock::function< void( int, const std::string& ) > f;
mock::detail::function< void( int, const std::string& ) > f;
f.expect();
f( 1, "s" );
f( 1, "s" );
@ -131,13 +131,13 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_unlimited_expectation_is_valid, error_fix
BOOST_FIXTURE_TEST_CASE( triggering_a_once_expectation_calls_unexpected_call_error_after_one_call, error_fixture )
{
{
mock::function< void() > f;
mock::detail::function< void() > f;
f.expect().once();
f();
CHECK_ERROR( f(), unexpected_call, 1, "?()\nv once()" );
}
{
mock::function< void( int, const std::string& ) > f;
mock::detail::function< void( int, const std::string& ) > f;
f.expect().once();
f( 1, "s" );
CHECK_ERROR( f( 1, "s" ), unexpected_call, 1, "?( 1, \"s\" )\nv once().with( any, any )" );
@ -146,7 +146,7 @@ BOOST_FIXTURE_TEST_CASE( triggering_a_once_expectation_calls_unexpected_call_err
BOOST_FIXTURE_TEST_CASE( literal_zero_can_be_used_in_function_call_as_pointers, error_fixture )
{
mock::function< void( int* ) > f;
mock::detail::function< void( int* ) > f;
f.expect().once();
f( 0 );
CHECK_CALLS( 1 );
@ -157,11 +157,11 @@ BOOST_FIXTURE_TEST_CASE( literal_zero_can_be_used_in_function_call_as_pointers,
BOOST_FIXTURE_TEST_CASE( verifying_an_unconfigured_function_succeeds, error_fixture )
{
{
mock::function< void() > f;
mock::detail::function< void() > f;
BOOST_CHECK( f.verify() );
}
{
mock::function< int( int, const std::string& ) > f;
mock::detail::function< int( int, const std::string& ) > f;
BOOST_CHECK( f.verify() );
}
}
@ -169,14 +169,14 @@ BOOST_FIXTURE_TEST_CASE( verifying_an_unconfigured_function_succeeds, error_fixt
BOOST_FIXTURE_TEST_CASE( verifying_an_unlimited_expectation_succeeds, error_fixture )
{
{
mock::function< void() > f;
mock::detail::function< void() > f;
f.expect();
BOOST_CHECK( f.verify() );
CHECK_CALLS( 0 );
}
CHECK_CALLS( 1 );
{
mock::function< int( int, const std::string& ) > f;
mock::detail::function< int( int, const std::string& ) > f;
f.expect();
BOOST_CHECK( f.verify() );
CHECK_CALLS( 0 );
@ -187,14 +187,14 @@ BOOST_FIXTURE_TEST_CASE( verifying_an_unlimited_expectation_succeeds, error_fixt
BOOST_FIXTURE_TEST_CASE( verifying_a_once_expectation_after_one_call_succeeds, error_fixture )
{
{
mock::function< void() > f;
mock::detail::function< void() > f;
f.expect().once();
f();
BOOST_CHECK( f.verify() );
CHECK_CALLS( 1 );
}
{
mock::function< void( int, const std::string& ) > f;
mock::detail::function< void( int, const std::string& ) > f;
f.expect().once();
f( 1, "s" );
BOOST_CHECK( f.verify() );
@ -205,12 +205,12 @@ BOOST_FIXTURE_TEST_CASE( verifying_a_once_expectation_after_one_call_succeeds, e
BOOST_FIXTURE_TEST_CASE( verifying_a_once_expectation_before_the_call_fails, error_fixture )
{
{
mock::function< void() > f;
mock::detail::function< void() > f;
f.expect().once();
CHECK_ERROR( BOOST_CHECK( ! f.verify() ), verification_failed, 0, "?\n. once()" );
}
{
mock::function< int( int, const std::string& ) > f;
mock::detail::function< int( int, const std::string& ) > f;
f.expect().once();
CHECK_ERROR( BOOST_CHECK( ! f.verify() ), verification_failed, 0, "?\n. once().with( any, any )" );
}
@ -218,7 +218,7 @@ BOOST_FIXTURE_TEST_CASE( verifying_a_once_expectation_before_the_call_fails, err
BOOST_FIXTURE_TEST_CASE( verifying_a_once_expectation_after_a_verify_and_one_call_succeeds, error_fixture )
{
mock::function< void() > f;
mock::detail::function< void() > f;
f.expect().once();
CHECK_ERROR( BOOST_CHECK( ! f.verify() ), verification_failed, 0, "?\n. once()" );
f();
@ -231,13 +231,13 @@ BOOST_FIXTURE_TEST_CASE( verifying_a_once_expectation_after_a_verify_and_one_cal
BOOST_FIXTURE_TEST_CASE( triggering_a_reset_function_calls_unexpected_call_error, error_fixture )
{
{
mock::function< void() > f;
mock::detail::function< void() > f;
f.expect();
f.reset();
CHECK_ERROR( f(), unexpected_call, 0, "?()" );
}
{
mock::function< int( int, const std::string& ) > f;
mock::detail::function< int( int, const std::string& ) > f;
f.expect();
f.reset();
CHECK_ERROR( f( 1, "s" ), unexpected_call, 0, "?( 1, \"s\" )" );
@ -247,13 +247,13 @@ BOOST_FIXTURE_TEST_CASE( triggering_a_reset_function_calls_unexpected_call_error
BOOST_FIXTURE_TEST_CASE( verifying_a_reset_function_succeeds, error_fixture )
{
{
mock::function< void() > f;
mock::detail::function< void() > f;
f.expect();
f.reset();
BOOST_CHECK( f.verify() );
}
{
mock::function< int( int, const std::string& ) > f;
mock::detail::function< int( int, const std::string& ) > f;
f.expect();
f.reset();
BOOST_CHECK( f.verify() );
@ -265,12 +265,12 @@ BOOST_FIXTURE_TEST_CASE( verifying_a_reset_function_succeeds, error_fixture )
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_with_wrong_parameter_value_in_equal_constraint_calls_unexpected_call_error, error_fixture )
{
{
mock::function< void( int ) > f;
mock::detail::function< void( int ) > f;
f.expect().with( 42 );
CHECK_ERROR( f( 43 ), unexpected_call, 0, "?( 43 )\n. unlimited().with( 42 )" );
}
{
mock::function< int( int, const std::string& ) > f;
mock::detail::function< int( int, const std::string& ) > f;
f.expect().with( 42, "expected" );
CHECK_ERROR( f( 42, "actual" ), unexpected_call, 0, "?( 42, \"actual\" )\n. unlimited().with( 42, \"expected\" )" );
}
@ -278,7 +278,7 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_with_wrong_parameter_value_in
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_with_wrong_parameter_value_in_equal_or_less_constraint_calls_unexpected_call_error, error_fixture )
{
mock::function< void( int ) > f;
mock::detail::function< void( int ) > f;
f.expect().with( mock::equal( 42 ) || mock::less( 42 ) );
f( 41 );
f( 42 );
@ -287,7 +287,7 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_with_wrong_parameter_value_in
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_with_wrong_parameter_value_in_equal_and_not_less_constraint_calls_unexpected_call_error, error_fixture )
{
mock::function< void( int ) > f;
mock::detail::function< void( int ) > f;
f.expect().with( mock::equal( 42 ) && ! mock::less( 41 ) );
f( 42 );
CHECK_ERROR( f( 43 ), unexpected_call, 1, "?( 43 )\n. unlimited().with( ( equal( 42 ) && ! less( 41 ) ) )" );
@ -311,14 +311,14 @@ namespace
BOOST_FIXTURE_TEST_CASE( passing_call_values_by_reference_is_transparent, error_fixture )
{
{
mock::function< void( my_interface& ) > f;
mock::detail::function< void( my_interface& ) > f;
my_implementation imp;
f.expect().with( mock::same( imp ) );
f( imp );
CHECK_CALLS( 1 );
}
{
mock::function< void( const my_interface& ) > f;
mock::detail::function< void( const my_interface& ) > f;
my_implementation imp;
f.expect().with( mock::same( imp ) );
f( imp );
@ -337,12 +337,12 @@ namespace
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_with_failing_custom_constraint_calls_unexpected_call_error, error_fixture )
{
{
mock::function< void( int ) > f;
mock::detail::function< void( int ) > f;
f.expect().with( &custom_constraint );
CHECK_ERROR( f( 42 ), unexpected_call, 0, "?( 42 )\n. unlimited().with( ? )" );
}
{
mock::function< int( int, const std::string& ) > f;
mock::detail::function< int( int, const std::string& ) > f;
f.expect().with( &custom_constraint, "actual" );
CHECK_ERROR( f( 42, "actual" ), unexpected_call, 0, "?( 42, \"actual\" )\n. unlimited().with( ?, \"actual\" )" );
}
@ -350,7 +350,7 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_with_failing_custom_constrain
//BOOST_FIXTURE_TEST_CASE( literal_zero_can_be_used_in_place_of_null_pointers_in_constraints, error_fixture )
//{
// mock::function< void( int* ) > f;
// mock::detail::function< void( int* ) > f;
// f.expect().with( 0 );
// f.reset();
// CHECK_CALLS( 1 );
@ -361,17 +361,17 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_with_failing_custom_constrain
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_with_no_return_set_calls_missing_action, error_fixture )
{
{
mock::function< int() > f;
mock::detail::function< int() > f;
f.expect();
CHECK_ERROR( f(), missing_action, 0, "?()\n. unlimited()" );
}
{
mock::function< int&() > f;
mock::detail::function< int&() > f;
f.expect();
CHECK_ERROR( f(), missing_action, 0, "?()\n. unlimited()" );
}
{
mock::function< const std::string&() > f;
mock::detail::function< const std::string&() > f;
f.expect();
CHECK_ERROR( f(), missing_action, 0, "?()\n. unlimited()" );
}
@ -380,20 +380,20 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_with_no_return_set_calls_miss
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_returns_the_set_value, error_fixture )
{
{
mock::function< int() > f;
mock::detail::function< int() > f;
f.expect().returns( 42 );
BOOST_CHECK_EQUAL( 42, f() );
CHECK_CALLS( 1 );
}
{
mock::function< int() > f;
mock::detail::function< int() > f;
const int i = 42;
f.expect().returns( i );
BOOST_CHECK_EQUAL( i, f() );
CHECK_CALLS( 1 );
}
{
mock::function< int() > f;
mock::detail::function< int() > f;
int i = 42;
f.expect().returns( boost::ref( i ) );
i = 43;
@ -401,20 +401,20 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_returns_the_set_value, error_
CHECK_CALLS( 1 );
}
{
mock::function< int&() > f;
mock::detail::function< int&() > f;
f.expect().returns( 42 );
BOOST_CHECK_EQUAL( 42, f() );
CHECK_CALLS( 1 );
}
{
mock::function< int&() > f;
mock::detail::function< int&() > f;
const int result = 42;
f.expect().returns( result );
BOOST_CHECK_EQUAL( result, f() );
CHECK_CALLS( 1 );
}
{
mock::function< int&() > f;
mock::detail::function< int&() > f;
int i = 42;
f.expect().returns( i );
i = 43;
@ -422,7 +422,7 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_returns_the_set_value, error_
CHECK_CALLS( 1 );
}
{
mock::function< int&() > f;
mock::detail::function< int&() > f;
int i = 42;
f.expect().returns( boost::ref( i ) );
i = 43;
@ -432,31 +432,31 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_returns_the_set_value, error_
CHECK_CALLS( 2 );
}
{
mock::function< std::string() > f;
mock::detail::function< std::string() > f;
f.expect().returns( "result" );
BOOST_CHECK_EQUAL( "result", f() );
CHECK_CALLS( 1 );
}
{
mock::function< const std::string&() > f;
mock::detail::function< const std::string&() > f;
f.expect().returns( "result" );
BOOST_CHECK_EQUAL( "result", f() );
CHECK_CALLS( 1 );
}
{
mock::function< int*() > f;
mock::detail::function< int*() > f;
f.expect().returns( 0 );
BOOST_CHECK( ! f() );
CHECK_CALLS( 1 );
}
{
mock::function< int() > f;
mock::detail::function< int() > f;
f.expect().returns( 0 );
BOOST_CHECK_EQUAL( 0, f() );
CHECK_CALLS( 1 );
}
{
mock::function< int&() > f;
mock::detail::function< int&() > f;
f.expect().returns( 0 );
BOOST_CHECK_EQUAL( 0, f() );
CHECK_CALLS( 1 );
@ -472,7 +472,7 @@ namespace
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_returns_the_set_auto_ptr_value, error_fixture )
{
{
mock::function< std::auto_ptr< int >() > f;
mock::detail::function< std::auto_ptr< int >() > f;
std::auto_ptr< int > ptr( new int( 3 ) );
f.expect().returns( boost::ref( ptr ) );
BOOST_CHECK_EQUAL( 3, *ptr );
@ -482,7 +482,7 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_returns_the_set_auto_ptr_valu
CHECK_CALLS( 2 );
}
{
mock::function< std::auto_ptr< int >() > f;
mock::detail::function< std::auto_ptr< int >() > f;
std::auto_ptr< int > ptr( new int( 3 ) );
f.expect().returns( ptr );
BOOST_CHECK( ! ptr.get() );
@ -491,33 +491,33 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_returns_the_set_auto_ptr_valu
CHECK_CALLS( 2 );
}
{
mock::function< std::auto_ptr< int >() > f;
mock::detail::function< std::auto_ptr< int >() > f;
f.expect().returns( new int( 3 ) );
BOOST_CHECK_EQUAL( 3, *f() );
BOOST_CHECK( ! f().get() );
CHECK_CALLS( 2 );
}
{
mock::function< std::auto_ptr< int >() > f;
mock::detail::function< std::auto_ptr< int >() > f;
f.expect().returns( std::auto_ptr< int >( new int( 3 ) ) );
BOOST_CHECK_EQUAL( 3, *f() );
BOOST_CHECK( ! f().get() );
CHECK_CALLS( 2 );
}
{
mock::function< std::auto_ptr< A >() > f;
mock::detail::function< std::auto_ptr< A >() > f;
f.expect().returns( new B );
BOOST_CHECK_NO_THROW( f() );
CHECK_CALLS( 1 );
}
{
mock::function< std::auto_ptr< A >() > f;
mock::detail::function< std::auto_ptr< A >() > f;
f.expect().returns( std::auto_ptr< A >( new B ) );
BOOST_CHECK_NO_THROW( f() );
CHECK_CALLS( 1 );
}
{
mock::function< std::auto_ptr< A >() > f;
mock::detail::function< std::auto_ptr< A >() > f;
f.expect().returns( std::auto_ptr< B >( new B ) );
BOOST_CHECK_NO_THROW( f() );
CHECK_CALLS( 1 );
@ -534,7 +534,7 @@ namespace
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_calls_the_custom_functor, error_fixture )
{
mock::function< int() > f;
mock::detail::function< int() > f;
f.expect().calls( &custom_result );
BOOST_CHECK_EQUAL( 42, f() );
CHECK_CALLS( 1 );
@ -550,7 +550,7 @@ namespace
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_calls_the_custom_functor_with_parameters, error_fixture )
{
mock::function< int( int ) > f;
mock::detail::function< int( int ) > f;
f.expect().calls( &custom_result_with_parameter );
BOOST_CHECK_EQUAL( 42, f( 42 ) );
CHECK_CALLS( 1 );
@ -558,7 +558,7 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_calls_the_custom_functor_with
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_calls_the_custom_functor_without_parameters_thanks_to_boost_bind, error_fixture )
{
mock::function< int( int ) > f;
mock::detail::function< int( int ) > f;
f.expect().calls( boost::bind( &custom_result ) );
BOOST_CHECK_EQUAL( 42, f( 17 ) );
CHECK_CALLS( 1 );
@ -566,7 +566,7 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_calls_the_custom_functor_with
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_throws_the_set_exception, error_fixture )
{
mock::function< int() > f;
mock::detail::function< int() > f;
f.expect().throws( std::runtime_error( "some exception" ) );
try
{
@ -586,7 +586,7 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_throws_the_set_exception, err
BOOST_FIXTURE_TEST_CASE( expecting_twice_a_single_expectation_makes_it_callable_twice, error_fixture )
{
{
mock::function< void() > f;
mock::detail::function< void() > f;
f.expect().once();
f.expect().once();
f();
@ -594,7 +594,7 @@ BOOST_FIXTURE_TEST_CASE( expecting_twice_a_single_expectation_makes_it_callable_
CHECK_ERROR( f(), unexpected_call, 2, "?()\nv once()\nv once()" );
}
{
mock::function< void( const std::string& ) > f;
mock::detail::function< void( const std::string& ) > f;
f.expect().once().with( "first" );
f.expect().once().with( "second" );
f( "first" );
@ -606,7 +606,7 @@ BOOST_FIXTURE_TEST_CASE( expecting_twice_a_single_expectation_makes_it_callable_
BOOST_FIXTURE_TEST_CASE( best_expectation_is_selected_first, error_fixture )
{
{
mock::function< void( int ) > f;
mock::detail::function< void( int ) > f;
f.expect().once().with( 1 );
f.expect().once().with( 2 );
f( 2 );
@ -614,7 +614,7 @@ BOOST_FIXTURE_TEST_CASE( best_expectation_is_selected_first, error_fixture )
CHECK_ERROR( f( 3 ), unexpected_call, 2, "?( 3 )\nv once().with( 1 )\nv once().with( 2 )" );
}
{
mock::function< void( const std::string& ) > f;
mock::detail::function< void( const std::string& ) > f;
f.expect().once().with( "first" );
f.expect().once().with( "second" );
f( "second" );
@ -639,7 +639,7 @@ namespace
BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, error_fixture )
{
{
mock::function< void( int ) > f;
mock::detail::function< void( int ) > f;
f.expect().once().with( 1 );
f.expect().once().with( 2 );
BOOST_CHECK_NO_THROW( f( 2 ) );
@ -651,7 +651,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
f.reset();
}
{
mock::function< void( int ) > f;
mock::detail::function< void( int ) > f;
f.expect().never().with( 1 );
const std::string expected = "?\n"
"v never().with( 1 )";
@ -659,7 +659,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
f.reset();
}
{
mock::function< void( const std::string& ) > f;
mock::detail::function< void( const std::string& ) > f;
f.expect().never().with( mock::less( "first" ) );
f.expect().exactly( 2 ).with( "second" );
BOOST_CHECK_NO_THROW( f( "second" ) );
@ -680,7 +680,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
f.reset();
}
{
mock::function< void( int ) > f;
mock::detail::function< void( int ) > f;
f.expect().once();
const std::string expected = "?\n"
". once().with( any )";
@ -688,7 +688,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
f.reset();
}
{
mock::function< void( int ) > f;
mock::detail::function< void( int ) > f;
f.expect().once().with( mock::any );
const std::string expected = "?\n"
". once().with( any )";
@ -696,7 +696,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
f.reset();
}
{
mock::function< void( int ) > f;
mock::detail::function< void( int ) > f;
f.expect().once();
const std::string expected = "?\n"
". once().with( any )";
@ -704,7 +704,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
f.reset();
}
{
mock::function< void( int ) > f;
mock::detail::function< void( int ) > f;
f.expect().once().with( &custom_constraint );
const std::string expected = "?\n"
". once().with( ? )";
@ -715,27 +715,27 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
BOOST_FIXTURE_TEST_CASE( expectation_with_remaining_untriggered_matches_upon_destruction_calls_untriggered_expectation, error_fixture )
{
std::auto_ptr< mock::function< void() > > f( new mock::function< void() > );
std::auto_ptr< mock::detail::function< void() > > f( new mock::detail::function< void() > );
f->expect().once();
CHECK_ERROR( f.reset(), untriggered_expectation, 0, "?\n. once()" );
}
BOOST_FIXTURE_TEST_CASE( verifying_expectation_with_remaining_matches_disables_the_automatic_verification_upon_destruction, error_fixture )
{
mock::function< void() > f;
mock::detail::function< void() > f;
f.expect().once();
CHECK_ERROR( f.verify(), verification_failed, 0, "?\n. once()" );
}
BOOST_FIXTURE_TEST_CASE( triggering_unexpected_call_call_disables_the_automatic_verification_upon_destruction, error_fixture )
{
mock::function< void() > f;
mock::detail::function< void() > f;
CHECK_ERROR( f(), unexpected_call, 0, "?()" );
}
BOOST_FIXTURE_TEST_CASE( adding_an_expectation_reactivates_the_verification_upon_destruction, error_fixture )
{
std::auto_ptr< mock::function< void() > > f( new mock::function< void() > );
std::auto_ptr< mock::detail::function< void() > > f( new mock::detail::function< void() > );
CHECK_ERROR( (*f)(), unexpected_call, 0, "?()" );
f->expect().once();
CHECK_ERROR( f.reset(), untriggered_expectation, 0, "?\n. once()" );
@ -745,7 +745,7 @@ BOOST_FIXTURE_TEST_CASE( throwing_an_exception_disables_the_automatic_verificati
{
try
{
mock::function< void() > f;
mock::detail::function< void() > f;
f.expect().once();
throw std::exception();
}