]> pd.if.org Git - pdclib/blobdiff - functions/stdio/puts.c
Comment cleanups.
[pdclib] / functions / stdio / puts.c
index b7954ea0c69b92895a76741d8df170c6ccdd4cab..7937c0d45ff4709511f54f16684c05962f8a4177 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /* puts( const char * )
 
    This file is part of the Public Domain C Library (PDCLib).
@@ -49,7 +47,18 @@ int puts( const char * s )
 
 int main( void )
 {
-    TESTCASE( puts( "SUCCESS testing puts()" ) >= 0 );
+    FILE * fh;
+    char const * message = "SUCCESS testing puts()";
+    char buffer[23];
+    buffer[22] = 'x';
+    TESTCASE( ( fh = freopen( testfile, "wb+", stdout ) ) != NULL );
+    TESTCASE( puts( message ) >= 0 );
+    rewind( fh );
+    TESTCASE( fread( buffer, 1, 22, fh ) == 22 );
+    TESTCASE( memcmp( buffer, message, 22 ) == 0 );
+    TESTCASE( buffer[22] == 'x' );
+    TESTCASE( fclose( fh ) == 0 );
+    TESTCASE( remove( testfile ) == 0 );
     return TEST_RESULTS;
 }