Alf P. Steinbach wrote:
OK, this displays my ignorance of what's out there (it's been a long
time since I developed for a living), and also my laziness not
googling. :-)
However.
I want to unit-test some library code I'm sort of extracting from some
old code I have.
For unit testing, see this:
http://cxxtest.sourceforge.net/guide.html
The things that should work without error are easy to test, and it's
currently not so much code that I've considered a testing framework,
although the code size increases. I'm thinking that perhaps the
popular frameworks don't support my needs: there are cases where the
code /should/ assert at run time. And worse, there are cases where the
could should assert at compile time...
How do you deal with this kind of testing, testing that things fail as
they should (at compile time and at run time)?
For compile time testing, see this:
http://www.boost.org/doc/libs/1_42_0/doc/html/boost_staticassert.html
For run time testing, I am using a macro, which throws an exception if
the condition fails. The exception class prints backtrace and the failed
condition.
Thanks, but I think you misunderstood the question.
E.g., the problem isn't to produce compile time asserts. The problem is testing
them, systematically. Preferably in an automated way.