![]() |
SuperTinyKernel™ RTOS 1.05.3
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Common context for a test suite. More...
#include <stktest_context.h>
Public Types | |
| enum | EConsts { SUCCESS_EXIT_CODE = 0 , DEFAULT_FAILURE_EXIT_CODE = 1 } |
Public Member Functions | |
| TestContext () | |
| void | ExpectAssert (bool expect) |
| Start expecting assertion for the test case. | |
| bool | IsExpectingAssert () const |
| Check if test case is expecting assertion. | |
| void | ExpectPanic (bool expect) |
| Start expecting kernel panic for the test case. | |
| bool | IsExpectingPanic () const |
| Check if test case is expecting kernel panic. | |
| void | RethrowAssertException (bool rethrow) |
| Re-throw assert's exception for the test case. | |
| bool | IsRethrowingAssertException () const |
| Check if exception must be thrown if assertion is hit. | |
Static Public Member Functions | |
| static void | ShowTestSuitePrologue () |
| Show text string as prologue before tests start. | |
| static void | ShowTestSuiteEpilogue (int32_t result) |
| Show text string as epilogue after tests end. | |
| static void | ForceExitTestSuite (int32_t result) |
| Exit test suite process forcibly. | |
Private Attributes | |
| bool | m_expect_assert |
| assert expectation flag | |
| bool | m_expect_panic |
| panic expectation flag | |
| bool | m_rethrow_assert |
| rethrow assert's exception | |
Static Private Attributes | |
| static TestContext | m_instance |
| global instance of the TestContext | |
Common context for a test suite.
Definition at line 24 of file stktest_context.h.
| Enumerator | |
|---|---|
| SUCCESS_EXIT_CODE | exit code for exit() to denote the success of the test |
| DEFAULT_FAILURE_EXIT_CODE | default exit code for exit() to denote failure of the test |
Definition at line 27 of file stktest_context.h.
|
inlineexplicit |
Definition at line 33 of file stktest_context.h.
References m_expect_assert, m_expect_panic, and m_rethrow_assert.
|
inline |
Start expecting assertion for the test case.
| [in] | expect | True to expect otherwise False. |
Definition at line 39 of file stktest_context.h.
References m_expect_assert.
|
inline |
Start expecting kernel panic for the test case.
| [in] | expect | True to expect otherwise False. |
Definition at line 48 of file stktest_context.h.
References m_expect_panic.
|
inlinestatic |
Exit test suite process forcibly.
| [in] | result | 0 if no tests are failed otherwise number of failed tests. |
Definition at line 86 of file stktest_context.h.
References ShowTestSuiteEpilogue().
Referenced by stk::test::switch_::TestTask< _AccessMode >::Run().
|
inline |
Check if test case is expecting assertion.
Definition at line 43 of file stktest_context.h.
References m_expect_assert.
|
inline |
Check if test case is expecting kernel panic.
Definition at line 52 of file stktest_context.h.
References m_expect_panic.
|
inline |
Check if exception must be thrown if assertion is hit.
Definition at line 61 of file stktest_context.h.
References m_rethrow_assert.
|
inline |
Re-throw assert's exception for the test case.
| [in] | expect | True to rethrow otherwise False. |
Definition at line 57 of file stktest_context.h.
References m_rethrow_assert.
|
inlinestatic |
Show text string as epilogue after tests end.
| [in] | result | 0 if no tests are failed otherwise number of failed tests. |
Definition at line 78 of file stktest_context.h.
Referenced by ForceExitTestSuite(), and main().
|
inlinestatic |
Show text string as prologue before tests start.
Definition at line 65 of file stktest_context.h.
Referenced by main().
|
private |
assert expectation flag
Definition at line 94 of file stktest_context.h.
Referenced by ExpectAssert(), IsExpectingAssert(), and TestContext().
|
private |
panic expectation flag
Definition at line 95 of file stktest_context.h.
Referenced by ExpectPanic(), IsExpectingPanic(), and TestContext().
|
staticprivate |
global instance of the TestContext
Definition at line 93 of file stktest_context.h.
|
private |
rethrow assert's exception
Definition at line 96 of file stktest_context.h.
Referenced by IsRethrowingAssertException(), RethrowAssertException(), and TestContext().