Test

Overview

// macros

#define CLEANUP_TEST_FAIL(fmt...)
#define TEST_BEHAVIOUR_DEF
#define TEST_END
#define TEST_END_SPECIFIC
#define TEST_FAIL(fmt...)
#define TEST_ON_JMP_DO
#define TEST_ON_JMP_DO_IF_FAILURE
#define TEST_ON_JMP_DO_IF_SUCCESS
#define TEST_ON_JMP_DO_SPECIFIC
#define TEST_SKIP(...)
#define TEST_START
#define TEST_START_SPECIFIC
#define TEST_START_VARS
#define TEST_STOP
#define TEST_SUCCESS

Detailed Documentation

Macros

#define CLEANUP_TEST_FAIL(fmt...)

Set test termination status to failure, report an error. Should be used instead of TEST_FAIL in the cleanup section.

Parameters:

fmt

error message format string with parameters

#define TEST_BEHAVIOUR_DEF

Macro to add behaviour switches in code that does not call TEST_START. It should not exist yet it does

#define TEST_END

The last action of the test main() function.

To define test-specific action define TEST_END_SPECIFIC macro

#define TEST_END_SPECIFIC

Define empty test end procedure if test does not care about it.

#define TEST_FAIL(fmt...)

Terminate a test with failure status, report an error.

Parameters:

fmt

error message format string with parameters

#define TEST_ON_JMP_DO

Template action to be done on jump in the test.

#define TEST_ON_JMP_DO_SPECIFIC

Template action to be done on jump in TEST_START_SPECIFIC.

#define TEST_SKIP(...)

Terminate a test with skip status, optionally reporting the reason as a verdict.

#define TEST_START

The first action of any test main() function.

Variable rc and result are defined.

main() must get argc and argv parameters.

To define a set of variables accessed in each test, you should define TEST_START_VARS macro as the list of additional variables To define test-specific action define TEST_START_SPECIFIC macro

#define TEST_START_SPECIFIC

Define empty test start procedure if test does not care about it.

#define TEST_START_VARS

Define empty list of test-specific variables if test does not care about them.

#define TEST_STOP

Terminate a test with failure status. It is assumed that error is already reported.

#define TEST_SUCCESS

Terminate a test with success status.