QP/C++ 6.9.3
qutest.cpp File Reference

QF/C++ stub for QUTEST unit testing. More...

#include "qf_port.hpp"
#include "qf_pkg.hpp"
#include "qassert.h"
#include "qs_port.hpp"
#include "qs_pkg.hpp"
Include dependency graph for qutest.cpp:

Go to the source code of this file.

Namespaces

 QP
 namespace associated with the QP/C++ framework
 

Functions

Q_NORETURN Q_onAssert (char_t const *const module, int_t const location)
 Callback function invoked in case of any assertion failure. More...
 

Detailed Description

QF/C++ stub for QUTEST unit testing.

Definition in file qutest.cpp.

Function Documentation

◆ Q_onAssert()

Q_NORETURN Q_onAssert ( char_t const *const  module,
int_t const  location 
)

Callback function invoked in case of any assertion failure.

Description
This is an application-specific callback function needs to be defined in the application to perform the clean system shutdown and perhaps a reset.
Parameters
[in]modulename of the file/module in which the assertion failed (constant, zero-terminated C string)
[in]locationlocation of the assertion within the module. This could be a line number or a user-specified ID-number.
Note
This callback function should not return, as continuation after an assertion failure does not make sense.
The Q_onAssert() function is the last line of defense after the system failure and its implementation shouild be very carefully designed and tested under various fault conditions, including but not limited to: stack overflow, stack corruption, or calling Q_onAssert() from an interrupt.
It is typically a bad idea to implement Q_onAssert() as an endless loop that ties up the CPU. During debuggin, Q_onAssert() is an ideal place to put a breakpoint.

Called by the following macros: 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.

Definition at line 412 of file qutest.cpp.