From a48de6a8b8ef9b1a8f75d023d4ddf2b2e43cace6 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 26 Aug 2017 15:31:38 +0300 Subject: [PATCH] Added tests for next/prior to the Jamfile. Ported tests to lightweight_test.hpp. --- test/Jamfile.v2 | 1 + test/next_prior_test.cpp | 41 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 927a98a..ac694e1 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -56,6 +56,7 @@ test-suite iterator [ run minimum_category.cpp ] [ compile-fail minimum_category_compile_fail.cpp ] + [ run next_prior_test.cpp ] [ run advance_test.cpp ] [ run distance_test.cpp ] ; diff --git a/test/next_prior_test.cpp b/test/next_prior_test.cpp index cd2812f..734a212 100644 --- a/test/next_prior_test.cpp +++ b/test/next_prior_test.cpp @@ -18,8 +18,7 @@ // simple functions, though, and it would be very strange if these // tests were to fail. -#define BOOST_INCLUDE_MAIN -#include +#include #include #include @@ -73,32 +72,32 @@ bool minus_n_unsigned_test(Iterator first, Iterator last, Distance size) return i == first; } -int test_main(int, char*[]) +int main(int, char*[]) { std::vector x(8); std::list y(x.begin(), x.end()); // Tests with iterators - BOOST_REQUIRE(plus_one_test(x.begin(), x.end(), y.begin())); - BOOST_REQUIRE(plus_n_test(x.begin(), x.end(), y.begin())); - BOOST_REQUIRE(minus_one_test(x.begin(), x.end(), y.end())); - BOOST_REQUIRE(minus_n_test(x.begin(), x.end(), y.end())); - BOOST_REQUIRE(minus_n_unsigned_test(x.begin(), x.end(), x.size())); - BOOST_REQUIRE(minus_n_unsigned_test(y.begin(), y.end(), y.size())); + BOOST_TEST(plus_one_test(x.begin(), x.end(), y.begin())); + BOOST_TEST(plus_n_test(x.begin(), x.end(), y.begin())); + BOOST_TEST(minus_one_test(x.begin(), x.end(), y.end())); + BOOST_TEST(minus_n_test(x.begin(), x.end(), y.end())); + BOOST_TEST(minus_n_unsigned_test(x.begin(), x.end(), x.size())); + BOOST_TEST(minus_n_unsigned_test(y.begin(), y.end(), y.size())); - BOOST_REQUIRE(plus_one_test(x.rbegin(), x.rend(), y.begin())); - BOOST_REQUIRE(plus_n_test(x.rbegin(), x.rend(), y.begin())); - BOOST_REQUIRE(minus_one_test(x.rbegin(), x.rend(), y.end())); - BOOST_REQUIRE(minus_n_test(x.rbegin(), x.rend(), y.end())); - BOOST_REQUIRE(minus_n_unsigned_test(x.rbegin(), x.rend(), x.size())); - BOOST_REQUIRE(minus_n_unsigned_test(x.rbegin(), x.rend(), y.size())); + BOOST_TEST(plus_one_test(x.rbegin(), x.rend(), y.begin())); + BOOST_TEST(plus_n_test(x.rbegin(), x.rend(), y.begin())); + BOOST_TEST(minus_one_test(x.rbegin(), x.rend(), y.end())); + BOOST_TEST(minus_n_test(x.rbegin(), x.rend(), y.end())); + BOOST_TEST(minus_n_unsigned_test(x.rbegin(), x.rend(), x.size())); + BOOST_TEST(minus_n_unsigned_test(x.rbegin(), x.rend(), y.size())); // Tests with integers - BOOST_REQUIRE(boost::next(5) == 6); - BOOST_REQUIRE(boost::next(5, 7) == 12); - BOOST_REQUIRE(boost::prior(5) == 4); - BOOST_REQUIRE(boost::prior(5, 7) == -2); - BOOST_REQUIRE(boost::prior(5, 7u) == -2); + BOOST_TEST(boost::next(5) == 6); + BOOST_TEST(boost::next(5, 7) == 12); + BOOST_TEST(boost::prior(5) == 4); + BOOST_TEST(boost::prior(5, 7) == -2); + BOOST_TEST(boost::prior(5, 7u) == -2); - return 0; + return boost::report_errors(); }