1
0

Test failures are reported verbosely and into the debug console on Win.

This commit is contained in:
madmaxoft 2014-05-30 10:56:12 +02:00
parent 5368c5dd79
commit 0b60caac4a
2 changed files with 19 additions and 3 deletions

View File

@ -271,9 +271,25 @@ void inline LOGERROR(const char* a_Format, ...)
{
};
#ifdef _WIN32
#define REPORT_ERROR(FMT, ...) \
{ \
AString msg = Printf(FMT, __VA_ARGS__); \
puts(msg.c_str()); \
fflush(stdout); \
OutputDebugStringA(msg.c_str()); \
}
#else
#define REPORT_ERROR(FMT, ...) \
{ \
AString msg = Printf(FMT, __VA_ARGS__); \
puts(msg.c_str()); \
fflush(stdout); \
}
#endif
#define ASSERT(x) do { if (!(x)) { throw cAssertFailure();} } while (0)
#define testassert(x) do { if(!(x)) { exit(1); } } while (0)
#define CheckAsserts(x) do { try {x} catch (cAssertFailure) { break; } exit(1); } while (0)
#define testassert(x) do { if(!(x)) { REPORT_ERROR("Test failure: %s, file %s, line %d\n", #x, __FILE__, __LINE__); exit(1); } } while (0)
#define CheckAsserts(x) do { try {x} catch (cAssertFailure) { break; } REPORT_ERROR("Test failure: assert didn't fire for %s, file %s, line %d\n", #x, __FILE__, __LINE__); exit(1); } while (0)
#else
#ifdef _DEBUG

View File

@ -5,7 +5,7 @@ enable_testing()
include_directories(${CMAKE_SOURCE_DIR}/src/)
add_definitions(-DTEST_GLOBALS=1)
add_library(ChunkBuffer ${CMAKE_SOURCE_DIR}/src/ChunkData.cpp)
add_library(ChunkBuffer ${CMAKE_SOURCE_DIR}/src/ChunkData.cpp ${CMAKE_SOURCE_DIR}/src/StringUtils.cpp)
add_executable(creatable-exe creatable.cpp)