Boost logo

Boost :

Subject: Re: [boost] doctest - the lightest feature rich C++ single header testing framework - if it can enter boost and if it/boost will benefit from that
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2016-05-23 04:57:29

2016-05-23 5:26 GMT+02:00 Gavin Lambert <gavinl_at_[hidden]>:

> On 23/05/2016 14:29, Vinnie Falco wrote:
>> I'm reading this thread about doctest and I checked out the library.
>> The first thing I noticed was macros and odd syntax. For example:
>> TEST_CASE("testing the factorial function") {
>> CHECK(factorial(1) == 1);
>> CHECK(factorial(2) == 2);
>> CHECK(factorial(10) == 3628800);
>> }
>> This looks like non-standard C++ and heavy on macros which turned me
>> off to Boost.Test for the same reasons. I considered using Boost.Test
>> for yet another library I am about to release and I gave up when I saw
>> the baffling use of macros.
> Generally macros are used for assertions because you want to include
> __LINE__ (and typically also __FILE__) in the assertion failure so that you
> can find *which* assertion failed (often the condition alone is not
> sufficiently unambiguous), and there isn't really any better way to get
> those AFAIK. (Sometimes it's possible to extract the failure location from
> a thrown exception, but this is highly compiler-dependent and non-standard
> -- and you're not interested in that specific point, but in one of its
> callers.)

Another reason is that you can can catch an exception thrown from an
expression you are testing, and report it uniformly along other test


Boost list run by bdawes at, gregod at, cpdaniel at, john at