From 677b99cd662591d31eac188e5da76079130bec3f Mon Sep 17 00:00:00 2001 From: solar Date: Mon, 30 Jan 2006 20:17:24 +0000 Subject: [PATCH] Added test driver. git-svn-id: https://srv7.svn-repos.de/dev34/pdclib/trunk@128 546481bc-9713-0410-bf18-d3337bbf4a3e --- functions/stdlib/atexit.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/functions/stdlib/atexit.c b/functions/stdlib/atexit.c index 52df21c..1436356 100644 --- a/functions/stdlib/atexit.c +++ b/functions/stdlib/atexit.c @@ -34,11 +34,33 @@ int atexit( void (*func)( void ) ) #ifdef TEST #include <_PDCLIB_test.h> +#include + +static int flags[ 32 ]; + +static void counthandler() +{ + static int rc = 0; + flags[ rc ] = rc; + ++rc; +} + +static void checkhandler() +{ + for ( int i = 0; i < 31; ++i ) + { + assert( flags[ i ] == i ); + } +} int main() { BEGIN_TESTS; - TESTCASE( NO_TESTDRIVER ); + TESTCASE( atexit( &checkhandler ) == 0 ); + for ( int i = 0; i < 31; ++i ) + { + TESTCASE( atexit( &counthandler ) == 0 ); + } return TEST_RESULTS; } -- 2.47.2