X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Fvfprintf.c;h=9a9a9503ce099eb5a5ac6f4ef000c4d7effc54b6;hb=f603f88b4456cf9b7ab1328bf657ede22a0c9940;hp=8e3ff9548482a81610cd12f937c191e310c76aff;hpb=51ffde01e2c794ed75f9a202540e2038fce60148;p=pdclib diff --git a/functions/stdio/vfprintf.c b/functions/stdio/vfprintf.c index 8e3ff95..9a9a950 100644 --- a/functions/stdio/vfprintf.c +++ b/functions/stdio/vfprintf.c @@ -24,6 +24,7 @@ int vfprintf( struct _PDCLIB_file_t * _PDCLIB_restrict stream, const char * _PDC { /* No conversion specifier, print verbatim */ putc( *(format++), stream ); + status.i++; } else { @@ -37,11 +38,26 @@ int vfprintf( struct _PDCLIB_file_t * _PDCLIB_restrict stream, const char * _PDC #endif #ifdef TEST +#include #include <_PDCLIB_test.h> +static int testprintf( FILE * stream, const char * format, ... ) +{ + int i; + va_list arg; + va_start( arg, format ); + i = vfprintf( stream, format, arg ); + va_end( arg ); + return i; +} + int main( void ) { - TESTCASE( NO_TESTDRIVER ); + FILE * fh; + TESTCASE( ( fh = fopen( "testfile", "w" ) ) != NULL ); + TESTCASE( testprintf( fh, "Hallo\n" ) == 6 ); + TESTCASE( fclose( fh ) == 0 ); + /* FIXME: Testfile doesn't exist... */ return TEST_RESULTS; }