3 /* _PDCLIB_assert( char const * )
5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
16 #define _PDCLIB_AUX_H _PDCLIB_AUX_H
17 #include <_PDCLIB_aux.h>
20 #if _PDCLIB_C_VERSION == 99
21 void _PDCLIB_assert( char const * const message1, char const * const function, char const * const message2 )
23 fputs( message1, stderr );
24 fputs( function, stderr );
25 fputs( message2, stderr );
29 void _PDCLIB_assert( char const * const message )
31 fputs( message, stderr );
39 #include <_PDCLIB_test.h>
42 static int EXPECTED_ABORT = 0;
43 static int UNEXPECTED_ABORT = 1;
45 static void aborthandler( int sig )
47 TESTCASE( ! EXPECTED_ABORT );
48 exit( (signed int)rc );
54 static int disabled_test( void )
57 assert( i == 0 ); /* NDEBUG set, condition met */
58 assert( i == 1 ); /* NDEBUG set, condition fails */
67 TESTCASE( signal( SIGABRT, &aborthandler ) != SIG_ERR );
68 TESTCASE( disabled_test() == 0 );
69 assert( UNEXPECTED_ABORT ); /* NDEBUG not set, condition met */
70 assert( EXPECTED_ABORT ); /* NDEBUG not set, condition fails - should abort */