MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / SDLTest_Assert

Function SDLTest_Assert

deps/SDL2/src/test/SDL_test_assert.c:47–60  ·  view source on GitHub ↗

* Assert that logs and break execution flow on failures (i.e. for harness errors). */

Source from the content-addressed store, hash-verified

45 * Assert that logs and break execution flow on failures (i.e. for harness errors).
46 */
47void 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).

Callers 1

Calls 3

SDL_memsetFunction · 0.85
SDL_vsnprintfFunction · 0.85
SDLTest_AssertCheckFunction · 0.85

Tested by

no test coverage detected