]> pd.if.org Git - pdclib/commitdiff
_PDCLIB_iotest.h: Print out the format string which caused the error (PDCLIB-6)
authorOwen Shepherd <owen.shepherd@e43.eu>
Sat, 25 Aug 2012 14:32:54 +0000 (15:32 +0100)
committerOwen Shepherd <owen.shepherd@e43.eu>
Sat, 25 Aug 2012 14:32:54 +0000 (15:32 +0100)
testing/_PDCLIB_iotest.h

index 134a4446809447c1acd1890834d1023cdb97c93e..c3118dc95627d548d0d9a4a006ed4aae3c81fd1a 100644 (file)
@@ -32,6 +32,7 @@
 #define PREP_RESULT_BUFFER
 #endif
 
+#define GETFMT( fmt, ... ) (fmt)
 #define PRINTF_TEST( expected_rc, expected_string, ... ) do { \
         PREP_RESULT_BUFFER \
         int actual_rc = testprintf( target, __VA_ARGS__ ); \
              ( RESULT_MISMATCH( target, expected_string ) ) ) \
         { \
             ++TEST_RESULTS; \
-            fprintf( stderr, "FAILED: " __FILE__ " (" _PDCLIB_FILEID "), line %d\n        expected %2d, \"%s\"\n        actual   %2d, \"%s\"\n", __LINE__, expected_rc, expected_string, actual_rc, RESULT_STRING( target ) ); \
+            fprintf( stderr, \
+                "FAILED: " __FILE__ " (" _PDCLIB_FILEID "), line %d\n" \
+                "        format string \"%s\"\n" \
+                "        expected %2d, \"%s\"\n" \
+                "        actual   %2d, \"%s\"\n", \
+                 __LINE__, GETFMT(__VA_ARGS__, 0), expected_rc, \
+                 expected_string, actual_rc, RESULT_STRING( target ) ); \
         } \
     } while ( 0 )