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