X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Fsnprintf.c;h=e1a695678cc3f4c6909e19afb86837e6a223bf96;hb=d6f1494a4f38a212b29a13ee713885058dcf0fe7;hp=a34558992e5b84a717282dc5da67a976cdaeec8b;hpb=92177644f19b596c593293cb20c4f6677186f3b6;p=pdclib diff --git a/functions/stdio/snprintf.c b/functions/stdio/snprintf.c index a345589..e1a6956 100644 --- a/functions/stdio/snprintf.c +++ b/functions/stdio/snprintf.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /* snprintf( char *, size_t, const char *, ... ) This file is part of the Public Domain C Library (PDCLib). @@ -24,19 +22,19 @@ int snprintf( char * _PDCLIB_restrict s, size_t n, const char * _PDCLIB_restrict #endif #ifdef TEST -#include <_PDCLIB_test.h> - -#include -#include +#define _PDCLIB_FILEID "stdio/snprintf.c" +#define _PDCLIB_STRINGIO -#define testprintf( s, n, format, ... ) snprintf( s, n, format, __VA_ARGS__ ) +#include "_PDCLIB_test.h" -#define TESTCASE_SPRINTF( x ) TESTCASE( x ) +#define testprintf( s, format, ... ) snprintf( s, 100, format, __VA_ARGS__ ) int main( void ) { - char buffer[100]; -#include "printf_testcases.incl" + char target[100]; +#include "printf_testcases.h" + TESTCASE( snprintf( NULL, 0, "foo" ) == 3 ); + TESTCASE( snprintf( NULL, 0, "%d", 100 ) == 3 ); return TEST_RESULTS; }