]> pd.if.org Git - pdclib/blobdiff - functions/stdio/fscan_sources.incl
Improved unified tests.
[pdclib] / functions / stdio / fscan_sources.incl
index 8cfa64bd1c1d339a8560c9f04aeb566365a2873b..ef0ac7fa55fe5de9fa2a3da0193638d33e185f46 100644 (file)
 
 
 /* fscan */
-#define TESTSCAN( result, count, source, offset, format, ... ) \
+#define TESTSCAN( result, count, source, offset, ... ) \
     do \
     { \
         int n = -1; \
         TESTCASE( fseek( source, offset, SEEK_SET ) == 0 ); \
-        TESTCASE( SCANFUNC( source, format "%n", __VA_ARGS__, &n ) == result ); \
-        TESTCASE( n == count ); \
+        int res = SCANFUNC( source, __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_FSCAN
+