claw
1.9.0
|
Some assert macros to strengthen you code. More...
#include <cstdlib>
#include <iostream>
#include <sstream>
Go to the source code of this file.
Namespaces | |
claw | |
This is the main namespace. | |
Macros | |
#define | CLAW_ASSERT(b, s) claw::debug_assert(__FILE__, __FUNCTION__, __LINE__, (b), (s)) |
Print a message on std::cerr and stop the program if a condition is not true. More... | |
#define | CLAW_FAIL(s) claw::debug_assert(__FILE__, __FUNCTION__, __LINE__, false, (s)) |
Print a message on std::cerr and stop the program. More... | |
#define | CLAW_PRECOND(b) CLAW_ASSERT(b, "precondition failed: " #b) |
Abort the program if a precondition is not true. More... | |
#define | CLAW_POSTCOND(b) CLAW_ASSERT(b, "postcondition failed: " #b) |
Abort the program if a postcondition is not true. More... | |
Functions | |
void | claw::debug_assert (const char *file, const char *func, unsigned int line, bool b, const std::string &s) |
The method used by CLAW_ASSERT macro. Souldn't be used elsewhere. More... | |
Some assert macros to strengthen you code.
Definition in file assert.hpp.
CLAW_ASSERT | ( | b, | |
s | |||
) | claw::debug_assert(__FILE__, __FUNCTION__, __LINE__, (b), (s)) |
Print a message on std::cerr and stop the program if a condition is not true.
b | Condition to verify. |
s | An error message. |
Definition at line 88 of file assert.hpp.
CLAW_FAIL | ( | s | ) | claw::debug_assert(__FILE__, __FUNCTION__, __LINE__, false, (s)) |
Print a message on std::cerr and stop the program.
s | An error message. |
Definition at line 91 of file assert.hpp.
CLAW_POSTCOND | ( | b | ) | CLAW_ASSERT(b, "postcondition failed: " #b) |
Abort the program if a postcondition is not true.
b | Condition to verify. |
Definition at line 96 of file assert.hpp.
CLAW_PRECOND | ( | b | ) | CLAW_ASSERT(b, "precondition failed: " #b) |
Abort the program if a precondition is not true.
b | Condition to verify. |
Definition at line 94 of file assert.hpp.