mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Added support for several sequences in 'in'
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@635 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
4ee2837dcd
commit
8d2fb9c94c
6 changed files with 34 additions and 15 deletions
|
|
@ -6,6 +6,7 @@ Not yet released
|
|||
* Added support for C++11 lambdas as constraints
|
||||
* Return actions now accept by copy types derived from abstract base types
|
||||
* Officially documented MOCK_UNARY_CONSTRAINT and MOCK_BINARY_CONSTRAINT
|
||||
* Added support for several sequences in 'in'
|
||||
|
||||
[endsect]
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
|||
calculator c( v );
|
||||
mock::sequence s;
|
||||
MOCK_EXPECT( v.display ).once().with( 0 ).in( s ); // add this expectation to the sequence
|
||||
MOCK_EXPECT( v.display ).with( 1 ).in( s ); // add this expectation to the sequence after the previous one
|
||||
MOCK_EXPECT( v.display ).with( 1 ).in( s ); // add this expectation to the sequence after the previous call
|
||||
c.add( 0, 0 );
|
||||
c.add( 1, 0 );
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
|||
mock::sequence s1, s2;
|
||||
MOCK_EXPECT( v.display ).once().with( 0 ).in( s1 );
|
||||
MOCK_EXPECT( v.display ).once().with( 1 ).in( s2 );
|
||||
MOCK_EXPECT( v.display ).with( 2 ).in( s1 ).in( s2 ); // add this expectation to both sequences after the previous ones
|
||||
MOCK_EXPECT( v.display ).with( 2 ).in( s1, s2 ); // add this expectation to both sequences after the previous calls
|
||||
c.add( 0, 0 );
|
||||
c.add( 1, 0 );
|
||||
c.add( 1, 1 );
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ An expectation is a statement of configuration for a mock object.
|
|||
|
||||
Synopsis :
|
||||
|
||||
MOCK_EXPECT( identifier ).``[link turtle.reference.expectation.invocation invocation]``( arguments ).with( ``[link turtle.reference.expectation.constraints constraints]`` ).in( ``[link turtle.reference.expectation.sequence sequence]`` ).``[link turtle.reference.expectation.actions action]``( value );
|
||||
MOCK_EXPECT( identifier ).``[link turtle.reference.expectation.invocation invocation]``( arguments ).with( ``[link turtle.reference.expectation.constraints constraints]`` ).in( ``[link turtle.reference.expectation.sequence sequences]`` ).``[link turtle.reference.expectation.actions action]``( value );
|
||||
|
||||
[note The identifier refers to the one specified when [link turtle.reference.creation creating] a mock object]
|
||||
|
||||
|
|
@ -612,9 +612,9 @@ Example using &&, || and ! :
|
|||
|
||||
Synopsis :
|
||||
|
||||
mock::sequence s;
|
||||
MOCK_EXPECT( identifier_1 ).in( s );
|
||||
MOCK_EXPECT( identifier_2 ).in( s );
|
||||
mock::sequence s_1, s_2;
|
||||
MOCK_EXPECT( identifier_1 ).in( s_1 );
|
||||
MOCK_EXPECT( identifier_2 ).in( s_1, s_2 );
|
||||
|
||||
Example :
|
||||
|
||||
|
|
@ -636,20 +636,25 @@ Example :
|
|||
MOCK_EXPECT( c_2.method_2 ).in( s );
|
||||
}
|
||||
|
||||
Example of setting several sequences by chaining calls to ['in] :
|
||||
Example of setting several sequences :
|
||||
|
||||
MOCK_CLASS( mock_class )
|
||||
{
|
||||
MOCK_METHOD( method, 0, void() )
|
||||
};
|
||||
|
||||
BOOST_AUTO_TEST_CASE( demonstrates_enforcing_several_expectations_orders )
|
||||
BOOST_AUTO_TEST_CASE( demonstrates_enforcing_several_expectation_orders )
|
||||
{
|
||||
mock_class c;
|
||||
mock::sequence s_1, s_2;
|
||||
MOCK_EXPECT( c.method ).in( s_1 ).in( s_2 );
|
||||
MOCK_EXPECT( c.method ).in( s_1, s_2 );
|
||||
}
|
||||
|
||||
The maximum number of sequences that can be passed to ['in] is MOCK_MAX_SEQUENCES which defaults to 5. If needed the value can be increased before including the library :
|
||||
|
||||
#define MOCK_MAX_SEQUENCES 7
|
||||
#include <mock/turtle.hpp>
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Actions]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue