stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: Static assertions in tests?
Date Wed, 09 Jul 2008 22:18:15 GMT
Eric Lemings wrote:
>  
> For compile-time tests, would it be preferable to use a static assertion
> or continue using good ol' rw_assert() even for compile-time checks?  In
> the former case, the test will fail to build and, in the latter case,
> the compile-time check will not be easily distinguisable from other
> runtime assertions.

I would recommend against using one component of the library
(static_assert) to test another.

The approach taken by existing tests is to verify types and
signatures by using them in ways that would make the tests
ill-formed if they didn't match the requirements, causing
a compiler error. You can see examples of this approach in
the 23.vector.cons.cpp test that was just mentioned.

Martin

Mime
View raw message