Further streamlined testing.
[fw/pdclib] / functions / stdio / fprintf.c
1 /* $Id$ */
2
3 /* fprintf( FILE *, const char *, ... )
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 #include <stdio.h>
10 #include <stdarg.h>
11
12 #ifndef REGTEST
13
14 int fprintf( struct _PDCLIB_file_t * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, ... )
15 {
16     int rc;
17     va_list ap;
18     va_start( ap, format );
19     rc = vfprintf( stream, format, ap );
20     va_end( ap );
21     return rc;
22 }
23
24 #endif
25
26 #ifdef TEST
27 #include <limits.h>
28 #include <string.h>
29 #include <_PDCLIB_test.h>
30
31 #define testprintf( stream, n, format, ... ) fprintf( stream, format, __VA_ARGS__ )
32
33 #define TESTCASE_SPRINTF( x )
34
35 int main( void )
36 {
37     FILE * buffer;
38     TESTCASE( ( buffer = fopen( "testing/testfile", "wb" ) ) != NULL );
39 #include "printf_testcases.incl"
40     TESTCASE( fclose( buffer ) == 0 );
41 #include "fprintf_reftest.incl"
42     TESTCASE( remove( "testing/testfile" ) == 0 );
43     return TEST_RESULTS;
44 }
45
46 #endif