X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstdio%2Fsscan_sources.incl;h=d293742e0f3064d01f2f5797cb2019899421c002;hp=ba4eb24aac2a2e04fca8398b0b380d9b0c8d3f77;hb=61cd4c099107b37d2b485c2ceb21ad661c899309;hpb=53b58d5bba717ecbf47baa0feab2b38cc55a804a diff --git a/functions/stdio/sscan_sources.incl b/functions/stdio/sscan_sources.incl index ba4eb24..d293742 100644 --- a/functions/stdio/sscan_sources.incl +++ b/functions/stdio/sscan_sources.incl @@ -17,11 +17,25 @@ /* sscan */ -#define TESTSCAN( result, count, source, offset, format, ... ) \ +#define TESTSCAN( result, count, source, offset, ... ) \ do \ { \ int n = -1; \ - TESTCASE( SCANFUNC( source + offset, format "%n", __VA_ARGS__, &n ) == result ); \ - TESTCASE( n == count ); \ + int res = SCANFUNC( source + offset, __VA_ARGS__ ); \ + if ( res != result ) \ + { \ + rc += 1; \ + printf( "FAILED: " __FILE__ ", line %d - expected result %d, got %d\n", __LINE__, result, res ); \ + } \ + if ( n != count ) \ + { \ + rc += 1; \ + printf( "FAILED: " __FILE__ ", line %d - expected count %d, got %d\n", __LINE__, count, n ); \ + } \ } while ( 0 ) +#define SCAN( format ) format "%n", &n +#define SCANPARMS( format, ... ) format "%n", __VA_ARGS__, &n + +#define _PDCLIB_SSCAN +