Changeset 6799
- Timestamp:
- 07/09/10 16:00:39 (21 months ago)
- Location:
- branches/refactor/UNIT_TESTER
- Files:
-
- 2 modified
-
test_global.h (modified) (1 diff)
-
test_unit.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/refactor/UNIT_TESTER/test_global.h
r6798 r6799 130 130 TRIGGER_ASSERTION(); // fake an assertion failure 131 131 } 132 static void ioerrorf(const char *filename, int lineno, const char *format, ...) __attribute__((format(printf, 3, 4))) { 133 FlushedOutput yes; 134 fprintf(stderr, "%s:%i: Error: ", filename, lineno); 135 VPRINTFORMAT(format); 136 fprintf(stderr, " (errno=%i='%s')", errno, strerror(errno)); 137 fputc('\n', stderr); 138 TRIGGER_ASSERTION(); // fake an assertion failure 139 } 132 140 #undef VPRINTFORMAT 133 141 }; -
branches/refactor/UNIT_TESTER/test_unit.h
r6798 r6799 19 19 #include <cstdarg> 20 20 #endif 21 #ifndef ERRNO_H 22 #include <errno.h> 23 #endif 21 24 22 25 #define ENABLE_CRASH_TESTS // comment out this line to get rid of provoked SEGVs (e.g. while debugging test-code) … … 153 156 return is_similar(d1, d2, 0.000001); 154 157 } 158 159 155 160 156 161 inline bool files_are_equal(const char *file1, const char *file2) { … … 242 247 #define TEST_ERROR(format,strarg) arb_test::FlushedOutput::errorf(__FILE__, __LINE__, format, (strarg)) 243 248 #define TEST_ERROR2(format,strarg1,strarg2) arb_test::FlushedOutput::errorf(__FILE__, __LINE__, format, (strarg1), (strarg2)) 249 #define TEST_IOERROR(format,strarg) arb_test::FlushedOutput::ioerrorf(__FILE__, __LINE__, format, (strarg)) 244 250 245 251 // -------------------------------------------------------------------------------- … … 258 264 #define TEST_ASSERT_ZERO(cond) TEST_ASSERT((cond) == 0) 259 265 #define TEST_ASSERT_ZERO__BROKEN(cond) TEST_ASSERT__BROKEN((cond) == 0) 266 267 #define TEST_ASSERT_ZERO_OR_SHOW_ERRNO(iocond) \ 268 do { \ 269 if (!(iocond)) \ 270 TEST_IOERROR("I/O-failure in '%s'", #iocond); \ 271 } while(0) 260 272 261 273 // --------------------------------------------------------------------------------
