mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Added error diagnostic for a missing action
This commit is contained in:
parent
474b0afcb8
commit
fd78c134b7
2 changed files with 46 additions and 0 deletions
|
|
@ -94,3 +94,36 @@ BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
|||
}
|
||||
//]
|
||||
}
|
||||
|
||||
namespace action
|
||||
{
|
||||
//[ action_view
|
||||
class view
|
||||
{
|
||||
public:
|
||||
virtual bool display( int result ) = 0; // returns a boolean
|
||||
};
|
||||
//]
|
||||
|
||||
MOCK_BASE_CLASS( mock_view, view )
|
||||
{
|
||||
MOCK_METHOD( display, 1 )
|
||||
};
|
||||
|
||||
class calculator
|
||||
{
|
||||
public:
|
||||
calculator( view& v );
|
||||
|
||||
void add( int a, int b );
|
||||
};
|
||||
//[ action_test
|
||||
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
||||
{
|
||||
mock_view v;
|
||||
calculator c( v );
|
||||
MOCK_EXPECT( v.display ).once().with( 0 ); // missing returns( true )
|
||||
c.add( 0, 0 );
|
||||
}
|
||||
//]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue