]> pd.if.org Git - pdclib/blobdiff - platform/example/functions/stdlib/system.c
Whitespace cleanups.
[pdclib] / platform / example / functions / stdlib / system.c
index 2e0079a449d942178badaedf8d98a285e842d95d..8b5d4d7023270471dec3eddb1d5728369ef58ed3 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /* system( const char * )
 
    This file is part of the Public Domain C Library (PDCLib).
@@ -34,13 +32,24 @@ int system( const char * string )
 }
 
 #ifdef TEST
-#include <_PDCLIB_test.h>
+
+#include "_PDCLIB_test.h"
 
 #define SHELLCOMMAND "echo 'SUCCESS testing system()'"
 
 int main( void )
 {
+    FILE * fh;
+    char buffer[25];
+    buffer[24] = 'x';
+    TESTCASE( ( fh = freopen( testfile, "wb+", stdout ) ) != NULL );
     TESTCASE( system( SHELLCOMMAND ) );
+    rewind( fh );
+    TESTCASE( fread( buffer, 1, 24, fh ) == 24 );
+    TESTCASE( memcmp( buffer, "SUCCESS testing system()", 24 ) == 0 );
+    TESTCASE( buffer[24] == 'x' );
+    TESTCASE( fclose( fh ) == 0 );
+    TESTCASE( remove( testfile ) == 0 );
     return TEST_RESULTS;
 }