SDL 2.0
SDL_test_assert.h File Reference
#include "begin_code.h"
#include "close_code.h"
+ Include dependency graph for SDL_test_assert.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ASSERT_FAIL   0
 Fails the assert.
 
#define ASSERT_PASS   1
 Passes the assert.
 

Functions

void SDLTest_Assert (int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(2)
 Assert that logs and break execution flow on failures.
 
int SDLTest_AssertCheck (int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(2)
 Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters.
 
void SDLTest_AssertPass (SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(1)
 Explicitly pass without checking an assertion condition. Updates assertion counter.
 
void SDLTest_ResetAssertSummary (void)
 Resets the assert summary counters to zero.
 
void SDLTest_LogAssertSummary (void)
 Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
 
int SDLTest_AssertSummaryToTestResult (void)
 Converts the current assert summary state to a test result.
 

Detailed Description

Include file for SDL test framework.

This code is a part of the SDL2_test library, not the main SDL library.

Definition in file SDL_test_assert.h.

Macro Definition Documentation

◆ ASSERT_FAIL

#define ASSERT_FAIL   0

Fails the assert.

Definition at line 48 of file SDL_test_assert.h.

◆ ASSERT_PASS

#define ASSERT_PASS   1

Passes the assert.

Definition at line 53 of file SDL_test_assert.h.

Function Documentation

◆ SDLTest_Assert()

void SDLTest_Assert ( int  assertCondition,
SDL_PRINTF_FORMAT_STRING const char *  assertDescription,
  ... 
)

Assert that logs and break execution flow on failures.

Parameters
assertConditionEvaluated condition or variable to assert; fail (==0) or pass (!=0).
assertDescriptionMessage to log with the assert describing it.

◆ SDLTest_AssertCheck()

int SDLTest_AssertCheck ( int  assertCondition,
SDL_PRINTF_FORMAT_STRING const char *  assertDescription,
  ... 
)

Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters.

Parameters
assertConditionEvaluated condition or variable to assert; fail (==0) or pass (!=0).
assertDescriptionMessage to log with the assert describing it.
Returns
the assertCondition so it can be used to externally to break execution flow if desired.

◆ SDLTest_AssertPass()

void SDLTest_AssertPass ( SDL_PRINTF_FORMAT_STRING const char *  assertDescription,
  ... 
)

Explicitly pass without checking an assertion condition. Updates assertion counter.

Parameters
assertDescriptionMessage to log with the assert describing it.

◆ SDLTest_AssertSummaryToTestResult()

int SDLTest_AssertSummaryToTestResult ( void  )

Converts the current assert summary state to a test result.

Returns
TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT

◆ SDLTest_LogAssertSummary()

void SDLTest_LogAssertSummary ( void  )

Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.

◆ SDLTest_ResetAssertSummary()

void SDLTest_ResetAssertSummary ( void  )

Resets the assert summary counters to zero.