Assertions

# define CPPUT_ASSERT            \
   CPPUT_BEGIN_ASSERTION_MACRO() \
   ::CppUT::checkTrue

void checkTrue( bool shouldBeTrue, const Message &message )
{
   if ( shouldBeTrue )
      return;

   Message newMessage( message );
   newMessage.insertAt( 0, translate( "Assertion failed: expression did not evaluate to true." ) );
   fail( newMessage );
}

Note: currently investigating the possibility of capturing the call stack in addition to the file and source line.

Note: some regular-expression-based assertions would be useful.

CppUnit2/Assertions (last edited 2008-02-26 06:29:58 by localhost)

SourceForge.net Logo