Trumphurst Ltd.

Submit a comment to an "Available C++ Libraries FAQ" entry

CategoryTools for C++ Programmers

ModAssert - A library of ASSERT-like macros that can use rich booleans

In C and C++ the traditional assert function is used to tell the user that something unexpected happened, that might cause the program to fail. Macros were written to extend this mechanism, like ASSERT_EQUAL(a,b) to give a short explanation "lefthand is <9>, righthand is <10>". However, such a macros functionality can't be reused in any way if we want to have a similar VERIFY_EQUAL (which still evaluates its arguments in non-debug mode), or an ASSERT_EQUAL_MSG (to add a message).

The Modular Assert macros use Rich Booleans, to have a modular assertion framework where any type of ASSERT can be combined with any Rich Boolean or a simple boolean expression. This package has 16 different types of assertion macros (ASSERT, VERIFY, ASSERT_P, ...), which can be combined with any rich boolean to provide extra information (or a simple boolean expression). So one could write ASSERT(rbEQUAL(a,b)), VERIFY(rbLESS(foo(), 10)), etc. Furthermore, the macros allow an arbitray number of expressions to be evaluated and shown when an assertion fails. A level can be assigned to each assertion (Info, Debug, Error or Fatal). Assertions can be ignored per case, level or file.

They are released under the Boost License, which allows free use in any code. It was tested with Visual C++ and Gnu C++, but contains no platform or compiler specific code (except for the demo code), so it should be portable.

Licensing : Non commercial


Do not expect an immediate response - the contents of this form will be added to a queue, which I process manually about once a week. If you don't fill in your email address correctly, you will not (obviously) get any reply at all. Other invalid information may result in a mailed request for clarification.

Enter your comment in the areas provided below. Be sure to include your name and email address.

Please don't bother trying to post spam or links to dodgy web sites - everything you post here is reviewed by a human being before being released for public viewing.


Your Name
Your Email Address
Comment:

Click to submit your comment.
Up to the FAQ title page

For more information on any of Trumphurst's products and services, please


This page, and all contents, are Copyright © 1997-2017 by
Trumphurst Ltd.
The Willows
Canalside
St. Martins Moor
Oswestry
Shropshire
SY10 7BH
England.
Contact us
www.trumphurst.com is hosted by JumboCruiser.