[Dune] [Dune-Commit] dune-grid r8200 - trunk/dune/grid/test
Christian Engwer
christian.engwer at uni-muenster.de
Thu May 31 16:24:07 CEST 2012
On Thu, May 31, 2012 at 03:47:13PM +0200, Jö Fahlke wrote:
> Am Thu, 31. May 2012, 13:56:29 +0200 schrieb Christoph Grüninger:
> > your proposal sounds good. In my patch I followed Oliver's
> > suggestions, see [1].
> > So, what should I change? Include "#define NDEBUG 0" in every test?
> > Or pass it to every test using the Makefile? Or just make sure that
> > I'll run the tests only without -DNDEBUG? Should I remove the
> > #ifndefs I added?
>
> IMO replace assert() by something that doesn't depend on NDEBUG. With "#undef
> NDEBUG" you also forcibly enable assert() in other headers, even though the
> user may have specified -DNDEBUG, which would eb a bit surprising.
Hi Jö,
I disagree. The tests aren't production code and usually not run by
the users. I think it is reasonable to use assert in different places
of the code, but the tests should make use of these assertions.
I'm not sure how easy it is to undefine NDEBUG via the Makefiles. The
solution with #undef NDEBUG in the header is also not really nice,
although perhaps the better option. In this case I would create an
other header which does exactly this, or we might even add the
appropricate code to config.h.
Something like:
#if RUNTEST and defined NDEBUG
#undef NDEBUG
#endif
Christian
More information about the Dune
mailing list