Factorized invocation configuration

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@765 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2015-03-01 11:27:48 +00:00
parent d18f499e48
commit 6503e69624
2 changed files with 8 additions and 34 deletions

View file

@ -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

View file

@ -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;
}