Boost logo

Boost :

Subject: Re: [boost] [Hana] Informal review request
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2015-03-05 22:59:40


On 6 Mar 2015 at 1:11, Louis Dionne wrote:

> > I'd suggest an alternative course: these are "current state is
> > impossible" assertions right? In which case fatal application exit is
> > the only valid outcome, plus you want them always there even in
> > optimised builds, and ideally you want some sort of useful error
> > message.
>
> The *_CHECK macros in Hana are just meant to be used for unit
> testing. They should be enabled in all build configurations so
> I can test both the Debug and Release modes. Currently,
> BOOST_HANA_RUNTIME_CHECK(expr) is defined (roughly) as
>
> if (!expr) {
> std::cerr << "some useful error message";
> std::abort();
> }
>
> Of course it is less naive PP-wise, but that's the gist of it.

Ah, then I'd urge you to use BOOST_CHECK/BOOST_REQUIRE which will
spit out the results of all your tests into an XML file that Jenkins
CI can display on a pretty graph. Then you can get Hana being nightly
soak tested for compilation time/memory consumption regressions etc.

You don't need Boost.Test necessarily for this, yet to be renamed
BindLib has a threadsafe CATCH fork wrapped into Boost Test emulation
macros. CATCH is totally header only, my threadsafe fork you can
fetch as one giant single standalone include file at:

https://github.com/ned14/Catch-ThreadSafe/blob/develop/single_include/
catch.hpp

Just drop that into your git repo. No dependencies needed.

If you want a preformed set of Boost test macros which thunk into
threadsafe CATCH, that can be found at:

https://github.com/ned14/Boost.BindLib/blob/master/include/boost/test/
unit_test.hpp

Which is also header only, I even use some undefined behaviour to
avoid you having to bother with with defining your own main().

Oh, and CATCH prints your unit testing results in pretty colours to
the console. Plus you can run unit test filters, useful when you want
to narrow into a very small part of the test suite. Much nicer than
std:cerr :)

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ 
http://ie.linkedin.com/in/nialldouglas/



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