|
C++ Library, mos@ua
0.9
cpplib-mos
|
Design-by-Contract module. More...
Files | |
| file | dbc.h |
| Design-by-Contract module. | |
Macros | |
| #define | check(condition, message) |
| Checks the verification of an general algorithm assertion. More... | |
| #define | require(condition, message) |
| Checks the verification of a precondition. More... | |
| #define | ensure(condition, message) |
| Checks the verification of a postcondition. More... | |
| #define | invariant(condition, message) |
| Checks the verification of an invariant. More... | |
Design-by-Contract module.
This module gives a better support for DbC in C++.
When compared with assert.h this module offers the following functionalities:
stderr (with the identification and the precise location of the assertion), generates a segmentation fault (enabling a stack trace within a debugger like gdb), and exits program execution;char* exception with the description of the failed assertion.Debug settings:
assert.h, this module accepts NDEBUG macro definition to disable all assertion run-time verification.NDEBUG_CHECKS, NDEBUG_PRECONDITIONS, NDEBUG_POSTCONDITIONS, and NDEBUG_INVARIANTS.DEBUG_ONLY_PRECONDITIONS ensures that only precondition debugging remains active (regardless of other debug definitions).| #define check | ( | condition, | |
| message | |||
| ) |
Checks the verification of an general algorithm assertion.
This assertion verification can be disabled at compile time by defining the macro NDEBUG_CHECKS.
| [in] | condition | expression to assert its truthness |
| [in] | message | text to be presented with error information when the assertion fails |
| #define require | ( | condition, | |
| message | |||
| ) |
Checks the verification of a precondition.
This assertion verification can be disabled at compile time by defining the macro NDEBUG_PRECONDITIONS.
| [in] | condition | expression to assert its truthness |
| [in] | message | text to be presented with error information when the assertion fails |
| #define ensure | ( | condition, | |
| message | |||
| ) |
Checks the verification of a postcondition.
This assertion verification can be disabled at compile time by defining the macro NDEBUG_POSTCONDITIONS.
| [in] | condition | expression to assert its truthness |
| [in] | message | text to be presented with error information when the assertion fails |
| #define invariant | ( | condition, | |
| message | |||
| ) |
Checks the verification of an invariant.
This assertion verification can be disabled at compile time by defining the macro NDEBUG_INVARIANTS.
| [in] | condition | expression to assert its truthness |
| [in] | message | text to be presented with error information when the assertion fails |