#include "filenames.h"
#include "misc.h"
#include "terminal_colors.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
Go to the source code of this file.
◆ COLOR_FAIL
◆ COLOR_NOTE
◆ COLOR_SUCC
◆ COLOR_TEST_TAG
◆ CRITICAL_TEST
#define CRITICAL_TEST |
( |
| CONDITION | ) |
|
Value: do \
{ \
if ( !UNIT_TEST_( #CONDITION, CONDITION, __FILE_NAME__, __LINE__, true ) ) \
{ \
} \
} \
while ( 0 )
#define TEST_NAME_CREATOR(TOK)
To avoid namespace collisions.
Definition unit_tests.h:52
#define END_TEST
Definition unit_tests.h:97
If condition evaluates to true, "SUCCESS" is printed in the color defined in COLOR_SUCC (green by default).
If condition evaluates to false, "FAILURE" is printed in the color defined in COLOR_FAIL (red by default), and the TEST() case returns.
◆ END_TEST
Value:
}
#define COLOR_DEFAULT
Definition terminal_colors.h:33
#define PRINT_COLOR
Definition terminal_colors.h:18
#define COLOR_TEST_TAG
Definition unit_tests.h:47
#define COLOR_SUCC
Definition unit_tests.h:39
#define COLOR_FAIL
Definition unit_tests.h:35
Ends a TEST() block.
Prints a summary of the test case and returns if it failed.
◆ RUN_TEST
#define RUN_TEST |
( |
| HANDLE | ) |
|
Value:Runs a test block and increments the proper static variables.
- Parameters
-
◆ TEST
Value:Begin a test block.
Counts the number of tests ran/failed. Must be terminated by END_TEST.
If UNIT_TESTS_SILENT is not defined, this macro prints the test name as the start of the test case.
- Parameters
-
HANDLE | handle of the test case – must be unique |
◆ TEST_NAME_CREATOR
#define TEST_NAME_CREATOR |
( |
| TOK | ) |
|
Value:
To avoid namespace collisions.
◆ UNIT_TEST
#define UNIT_TEST |
( |
| CONDITION | ) |
|
Value: do \
{ \
if ( !UNIT_TEST_( #CONDITION, CONDITION, __FILE_NAME__, __LINE__, false ) ) \
} \
while ( 0 )
If condition evaluates to true, "SUCCESS" is printed in the color defined in COLOR_SUCC (green by default).
If condition evaluates to false, "FAILURE" is printed in the color defined in COLOR_FAIL (red by default)
◆ FINISH_TESTING()
Prints a summary of all TEST() and UNIT_TEST() cases and exits.
Exit value is EXIT_SUCCESS if no unit test failed, else EXIT_FAILURE.
◆ GET_UNIT_TEST_VERBOSITY()
- Returns
- value of the static verbosity variable
◆ SET_UNIT_TEST_VERBOSITY()
If set to false, UNIT_TESTs do not show successes.
This option is independent of the macro UNIT_TESTS_SILENT, which silences all messages.
- Parameters
-