From 1f1e143b06e556c5792be716c885426dd91ebc62 Mon Sep 17 00:00:00 2001 From: Mathieu Champlon Date: Thu, 2 Apr 2015 06:52:58 +0200 Subject: [PATCH] Added an example demonstrating one constraint for multiple arguments. --- doc/example/reference.cpp | 21 +++++++++++++++++++++ doc/reference.qbk | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/doc/example/reference.cpp b/doc/example/reference.cpp index fb010ee..e0783a1 100644 --- a/doc/example/reference.cpp +++ b/doc/example/reference.cpp @@ -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 diff --git a/doc/reference.qbk b/doc/reference.qbk index d4f11db..e4d0fb4 100644 --- a/doc/reference.qbk +++ b/doc/reference.qbk @@ -453,6 +453,10 @@ Example using &&, || and ! : [constraints_example_8] +Example using one constraint for all parameters : + +[constraints_example_9] + [endsect] [section Sequence]