|
kassert
0.2.0
Assertion library for KaMPIng
|
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 target property KASSERT_EXCEPTION_MODE to be set to ON on the target linking against kassert. 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.
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). Set the CMake target property KASSERT_ASSERTION_LEVEL on you target linking against kassert to the numeric value of the desired assertion level. If omitted, the assertion level is set to 0, which disables all assertions.
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.