Boost logo

Boost Users :

From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2019-11-25 19:13:00


(FYI, https://www.boost.org/community/policy.html says: Don't
Overquote, Don't Top-Post,...)

On Mon, 25 Nov 2019 at 19:10, Krzysztof Jusiak via Boost-users
<boost-users_at_[hidden]> wrote:
>
> I also updated benchmarks with Boost.Test-1.71.0 (static library).
> I didn't add Boost.LightweightTest though as it's just assertions (no tests/suites/etc...) so it makes it difficult to compare due to missing features.
> * https://github.com/boost-experimental/ut#benchmarks

Boost.LT does not offer formal vocabulary for cases and suites,
but saying it's "just assertions" is not quite accurate, I think.

According to some of TDD advocates, there shall be single assertion
per unit test [1]
(test case is an individual unit of testing, a unit test):

int sqr(int x) { return x * x; }
int main()
{
    BOOST_TEST( sqr(2) == 4 ); // test case 1
    BOOST_TEST_EQ( sqr(-3), 9 ); // test case 2
    return boost::report_errors();
}

For those who multiple assertions:

void test_sqr(int input, int expect)
{
    BOOST_TEST( sqr(input) == expect);
    BOOST_TEST( sqr(-input) == expect);
}
int main()
{
    test_sqrt(2, 4); // test case 1
    test_sqrt(-3, 9); // test case 1
    return boost::report_errors();
}

Finally, the single runnable test program is a test suite.

So, I will argue that Boost.LT does support test cases and test suites.

[1] https://osherove.com/blog/2006/10/3/avoid-multiple-asserts-in-a-single-unit-test-revisited.html

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net