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.
18 #define _PDCLIB_AUX_H _PDCLIB_AUX_H
19 #include <_PDCLIB_aux.h>
22 #if _PDCLIB_C_VERSION == 99
23 void _PDCLIB_assert( char const * const message1, char const * const function, char const * const message2 )
25 fputs( message1, stderr );
26 fputs( function, stderr );
27 fputs( message2, stderr );
31 void _PDCLIB_assert( char const * const message )
33 fputs( message, stderr );
41 #include <_PDCLIB_test.h>
44 static int EXPECTED_ABORT = 0;
45 static int UNEXPECTED_ABORT = 1;
47 static void aborthandler( int sig )
49 TESTCASE( ! EXPECTED_ABORT );
50 exit( (signed int)rc );
56 static int disabled_test( void )
59 assert( i == 0 ); /* NDEBUG set, condition met */
60 assert( i == 1 ); /* NDEBUG set, condition fails */
69 TESTCASE( signal( SIGABRT, &aborthandler ) != SIG_ERR );
70 TESTCASE( disabled_test() == 0 );
71 assert( UNEXPECTED_ABORT ); /* NDEBUG not set, condition met */
72 assert( EXPECTED_ABORT ); /* NDEBUG not set, condition fails - should abort */