micro-test-plus 3.2.0
µTest++, a lightweight testing framework for embedded platforms
Loading...
Searching...
No Matches
micro_os_plus::micro_test_plus::test_suite Class Reference

Test suites are classes that represent a named group of test cases which self register to the runner. More...

#include <micro-os-plus/micro-test-plus.h>

+ Inheritance diagram for micro_os_plus::micro_test_plus::test_suite:

Public Member Functions

template<typename Callable_T , typename... Args_T>
 test_suite (const char *name, Callable_T &&callable, Args_T &&... arguments)
 Construct a test suite.
 
 test_suite (const test_suite &)=delete
 
 test_suite (test_suite &&)=delete
 
virtual ~test_suite () override
 
void begin_test_case (const char *name)
 Mark the beginning of a named test case.
 
void begin_test_suite (void)
 Begin the execution of the test suite.
 
void end_test_case (void)
 Mark the end of a test case.
 
void end_test_suite (void)
 Mark the end of the test suite.
 
constexpr int failed_checks (void)
 Get the number of conditions that failed.
 
void increment_failed (void)
 Count one more failed test conditions.
 
void increment_successful (void)
 Count one more passed test conditions.
 
constexpr const char * name ()
 Get the suite name.
 
test_suiteoperator= (const test_suite &)=delete
 
test_suiteoperator= (test_suite &&)=delete
 
virtual void run (void) override
 Run the sequence of test cases in the suite.
 
constexpr int successful_checks (void)
 Get the number of conditions that passed.
 
constexpr int test_cases (void)
 Get the number of test cases.
 
constexpr bool unused (void)
 If all counter are null, it is unused.
 
constexpr bool was_successful (void)
 Get the test suite result.
 

Public Attributes

struct { 
 
   int   failed_checks 
 
