|
QP/C++
|
Customizable QP assertions. More...
Go to the source code of this file.
Defines | |
| #define | Q_DEFINE_THIS_FILE static char const Q_ROM Q_ROM_VAR l_this_file[] = __FILE__; |
| #define | Q_DEFINE_THIS_MODULE(name_) static char const Q_ROM Q_ROM_VAR l_this_file[] = #name_; |
| #define | Q_ASSERT(test_) |
| #define | Q_ASSERT_ID(id_, test_) |
| #define | Q_ALLEGE(test_) Q_ASSERT(test_) |
| #define | Q_ALLEGE_ID(id_, test_) Q_ASSERT_ID(id_, test_) |
| #define | Q_ERROR() (Q_onAssert(l_this_file, __LINE__)) |
| #define | Q_ERROR_ID(id_) (Q_onAssert(l_this_file, (id_))) |
| #define | Q_REQUIRE(test_) Q_ASSERT(test_) |
| #define | Q_REQUIRE_ID(id_, test_) Q_ASSERT_ID(id_, test_) |
| #define | Q_ENSURE(test_) Q_ASSERT(test_) |
| #define | Q_ENSURE_ID(id_, test_) Q_ASSERT_ID(id_, test_) |
| #define | Q_INVARIANT(test_) Q_ASSERT(test_) |
| #define | Q_INVARIANT_ID(id_, test_) Q_ASSERT_ID(id_, test_) |
| #define | Q_ASSERT_COMPILE(test_) extern char Q_assert_compile[(test_) ? 1 : -1] |
Functions | |
| void | Q_onAssert (char const Q_ROM *const Q_ROM_VAR file, int line) |
Customizable QP assertions.
Defines customizable and memory-efficient assertions applicable to embedded systems. This header file can be used in C, C++, and mixed C/C++ programs.
Definition in file qassert.h.
| #define Q_ALLEGE | ( | test_ | ) | Q_ASSERT(test_) |
General purpose assertion that ALWAYS evaluates the test_ argument and calls the Q_onAssert() callback if the test_ evaluates to FALSE.
Definition at line 130 of file qassert.h.
Referenced by QEP::getVersion(), QFsm::init(), and QHsm::init().
| #define Q_ALLEGE_ID | ( | id_, | |
| test_ | |||
| ) | Q_ASSERT_ID(id_, test_) |
General purpose assertion that ALWAYS evaluates the test_ argument and calls the Q_onAssert() callback if the test_ evaluates to FALSE. This assertion style is better suited for unit testig, because it avoids the volatility of line numbers for indentifying assertions.
| #define Q_ASSERT | ( | test_ | ) |
if (test_) { \ } \ else (Q_onAssert(&l_this_file[0], __LINE__))
General purpose assertion that makes sure the test_ argument is TRUE. Calls the Q_onAssert() callback if the test_ evaluates to FALSE.
Definition at line 101 of file qassert.h.
Referenced by QHsm::dispatch(), QF::gc(), QEP::getVersion(), QMPool::init(), QHsm::init(), QF::new_(), QEQueue::postFIFO(), QActive::postFIFO(), QEQueue::postLIFO(), QActive::postLIFO(), QF::publish(), and QActive::recall().
| #define Q_ASSERT_COMPILE | ( | test_ | ) | extern char Q_assert_compile[(test_) ? 1 : -1] |
| #define Q_ASSERT_ID | ( | id_, | |
| test_ | |||
| ) |
if (test_) { \ } \ else (Q_onAssert(&l_this_file[0], (id_)))
General purpose assertion that makes sure the test_ argument is TRUE. Calls the Q_onAssert() callback if the test_ evaluates to FALSE. The argument id_ is the ID number (unique within the file) of the assertion. This assertion style is better suited for unit testig, because it avoids the volatility of line numbers for indentifying assertions.
| #define Q_DEFINE_THIS_FILE static char const Q_ROM Q_ROM_VAR l_this_file[] = __FILE__; |
| #define Q_DEFINE_THIS_MODULE | ( | name_ | ) | static char const Q_ROM Q_ROM_VAR l_this_file[] = #name_; |
Place this macro at the top of each C/C++ module to define the module name as the argument name_. This file name will be used in reporting assertions in this file.
Definition at line 91 of file qassert.h.
Referenced by QEP::getVersion(), and QK::getVersion().
| #define Q_ENSURE | ( | test_ | ) | Q_ASSERT(test_) |
Assertion that checks for a postcondition. This macro is equivalent to Q_ASSERT, except the name provides a better documentation of the intention of this assertion.
| #define Q_ENSURE_ID | ( | id_, | |
| test_ | |||
| ) | Q_ASSERT_ID(id_, test_) |
Assertion that checks for a postcondition. This macro is equivalent to Q_ASSERT_ID, except the name provides a better documentation of the intention of this assertion.
| #define Q_ERROR | ( | ) | (Q_onAssert(l_this_file, __LINE__)) |
Assertion that always calls the Q_onAssert() callback if ever executed.
| #define Q_ERROR_ID | ( | id_ | ) | (Q_onAssert(l_this_file, (id_))) |
Assertion that always calls the Q_onAssert() callback if ever executed. This assertion style is better suited for unit testig, because it avoids the volatility of line numbers for indentifying assertions.
| #define Q_INVARIANT | ( | test_ | ) | Q_ASSERT(test_) |
Assertion that checks for an invariant. This macro is equivalent to Q_ASSERT, except the name provides a better documentation of the intention of this assertion.
| #define Q_INVARIANT_ID | ( | id_, | |
| test_ | |||
| ) | Q_ASSERT_ID(id_, test_) |
Assertion that checks for an invariant. This macro is equivalent to Q_ASSERT_ID, except the name provides a better documentation of the intention of this assertion.
| #define Q_REQUIRE | ( | test_ | ) | Q_ASSERT(test_) |
Assertion that checks for a precondition. This macro is equivalent to Q_ASSERT, except the name provides a better documentation of the intention of this assertion.
Definition at line 171 of file qassert.h.
Referenced by QF::getPoolMargin(), QF::getQueueMargin(), QK::getVersion(), QMPool::init(), QF::poolInit(), QF::publish(), QMPool::put(), QTimeEvt::QTimeEvt(), QTimeEvt::rearm(), QF::remove_(), QActive::start(), QActive::subscribe(), QActive::unsubscribe(), and QActive::unsubscribeAll().
| #define Q_REQUIRE_ID | ( | id_, | |
| test_ | |||
| ) | Q_ASSERT_ID(id_, test_) |
Assertion that checks for a precondition. This macro is equivalent to Q_ASSERT_ID, except the name provides a better documentation of the intention of this assertion.
| void Q_onAssert | ( | char const Q_ROM *const Q_ROM_VAR | file, |
| int | line | ||
| ) |
callback invoked in case the condition passed to Q_ASSERT, Q_REQUIRE, Q_ENSURE, Q_ERROR, Q_ALLEGE as well as Q_ASSERT_ID, Q_REQUIRE_ID, Q_ENSURE_ID, Q_ERROR_ID, and Q_ALLEGE_ID evaluates to FALSE.
| file | file name where the assertion failed |
| line | line number at which the assertion failed |
1.7.5.1