
On Tue, Sep 27, 2011 at 7:59 AM, Dave Abrahams <dave@boostpro.com> wrote:
on Tue Sep 27 2011, Ben Robinson <icaretaker-AT-gmail.com> wrote:
... I think you're over-promising here. You can't turn all non-compiling code into compiling code by wrapping it in something.
I clearly overstated what I was trying to accomplish. Let me try again: This submission would make it possible to write unit tests for static assertions in meta-programs, to verify that static assertions will pass when they should, and also to verify that static assertions will fail when they should. These tests will all compile, and the non-passing static assertions will communicate the detected failure to a test framework at run-time, instead of failing to compile. If ... you can
somehow turn that into a test that throws without modifying my component... you are a god. [You may still be a god, but not because you solved this problem ;-)]
I am not a god, but try telling that to my 6-year-old triplets and 18-month-old baby. :) I think what you mean to say is that it tests both positive and negative
assertions without responding to failed assertions by generating a compilation error.
Correct.
Personally I am very uncomfortable with the use of exceptions to deal with failed assertions, and in a test that's just a bunch of compile-time assertions, I don't see *any* advantage whatsoever in using exceptions.
Exceptions are simply an implementation detail I am using instead of the compile error. One benefit of writing unit tests which show something failing when it should, is for regression analysis. Rather than discussing this point in generalities, I will provide more examples of its usage, and hopefully I can better demonstrate the usefulness that way. Thank you, Ben Robinson, Ph.D. --
Dave Abrahams BoostPro Computing http://www.boostpro.com
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost