From 2b57104097d6b4e581d568bc0fee12540ad7ab13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Fri, 24 May 2013 21:59:09 +0200 Subject: [PATCH] Prefer BOOST_CHECK_EQUAL to BOOST_CHECK The former is more assertive than the latter and provides better diagnostics. Incidentally, switching to *_EQUAL() also fixes an assignment that was (probably) intended to be an equality test: BOOST_CHECK(count = num) in both test cases. --- tests/test_span.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/test_span.cpp b/tests/test_span.cpp index 5a8c0c868..0a87a2447 100644 --- a/tests/test_span.cpp +++ b/tests/test_span.cpp @@ -35,16 +35,16 @@ BOOST_AUTO_TEST_CASE(OneArgConstr) { const int num = 4; const Span s(num); - BOOST_CHECK(s.size() == num); + BOOST_CHECK_EQUAL(s.size(), num); for (int i = 0; i < num; ++i) { - BOOST_CHECK(s[i] == i); + BOOST_CHECK_EQUAL(s[i], i); } int count = 0; for (Span::const_iterator it = s.begin(); it != s.end(); ++it) { - BOOST_CHECK(*it == count); + BOOST_CHECK_EQUAL(*it, count); ++count; } - BOOST_CHECK(count = num); + BOOST_CHECK_EQUAL(count, num); } BOOST_AUTO_TEST_CASE(ThreeArgConstr) @@ -55,15 +55,14 @@ BOOST_AUTO_TEST_CASE(ThreeArgConstr) const int seq[num] = { start, start + 1*stride, start + 2*stride }; const Span s(num, stride, start); - BOOST_CHECK(s.size() == num); + BOOST_CHECK_EQUAL(s.size(), num); for (int i = 0; i < num; ++i) { - BOOST_CHECK(s[i] == seq[i]); + BOOST_CHECK_EQUAL(s[i], seq[i]); } int count = 0; for (Span::const_iterator it = s.begin(); it != s.end(); ++it) { - BOOST_CHECK(*it == seq[count]); + BOOST_CHECK_EQUAL(*it, seq[count]); ++count; } - BOOST_CHECK(count = num); + BOOST_CHECK_EQUAL(count, num); } -