ModAssert and Rich Booleans

ModAssert is a very advanced open source assertion package for C++. It is very flexible and easy to use. It uses Rich Booleans to create an analysis of what went wrong if an assertion fails.

The most basic assertion packages let you write something like

ASSERT(a==foo(b));

which shows a dialog box if the condition fails.

ModAssert on the other hand lets you write

MOD_ASSERT_P(b, rbEQUAL(a, foo(b)));

and lets the programmer choose what happens when the condition fails: show it in a dialog box, log it to a file, log it to a custom logger or displayer, or any combination of these. Furthermore a text like `a':<1> == `foo(b)':<2> nok will be shown (generated by the Rich Boolean macro rbEQUAL(a, foo(b)) ) where the expressions are between ` and ', and their values are between < and >. The value of b is also shown (the first parameter of the assertion). Ordinary boolean conditions are also possible with the same assertion macros.

This is just a small sample of the present features. It also integrates nicely with UquoniTest, by reporting failed assertions in domain code as a failure instead of showing a dialog box.

NameLanguageTypeDescriptionLicense
Rich Booleans C++ Library A set of boolean-like expressions, like rbEQUAL(a,b), that hold extra information if they evaluate to false, to inform the user why it evaluated to false, e.g. by showing the values of a and b. wxWindows license
ModAssert C++ Library A package of 128 variations on the ASSERT macro, that can have these rich booleans as an argument, like MOD_ASSERT(rbEQUAL(a,b)), but also regular boolean expressions. wxWindows license