|
QP/C++
|
Customizable QP assertions. More...
Go to the source code of this file.
Defines | |
| #define | Q_DEFINE_THIS_FILE static char_t const Q_ROM Q_ROM_VAR l_this_file[] = __FILE__; |
| #define | Q_DEFINE_THIS_MODULE(name_) static char_t const Q_ROM Q_ROM_VAR l_this_file[] = name_; |
| #define | Q_ASSERT(test_) ((test_) ? (void)0 : Q_onAssert(&l_this_file[0], (int_t)__LINE__)) |
| #define | Q_ASSERT_ID(id_, test_) ((test_) ? (void)0 : Q_onAssert(&l_this_file[0], (int_t)(id_)) |
| #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[0], (int_t)__LINE__) |
| #define | Q_ERROR_ID(id_) Q_onAssert(l_this_file, (int_t)(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 int_t Q_assert_compile[(test_) ? 1 : -1] |
Typedefs | |
| typedef int | int_t |
| Type for line numbers. | |
Functions | |
| void | Q_onAssert (char_t const Q_ROM *const Q_ROM_VAR file, int_t 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.
General purpose assertion that ALWAYS evaluates the test_ argument and calls the Q_onAssert() callback if the test_ evaluates to FALSE.
Definition at line 114 of file qassert.h.
Referenced by 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 testing, because it avoids the volatility of line numbers for identifying assertions.
| #define Q_ASSERT | ( | test_ | ) | ((test_) ? (void)0 : Q_onAssert(&l_this_file[0], (int_t)__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 89 of file qassert.h.
Referenced by QHsm::dispatch(), QF::gc(), QMPool::get(), QMPool::init(), QHsm::init(), QF::new_(), QEQueue::postFIFO(), QActive::postFIFO(), QEQueue::postLIFO(), QActive::postLIFO(), QF::publish(), QActive::recall(), and QF::tick().
| #define Q_ASSERT_COMPILE | ( | test_ | ) | extern int_t Q_assert_compile[(test_) ? 1 : -1] |
| #define Q_ASSERT_ID | ( | id_, | |
| test_ | |||
| ) | ((test_) ? (void)0 : Q_onAssert(&l_this_file[0], (int_t)(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 identifying assertions.
| #define Q_DEFINE_THIS_FILE static char_t const Q_ROM Q_ROM_VAR l_this_file[] = __FILE__; |
| #define Q_DEFINE_THIS_MODULE | ( | name_ | ) | static char_t const Q_ROM Q_ROM_VAR l_this_file[] = name_; |
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[0], (int_t)__LINE__) |
Assertion that always calls the Q_onAssert() callback if ever executed.
| #define Q_ERROR_ID | ( | id_ | ) | Q_onAssert(l_this_file, (int_t)(id_)) |
Assertion that always calls the Q_onAssert() callback if ever executed. This assertion style is better suited for unit testing, because it avoids the volatility of line numbers for identifying 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.
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 178 of file qassert.h.
Referenced by QFsm::dispatch(), QHsm::dispatch(), QF::getPoolMargin(), QF::getQueueMargin(), QMPool::init(), QFsm::init(), QHsm::init(), QHsm::isIn(), 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.
| typedef int int_t |
| void Q_onAssert | ( | char_t const Q_ROM *const Q_ROM_VAR | file, |
| int_t | 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.6.1