Simplification

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@54 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2009-09-27 09:26:10 +00:00
parent 3f118a8164
commit ed5ae2b859
3 changed files with 5 additions and 5 deletions

View file

@ -48,7 +48,7 @@ namespace mock
public: public:
struct expectation_tag struct expectation_tag
{}; {};
expectation_tag operator_exp; expectation_tag exp_;
expectation( const std::string& name = "?" ) expectation( const std::string& name = "?" )
: impl_( new expectation_impl( root, name ) ) : impl_( new expectation_impl( root, name ) )

View file

@ -140,7 +140,7 @@ namespace detail
mock::expectation< S > mock::expectation< S >
#define MOCK_MOCKER(o, t) \ #define MOCK_MOCKER(o, t) \
mock::detail::configure( mock::detail::ref( o ).t##_exp, \ mock::detail::configure( mock::detail::ref( o ).exp##t, \
BOOST_PP_STRINGIZE(t), mock::detail::ref( o ) ) BOOST_PP_STRINGIZE(t), mock::detail::ref( o ) )
#define MOCK_METHOD_ARG(z, n, arg) BOOST_PP_COMMA_IF(n) \ #define MOCK_METHOD_ARG(z, n, arg) BOOST_PP_COMMA_IF(n) \
@ -153,7 +153,7 @@ namespace detail
#define MOCK_MOCKER_ARGS(n) \ #define MOCK_MOCKER_ARGS(n) \
BOOST_PP_REPEAT_FROM_TO(0, n, MOCK_MOCKER_ARG, BOOST_PP_EMPTY) BOOST_PP_REPEAT_FROM_TO(0, n, MOCK_MOCKER_ARG, BOOST_PP_EMPTY)
#define MOCK_METHOD_EXPECTATION(S, t) \ #define MOCK_METHOD_EXPECTATION(S, t) \
mutable mock::expectation< S > t##_exp; mutable mock::expectation< S > exp##t;
#define MOCK_METHOD_STUB(M, n, S, t, c, tpn) \ #define MOCK_METHOD_STUB(M, n, S, t, c, tpn) \
tpn boost::function< S >::result_type M( \ tpn boost::function< S >::result_type M( \

View file

@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE( mock_functor_in_function_is_supported )
boost::function< int( float, const std::string& ) > func; boost::function< int( float, const std::string& ) > func;
{ {
MOCK_FUNCTOR( int( float, const std::string& ) ) f; MOCK_FUNCTOR( int( float, const std::string& ) ) f;
MOCK_EXPECT(f, operator).once().with( 3, "op" ).returns( 42 ); MOCK_EXPECT( f, _ ).once().with( 3, "op" ).returns( 42 );
func = f; func = f;
} }
BOOST_CHECK_EQUAL( 42, func( 3, "op" ) ); BOOST_CHECK_EQUAL( 42, func( 3, "op" ) );
@ -154,7 +154,7 @@ namespace
BOOST_FIXTURE_TEST_CASE( mock_functor_in_fixture_is_supported, functor_fixture ) BOOST_FIXTURE_TEST_CASE( mock_functor_in_fixture_is_supported, functor_fixture )
{ {
MOCK_EXPECT(f, operator).once().with( 3, "op" ).returns( 42 ); MOCK_EXPECT( f, _ ).once().with( 3, "op" ).returns( 42 );
BOOST_CHECK_EQUAL( 42, f( 3.f, "op" ) ); BOOST_CHECK_EQUAL( 42, f( 3.f, "op" ) );
} }