]> pd.if.org Git - pdclib/blobdiff - platform/example_cygwin/functions/stdio/tmpfile.c
Fixed prototype warnings.
[pdclib] / platform / example_cygwin / functions / stdio / tmpfile.c
index 255a35eb75721d58d352cd1279a1dd7f3fdda622..3049260a5d332dfcc29681030b2685731ba52c0f 100644 (file)
@@ -21,9 +21,21 @@ struct _PDCLIB_file_t * tmpfile( void )
 #ifdef TEST
 #include <_PDCLIB_test.h>
 
-int main()
+int main( void )
 {
-    TESTCASE( NO_TESTDRIVER );
+    FILE * fh;
+    char filename[ L_tmpnam ];
+    FILE * fhtest;
+    TESTCASE( ( fh = tmpfile() ) != NULL );
+    TESTCASE( fputc( 'x', fh ) == 'x' );
+    /* Checking that file is actually there */
+    TESTCASE_NOREG( strcpy( filename, fh->filename ) == filename );
+    TESTCASE_NOREG( ( fhtest = fopen( filename, "r" ) ) != NULL );
+    TESTCASE_NOREG( fclose( fhtest ) == 0 );
+    /* Closing tmpfile */
+    TESTCASE( fclose( fh ) == 0 );
+    /* Checking that file was deleted */
+    TESTCASE_NOREG( fopen( filename, "r" ) == NULL );
     return TEST_RESULTS;
 }