cbmimage
Loading...
Searching...
No Matches
Test helper definitions, not part of the library

Macros

#define TEST_ASSERT(_x)
 

Functions

void TEST_i_ASSERT_FAIL (const char *expression, const char *file, int line)
 
void dump (const void *buffer_void, unsigned int size)
 

Detailed Description

Macro Definition Documentation

◆ TEST_ASSERT

#define TEST_ASSERT ( _x)
Value:
if (_x) {} else TEST_i_ASSERT_FAIL( #_x, __FILE__, __LINE__ )
void TEST_i_ASSERT_FAIL(const char *expression, const char *file, int line)
Definition testhelper.c:40

check assertion

Parameters
[in]_xCondition that is to be tested.
Remarks
  • If the condition is not true, a specific message is generated and the execution aborts (in TEST_i_ASSERT_FAIL().
  • This macro is a replacement for the C assert() macro. The advantage w.r.t. assert() is that the output is defined by us, and so, we can test for the output in the test framework.

Function Documentation

◆ dump()

void dump ( const void * buffer_void,
unsigned int size )

dump a buffer to stdout

Parameters
[in]buffer_voidPointer to the buffer that wants to be dumped
[in]sizeThe number of bytes that are being dumped from the buffer.

◆ TEST_i_ASSERT_FAIL()

void TEST_i_ASSERT_FAIL ( const char * expression,
const char * file,
int line )

output and exit after an assertion failed

Parameters
[in]expression(string) the condition that was tested and did not hold
[in]fileThe name of the file the had the test in it
[in]lineThe line number in the file where the test was placed
Remarks
  • This function does not return
  • Be careful when changing the output: The last line is tested by the test framework. Do not change it if you do not want to change the test framework itself.