Added mock::affirm constraint which is equivalent to !mock::negate

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@299 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2011-04-16 20:09:20 +00:00
parent b3954c469c
commit 817334e069
2 changed files with 10 additions and 0 deletions

View file

@ -44,6 +44,7 @@ namespace mock
const constraint< detail::N > N;
MOCK_CONSTRAINT(any, true && &actual)
MOCK_CONSTRAINT(affirm, !! actual)
MOCK_CONSTRAINT(negate, ! actual)
MOCK_CONSTRAINT(evaluate, actual())

View file

@ -25,6 +25,7 @@ BOOST_AUTO_TEST_CASE( all_comparison_constraints_can_be_instanciated )
BOOST_AUTO_TEST_CASE( constraints_can_be_negated_using_the_not_operator )
{
! mock::any;
! mock::affirm;
! mock::negate;
! mock::evaluate;
! mock::equal( 0 );
@ -231,6 +232,14 @@ BOOST_AUTO_TEST_CASE( retrieve_uses_assignment_operator )
mock::retrieve( b ).f_( a );
}
BOOST_AUTO_TEST_CASE( affirm )
{
int* i = 0;
int j;
BOOST_CHECK( ! mock::affirm.f_( i ) );
BOOST_CHECK( mock::affirm.f_( &j ) );
}
BOOST_AUTO_TEST_CASE( negate )
{
int* i = 0;