zenilib: zenilib/jni/external/sdl/src/test/SDL_test_assert.c File Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions | Variables
SDL_test_assert.c File Reference
`#include "SDL_config.h"`
`#include "SDL_test.h"`

Go to the source code of this file.

## Functions

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

## Variables

const char * | SDLTest_AssertCheckFormat = "Assert '%s': %s"
static Uint32 | SDLTest_AssertsFailed = 0
static Uint32 | SDLTest_AssertsPassed = 0
const char * | SDLTest_AssertSummaryFormat = "Assert Summary: Total=%d Passed=%d Failed=%d"

## Function Documentation

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

Assert that logs and break execution flow on failures.

Parameters

  assertCondition | Evaluated condition or variable to assert; fail (==0) or pass (!=0).
  assertDescription | Message to log with the assert describing it.

Definition at line 47 of file SDL_test_assert.c.

References SDL_assert, SDL_memset(), SDL_vsnprintf(), SDLTest_AssertCheck(), and SDLTEST_MAX_LOGMESSAGE_LENGTH.

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

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

Parameters

  assertCondition | Evaluated condition or variable to assert; fail (==0) or pass (!=0).
  assertDescription | Message to log with the assert describing it.

Returns
  Returns the assertCondition so it can be used to externally to break execution flow if desired.

Definition at line 65 of file SDL_test_assert.c.

References ASSERT_FAIL, SDL_memset(), SDL_vsnprintf(), SDLTest_AssertCheckFormat, SDLTest_AssertsFailed, SDLTest_AssertsPassed, SDLTest_Log(), SDLTest_LogError(), and SDLTEST_MAX_LOGMESSAGE_LENGTH.

Referenced by SDLTest_Assert().

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

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

Parameters

  assertDescription | Message to log with the assert describing it.

Definition at line 94 of file SDL_test_assert.c.

References SDL_memset(), SDL_vsnprintf(), SDLTest_AssertCheckFormat, SDLTest_AssertsPassed, SDLTest_Log(), and SDLTEST_MAX_LOGMESSAGE_LENGTH.

int SDLTest_AssertSummaryToTestResult | ( |  | ) |

Converts the current assert summary state to a test result.

Returns
  TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT

Definition at line 139 of file SDL_test_assert.c.

References SDLTest_AssertsFailed, SDLTest_AssertsPassed, TEST_RESULT_FAILED, TEST_RESULT_NO_ASSERT, and TEST_RESULT_PASSED.

Referenced by SDLTest_RunTest().

void SDLTest_LogAssertSummary | ( |  | ) |

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

Definition at line 123 of file SDL_test_assert.c.

References SDLTest_AssertsFailed, SDLTest_AssertsPassed, SDLTest_AssertSummaryFormat, SDLTest_Log(), and SDLTest_LogError().

Referenced by SDLTest_RunTest().

void SDLTest_ResetAssertSummary | ( |  | ) |

Resets the assert summary counters to zero.

Definition at line 113 of file SDL_test_assert.c.

References SDLTest_AssertsFailed, and SDLTest_AssertsPassed.

Referenced by SDLTest_RunTest().

## Variable Documentation

const char* SDLTest_AssertCheckFormat = "Assert '%s': %s"

Definition at line 33 of file SDL_test_assert.c.

Referenced by SDLTest_AssertCheck(), and SDLTest_AssertPass().

Uint32 SDLTest_AssertsFailed = 0

static

Definition at line 39 of file SDL_test_assert.c.

Referenced by SDLTest_AssertCheck(), SDLTest_AssertSummaryToTestResult(), SDLTest_LogAssertSummary(), and SDLTest_ResetAssertSummary().

Uint32 SDLTest_AssertsPassed = 0

static

Definition at line 42 of file SDL_test_assert.c.

Referenced by SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_AssertSummaryToTestResult(), SDLTest_LogAssertSummary(), and SDLTest_ResetAssertSummary().

const char* SDLTest_AssertSummaryFormat = "Assert Summary: Total=%d Passed=%d Failed=%d"

Definition at line 36 of file SDL_test_assert.c.

Referenced by SDLTest_LogAssertSummary().