Boost logo

Boost :

Subject: Re: [boost] Unittest capability for meta-programs feedback request
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-09-28 02:30:52


on Tue Sep 27 2011, Ben Robinson <icaretaker-AT-gmail.com> wrote:

>>
>> on Tue Sep 27 2011, Gennadiy Rozental <rogeeff-AT-gmail.com> wrote:
>>
>> > Dave Abrahams <dave <at> boostpro.com> writes:
>> >
>> > Now if you can come up with another approach to test these
>> > expectations I'd be happy to listen.
>>
>> We already have an approach; it requires integration with the test
>> system. Yes, it's imperfect, but it does do the kind of testing needed
>> to see that MyComponent<int> is prohibited.
>>
>> Can you elaborate on this in greater detail? Currently, if I want to prove
> a static assertion fails, my admittedly cumbersome technique is to uncomment
> the test for that condition, compile to produce the error, then re-comment
> out the test. This becomes very tedious for large numbers of regression
> tests.

I wouldn't advocate the technique for testing that a static assertion
fails; what you're proposing in this thread is much better suited to
that use case.

However, if you need to prove that something fails compilation (an
altogether different problem), you can do it by having the testing
system invert the result of running the compiler. For robustness you
should also make sure that everything compiles successfully if you
disable the specific trigger for the failure, and maybe check the error
messages.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk