X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Fsscan_sources.incl;h=490d95df5fbf2389f9054346beb0944ad40fb3e1;hb=e225d3c69eaaeb3203de2532bb4eb37d1f813de7;hp=8c64ded3f2282cf2ce8e94a8f9b1544c54a3c36c;hpb=267fe05174a4ac4059e83e4275e4776735797658;p=pdclib diff --git a/functions/stdio/sscan_sources.incl b/functions/stdio/sscan_sources.incl index 8c64ded..490d95d 100644 --- a/functions/stdio/sscan_sources.incl +++ b/functions/stdio/sscan_sources.incl @@ -3,9 +3,9 @@ "-2147483648 +2147483647 +4294967295\n" "-9223372036854775808 +9223372036854775807\n" "+18446744073709551615\n"; - char const * hexadecimal = "-0x0 -0x000 -0x7f 0x80 0xff -0x7fff 0x8000\n" - "0xffff -0x7fffffff 0x80000000 0xffffffff\n" - "-0x7fffffffffffffff 0x8000000000000000\n" + char const * hexadecimal = "-0x0 -0x000 -0x7f -0x80 0xff -0x7fff -0x8000\n" + "0xffff -0x7fffffff -0x80000000 0xffffffff\n" + "-0x7fffffffffffffff -0x8000000000000000\n" "0xffffffffffffffff\n"; char const * octal = "+0000 -0000 +0177 +0377 -0377 +077777 +0177777\n" "-0177777 +017777777777 +037777777777\n" @@ -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 +