mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Merge pull request #7 from mat007/multi-constraint-example
Added an example demonstrating one constraint for multiple arguments.
This commit is contained in:
commit
474b0afcb8
2 changed files with 25 additions and 0 deletions
|
|
@ -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
|
||||
{
|
||||
//[ sequence_example_1
|
||||
|
|
|
|||
|
|
@ -453,6 +453,10 @@ Example using &&, || and ! :
|
|||
|
||||
[constraints_example_8]
|
||||
|
||||
Example using one constraint for all parameters :
|
||||
|
||||
[constraints_example_9]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Sequence]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue