]> pd.if.org Git - pdclib/blob - functions/stdio/sscan_sources.incl
Disabled 'special case' tests for regression.
[pdclib] / functions / stdio / sscan_sources.incl
1     char const * general     = "12345678901\0003-5+7\0009\3772 4 6 8 0\3771 \011 5%%  0";
2     char const * decimal     = "-0 +0 -128 +127 +255 -32768 +32767 +65535\n"
3                                "-2147483648 +2147483647 +4294967295\n"
4                                "-9223372036854775808 +9223372036854775807\n"
5                                "+18446744073709551615\n";
6     char const * hexadecimal = "-0x0 -0x000 -0x7f -0x80 0xff -0x7fff -0x8000\n"
7                                "0xffff -0x7fffffff -0x80000000 0xffffffff\n"
8                                "-0x7fffffffffffffff -0x8000000000000000\n"
9                                "0xffffffffffffffff\n";
10     char const * octal       = "+0000 -0000 +0177 +0377 -0377 +077777 +0177777\n"
11                                "-0177777 +017777777777 +037777777777\n"
12                                "-037777777777 +0777777777777777777777\n"
13                                "+01777777777777777777777\n"
14                                "-01777777777777777777777\n";
15     char const * alpha       = "abcdefgh-ijklmnop[qrs%uvw]xyz";
16 #ifndef REGTEST
17     char const * special     = "-0xz\n";
18 #endif
19
20
21 /* sscan */
22 #define TESTSCAN( result, count, source, offset, ... ) \
23     do \
24     { \
25         int n = -1; \
26         int res = SCANFUNC( source + offset, __VA_ARGS__ ); \
27         if ( res != result ) \
28         { \
29             rc += 1; \
30             printf( "FAILED: " __FILE__ ", line %d - expected result %d, got %d\n", __LINE__, result, res ); \
31         } \
32         if ( n != count ) \
33         { \
34             rc += 1; \
35             printf( "FAILED: " __FILE__ ", line %d - expected count %d, got %d\n", __LINE__, count, n ); \
36         } \
37     } while ( 0 )
38
39 #define SCAN( format )           format "%n",              &n
40 #define SCANPARMS( format, ... ) format "%n", __VA_ARGS__, &n
41
42 #define _PDCLIB_SSCAN
43