* Assert that logs and break execution flow on failures (i.e. for harness errors). */
| 45 | * Assert that logs and break execution flow on failures (i.e. for harness errors). |
| 46 | */ |
| 47 | void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) |
| 48 | { |
| 49 | va_list list; |
| 50 | char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH]; |
| 51 | |
| 52 | /* Print assert description into a buffer */ |
| 53 | SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH); |
| 54 | va_start(list, assertDescription); |
| 55 | SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, assertDescription, list); |
| 56 | va_end(list); |
| 57 | |
| 58 | /* Log, then assert and break on failure */ |
| 59 | SDL_assert((SDLTest_AssertCheck(assertCondition, "%s", logMessage))); |
| 60 | } |
| 61 | |
| 62 | /* |
| 63 | * Assert that logs but does not break execution flow on failures (i.e. for test cases). |
no test coverage detected