5 /* _PDCLIB_assert( char const * )
7 This file is part of the Public Domain C Library (PDCLib).
8 Permission is granted to use, modify, and / or redistribute at will.
15 #define _PDCLIB_AUX_H _PDCLIB_AUX_H
16 #include <_PDCLIB_aux.h>
19 #if _PDCLIB_C_VERSION == 99
20 void _PDCLIB_assert( char const * const message1, char const * const function, char const * const message2 )
22 fputs( message1, stderr );
23 fputs( function, stderr );
24 fputs( message2, stderr );
28 void _PDCLIB_assert( char const * const message )
30 fputs( message, stderr );
37 #include <_PDCLIB_test.h>
41 static int EXPECTED_ABORT = 0;
42 static int UNEXPECTED_ABORT = 1;
44 void aborthandler( int signal )
46 TESTCASE( ! EXPECTED_ABORT );
56 assert( i == 0 ); /* NDEBUG set, condition met */
57 assert( i == 1 ); /* NDEBUG set, condition fails */
67 TESTCASE( signal( SIGABRT, &aborthandler ) != SIG_ERR );
68 assert( UNEXPECTED_ABORT ); /* NDEBUG not set, condition met */
69 assert( EXPECTED_ABORT ); /* NDEBUG not set, condition fails - should abort */