UEFIStarter
a simple UEFI framework
Macros | Functions | Variables
tests.h File Reference

Basis for test suites. More...

#include <Uefi.h>
#include "types.h"
#include "asserts.h"
#include "output.h"
#include <UEFIStarter/core/console.h>

Go to the source code of this file.

Macros

#define INIT_TESTGROUP(NAME)
 Helper macro to start a testgroup. More...
 
#define FINISH_TESTGROUP()   return TRUE;
 Helper macro to end a testgroup.
 
#define RUN_TEST(FUNC, DESC)   run_test(FUNC,DESC);
 Helper macro to run a test. More...
 
#define mark_test_incomplete()   individual_test_results.incomplete_count++;
 Helper macro to mark a test as incomplete.
 

Functions

void run_tests ()
 Runs a test group. More...
 
void run_test (void(*func)(), CHAR16 *description)
 Runs an individual test. More...
 
void run_group (BOOLEAN(*func)())
 Runs a test group. More...
 
BOOLEAN is_skipped_test (CHAR16 *name)
 Tests whether a given test should be skipped. More...
 

Variables

test_results_t individual_test_results
 results for the current test
 
test_results_t global_test_results
 results for all tests in this suite
 
test_verbosity_t test_verbosity
 the current test verbosity
 

Detailed Description

Basis for test suites.

Author
Richard Nusser
License
GPLv3 (see http://www.gnu.org/licenses/)
See also
https://github.com/rinusser/UEFIStarter

Macro Definition Documentation

◆ INIT_TESTGROUP

#define INIT_TESTGROUP (   NAME)
Value:
if(is_skipped_test(NAME)) \
{ \
global_test_results.skipped_count++; \
return FALSE; \
} \
print_test_group_start(NAME);
BOOLEAN is_skipped_test(CHAR16 *name)
Tests whether a given test should be skipped.
Definition: tests.c:239

Helper macro to start a testgroup.

Parameters
NAMEthe test group's name

◆ RUN_TEST

#define RUN_TEST (   FUNC,
  DESC 
)    run_test(FUNC,DESC);

Helper macro to run a test.

Parameters
FUNCthe test's function to execute
DESCthe test's description

Function Documentation

◆ run_tests()

void run_tests ( )

Runs a test group.

This gets created automatically (in generated/runner.c in the test suite's directory).

◆ run_test()

void run_test ( void(*)()  func,
CHAR16 *  description 
)

Runs an individual test.

This function takes care of required setup/teardown around tests.

Parameters
functhe test function to execute
descriptionthe test's description

◆ run_group()

void run_group ( BOOLEAN(*)()  func)

Runs a test group.

Parameters
functhe test group to run

◆ is_skipped_test()

BOOLEAN is_skipped_test ( CHAR16 *  name)

Tests whether a given test should be skipped.

Parameters
namethe test's name
Returns
whether the test should be skipped