From: solar Date: Fri, 23 Dec 2005 10:42:25 +0000 (+0000) Subject: Improved "expected assertion failure" message in testdriver. X-Git-Tag: v0.4~29 X-Git-Url: https://pd.if.org/git/?p=pdclib;a=commitdiff_plain;h=6005763f4345360aff7628f2fef1c93c85c3edbd Improved "expected assertion failure" message in testdriver. --- 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; }