#1130 Write Dune-specific assert which ignores -DNDEBUG
|Reported by||Christoph Grüninger (email@example.com)|
|Reported at||Jun 15, 2012 09:59|
|Version||Git (pre2.4) [autotools]|
|Operating System||Unspecified / All|
|Last edited by||Christoph Grüninger (firstname.lastname@example.org)|
|Last edited at||Nov 20, 2013 07:31|
Citing from Jö's message :
That means we want to run many of the tests once with -DNDEBUG and once with -UNDEBUG. In both cases we want to always enable those misused asserts in the testing code. We could do that in the following way:
introduce a macro unittest_assert() which is always enabled and use that in the relevant testing code. Or use "if(!...) abort();" or similar.
when compiling with -DENABLE_DEBUG forcibly undefine NDEBUG in the test programs
when compiling with -DDISABLE_DEBUG forcibly define NDEBUG in the test programs
otherwise, leave NDEBUG untouched.
We can put that stuff in a header. But we should use seperate headers for unittest_assert() and the NDEBUG-fiddling, since the latter needs a very specific position in the list of includes.
Are all corner-cases covered by this scheme?