From: solar Date: Fri, 23 Dec 2005 10:42:25 +0000 (+0000) Subject: Improved "expected assertion failure" message in testdriver. X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=1b6d9d589ae0d6bea81268c764281a92130af213;p=fw%2Fpdclib Improved "expected assertion failure" message in testdriver. git-svn-id: https://srv7.svn-repos.de/dev34/pdclib/trunk@111 546481bc-9713-0410-bf18-d3337bbf4a3e --- diff --git a/functions/assert.c b/functions/assert.c index cf3afb9..349570c 100644 --- a/functions/assert.c +++ b/functions/assert.c @@ -35,6 +35,7 @@ void _PDCLIB_assert( char const * const message ) static int rc = 0; static int EXPECTED_ABORT = 0; +static int UNEXPECTED_ABORT = 1; void aborthandler( int signal ) { @@ -58,12 +59,10 @@ int disabled_test() int main() { - int i = 0; BEGIN_TESTS; TESTCASE( signal( SIGABRT, &aborthandler ) != SIG_ERR ); - assert( i == 0 ); /* NDEBUG not set, condition met */ - puts( "Expecting failed assert() message here:" ); - assert( i == 1 ); /* NDEBUG not set, condition fails - should abort */ + assert( UNEXPECTED_ABORT ); /* NDEBUG not set, condition met */ + assert( EXPECTED_ABORT ); /* NDEBUG not set, condition fails - should abort */ return TEST_RESULTS; }