   int   successful_checks 
 
current_test_case 
 
bool process_deferred_begin = true
 

Protected Attributes

std::function< void(void)> callable_
 
int failed_checks_ = 0
 Count of test conditions that failed.
 
const char * name_
 The test suite name.
 
int successful_checks_ = 0
 Count of test conditions that passed.
 
const char * test_case_name_
 The current test case name.
 
int test_cases_ = 0
 Count of test cases in the test suite.
 

Detailed Description

Test suites are classes that represent a named group of test cases which self register to the runner.

Definition at line 255 of file test-suite.h.

Constructor & Destructor Documentation

◆ test_suite() [1/3]

template<typename Callable_T , typename... Args_T>
micro_os_plus::micro_test_plus::test_suite::test_suite ( const char * name,
Callable_T && callable,
Args_T &&... arguments )

Construct a test suite.

Template Parameters
Callable_TThe type of an object that can be called.
Args_TThe type of the callable arguments.
Parameters
[in]nameThe test case name or description. A short string used in the report.
[in]callableA generic callable object, invoked to perform the test. Usually a lambda.
[in]argumentsA possibly empty list of arguments to be passed to the callable.

Definition at line 41 of file inlines.h.

◆ test_suite() [2/3]

micro_os_plus::micro_test_plus::test_suite::test_suite ( const test_suite & )
delete

◆ test_suite() [3/3]

micro_os_plus::micro_test_plus::test_suite::test_suite ( test_suite && )
delete

◆ ~test_suite()

micro_os_plus::micro_test_plus::test_suite::~test_suite ( )
overridevirtual

Definition at line 123 of file test-suite.cpp.

Member Function Documentation

◆ begin_test_case()

void micro_os_plus::micro_test_plus::test_suite_base::begin_test_case ( const char * name)
inherited

Mark the beginning of a named test case.

Parameters
[in]nameThe test case name.
Returns
Nothing.

Definition at line 79 of file test-suite.cpp.

◆ begin_test_suite()

void micro_os_plus::micro_test_plus::test_suite_base::begin_test_suite ( void )
inherited

Begin the execution of the test suite.

Parameters
None.
Returns
Nothing.

Definition at line 61 of file test-suite.cpp.

◆ end_test_case()

void micro_os_plus::micro_test_plus::test_suite_base::end_test_case ( void )
inherited

Mark the end of a test case.

Parameters
None.
Returns
Nothing.

Definition at line 95 of file test-suite.cpp.

◆ end_test_suite()

void micro_os_plus::micro_test_plus::test_suite_base::end_test_suite ( void )
inherited

Mark the end of the test suite.

Parameters
None.
Returns
Nothing.

Definition at line 69 of file test-suite.cpp.

◆ failed_checks()

constexpr int micro_os_plus::micro_test_plus::test_suite_base::failed_checks ( void )
inlineconstexprinherited

Get the number of conditions that failed.

Parameters
None.
Returns
An integer with the number checks that failed.

Definition at line 151 of file test-suite.h.

◆ increment_failed()

void micro_os_plus::micro_test_plus::test_suite_base::increment_failed ( void )
inherited

Count one more failed test conditions.

Parameters
None.
Returns
Nothing.

Definition at line 108 of file test-suite.cpp.

◆ increment_successful()

void micro_os_plus::micro_test_plus::test_suite_base::increment_successful ( void )
inherited

Count one more passed test conditions.

Parameters
None.
Returns
Nothing.

Definition at line 101 of file test-suite.cpp.

◆ name()

constexpr const char * micro_os_plus::micro_test_plus::test_suite_base::name ( )
inlineconstexprinherited

Get the suite name.

Parameters
None.
Returns
A pointer to the null terminated test suite name.

Definition at line 107 of file test-suite.h.

◆ operator=() [1/2]

test_suite & micro_os_plus::micro_test_plus::test_suite::operator= ( const test_suite & )
delete

◆ operator=() [2/2]

test_suite & micro_os_plus::micro_test_plus::test_suite::operator= ( test_suite && )
delete

◆ run()

void micro_os_plus::micro_test_plus::test_suite::run ( void )
overridevirtual

Run the sequence of test cases in the suite.

Parameters
None.
Returns
Nothing.

Reimplemented from micro_os_plus::micro_test_plus::test_suite_base.

Definition at line 117 of file test-suite.cpp.

◆ successful_checks()

constexpr int micro_os_plus::micro_test_plus::test_suite_base::successful_checks ( void )
inlineconstexprinherited

Get the number of conditions that passed.

Parameters
None.
Returns
An integer with the number checks that passed.

Definition at line 139 of file test-suite.h.

◆ test_cases()

constexpr int micro_os_plus::micro_test_plus::test_suite_base::test_cases ( void )
inlineconstexprinherited

Get the number of test cases.

Parameters
None.
Returns
An integer with the number of test cases.

Definition at line 163 of file test-suite.h.

◆ unused()

constexpr bool micro_os_plus::micro_test_plus::test_suite_base::unused ( void )
inlineconstexprinherited

If all counter are null, it is unused.

Parameters
None.
Returns
True if the test suite is not used.

Definition at line 208 of file test-suite.h.

◆ was_successful()

constexpr bool micro_os_plus::micro_test_plus::test_suite_base::was_successful ( void )
inlineconstexprinherited

Get the test suite result.

Parameters
None.
Returns
True if the test suite was successful.

Definition at line 195 of file test-suite.h.

Member Data Documentation

◆ callable_

std::function<void (void)> micro_os_plus::micro_test_plus::test_suite::callable_
protected

Definition at line 289 of file test-suite.h.

◆ [struct]

struct { ... } micro_os_plus::micro_test_plus::test_suite_base::current_test_case

◆ failed_checks

int micro_os_plus::micro_test_plus::test_suite_base::failed_checks
inherited

Definition at line 245 of file test-suite.h.

◆ failed_checks_

int micro_os_plus::micro_test_plus::test_suite_base::failed_checks_ = 0
protectedinherited

Count of test conditions that failed.

Definition at line 233 of file test-suite.h.

◆ name_

const char* micro_os_plus::micro_test_plus::test_suite_base::name_
protectedinherited

The test suite name.

Definition at line 218 of file test-suite.h.

◆ process_deferred_begin

bool micro_os_plus::micro_test_plus::test_suite_base::process_deferred_begin = true
inherited

Definition at line 241 of file test-suite.h.

◆ successful_checks

int micro_os_plus::micro_test_plus::test_suite_base::successful_checks
inherited

Definition at line 244 of file test-suite.h.

◆ successful_checks_

int micro_os_plus::micro_test_plus::test_suite_base::successful_checks_ = 0
protectedinherited

Count of test conditions that passed.

Definition at line 228 of file test-suite.h.

◆ test_case_name_

const char* micro_os_plus::micro_test_plus::test_suite_base::test_case_name_
protectedinherited

The current test case name.

Definition at line 223 of file test-suite.h.

◆ test_cases_

int micro_os_plus::micro_test_plus::test_suite_base::test_cases_ = 0
protectedinherited

Count of test cases in the test suite.

Definition at line 238 of file test-suite.h.


The documentation for this class was generated from the following files: