diff --git a/turtle/detail/expectation_template.hpp b/turtle/detail/expectation_template.hpp index adcd91d..f88372a 100644 --- a/turtle/detail/expectation_template.hpp +++ b/turtle/detail/expectation_template.hpp @@ -79,35 +79,9 @@ namespace detail (*it)->remove( this ); } - expectation& once() + void invoke( const boost::shared_ptr< invocation >& i ) { - invocation_ = boost::make_shared< detail::once >(); - return *this; - } - expectation& never() - { - invocation_ = boost::make_shared< detail::never >(); - return *this; - } - expectation& exactly( std::size_t count ) - { - invocation_ = boost::make_shared< detail::exactly >( count ); - return *this; - } - expectation& at_least( std::size_t min ) - { - invocation_ = boost::make_shared< detail::at_least >( min ); - return *this; - } - expectation& at_most( std::size_t max ) - { - invocation_ = boost::make_shared< detail::at_most >( max ); - return *this; - } - expectation& between( std::size_t min, std::size_t max ) - { - invocation_ = boost::make_shared< detail::between >( min, max ); - return *this; + invocation_ = i; } #ifndef MOCK_NUM_ARGS_0 diff --git a/turtle/detail/function_impl_template.hpp b/turtle/detail/function_impl_template.hpp index 1b7d41d..65fdc53 100644 --- a/turtle/detail/function_impl_template.hpp +++ b/turtle/detail/function_impl_template.hpp @@ -100,32 +100,32 @@ namespace detail wrapper once() { - this->e_->once(); + this->e_->invoke( boost::make_shared< detail::once >() ); return *this; } wrapper never() { - this->e_->never(); + this->e_->invoke( boost::make_shared< detail::never >() ); return *this; } wrapper exactly( std::size_t count ) { - this->e_->exactly( count ); + this->e_->invoke( boost::make_shared< detail::exactly >( count ) ); return *this; } wrapper at_least( std::size_t min ) { - this->e_->at_least( min ); + this->e_->invoke( boost::make_shared< detail::at_least >( min ) ); return *this; } wrapper at_most( std::size_t max ) { - this->e_->at_most( max ); + this->e_->invoke( boost::make_shared< detail::at_most >( max ) ); return *this; } wrapper between( std::size_t min, std::size_t max ) { - this->e_->between( min, max ); + this->e_->invoke( boost::make_shared< detail::between >( min, max ) ); return *this; }