Boost logo

Boost :

Subject: Re: [boost] Call for Review: Boost.Test documentation rewrite
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2014-01-18 23:52:31


Bjorn Reese <breese <at> mail1.stofanet.dk> writes:

>
> On 01/12/2014 10:19 PM, Gennadiy Rozental wrote:
>
> >> PS Boost.Test feels much more complicated than most users need.
> >> So we might have a Boost.MiniTest too?
> >
> > I never really understood these claims, without any specific examples. I
am
> > obviously biased, but show me "simple" library and we can discuss it.
Even
> > "hidden" boost alternatives - they are not simpler from user standpoint,
> > they require as much typing (if not more). They are "lighter" indeed
from
> > compiler standpoint, but there is a price you pay for this.
>
> Here is an example (requires C++11 though)
>
> https://github.com/martinmoene/lest

Example of what? How is this any simpler?

-------------------------------------
const lest::test specification[] =
{
    "Empty string has length zero (succeed)", []
    {
        EXPECT( 0 == string( ).length() );
        EXPECT( 0 == string("").length() );
    },

    "Text compares lexically (fail)", []
    {
        EXPECT( string("hello") > string("world") );
    }
};

int main()
{
    return lest::run( specification );
}
------------------------------------

vs.

BOOST_AUTO_TEST_CASE( my_test )
{
    BOOST_TEST( 0 == string( ).length() );
    BOOST_TEST_MESSAGE( 0 == string("").length(),
                        "Empty string has length zero (succeed)" );
    BOOST_TEST_MESSAGE(string("hello") > "world",
                        "Text compares lexically (fail)" );
}
------------------------------------

Not only Boost.Test version is simpler, it is also smaller, easier to
understand, easier to extend, more flexible and provides better output in
general. On top of than it simply does not look weird with all these [] {}
spread all over your example. And I am not talking about all the other
features UTF has, that this library does not even come close to replicate.

Gennadiy


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