#1130 Write Dune-specific assert which ignores -DNDEBUG
Metadata
Property | Value |
---|---|
Reported by | Christoph Grüninger (gruenich@iws.uni-stuttgart.de) |
Reported at | Jun 15, 2012 09:59 |
Type | Feature Request |
Version | Git (pre2.4) [autotools] |
Operating System | Unspecified / All |
Last edited by | Christoph Grüninger (gruenich@iws.uni-stuttgart.de) |
Last edited at | Nov 20, 2013 07:31 |
Description
Citing from Jö's message [1]:
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?
[1] http://lists.dune-project.org/pipermail/dune/2012-June/011537.html