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 char const * special = "-0xz\n";
20 #define TESTSCAN( result, count, source, offset, ... ) \
24 int res = SCANFUNC( source + offset, __VA_ARGS__ ); \
25 if ( res != result ) \
28 printf( "FAILED: " __FILE__ ", line %d - expected result %d, got %d\n", __LINE__, result, res ); \
33 printf( "FAILED: " __FILE__ ", line %d - expected count %d, got %d\n", __LINE__, count, n ); \
37 #define SCAN( format ) format "%n", &n
38 #define SCANPARMS( format, ... ) format "%n", __VA_ARGS__, &n