Merge pull request #7 from mat007/multi-constraint-example

Added an example demonstrating one constraint for multiple arguments.
This commit is contained in:
Mathieu Champlon 2015-04-02 06:53:36 +02:00
commit 474b0afcb8
2 changed files with 25 additions and 0 deletions

View file

@ -716,6 +716,27 @@ BOOST_AUTO_TEST_CASE( demonstrates_combining_constraints )
//] //]
} }
namespace constraints_example_9
{
//[ constraints_example_9
MOCK_CLASS( mock_class )
{
MOCK_METHOD( method, 2, void( const std::string&, std::size_t ) )
};
bool custom_constraint( const std::string& actual_1, std::size_t actual_2 )
{
return actual_1.size() <= actual_2;
}
BOOST_AUTO_TEST_CASE( demonstrates_one_constraint_for_all_arguments )
{
mock_class c;
MOCK_EXPECT( c.method ).with( &custom_constraint );
}
//]
}
namespace sequence_example_1 namespace sequence_example_1
{ {
//[ sequence_example_1 //[ sequence_example_1

View file

@ -453,6 +453,10 @@ Example using &&, || and ! :
[constraints_example_8] [constraints_example_8]
Example using one constraint for all parameters :
[constraints_example_9]
[endsect] [endsect]
[section Sequence] [section Sequence]