QP/C++  7.0.1
Real-Time Embedded Framework
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"

Go to the source code of this file.

Namespaces

namespace  QP
 namespace associated with the QP/C++ framework
 

Functions

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

Detailed Description

Date
Last updated on: 2022-05-15
Version
Last updated for: Version 7.0.1, 2022-05-14

Definition in file qutest.cpp.

Function Documentation

◆ Q_onAssert()

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

Callback function invoked in case of any assertion failure.

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 456 of file qutest.cpp.