Thrill
0.1
|
tlx contains a set of macros called die_...
for simple invariant testing. They test some condition and fail with nice output containing both the condition, and file/line information where it occurred.
die(message)
- always terminates with given message.die_unless(condition)
- terminates if condition is falsedie_if(condition)
- terminates if condition is truedie_verbose_unless(condition,message)
- terminates if condition is falsedie_verbose_if(condition,message)
- terminates if condition is truedie_unequal(a,b)
- terminates unless a == b.die_unequal_eps6(a,b)
- terminates unless abs(a - b) < 1e-6 for approximate equality.die_equal(a,b)
- terminates if a == b.die_unless_throws(code,exception)
- terminate if code does not throw the exceptionFurthermore, some additional assert macros are also available. These are only active in Debug mode, if NDEBUG is defined they are compiled out.
assert_equal(a,b)
- checks if a == b.assert_unequal(a,b)
- checks if a != b.tlx die macros can also be modified to throw a DieException instead of calling std::terminate. Either call set_die_with_exception(true)
to define TLX_DIE_WITH_EXCEPTION=1 using the preprocessor.