Reworked scanf() testing. General cleanups.
[fw/pdclib] / functions / stdio / vfprintf.c
index 2b216db9ff71b19dec53384c3ab92d2f5b762bbd..cc6e7a6e40388f9c65a187c3df3bea8e7e3dff8c 100644 (file)
@@ -49,12 +49,12 @@ int vfprintf( struct _PDCLIB_file_t * _PDCLIB_restrict stream, const char * _PDC
 #endif
 
 #ifdef TEST
-#include <stdlib.h>
-#include <limits.h>
-#include <string.h>
+#define _PDCLIB_FILEID "stdio/vfprintf.c"
+#define _PDCLIB_FILEIO
+
 #include <_PDCLIB_test.h>
 
-static int testprintf( FILE * stream, size_t n, const char * format, ... )
+static int testprintf( FILE * stream, const char * format, ... )
 {
     int i;
     va_list arg;
@@ -64,16 +64,12 @@ static int testprintf( FILE * stream, size_t n, const char * format, ... )
     return i;
 }
 
-#define TESTCASE_SPRINTF( x )
-
 int main( void )
 {
-    FILE * buffer;
-    TESTCASE( ( buffer = fopen( testfile, "wb" ) ) != NULL );
-#include "printf_testcases.incl"
-    TESTCASE( fclose( buffer ) == 0 );
-#include "fprintf_reftest.incl"
-    TESTCASE( remove( testfile ) == 0 );
+    FILE * target;
+    TESTCASE( ( target = tmpfile() ) != NULL );
+#include "printf_testcases.h"
+    TESTCASE( fclose( target ) == 0 );
     return TEST_RESULTS;
 }