KASSERT
0.0.1
Karlsruhe Assertion Library
|
The KASSERT macros accepts 1, 2 or 3 arguments.
You can also use C++ streams to build custom error messages on the fly.
Use THROWING_KASSERT to throw an exception if the assertion fails. This requires the library to be build in exception mode (-DKASSERT_EXCEPTION_MODE=On
). If exception mode is not enabled, THROWING_KASSERT acts the same as KASSERT.
You can also throw a custom exception type using the THROWING_KASSERT_SPECIFIED macro:
The constructor of your custom exception type must be called with a std::string
as its first argument, followed by the remaining arguments [, ...]
passed to THROWING_KASSERT_SPECIFIED.
To control which assertions are enabled or disabled, you must supply the CMake option -DKASSERT_ASSERTION_LEVEL=<numeric>
. If omitted, the assertion level is set to 0
, which disables all assertions.
Assertions are enabled if their assertion level (optional third parameter of KASSERT ) is less than or equal to the active assertion level. The default level is kassert::assert::normal
(30), see Assertion levels.
You are free to define your own assertion levels. For instance:
Doxygen 1.9.2
or newerKAssert is released under the MIT License. See LICENSE for details.