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.
15 #include <_PDCLIB_aux.h>
17 void _PDCLIB_assert99( char const * const message1, char const * const function, char const * const message2 )
19 fputs( message1, stderr );
20 fputs( function, stderr );
21 fputs( message2, stderr );
25 void _PDCLIB_assert89( char const * const message )
27 fputs( message, stderr );
34 #include <_PDCLIB_test.h>
37 static int EXPECTED_ABORT = 0;
38 static int UNEXPECTED_ABORT = 1;
40 static void aborthandler( int sig )
42 TESTCASE( ! EXPECTED_ABORT );
43 exit( (signed int)TEST_RESULTS );
49 static int disabled_test( void )
52 assert( i == 0 ); /* NDEBUG set, condition met */
53 assert( i == 1 ); /* NDEBUG set, condition fails */
62 TESTCASE( signal( SIGABRT, &aborthandler ) != SIG_ERR );
63 TESTCASE( disabled_test() == 0 );
64 assert( UNEXPECTED_ABORT ); /* NDEBUG not set, condition met */
65 assert( EXPECTED_ABORT ); /* NDEBUG not set, condition fails - should abort */