Subject: Re: [boost] Is there interest in unit testing both passing and failing BOOST_MPL_ASSERTs?
From: Ben Robinson (icaretaker_at_[hidden])
Date: 2011-09-16 03:17:19
On Thu, Sep 15, 2011 at 3:46 PM, Gennadiy Rozental <rogeeff_at_[hidden]>wrote:
> Gordon Woodhull <gordon <at> woodhull.com> writes:
> This is bad idea in general compile you unit test with different options
> your regular build and bad idea generate different code in this case as
> Also what these statements do in regular build? Server as static asserts?
> In general, I agree that is is bad idea to compile code under test with
different compiler flags than in production, but in this case, with the
production flags, the code would fail to compile anyway, so nothing would be
produced that can be run in a unit test framework. The key ingredient of my
idea, is to allow the code to compile by conditionally replacing the failing
static asserts with throwing a run-time exception. Now the code can
compile, and unit tests can be written to confirm that each assertion either
passes or fails as desired.
And yes, in a production build, they are static asserts that will fail to
compile if the library user instantiates something incorrectly.
Ben Robinson, Ph.D.
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk