Reworked all LocalFunction tests and examples to use Boost.Detail/LightweightTest (instead of Boost.Test) and test sequence syntax without variadic macros (..._nova tests).

[SVN r77747]
This commit is contained in:
Lorenzo Caminiti
2012-04-03 19:40:20 +00:00
parent d89c4fbde0
commit 5c0948bf6e
112 changed files with 828 additions and 612 deletions

View File

@@ -6,22 +6,23 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/config.hpp>
#ifndef BOOST_NO_VARIADIC_MACROS
#ifdef BOOST_NO_VARIADIC_MACROS
# error "variadic macros required"
#else
#include <boost/local_function.hpp>
#define BOOST_TEST_MODULE TestTranform
#include <boost/test/unit_test.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
#include <vector>
BOOST_AUTO_TEST_CASE(test_transform) {
int main(void) {
//[transform
int offset = 5;
std::vector<int> v;
std::vector<int> w;
for(int i = 1; i <= 2; ++i) v.push_back(i * 10);
BOOST_CHECK(v[0] == 10); BOOST_CHECK(v[1] == 20);
BOOST_TEST(v[0] == 10); BOOST_TEST(v[1] == 20);
w.resize(v.size());
int BOOST_LOCAL_FUNCTION(const bind& offset, int i) {
@@ -29,7 +30,7 @@ BOOST_AUTO_TEST_CASE(test_transform) {
} BOOST_LOCAL_FUNCTION_NAME(inc)
std::transform(v.begin(), v.end(), w.begin(), inc);
BOOST_CHECK(w[0] == 16); BOOST_CHECK(w[1] == 26);
BOOST_TEST(w[0] == 16); BOOST_TEST(w[1] == 26);
int BOOST_LOCAL_FUNCTION(bind& inc, int i, int j) {
return inc(i + j); // Call the other bound local function.
@@ -37,13 +38,10 @@ BOOST_AUTO_TEST_CASE(test_transform) {
offset = 0;
std::transform(v.begin(), v.end(), w.begin(), v.begin(), inc_sum);
BOOST_CHECK(v[0] == 27); BOOST_CHECK(v[1] == 47);
BOOST_TEST(v[0] == 27); BOOST_TEST(v[1] == 47);
//]
return boost::report_errors();
}
#else
int main(void) { return 0; } // Trivial test.
#endif
#endif // VARIADIC_MACROS