|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77747 - in trunk/libs/local_function: example test
From: lorcaminiti_at_[hidden]
Date: 2012-04-03 15:40:29
Author: lcaminiti
Date: 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
New Revision: 77747
URL: http://svn.boost.org/trac/boost/changeset/77747
Log:
Reworked all LocalFunction tests and examples to use Boost.Detail/LightweightTest (instead of Boost.Test) and test sequence syntax without variadic macros (..._nova tests).
Added:
trunk/libs/local_function/example/add_cxx11_lambda.cpp (contents, props changed)
trunk/libs/local_function/example/expensive_copy_cxx11_lambda.cpp
- copied, changed from r77724, /trunk/libs/local_function/example/expensive_copy_lambda.cpp
trunk/libs/local_function/example/gcc_cxx11_lambda.cpp
- copied, changed from r77724, /trunk/libs/local_function/example/gcc_lambda_cxx11.cpp
trunk/libs/local_function/example/noncopyable_cxx11_lambda_error.cpp
- copied, changed from r77724, /trunk/libs/local_function/example/noncopyable_lambda_error.cpp
trunk/libs/local_function/example/profile_cxx11_lambda.cpp
- copied, changed from r77724, /trunk/libs/local_function/example/profile_lambda.cpp
trunk/libs/local_function/example/profile_legend_cxx11_lambda.png
- copied unchanged from r77724, /trunk/libs/local_function/example/profile_legend_lambda.png
trunk/libs/local_function/test/add_classifiers_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/add_default_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/add_except_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/add_inline_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/add_params_only_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/add_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/add_template_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/add_this_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/add_typed_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/add_with_default_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/all_decl_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/factorial_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/goto_error_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/goto_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/macro_commas_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/nesting_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/nova.hpp (contents, props changed)
trunk/libs/local_function/test/operator_error_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/operator_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/overload_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/return_assign_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/return_derivative_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/return_inc_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/return_setget_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/return_this_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/same_line_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/ten_void_nova.cpp (contents, props changed)
trunk/libs/local_function/test/transform_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/typeof_seq_nova.cpp (contents, props changed)
trunk/libs/local_function/test/typeof_template_seq_nova.cpp (contents, props changed)
Removed:
trunk/libs/local_function/example/expensive_copy_lambda.cpp
trunk/libs/local_function/example/gcc_lambda_cxx11.cpp
trunk/libs/local_function/example/noncopyable_lambda_error.cpp
trunk/libs/local_function/example/profile_lambda.cpp
trunk/libs/local_function/example/profile_legend_lambda.png
trunk/libs/local_function/test/add_lambda.cpp
Text files modified:
trunk/libs/local_function/example/Jamfile.v2 | 11 ++---
trunk/libs/local_function/example/add_global_functor.cpp | 8 ++--
trunk/libs/local_function/example/add_local_functor.cpp | 9 ++--
trunk/libs/local_function/example/add_phoenix.cpp | 9 ++--
trunk/libs/local_function/example/chrono.py | 5 ++
trunk/libs/local_function/example/const_block.hpp | 5 +-
trunk/libs/local_function/example/expensive_copy_cxx11_lambda.cpp | 14 +++----
trunk/libs/local_function/example/expensive_copy_local_function.cpp | 6 +-
trunk/libs/local_function/example/gcc_access.cpp | 12 +++---
trunk/libs/local_function/example/gcc_cxx11_lambda.cpp | 22 +++++------
trunk/libs/local_function/example/gcc_lambda.cpp | 20 ++++-----
trunk/libs/local_function/example/gcc_square.cpp | 8 ++--
trunk/libs/local_function/example/gcc_store.cpp | 12 +++---
trunk/libs/local_function/example/impl_pp_keyword.cpp | 10 ++--
trunk/libs/local_function/example/impl_tparam_tricks.cpp | 8 ++--
trunk/libs/local_function/example/n2529_this.cpp | 12 +++---
trunk/libs/local_function/example/n2550_find_if.cpp | 10 ++--
trunk/libs/local_function/example/noncopyable_cxx11_lambda_error.cpp | 14 +++----
trunk/libs/local_function/example/noncopyable_local_function.cpp | 2
trunk/libs/local_function/example/phoenix_factorial.cpp | 10 ++--
trunk/libs/local_function/example/phoenix_factorial_local.cpp | 10 ++--
trunk/libs/local_function/example/profile_cxx11_lambda.cpp | 10 ++---
trunk/libs/local_function/example/scope_exit.cpp | 16 ++++----
trunk/libs/local_function/test/Jamfile.v2 | 79 ++++++++++++++++-----------------------
trunk/libs/local_function/test/add.cpp | 19 ++++-----
trunk/libs/local_function/test/add_classifiers.cpp | 20 +++++-----
trunk/libs/local_function/test/add_classifiers_seq.cpp | 18 ++++-----
trunk/libs/local_function/test/add_default.cpp | 20 ++++-----
trunk/libs/local_function/test/add_default_seq.cpp | 8 ++--
trunk/libs/local_function/test/add_except.cpp | 18 ++++-----
trunk/libs/local_function/test/add_except_seq.cpp | 8 ++--
trunk/libs/local_function/test/add_inline.cpp | 18 ++++-----
trunk/libs/local_function/test/add_inline_seq.cpp | 8 ++--
trunk/libs/local_function/test/add_params_only.cpp | 18 ++++-----
trunk/libs/local_function/test/add_params_only_seq.cpp | 8 ++--
trunk/libs/local_function/test/add_seq.cpp | 9 ++--
trunk/libs/local_function/test/add_template.cpp | 18 ++++-----
trunk/libs/local_function/test/add_template_seq.cpp | 8 ++--
trunk/libs/local_function/test/add_this.cpp | 18 ++++-----
trunk/libs/local_function/test/add_this_seq.cpp | 8 ++--
trunk/libs/local_function/test/add_typed.cpp | 18 ++++-----
trunk/libs/local_function/test/add_typed_seq.cpp | 8 ++--
trunk/libs/local_function/test/add_with_default.cpp | 18 ++++-----
trunk/libs/local_function/test/add_with_default_seq.cpp | 8 ++--
trunk/libs/local_function/test/all_decl.cpp | 10 ++---
trunk/libs/local_function/test/factorial.cpp | 22 +++++------
trunk/libs/local_function/test/factorial_seq.cpp | 12 +++---
trunk/libs/local_function/test/goto.cpp | 15 +++----
trunk/libs/local_function/test/goto_error.cpp | 13 ++----
trunk/libs/local_function/test/goto_error_seq.cpp | 5 +-
trunk/libs/local_function/test/goto_seq.cpp | 5 +-
trunk/libs/local_function/test/macro_commas.cpp | 16 +++-----
trunk/libs/local_function/test/macro_commas_seq.cpp | 5 +-
trunk/libs/local_function/test/nesting.cpp | 18 ++++-----
trunk/libs/local_function/test/nesting_seq.cpp | 8 ++--
trunk/libs/local_function/test/operator.cpp | 18 ++++-----
trunk/libs/local_function/test/operator_error.cpp | 16 +++----
trunk/libs/local_function/test/operator_error_seq.cpp | 8 ++--
trunk/libs/local_function/test/operator_seq.cpp | 8 ++--
trunk/libs/local_function/test/overload.cpp | 25 +++++-------
trunk/libs/local_function/test/overload_seq.cpp | 14 +++---
trunk/libs/local_function/test/return_assign.cpp | 24 +++++------
trunk/libs/local_function/test/return_assign_seq.cpp | 14 +++---
trunk/libs/local_function/test/return_derivative.cpp | 18 ++++-----
trunk/libs/local_function/test/return_derivative_seq.cpp | 8 ++--
trunk/libs/local_function/test/return_inc.cpp | 24 +++++------
trunk/libs/local_function/test/return_inc_seq.cpp | 14 +++---
trunk/libs/local_function/test/return_setget.cpp | 20 ++++-----
trunk/libs/local_function/test/return_setget_seq.cpp | 10 ++--
trunk/libs/local_function/test/return_this.cpp | 24 +++++------
trunk/libs/local_function/test/return_this_seq.cpp | 14 +++---
trunk/libs/local_function/test/same_line.cpp | 19 ++++-----
trunk/libs/local_function/test/same_line_seq.cpp | 9 ++--
trunk/libs/local_function/test/ten_void.cpp | 9 ++--
trunk/libs/local_function/test/transform.cpp | 22 +++++------
trunk/libs/local_function/test/transform_seq.cpp | 13 +++---
trunk/libs/local_function/test/typeof.cpp | 18 ++++-----
trunk/libs/local_function/test/typeof_seq.cpp | 8 ++--
trunk/libs/local_function/test/typeof_template.cpp | 18 ++++-----
trunk/libs/local_function/test/typeof_template_seq.cpp | 8 ++--
80 files changed, 509 insertions(+), 601 deletions(-)
Modified: trunk/libs/local_function/example/Jamfile.v2
==============================================================================
--- trunk/libs/local_function/example/Jamfile.v2 (original)
+++ trunk/libs/local_function/example/Jamfile.v2 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -7,8 +7,7 @@
import testing ;
-project : requirements <library>/boost//unit_test_framework ;
-
+run add_cxx11_lambda.cpp ;
run add_global_functor.cpp ;
run add_local_functor.cpp ;
run add_phoenix.cpp ;
@@ -17,12 +16,12 @@
compile-fail const_block_error.cpp : <variant>debug : ;
run const_block_error.cpp : <variant>release : ;
-run expensive_copy_lambda.cpp ;
+run expensive_copy_cxx11_lambda.cpp ;
run expensive_copy_local_function.cpp ;
run gcc_access.cpp ;
run gcc_lambda.cpp ;
-run gcc_lambda_cxx11.cpp ;
+run gcc_cxx11_lambda.cpp ;
run gcc_square.cpp ;
run gcc_store.cpp ;
@@ -32,7 +31,7 @@
run n2529_this.cpp ;
run n2550_find_if.cpp ;
-compile-fail noncopyable_lambda_error.cpp ;
+compile-fail noncopyable_cxx11_lambda_error.cpp ;
run noncopyable_local_function.cpp ;
run phoenix_factorial.cpp ;
@@ -44,7 +43,7 @@
<library>/boost/system//boost_system
<link>static
;
-exe profile_lambda : profile_lambda.cpp
+exe profile_cxx11_lambda : profile_cxx11_lambda.cpp
: <library>/boost/chrono//boost_chrono
<library>/boost/system//boost_system
<link>static
Added: trunk/libs/local_function/example/add_cxx11_lambda.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/example/add_cxx11_lambda.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,34 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_LAMBDAS
+# error "lambda functions required"
+#else
+
+#include <boost/detail/lightweight_test.hpp>
+#include <algorithm>
+
+//[add_cxx11_lambda
+int main(void) { // Some local scope.
+ int sum = 0, factor = 10; // Variables in scope to bind.
+
+ auto add = [factor, &sum](int num) { // C++11 only.
+ sum += factor * num;
+ };
+
+ add(1); // Call the lambda.
+ int nums[] = {2, 3};
+ std::for_each(nums, nums + 2, add); // Pass it to an algorithm.
+
+ BOOST_TEST(sum == 60); // Assert final summation value.
+ return boost::report_errors();
+}
+//]
+
+#endif
+
Modified: trunk/libs/local_function/example/add_global_functor.cpp
==============================================================================
--- trunk/libs/local_function/example/add_global_functor.cpp (original)
+++ trunk/libs/local_function/example/add_global_functor.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -5,8 +5,7 @@
// http://www.boost.org/LICENSE_1_0.txt)
// Home at http://www.boost.org/libs/local_function
-#define BOOST_TEST_MODULE TestAddGlobalFunctor
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
//[add_global_functor
@@ -22,7 +21,7 @@
const int factor; // Make `factor` constant.
};
-BOOST_AUTO_TEST_CASE(test_add_global_functor) {
+int main(void) {
int sum = 0, factor = 10;
global_add add(sum, factor);
@@ -31,7 +30,8 @@
int nums[] = {2, 3};
std::for_each(nums, nums + 2, add); // Passed as template parameter.
- BOOST_CHECK(sum == 60);
+ BOOST_TEST(sum == 60);
+ return boost::report_errors();
}
//]
Modified: trunk/libs/local_function/example/add_local_functor.cpp
==============================================================================
--- trunk/libs/local_function/example/add_local_functor.cpp (original)
+++ trunk/libs/local_function/example/add_local_functor.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -5,12 +5,10 @@
// http://www.boost.org/LICENSE_1_0.txt)
// Home at http://www.boost.org/libs/local_function
-#define BOOST_TEST_MODULE TestAddLocalFunctor
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
-BOOST_AUTO_TEST_CASE(test_add_local_functor)
//[add_local_functor
-{
+int main(void) {
int sum = 0, factor = 10;
struct local_add { // Unfortunately, boilerplate code to program the class.
@@ -29,7 +27,8 @@
// Unfortunately, cannot pass as template parameter to `std::for_each`.
for(size_t i = 0; i < 2; ++i) add(nums[i]);
- BOOST_CHECK(sum == 60);
+ BOOST_TEST(sum == 60);
+ return boost::report_errors();
}
//]
Modified: trunk/libs/local_function/example/add_phoenix.cpp
==============================================================================
--- trunk/libs/local_function/example/add_phoenix.cpp (original)
+++ trunk/libs/local_function/example/add_phoenix.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,14 +6,12 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/spirit/include/phoenix.hpp>
-#define BOOST_TEST_MODULE TestAddPhoenix
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
#include <iostream>
-BOOST_AUTO_TEST_CASE(test_add_phoenix)
//[add_phoenix
-{
+int main(void) {
using boost::phoenix::let;
using boost::phoenix::local_names::_f;
using boost::phoenix::cref;
@@ -29,7 +27,8 @@
ref(sum) += _f * _1, _1 // Access `sum` by reference.
]);
- BOOST_CHECK(sum == 60);
+ BOOST_TEST(sum == 60);
+ return boost::report_errors();
}
//]
Modified: trunk/libs/local_function/example/chrono.py
==============================================================================
--- trunk/libs/local_function/example/chrono.py (original)
+++ trunk/libs/local_function/example/chrono.py 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -9,7 +9,10 @@
import time
import os
-# Usage: python crono.py COMMAND [COMMAND_OPTIONS]
+if len(sys.argv) < 2:
+ print "Usage: python " + sys.argv[0] + " COMMAND [COMMAND_OPTIONS]"
+ print "Measure run-time of executing the specified command."
+ exit(1)
cmd = ""
for arg in sys.argv[1:]: cmd += str(arg) + " "
Modified: trunk/libs/local_function/example/const_block.hpp
==============================================================================
--- trunk/libs/local_function/example/const_block.hpp (original)
+++ trunk/libs/local_function/example/const_block.hpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -17,7 +17,6 @@
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/control/iif.hpp>
#include <boost/preprocessor/cat.hpp>
-#include <cassert>
// PRIVATE //
@@ -34,8 +33,8 @@
)
#define CONST_BLOCK_END_(id) \
- BOOST_LOCAL_FUNCTION_NAME(BOOST_PP_CAT(const_assert_, id)) \
- BOOST_PP_CAT(const_assert_, id)(); /* call local function immediately */
+ BOOST_LOCAL_FUNCTION_NAME(BOOST_PP_CAT(const_block_, id)) \
+ BOOST_PP_CAT(const_block_, id)(); /* call local function immediately */
// PUBLIC //
Copied: trunk/libs/local_function/example/expensive_copy_cxx11_lambda.cpp (from r77724, /trunk/libs/local_function/example/expensive_copy_lambda.cpp)
==============================================================================
--- /trunk/libs/local_function/example/expensive_copy_lambda.cpp (original)
+++ trunk/libs/local_function/example/expensive_copy_cxx11_lambda.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,16 +6,18 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/config.hpp>
-#ifndef BOOST_NO_LAMBDAS
+#ifdef BOOST_NO_LAMBDAS
+# error "lambda functions required"
+#else
#include <iostream>
#include <cassert>
-//[expensive_copy_lambda
+//[expensive_copy_cxx11_lambda
struct n {
int i;
n(int _i): i(_i) {}
- n(n const& x): i(x.i) { // Some time consuming copy.
+ n(n const& x): i(x.i) { // Some time consuming copy operation.
for (unsigned i = 0; i < 10000; ++i) std::cout << '.';
}
};
@@ -24,7 +26,7 @@
n x(-1);
auto f = [x]() { // Problem: Expensive copy, but if bind
- assert( x.i == -1); // by `&x` then `x` is not constant.
+ assert(x.i == -1); // by `&x` then `x` is not constant.
};
f();
@@ -32,9 +34,5 @@
}
//]
-#else // NO_LAMBDAS
-
-int main(void) { return 0; } // Trivial test.
-
#endif // NO_LAMBDAS
Deleted: trunk/libs/local_function/example/expensive_copy_lambda.cpp
==============================================================================
--- trunk/libs/local_function/example/expensive_copy_lambda.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
+++ (empty file)
@@ -1,40 +0,0 @@
-
-// Copyright (C) 2009-2012 Lorenzo Caminiti
-// Distributed under the Boost Software License, Version 1.0
-// (see accompanying file LICENSE_1_0.txt or a copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-// Home at http://www.boost.org/libs/local_function
-
-#include <boost/config.hpp>
-#ifndef BOOST_NO_LAMBDAS
-
-#include <iostream>
-#include <cassert>
-
-//[expensive_copy_lambda
-struct n {
- int i;
- n(int _i): i(_i) {}
- n(n const& x): i(x.i) { // Some time consuming copy.
- for (unsigned i = 0; i < 10000; ++i) std::cout << '.';
- }
-};
-
-int main(void) {
- n x(-1);
-
- auto f = [x]() { // Problem: Expensive copy, but if bind
- assert( x.i == -1); // by `&x` then `x` is not constant.
- };
- f();
-
- return 0;
-}
-//]
-
-#else // NO_LAMBDAS
-
-int main(void) { return 0; } // Trivial test.
-
-#endif // NO_LAMBDAS
-
Modified: trunk/libs/local_function/example/expensive_copy_local_function.cpp
==============================================================================
--- trunk/libs/local_function/example/expensive_copy_local_function.cpp (original)
+++ trunk/libs/local_function/example/expensive_copy_local_function.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -13,7 +13,7 @@
struct n {
int i;
n(int _i): i(_i) {}
- n(n const& x): i(x.i) { // Some time consuming copy.
+ n(n const& x): i(x.i) { // Some time consuming copy operation.
for (unsigned i = 0; i < 10000; ++i) std::cout << '.';
}
};
@@ -21,8 +21,8 @@
int main(void) {
n x(-1);
- void BOOST_LOCAL_FUNCTION(const bind& x) { // OK: No copy
- assert( x.i == -1 ); // and constant.
+ void BOOST_LOCAL_FUNCTION(const bind& x) { // OK: No copy expensive
+ assert(x.i == -1); // copy but constant.
} BOOST_LOCAL_FUNCTION_NAME(f)
f();
Modified: trunk/libs/local_function/example/gcc_access.cpp
==============================================================================
--- trunk/libs/local_function/example/gcc_access.cpp (original)
+++ trunk/libs/local_function/example/gcc_access.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,18 +6,18 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestGccAccess
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
-BOOST_AUTO_TEST_CASE(test_gcc_access) {
+int main(void) {
int nums[] = {1, 2, 3};
int offset = -1;
int BOOST_LOCAL_FUNCTION(const bind offset, int* array, int index) {
return array[index + offset];
} BOOST_LOCAL_FUNCTION_NAME(access)
- BOOST_CHECK(access(nums, 1) == 1);
- BOOST_CHECK(access(nums, 2) == 2);
- BOOST_CHECK(access(nums, 3) == 3);
+ BOOST_TEST(access(nums, 1) == 1);
+ BOOST_TEST(access(nums, 2) == 2);
+ BOOST_TEST(access(nums, 3) == 3);
+ return boost::report_errors();
}
Copied: trunk/libs/local_function/example/gcc_cxx11_lambda.cpp (from r77724, /trunk/libs/local_function/example/gcc_lambda_cxx11.cpp)
==============================================================================
--- /trunk/libs/local_function/example/gcc_lambda_cxx11.cpp (original)
+++ trunk/libs/local_function/example/gcc_cxx11_lambda.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,14 +6,15 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/config.hpp>
-#ifndef BOOST_NO_LAMBDAS
+#ifdef BOOST_NO_LAMBDAS
+# error "lambda functions required"
+#else
-#define BOOST_TEST_MODULE TestGccLambdaCxx11
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
-BOOST_AUTO_TEST_CASE(test_gcc_lambda_cxx11) {
- //[gcc_lambda_cxx11
+int main(void) {
+ //[gcc_cxx11_lambda
int val = 2;
int nums[] = {1, 2, 3};
int* end = nums + 3;
@@ -25,13 +26,10 @@
);
//]
- BOOST_CHECK(iter != end);
- BOOST_CHECK(*iter == val);
+ BOOST_TEST(iter != end);
+ BOOST_TEST(*iter == val);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // LAMBDAS
Modified: trunk/libs/local_function/example/gcc_lambda.cpp
==============================================================================
--- trunk/libs/local_function/example/gcc_lambda.cpp (original)
+++ trunk/libs/local_function/example/gcc_lambda.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,14 +6,15 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/config.hpp>
-#if defined(__GCC__) || !defined(BOOST_NO_LAMBDAS)
+#ifndef __GNUC__
+# error "GCC compiler required (uses non-standard GCC statement expressions)"
+#else
#include "gcc_lambda.hpp"
-#define BOOST_TEST_MODULE TestGccLambda
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
-BOOST_AUTO_TEST_CASE(test_gcc_lambda) {
+int main(void) {
//[gcc_lambda
int val = 2;
int nums[] = {1, 2, 3};
@@ -26,13 +27,10 @@
);
//]
- BOOST_CHECK(iter != end);
- BOOST_CHECK(*iter == val);
+ BOOST_TEST(iter != end);
+ BOOST_TEST(*iter == val);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // GCC
Deleted: trunk/libs/local_function/example/gcc_lambda_cxx11.cpp
==============================================================================
--- trunk/libs/local_function/example/gcc_lambda_cxx11.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
+++ (empty file)
@@ -1,37 +0,0 @@
-
-// Copyright (C) 2009-2012 Lorenzo Caminiti
-// Distributed under the Boost Software License, Version 1.0
-// (see accompanying file LICENSE_1_0.txt or a copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-// Home at http://www.boost.org/libs/local_function
-
-#include <boost/config.hpp>
-#ifndef BOOST_NO_LAMBDAS
-
-#define BOOST_TEST_MODULE TestGccLambdaCxx11
-#include <boost/test/unit_test.hpp>
-#include <algorithm>
-
-BOOST_AUTO_TEST_CASE(test_gcc_lambda_cxx11) {
- //[gcc_lambda_cxx11
- int val = 2;
- int nums[] = {1, 2, 3};
- int* end = nums + 3;
-
- int* iter = std::find_if(nums, end,
- [val](int num) -> bool {
- return num == val;
- }
- );
- //]
-
- BOOST_CHECK(iter != end);
- BOOST_CHECK(*iter == val);
-}
-
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
-
Modified: trunk/libs/local_function/example/gcc_square.cpp
==============================================================================
--- trunk/libs/local_function/example/gcc_square.cpp (original)
+++ trunk/libs/local_function/example/gcc_square.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,8 +6,7 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestGccSquare
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
int add_square(int a, int b) {
int BOOST_LOCAL_FUNCTION(int z) {
@@ -17,7 +16,8 @@
return square(a) + square(b);
}
-BOOST_AUTO_TEST_CASE(test_gcc_square) {
- BOOST_CHECK(add_square(2, 4) == 20);
+int main(void) {
+ BOOST_TEST(add_square(2, 4) == 20);
+ return boost::report_errors();
}
Modified: trunk/libs/local_function/example/gcc_store.cpp
==============================================================================
--- trunk/libs/local_function/example/gcc_store.cpp (original)
+++ trunk/libs/local_function/example/gcc_store.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -7,8 +7,7 @@
#include <boost/local_function.hpp>
#include <boost/function.hpp>
-#define BOOST_TEST_MODULE TestGccStore
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
void intermediate(boost::function<void (int, int)> store_func, int size) {
store_func(size - 1, -1);
@@ -22,12 +21,13 @@
intermediate(store, size);
}
-BOOST_AUTO_TEST_CASE(test_gcc_store) {
+int main(void) {
int nums[] = {1, 2, 3};
hack(nums, 3);
- BOOST_CHECK(nums[0] == 1);
- BOOST_CHECK(nums[1] == 2);
- BOOST_CHECK(nums[2] == -1);
+ BOOST_TEST(nums[0] == 1);
+ BOOST_TEST(nums[1] == 2);
+ BOOST_TEST(nums[2] == -1);
+ return boost::report_errors();
}
Modified: trunk/libs/local_function/example/impl_pp_keyword.cpp
==============================================================================
--- trunk/libs/local_function/example/impl_pp_keyword.cpp (original)
+++ trunk/libs/local_function/example/impl_pp_keyword.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -9,8 +9,7 @@
#include <boost/local_function/detail/preprocessor/keyword/thisunderscore.hpp>
#include <boost/local_function/detail/preprocessor/keyword/const.hpp>
#include <boost/local_function/detail/preprocessor/keyword/bind.hpp>
-#define BOOST_TEST_MODULE TestImplPpKeyword
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
// Expand to 1 if space-separated tokens end with `this_`, 0 otherwise.
#define IS_THIS_BACK(tokens) \
@@ -20,9 +19,10 @@
tokens \
)))
-BOOST_AUTO_TEST_CASE(test_impl_pp_keyword) {
- BOOST_CHECK(IS_THIS_BACK(const bind this_) == 1);
- BOOST_CHECK(IS_THIS_BACK(const bind& x) == 0);
+int main(void) {
+ BOOST_TEST(IS_THIS_BACK(const bind this_) == 1);
+ BOOST_TEST(IS_THIS_BACK(const bind& x) == 0);
+ return boost::report_errors();
}
//]
Modified: trunk/libs/local_function/example/impl_tparam_tricks.cpp
==============================================================================
--- trunk/libs/local_function/example/impl_tparam_tricks.cpp (original)
+++ trunk/libs/local_function/example/impl_tparam_tricks.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,8 +6,7 @@
// Home at http://www.boost.org/libs/local_function
//[impl_tparam_tricks
-#define BOOST_TEST_MODULE TestImplTparamTricks
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
@@ -34,7 +33,7 @@
interface* func_;
};
-BOOST_AUTO_TEST_CASE(test_impl_tparam_tricks) {
+int main(void) {
int sum = 0, factor = 10;
// Local class for local function.
@@ -66,7 +65,8 @@
std::for_each(v.begin(), v.end(), add_casting); // OK.
std::for_each(v.begin(), v.end(), add_virtual); // OK.
- BOOST_CHECK(sum == 200);
+ BOOST_TEST(sum == 200);
+ return boost::report_errors();
}
//]
Modified: trunk/libs/local_function/example/n2529_this.cpp
==============================================================================
--- trunk/libs/local_function/example/n2529_this.cpp (original)
+++ trunk/libs/local_function/example/n2529_this.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,8 +6,7 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestN2529This
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
@@ -25,7 +24,7 @@
}
};
-BOOST_AUTO_TEST_CASE(test_n2529_this) {
+int main(void) {
std::vector<int> n(3);
n[0] = 1; n[1] = 2; n[2] = 3;
@@ -35,8 +34,9 @@
v vn(n);
vn.change_sign_all(i);
- BOOST_CHECK(vn.nums.at(0) == -1);
- BOOST_CHECK(vn.nums.at(1) == 2);
- BOOST_CHECK(vn.nums.at(2) == -3);
+ BOOST_TEST(vn.nums.at(0) == -1);
+ BOOST_TEST(vn.nums.at(1) == 2);
+ BOOST_TEST(vn.nums.at(2) == -3);
+ return boost::report_errors();
}
Modified: trunk/libs/local_function/example/n2550_find_if.cpp
==============================================================================
--- trunk/libs/local_function/example/n2550_find_if.cpp (original)
+++ trunk/libs/local_function/example/n2550_find_if.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,8 +6,7 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestN2550FindIf
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
@@ -16,7 +15,7 @@
explicit employee(const int& a_salary): salary(a_salary) {}
};
-BOOST_AUTO_TEST_CASE(test_n2550_find_if) {
+int main(void) {
std::vector<employee> employees;
employees.push_back(employee(85000));
employees.push_back(employee(100000));
@@ -35,7 +34,8 @@
std::vector<employee>::iterator i = std::find_if(
employees.begin(), employees.end(), between);
- BOOST_CHECK(i != employees.end());
- BOOST_CHECK(i->salary >= min_salary && i->salary < u_limit);
+ BOOST_TEST(i != employees.end());
+ BOOST_TEST(i->salary >= min_salary && i->salary < u_limit);
+ return boost::report_errors();
}
Copied: trunk/libs/local_function/example/noncopyable_cxx11_lambda_error.cpp (from r77724, /trunk/libs/local_function/example/noncopyable_lambda_error.cpp)
==============================================================================
--- /trunk/libs/local_function/example/noncopyable_lambda_error.cpp (original)
+++ trunk/libs/local_function/example/noncopyable_cxx11_lambda_error.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,7 +6,9 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/config.hpp>
-#ifndef BOOST_NO_LAMBDAS
+#ifdef BOOST_NO_LAMBDAS
+# error "lambda functions required"
+#else
#include <boost/noncopyable.hpp>
#include <cassert>
@@ -20,8 +22,8 @@
int main(void) {
n x(-1);
- auto f = [x](void) { // Error: x is non-copyable, but if
- assert( x.i == -1 ); // bind `&x` then `x` is not constant.
+ auto f = [x](void) { // Error: x is non-copyable, but if
+ assert(x.i == -1); // bind `&x` then `x` is not constant.
};
f();
@@ -29,9 +31,5 @@
}
//]
-#else // NO_LAMBDAS
-
-#error "Trivial failure."
-
-#endif // NO_LAMBDAS
+#endif // LAMBDAS
Deleted: trunk/libs/local_function/example/noncopyable_lambda_error.cpp
==============================================================================
--- trunk/libs/local_function/example/noncopyable_lambda_error.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
+++ (empty file)
@@ -1,37 +0,0 @@
-
-// Copyright (C) 2009-2012 Lorenzo Caminiti
-// Distributed under the Boost Software License, Version 1.0
-// (see accompanying file LICENSE_1_0.txt or a copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-// Home at http://www.boost.org/libs/local_function
-
-#include <boost/config.hpp>
-#ifndef BOOST_NO_LAMBDAS
-
-#include <boost/noncopyable.hpp>
-#include <cassert>
-
-//[noncopyable_lambda_error
-struct n: boost::noncopyable {
- int i;
- n(int _i): i(_i) {}
-};
-
-int main(void) {
- n x(-1);
-
- auto f = [x](void) { // Error: x is non-copyable, but if
- assert( x.i == -1 ); // bind `&x` then `x` is not constant.
- };
- f();
-
- return 0;
-}
-//]
-
-#else // NO_LAMBDAS
-
-#error "Trivial failure."
-
-#endif // NO_LAMBDAS
-
Modified: trunk/libs/local_function/example/noncopyable_local_function.cpp
==============================================================================
--- trunk/libs/local_function/example/noncopyable_local_function.cpp (original)
+++ trunk/libs/local_function/example/noncopyable_local_function.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -19,7 +19,7 @@
n x(-1);
void BOOST_LOCAL_FUNCTION(const bind& x) { // OK: No copy
- assert( x.i == -1 ); // and constant.
+ assert(x.i == -1); // and constant.
} BOOST_LOCAL_FUNCTION_NAME(f)
f();
Modified: trunk/libs/local_function/example/phoenix_factorial.cpp
==============================================================================
--- trunk/libs/local_function/example/phoenix_factorial.cpp (original)
+++ trunk/libs/local_function/example/phoenix_factorial.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -7,8 +7,7 @@
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/function.hpp>
-#define BOOST_TEST_MODULE TestPhoenixFactorial
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
//[phoenix_factorial
struct factorial_impl { // Phoenix function from global functor.
@@ -27,14 +26,15 @@
}
};
-BOOST_AUTO_TEST_CASE(test_phoenix_factorial) {
+int main(void) {
using boost::phoenix::arg_names::arg1;
boost::phoenix::function<factorial_impl> factorial;
int i = 4;
- BOOST_CHECK(factorial(i)() == 24); // Call.
- BOOST_CHECK(factorial(arg1)(i) == 24); // Lazy call.
+ BOOST_TEST(factorial(i)() == 24); // Call.
+ BOOST_TEST(factorial(arg1)(i) == 24); // Lazy call.
+ return boost::report_errors();
}
//]
Modified: trunk/libs/local_function/example/phoenix_factorial_local.cpp
==============================================================================
--- trunk/libs/local_function/example/phoenix_factorial_local.cpp (original)
+++ trunk/libs/local_function/example/phoenix_factorial_local.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -9,11 +9,10 @@
#include <boost/function.hpp>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/function.hpp>
-#define BOOST_TEST_MODULE TestPhoenixFactorialLocal
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
//[phoenix_factorial_local
-BOOST_AUTO_TEST_CASE(test_phoenix_factorial_local) {
+int main(void) {
using boost::phoenix::arg_names::arg1;
int BOOST_LOCAL_FUNCTION(int n) { // Unfortunately, monomorphic.
@@ -24,8 +23,9 @@
factorial(factorial_impl); // Phoenix function from local function.
int i = 4;
- BOOST_CHECK(factorial(i)() == 24); // Call.
- BOOST_CHECK(factorial(arg1)(i) == 24); // Lazy call.
+ BOOST_TEST(factorial(i)() == 24); // Call.
+ BOOST_TEST(factorial(arg1)(i) == 24); // Lazy call.
+ return boost::report_errors();
}
//]
Copied: trunk/libs/local_function/example/profile_cxx11_lambda.cpp (from r77724, /trunk/libs/local_function/example/profile_lambda.cpp)
==============================================================================
--- /trunk/libs/local_function/example/profile_lambda.cpp (original)
+++ trunk/libs/local_function/example/profile_cxx11_lambda.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,7 +6,9 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/config.hpp>
-#ifndef BOOST_NO_LAMBDAS
+#ifdef BOOST_NO_LAMBDAS
+# error "lambda functions required"
+#else
#include <boost/chrono.hpp>
#include <vector>
@@ -38,9 +40,5 @@
return 0;
}
-#else // NO_LAMBDAS
-
-int main(void) { return 0; } // Trivial program.
-
-#endif // NO_LAMBDAS
+#endif // LAMBDAS
Deleted: trunk/libs/local_function/example/profile_lambda.cpp
==============================================================================
--- trunk/libs/local_function/example/profile_lambda.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
+++ (empty file)
@@ -1,46 +0,0 @@
-
-// Copyright (C) 2009-2012 Lorenzo Caminiti
-// Distributed under the Boost Software License, Version 1.0
-// (see accompanying file LICENSE_1_0.txt or a copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-// Home at http://www.boost.org/libs/local_function
-
-#include <boost/config.hpp>
-#ifndef BOOST_NO_LAMBDAS
-
-#include <boost/chrono.hpp>
-#include <vector>
-#include <algorithm>
-#include <iostream>
-#include "profile_helpers.hpp"
-
-int main(int argc, char* argv[]) {
- unsigned long size = 0, trials = 0;
- profile::args(argc, argv, size, trials);
-
- double sum = 0.0;
- int factor = 1;
-
- std::vector<double> v(size);
- std::fill(v.begin(), v.end(), 1.0);
-
- boost::chrono::duration<double> trials_sec;
- for(unsigned long i = 0; i < trials; ++i) {
- boost::chrono::system_clock::time_point start =
- boost::chrono::system_clock::now();
- std::for_each(v.begin(), v.end(), [&sum, factor](const double& num) {
- sum += factor * num;
- });
- trials_sec += boost::chrono::system_clock::now() - start;
- }
-
- profile::display(size, trials, sum, trials_sec.count());
- return 0;
-}
-
-#else // NO_LAMBDAS
-
-int main(void) { return 0; } // Trivial program.
-
-#endif // NO_LAMBDAS
-
Deleted: trunk/libs/local_function/example/profile_legend_lambda.png
==============================================================================
Binary file. No diff available.
Modified: trunk/libs/local_function/example/scope_exit.cpp
==============================================================================
--- trunk/libs/local_function/example/scope_exit.cpp (original)
+++ trunk/libs/local_function/example/scope_exit.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -10,13 +10,11 @@
#include <boost/typeof/typeof.hpp>
#include <boost/typeof/std/vector.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-#define BOOST_TEST_MODULE TestScopeExit
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <iostream>
#include <sstream>
-class person; BOOST_TYPEOF_REGISTER_TYPE(person)
class person {
friend class world;
public:
@@ -32,8 +30,8 @@
id_t id_;
evolution_t evolution_;
};
+BOOST_TYPEOF_REGISTER_TYPE(person)
-class world; BOOST_TYPEOF_REGISTER_TYPE(world)
class world {
public:
typedef unsigned int id_t;
@@ -53,6 +51,7 @@
id_t next_id_;
std::vector<person> persons_;
};
+BOOST_TYPEOF_REGISTER_TYPE(world)
void world::add_person(person const& a_person) {
persons_.push_back(a_person);
@@ -87,17 +86,17 @@
checkpoint = ++p.evolution_;
}
-BOOST_AUTO_TEST_CASE(test_scope_exit) {
+int main(void) {
person adam, eva;
std::ostringstream oss;
oss << adam;
std::cout << oss.str() << std::endl;
- BOOST_CHECK(oss.str() == "person(0, 0)");
+ BOOST_TEST(oss.str() == "person(0, 0)");
oss.str("");
oss << eva;
std::cout << oss.str() << std::endl;
- BOOST_CHECK(oss.str() == "person(0, 0)");
+ BOOST_TEST(oss.str() == "person(0, 0)");
world w;
w.add_person(adam);
@@ -105,6 +104,7 @@
oss.str("");
oss << w;
std::cout << oss.str() << std::endl;
- BOOST_CHECK(oss.str() == "world(3, { person(1, 2), person(2, 2), })");
+ BOOST_TEST(oss.str() == "world(3, { person(1, 2), person(2, 2), })");
+ return boost::report_errors();
}
Modified: trunk/libs/local_function/test/Jamfile.v2
==============================================================================
--- trunk/libs/local_function/test/Jamfile.v2 (original)
+++ trunk/libs/local_function/test/Jamfile.v2 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -7,55 +7,42 @@
import testing ;
-project : requirements <library>/boost//unit_test_framework ;
-
-# Run variadic and sequence syntax (also forcing no variadic macros).
-rule run-vaseq ( file_name )
+rule vaseq ( command target )
{
- run $(file_name).cpp ;
- run $(file_name)_seq.cpp ;
- run $(file_name)_seq.cpp : : : <define>BOOST_NO_VARIADIC_MACROS :
- $(file_name)_seq_nova : ;
+ $(command) $(target).cpp ;
+ $(command) $(target)_seq.cpp ;
+ $(command) $(target)_seq_nova.cpp ;
}
-# Compile-fail variadic and sequence syntax (also forcing no variadic macros).
-rule compile-fail-vaseq ( file_name )
-{
- compile-fail $(file_name).cpp ;
- compile-fail $(file_name)_seq.cpp ;
- compile-fail $(file_name)_seq.cpp : <define>BOOST_NO_VARIADIC_MACROS :
- $(file_name)_seq_nova ;
-}
+vaseq run add ;
+vaseq run add_classifiers ;
+vaseq run add_default ;
+vaseq run add_except ;
+vaseq run add_inline ;
+vaseq run add_params_only ;
+vaseq run add_template ;
+vaseq run add_this ;
+vaseq run add_typed ;
+vaseq run add_with_default ;
+vaseq run all_decl ;
+vaseq run factorial ;
+vaseq run goto ;
+vaseq compile-fail goto_error ;
+vaseq run macro_commas ;
+vaseq run nesting ;
+vaseq run operator ;
+vaseq compile-fail operator_error ;
+vaseq run overload ;
+vaseq run return_assign ;
+vaseq run return_derivative ;
+vaseq run return_inc ;
+vaseq run return_setget ;
+vaseq run return_this ;
+vaseq run same_line ;
+vaseq run transform ;
+vaseq run typeof ;
+vaseq run typeof_template ;
-run-vaseq add ;
-run-vaseq add_classifiers ;
-run-vaseq add_default ;
-run-vaseq add_except ;
-run-vaseq add_inline ;
-run add_lambda.cpp ;
-run-vaseq add_params_only ;
-run-vaseq add_template ;
-run-vaseq add_this ;
-run-vaseq add_typed ;
-run-vaseq add_with_default ;
-run-vaseq all_decl ;
-run-vaseq factorial ;
-run-vaseq goto ;
-compile-fail-vaseq goto_error ;
-run-vaseq macro_commas ;
-run-vaseq nesting ;
-run-vaseq operator ;
-compile-fail-vaseq operator_error ;
-run-vaseq overload ;
-run-vaseq return_assign ;
-run-vaseq return_derivative ;
-run-vaseq return_inc ;
-run-vaseq return_setget ;
-run-vaseq return_this ;
-run-vaseq same_line ;
run ten_void.cpp ;
-run ten_void.cpp : : : <define>BOOST_NO_VARIADIC_MACROS : ten_void_nova : ;
-run-vaseq transform ;
-run-vaseq typeof ;
-run-vaseq typeof_template ;
+run ten_void_nova.cpp ;
Modified: trunk/libs/local_function/test/add.cpp
==============================================================================
--- trunk/libs/local_function/test/add.cpp (original)
+++ trunk/libs/local_function/test/add.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,16 +6,16 @@
// 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 TestAdd
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
-BOOST_AUTO_TEST_CASE(test_add)
//[add
-{ // Some local scope.
+int main(void) { // Some local scope.
int sum = 0, factor = 10; // Variables in scope to bind.
void BOOST_LOCAL_FUNCTION(const bind factor, bind& sum, int num) {
@@ -26,13 +26,10 @@
int nums[] = {2, 3};
std::for_each(nums, nums + 2, add); // Pass it to an algorithm.
- BOOST_CHECK(sum == 60); // Assert final summation value.
+ BOOST_TEST(sum == 60); // Assert final summation value.
+ return boost::report_errors();
}
//]
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/add_classifiers.cpp
==============================================================================
--- trunk/libs/local_function/test/add_classifiers.cpp (original)
+++ trunk/libs/local_function/test/add_classifiers.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,25 +6,25 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/config.hpp>
-#if defined(BOOST_NO_AUTO_DECLARATIONS) && !defined(BOOST_NO_VARIADIC_MACROS)
+#if !defined(BOOST_NO_AUTO_DECLARATIONS)
+# error "auto-declarations not allowed (using `auto` as storage classifier)"
+#elif defined(BOOST_NO_VARIADIC_MACROS)
+# error "variadic macros required"
+#else
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestAddClassifiers
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
-BOOST_AUTO_TEST_CASE(test_add_classifiers) {
+int main(void) {
//[add_classifiers
int BOOST_LOCAL_FUNCTION(auto int x, register int y) { // Classifiers.
return x + y;
} BOOST_LOCAL_FUNCTION_NAME(add)
//]
- BOOST_CHECK(add(1, 2) == 3);
+ BOOST_TEST(add(1, 2) == 3);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // AUTO_DECLARATIONS && VARIADIC_MACROS
Modified: trunk/libs/local_function/test/add_classifiers_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/add_classifiers_seq.cpp (original)
+++ trunk/libs/local_function/test/add_classifiers_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,23 +6,21 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/config.hpp>
-#ifdef BOOST_NO_AUTO_DECLARATIONS
+#ifndef BOOST_NO_AUTO_DECLARATIONS
+# error "auto-declarations not allowed (using `auto` as storage classifier)"
+#else
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestAddClassifiersSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
-BOOST_AUTO_TEST_CASE(test_add_classifiers_seq) {
+int main(void) {
int BOOST_LOCAL_FUNCTION( (auto int x) (register int y) ) {
return x + y;
} BOOST_LOCAL_FUNCTION_NAME(add)
- BOOST_CHECK(add(1, 2) == 3);
+ BOOST_TEST(add(1, 2) == 3);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // AUTO_DECLARATIONS
Added: trunk/libs/local_function/test/add_classifiers_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_classifiers_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "add_classifiers_seq.cpp"
+
Modified: trunk/libs/local_function/test/add_default.cpp
==============================================================================
--- trunk/libs/local_function/test/add_default.cpp (original)
+++ trunk/libs/local_function/test/add_default.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,25 +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 TestAddDefault
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
-BOOST_AUTO_TEST_CASE(test_add_default) {
+int main(void) {
//[add_default
- int BOOST_LOCAL_FUNCTION(int x, int y, default 2) { // Default.
+ int BOOST_LOCAL_FUNCTION(int x, int y, default 2) { // Default parameter.
return x + y;
} BOOST_LOCAL_FUNCTION_NAME(add)
- BOOST_CHECK(add(1) == 3);
+ BOOST_TEST(add(1) == 3);
//]
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/add_default_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/add_default_seq.cpp (original)
+++ trunk/libs/local_function/test/add_default_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,14 +6,14 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestAddDefaultSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
-BOOST_AUTO_TEST_CASE(test_add_default_seq) {
+int main(void) {
int BOOST_LOCAL_FUNCTION( (int x) (int y)(default 2) ) {
return x + y;
} BOOST_LOCAL_FUNCTION_NAME(add)
- BOOST_CHECK(add(1) == 3);
+ BOOST_TEST(add(1) == 3);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/add_default_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_default_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "add_default_seq.cpp"
+
Modified: trunk/libs/local_function/test/add_except.cpp
==============================================================================
--- trunk/libs/local_function/test/add_except.cpp (original)
+++ trunk/libs/local_function/test/add_except.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,13 +6,14 @@
// 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 TestAddExcept
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
-BOOST_AUTO_TEST_CASE(test_except) {
+int main(void) {
//[add_except
double sum = 0.0;
int factor = 10;
@@ -25,12 +26,9 @@
add(100);
//]
- BOOST_CHECK(sum == 1000);
+ BOOST_TEST(sum == 1000);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; }
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/add_except_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/add_except_seq.cpp (original)
+++ trunk/libs/local_function/test/add_except_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,10 +6,9 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestAddExceptSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
-BOOST_AUTO_TEST_CASE(test_except_seq) {
+int main(void) {
double sum = 0.0;
int factor = 10;
@@ -20,6 +19,7 @@
add(100);
- BOOST_CHECK(sum == 1000);
+ BOOST_TEST(sum == 1000);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/add_except_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_except_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "add_except_seq.cpp"
+
Modified: trunk/libs/local_function/test/add_inline.cpp
==============================================================================
--- trunk/libs/local_function/test/add_inline.cpp (original)
+++ trunk/libs/local_function/test/add_inline.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,15 +6,16 @@
// 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 TestAddInline
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
-BOOST_AUTO_TEST_CASE(test_add_inline) {
+int main(void) {
//[add_inline
int sum = 0, factor = 10;
@@ -28,12 +29,9 @@
for(size_t i = 0; i < v.size(); ++i) add(v[i]); // Cannot use for_each.
//]
- BOOST_CHECK(sum == 1000);
+ BOOST_TEST(sum == 1000);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/add_inline_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/add_inline_seq.cpp (original)
+++ trunk/libs/local_function/test/add_inline_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,12 +6,11 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestAddInlineSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
-BOOST_AUTO_TEST_CASE(test_add_inline_seq) {
+int main(void) {
int sum = 0, factor = 10;
void BOOST_LOCAL_FUNCTION( (const bind factor) (bind& sum) (int num) ) {
@@ -23,6 +22,7 @@
for(size_t i = 0; i < v.size(); ++i) add(v[i]);
- BOOST_CHECK(sum == 1000);
+ BOOST_TEST(sum == 1000);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/add_inline_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_inline_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "add_inline_seq.cpp"
+
Deleted: trunk/libs/local_function/test/add_lambda.cpp
==============================================================================
--- trunk/libs/local_function/test/add_lambda.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
+++ (empty file)
@@ -1,37 +0,0 @@
-
-// Copyright (C) 2009-2012 Lorenzo Caminiti
-// Distributed under the Boost Software License, Version 1.0
-// (see accompanying file LICENSE_1_0.txt or a copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-// Home at http://www.boost.org/libs/local_function
-
-#include <boost/config.hpp>
-#ifndef BOOST_NO_LAMBDAS
-
-#define BOOST_TEST_MODULE TestAddLambda
-#include <boost/test/unit_test.hpp>
-#include <algorithm>
-
-BOOST_AUTO_TEST_CASE( test_add_lambda )
-//[add_lambda
-{ // Some local scope.
- int sum = 0, factor = 10; // Variables in scope to bind.
-
- auto add = [factor, &sum](int num) { // C++11 only.
- sum += factor * num;
- };
-
- add(1); // Call the lambda.
- int nums[] = {2, 3};
- std::for_each(nums, nums + 2, add); // Pass it to an algorithm.
-
- BOOST_CHECK(sum == 60); // Assert final summation value.
-}
-//]
-
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
-
Modified: trunk/libs/local_function/test/add_params_only.cpp
==============================================================================
--- trunk/libs/local_function/test/add_params_only.cpp (original)
+++ trunk/libs/local_function/test/add_params_only.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,25 +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 TestAddParamsOnly
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
-BOOST_AUTO_TEST_CASE(test_add_params_only) {
+int main(void) {
//[add_params_only
int BOOST_LOCAL_FUNCTION(int x, int y) { // Local function.
return x + y;
} BOOST_LOCAL_FUNCTION_NAME(add)
- BOOST_CHECK(add(1, 2) == 3); // Local function call.
+ BOOST_TEST(add(1, 2) == 3); // Local function call.
//]
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/add_params_only_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/add_params_only_seq.cpp (original)
+++ trunk/libs/local_function/test/add_params_only_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,14 +6,14 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestAddParamsOnlySeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
-BOOST_AUTO_TEST_CASE(test_add_params_only_seq) {
+int main(void) {
int BOOST_LOCAL_FUNCTION( (int x) (int y) ) {
return x + y;
} BOOST_LOCAL_FUNCTION_NAME(add)
- BOOST_CHECK(add(1, 2) == 3);
+ BOOST_TEST(add(1, 2) == 3);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/add_params_only_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_params_only_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "add_params_only_seq.cpp"
+
Modified: trunk/libs/local_function/test/add_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/add_seq.cpp (original)
+++ trunk/libs/local_function/test/add_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,13 +6,11 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestAddSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
-BOOST_AUTO_TEST_CASE(test_add_seq)
//[add_seq
-{
+int main(void) {
int sum = 0, factor = 10;
void BOOST_LOCAL_FUNCTION( (const bind factor) (bind& sum) (int num) ) {
@@ -23,7 +21,8 @@
int nums[] = {2, 3};
std::for_each(nums, nums + 2, add);
- BOOST_CHECK(sum == 60);
+ BOOST_TEST(sum == 60);
+ return boost::report_errors();
}
//]
Added: trunk/libs/local_function/test/add_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "add_seq.cpp"
+
Modified: trunk/libs/local_function/test/add_template.cpp
==============================================================================
--- trunk/libs/local_function/test/add_template.cpp (original)
+++ trunk/libs/local_function/test/add_template.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,11 +6,12 @@
// 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 TestAddTemplate
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
//[add_template
@@ -31,13 +32,10 @@
}
//]
-BOOST_AUTO_TEST_CASE(test_add_template) {
- BOOST_CHECK(total(1, 2, 3) == 60);
+int main(void) {
+ BOOST_TEST(total(1, 2, 3) == 60);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; }
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/add_template_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/add_template_seq.cpp (original)
+++ trunk/libs/local_function/test/add_template_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,8 +6,7 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestAddTemplateSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
template<typename T>
@@ -25,7 +24,8 @@
return sum;
}
-BOOST_AUTO_TEST_CASE(test_add_template_seq) {
- BOOST_CHECK(total(1, 2, 3) == 60);
+int main(void) {
+ BOOST_TEST(total(1, 2, 3) == 60);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/add_template_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_template_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "add_template_seq.cpp"
+
Modified: trunk/libs/local_function/test/add_this.cpp
==============================================================================
--- trunk/libs/local_function/test/add_this.cpp (original)
+++ trunk/libs/local_function/test/add_this.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,11 +6,12 @@
// 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 TestAddThis
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
@@ -33,16 +34,13 @@
};
//]
-BOOST_AUTO_TEST_CASE(test_add_this) {
+int main(void) {
std::vector<int> v(3);
v[0] = 1; v[1] = 2; v[2] = 3;
- BOOST_CHECK(adder().sum(v) == 60);
+ BOOST_TEST(adder().sum(v) == 60);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/add_this_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/add_this_seq.cpp (original)
+++ trunk/libs/local_function/test/add_this_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,8 +6,7 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestAddThisSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
@@ -29,10 +28,11 @@
int sum_;
};
-BOOST_AUTO_TEST_CASE(test_add_this_seq) {
+int main(void) {
std::vector<int> v(3);
v[0] = 1; v[1] = 2; v[2] = 3;
- BOOST_CHECK(adder().sum(v) == 60);
+ BOOST_TEST(adder().sum(v) == 60);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/add_this_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_this_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "add_this_seq.cpp"
+
Modified: trunk/libs/local_function/test/add_typed.cpp
==============================================================================
--- trunk/libs/local_function/test/add_typed.cpp (original)
+++ trunk/libs/local_function/test/add_typed.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,11 +6,12 @@
// 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 TestAddTyped
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
@@ -34,16 +35,13 @@
};
//]
-BOOST_AUTO_TEST_CASE(test_add_typed) {
+int main(void) {
std::vector<int> v(3);
v[0] = 1; v[1] = 2; v[2] = 3;
- BOOST_CHECK(adder().sum(v) == 60);
+ BOOST_TEST(adder().sum(v) == 60);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/add_typed_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/add_typed_seq.cpp (original)
+++ trunk/libs/local_function/test/add_typed_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,8 +6,7 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestAddTypedSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
@@ -28,10 +27,11 @@
int sum_;
};
-BOOST_AUTO_TEST_CASE(test_add_typed_seq) {
+int main(void) {
std::vector<int> v(3);
v[0] = 1; v[1] = 2; v[2] = 3;
- BOOST_CHECK(adder().sum(v) == 60);
+ BOOST_TEST(adder().sum(v) == 60);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/add_typed_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_typed_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "add_typed_seq.cpp"
+
Modified: trunk/libs/local_function/test/add_with_default.cpp
==============================================================================
--- trunk/libs/local_function/test/add_with_default.cpp (original)
+++ trunk/libs/local_function/test/add_with_default.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,29 +6,27 @@
// 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 TestAddWithDefault
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
//[add_with_default_macro
#define WITH_DEFAULT , default
//]
-BOOST_AUTO_TEST_CASE(test_add_with_default) {
+int main(void) {
//[add_with_default
int BOOST_LOCAL_FUNCTION(int x, int y WITH_DEFAULT 2) { // Default.
return x + y;
} BOOST_LOCAL_FUNCTION_NAME(add)
- BOOST_CHECK(add(1) == 3);
+ BOOST_TEST(add(1) == 3);
//]
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/add_with_default_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/add_with_default_seq.cpp (original)
+++ trunk/libs/local_function/test/add_with_default_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,16 +6,16 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestAddWithDefaultSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#define WITH_DEFAULT )(default
-BOOST_AUTO_TEST_CASE(test_add_with_default_seq) {
+int main(void) {
int BOOST_LOCAL_FUNCTION( (int x) (int y WITH_DEFAULT 2) ) {
return x + y;
} BOOST_LOCAL_FUNCTION_NAME(add)
- BOOST_CHECK(add(1) == 3);
+ BOOST_TEST(add(1) == 3);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/add_with_default_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_with_default_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "add_with_default_seq.cpp"
+
Modified: trunk/libs/local_function/test/all_decl.cpp
==============================================================================
--- trunk/libs/local_function/test/all_decl.cpp (original)
+++ trunk/libs/local_function/test/all_decl.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,7 +6,9 @@
// 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>
@@ -166,9 +168,5 @@
return 0;
}
-#else
-
-int main(void) { return 0; }
-
-#endif
+#endif // VARIADIC_MACROS
Added: trunk/libs/local_function/test/all_decl_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/all_decl_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "all_decl_seq.cpp"
+
Modified: trunk/libs/local_function/test/factorial.cpp
==============================================================================
--- trunk/libs/local_function/test/factorial.cpp (original)
+++ trunk/libs/local_function/test/factorial.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,11 +6,12 @@
// 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 TestFactorial
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
#include <vector>
@@ -35,20 +36,17 @@
};
//]
-BOOST_AUTO_TEST_CASE(test_factorial) {
+int main(void) {
std::vector<int> v(3);
v[0] = 1; v[1] = 3; v[2] = 4;
calculator calc;
calc.factorials(v);
- BOOST_CHECK(calc.results[0] == 1);
- BOOST_CHECK(calc.results[1] == 6);
- BOOST_CHECK(calc.results[2] == 24);
+ BOOST_TEST(calc.results[0] == 1);
+ BOOST_TEST(calc.results[1] == 6);
+ BOOST_TEST(calc.results[2] == 24);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/factorial_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/factorial_seq.cpp (original)
+++ trunk/libs/local_function/test/factorial_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,8 +6,7 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestFactorialSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
#include <vector>
@@ -30,14 +29,15 @@
}
};
-BOOST_AUTO_TEST_CASE(test_factorial_seq) {
+int main(void) {
std::vector<int> v(3);
v[0] = 1; v[1] = 3; v[2] = 4;
calculator calc;
calc.factorials(v);
- BOOST_CHECK(calc.results[0] == 1);
- BOOST_CHECK(calc.results[1] == 6);
- BOOST_CHECK(calc.results[2] == 24);
+ BOOST_TEST(calc.results[0] == 1);
+ BOOST_TEST(calc.results[1] == 6);
+ BOOST_TEST(calc.results[2] == 24);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/factorial_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/factorial_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "factorial_seq.cpp"
+
Modified: trunk/libs/local_function/test/goto.cpp
==============================================================================
--- trunk/libs/local_function/test/goto.cpp (original)
+++ trunk/libs/local_function/test/goto.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,11 +6,11 @@
// 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 TestGoto
-#include <boost/test/unit_test.hpp>
//[goto
int error(int x, int y) {
@@ -25,13 +25,10 @@
}
//]
-BOOST_AUTO_TEST_CASE(test_goto) {
+int main(void) {
error(1, 2);
+ return 0;
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/goto_error.cpp
==============================================================================
--- trunk/libs/local_function/test/goto_error.cpp (original)
+++ trunk/libs/local_function/test/goto_error.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,11 +6,11 @@
// 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 TestGotoError
-#include <boost/test/unit_test.hpp>
//[goto_error
int error(int x, int y) {
@@ -27,13 +27,10 @@
}
//]
-BOOST_AUTO_TEST_CASE(test_goto_error) {
+int main(void) {
error(1, 2);
+ return 0;
}
-#else
-
-#error "Trivial error."
-
#endif
Modified: trunk/libs/local_function/test/goto_error_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/goto_error_seq.cpp (original)
+++ trunk/libs/local_function/test/goto_error_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,8 +6,6 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestGotoErrorSeq
-#include <boost/test/unit_test.hpp>
int error(int x, int y) {
int BOOST_LOCAL_FUNCTION( (int x) ) {
@@ -22,7 +20,8 @@
return -1;
}
-BOOST_AUTO_TEST_CASE(test_goto_error_seq) {
+int main(void) {
error(1, 2);
+ return 0;
}
Added: trunk/libs/local_function/test/goto_error_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/goto_error_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "goto_error_seq.cpp"
+
Modified: trunk/libs/local_function/test/goto_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/goto_seq.cpp (original)
+++ trunk/libs/local_function/test/goto_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,8 +6,6 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestGotoSeq
-#include <boost/test/unit_test.hpp>
int error(int x, int y) {
int BOOST_LOCAL_FUNCTION( (int x) ) {
@@ -20,7 +18,8 @@
return validate(x + y);
}
-BOOST_AUTO_TEST_CASE(test_goto_seq) {
+int main(void) {
error(1, 2);
+ return 0;
}
Added: trunk/libs/local_function/test/goto_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/goto_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "goto_seq.cpp"
+
Modified: trunk/libs/local_function/test/macro_commas.cpp
==============================================================================
--- trunk/libs/local_function/test/macro_commas.cpp (original)
+++ trunk/libs/local_function/test/macro_commas.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,13 +6,12 @@
// 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>
#include <boost/utility/identity_type.hpp>
-#include <boost/config.hpp>
-#define BOOST_TEST_MODULE TestMacroCommas
-#include <boost/test/unit_test.hpp>
#include <map>
#include <string>
@@ -25,7 +24,7 @@
typedef int sign_t;
-BOOST_AUTO_TEST_CASE(test_macro_commas) {
+int main(void) {
//[macro_commas
void BOOST_LOCAL_FUNCTION(
BOOST_IDENTITY_TYPE((const std::map<std::string, size_t>&)) m,
@@ -41,11 +40,8 @@
std::map<std::string, size_t> m;
::sign_t sign = -1;
f(m, sign);
+ return 0;
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/macro_commas_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/macro_commas_seq.cpp (original)
+++ trunk/libs/local_function/test/macro_commas_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -8,8 +8,6 @@
#include <boost/local_function.hpp>
#include <boost/utility/identity_type.hpp>
#include <boost/config.hpp>
-#define BOOST_TEST_MODULE TestMacroCommasSeq
-#include <boost/test/unit_test.hpp>
#include <map>
#include <string>
@@ -22,7 +20,7 @@
typedef int sign_t;
-BOOST_AUTO_TEST_CASE(test_macro_commas_seq) {
+int main(void) {
void BOOST_LOCAL_FUNCTION(
(BOOST_IDENTITY_TYPE((const std::map<std::string, size_t>&)) m)
(BOOST_IDENTITY_TYPE((::sign_t)) sign)
@@ -36,5 +34,6 @@
std::map<std::string, size_t> m;
::sign_t sign = -1;
f(m, sign);
+ return 0;
}
Added: trunk/libs/local_function/test/macro_commas_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/macro_commas_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "macro_commas_seq.cpp"
+
Modified: trunk/libs/local_function/test/nesting.cpp
==============================================================================
--- trunk/libs/local_function/test/nesting.cpp (original)
+++ trunk/libs/local_function/test/nesting.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,13 +6,14 @@
// 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 TestNesting
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
-BOOST_AUTO_TEST_CASE(test_nesting) {
+int main(void) {
//[nesting
int x = 0;
@@ -28,12 +29,9 @@
f();
//]
- BOOST_CHECK(x == 0);
+ BOOST_TEST(x == 0);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/nesting_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/nesting_seq.cpp (original)
+++ trunk/libs/local_function/test/nesting_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,10 +6,9 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestNestingSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
-BOOST_AUTO_TEST_CASE(test_nesting_seq) {
+int main(void) {
int x = 0;
void BOOST_LOCAL_FUNCTION( (bind& x) ) {
@@ -23,6 +22,7 @@
f();
- BOOST_CHECK(x == 0);
+ BOOST_TEST(x == 0);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/nesting_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/nesting_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "nesting_seq.cpp"
+
Added: trunk/libs/local_function/test/nova.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/nova.hpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,21 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#ifndef NOVA_HPP_
+#define NOVA_HPP_
+
+#include <boost/config.hpp>
+
+// WARNING: This file must be included first in each compilation unit.
+
+// Force no variadic macros but avoiding macro redefinition warning/error.
+#ifndef BOOST_NO_VARIADIC_MACROS
+# define BOOST_NO_VARIADIC_MACROS
+#endif
+
+#endif // #include guard
+
Modified: trunk/libs/local_function/test/operator.cpp
==============================================================================
--- trunk/libs/local_function/test/operator.cpp (original)
+++ trunk/libs/local_function/test/operator.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,11 +6,12 @@
// 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 TestOperator
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
//[operator
struct point {
@@ -18,20 +19,17 @@
int y;
};
-BOOST_AUTO_TEST_CASE(test_operator) {
+int main(void) {
bool BOOST_LOCAL_FUNCTION(const point& p, const point& q) {
return p.x == q.x && p.y == q.y;
} BOOST_LOCAL_FUNCTION_NAME(equal) // OK: not using `operator...`.
point a; a.x = 1; a.y = 2;
point b = a;
- BOOST_CHECK(equal(a, b));
+ BOOST_TEST(equal(a, b));
+ return boost::report_errors();
}
//]
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/operator_error.cpp
==============================================================================
--- trunk/libs/local_function/test/operator_error.cpp (original)
+++ trunk/libs/local_function/test/operator_error.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,11 +6,12 @@
// 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 TestOperatorError
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
//[operator_error
struct point {
@@ -25,13 +26,10 @@
point a; a.x = 1; a.y = 2;
point b = a;
- BOOST_CHECK(a == b);
+ BOOST_TEST(a == b);
+ return boost::report_errors();
}
//]
-#else
-
-#error "Trivial error."
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/operator_error_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/operator_error_seq.cpp (original)
+++ trunk/libs/local_function/test/operator_error_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,21 +6,21 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestOperatorErrorSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
struct point {
int x;
int y;
};
-BOOST_AUTO_TEST_CASE(test_operator_error_seq) {
+int main(void) {
bool BOOST_LOCAL_FUNCTION( (const point& p) (const point& q) ) {
return p.x == q.x && p.y == q.y;
} BOOST_LOCAL_FUNCTION_NAME(operator==)
point a; a.x = 1; a.y = 2;
point b = a;
- BOOST_CHECK(a == b);
+ BOOST_TEST(a == b);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/operator_error_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/operator_error_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "operator_error_seq.cpp"
+
Modified: trunk/libs/local_function/test/operator_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/operator_seq.cpp (original)
+++ trunk/libs/local_function/test/operator_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,21 +6,21 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestOperatorSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
struct point {
int x;
int y;
};
-BOOST_AUTO_TEST_CASE(test_operator_seq) {
+int main(void) {
bool BOOST_LOCAL_FUNCTION( (const point& p) (const point& q) ) {
return p.x == q.x && p.y == q.y;
} BOOST_LOCAL_FUNCTION_NAME(equal)
point a; a.x = 1; a.y = 2;
point b = a;
- BOOST_CHECK(equal(a, b));
+ BOOST_TEST(equal(a, b));
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/operator_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/operator_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "operator_seq.cpp"
+
Modified: trunk/libs/local_function/test/overload.cpp
==============================================================================
--- trunk/libs/local_function/test/overload.cpp (original)
+++ trunk/libs/local_function/test/overload.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,19 +6,20 @@
// 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>
#include <boost/functional/overloaded_function.hpp> // For overloading.
-#define BOOST_TEST_MODULE TestOverload
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <string>
#include <cmath>
//[overload
int add_i(int x, int y) { return x + y; }
-BOOST_AUTO_TEST_CASE(test_overload) {
+int main(void) {
std::string s = "abc";
std::string BOOST_LOCAL_FUNCTION(
const bind& s, const std::string& x) {
@@ -37,16 +38,12 @@
, int (int, int)
> add(add_s, add_d, add_d, add_i); // Overloaded function object.
- BOOST_CHECK(add("xyz") == "abcxyz"); // Call `add_s`.
- BOOST_CHECK(fabs(add(3.21) - 4.44) < 0.001); // Call `add_d` (no default).
- BOOST_CHECK(fabs(add(3.21, 40.0) - 44.44) < 0.001); // Call `add_d`.
- BOOST_CHECK(add(1, 2) == 3); // Call `add_i`.
+ BOOST_TEST(add("xyz") == "abcxyz"); // Call `add_s`.
+ BOOST_TEST(fabs(add(3.21) - 4.44) < 0.001); // Call `add_d` (no default).
+ BOOST_TEST(fabs(add(3.21, 40.0) - 44.44) < 0.001); // Call `add_d`.
+ BOOST_TEST(add(1, 2) == 3); // Call `add_i`.
+ return boost::report_errors();
}
-//]
-
-#else
-
-int main(void) { return 0; } // Trivial test.
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/overload_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/overload_seq.cpp (original)
+++ trunk/libs/local_function/test/overload_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -7,14 +7,13 @@
#include <boost/local_function.hpp>
#include <boost/functional/overloaded_function.hpp>
-#define BOOST_TEST_MODULE TestOverloadSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <string>
#include <cmath>
int add_i(int x, int y) { return x + y; }
-BOOST_AUTO_TEST_CASE(test_overload_seq) {
+int main(void) {
std::string s = "abc";
std::string BOOST_LOCAL_FUNCTION(
(const bind& s) (const std::string& x) ) {
@@ -34,9 +33,10 @@
, int (int, int)
> add(add_s, add_d, add_d, add_i);
- BOOST_CHECK(add("xyz") == "abcxyz");
- BOOST_CHECK(fabs(add(3.21) - 4.44) < 0.001);
- BOOST_CHECK(fabs(add(3.21, 40.0) - 44.44) < 0.001);
- BOOST_CHECK(add(1, 2) == 3);
+ BOOST_TEST(add("xyz") == "abcxyz");
+ BOOST_TEST(fabs(add(3.21) - 4.44) < 0.001);
+ BOOST_TEST(fabs(add(3.21, 40.0) - 44.44) < 0.001);
+ BOOST_TEST(add(1, 2) == 3);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/overload_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/overload_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "overload_seq.cpp"
+
Modified: trunk/libs/local_function/test/return_assign.cpp
==============================================================================
--- trunk/libs/local_function/test/return_assign.cpp (original)
+++ trunk/libs/local_function/test/return_assign.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,17 +6,18 @@
// 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>
#include <boost/function.hpp>
-#define BOOST_TEST_MODULE TestReturnAssign
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <iostream>
//[return_assign
-void call1(boost::function<int (int) > f) { BOOST_CHECK(f(1) == 5); }
-void call0(boost::function<int (void)> f) { BOOST_CHECK(f() == 5); }
+void call1(boost::function<int (int) > f) { BOOST_TEST(f(1) == 5); }
+void call0(boost::function<int (void)> f) { BOOST_TEST(f() == 5); }
boost::function<int (int, int)> linear(const int& slope) {
int BOOST_LOCAL_FUNCTION(const bind& slope,
@@ -25,7 +26,7 @@
} BOOST_LOCAL_FUNCTION_NAME(lin)
boost::function<int (int, int)> f = lin; // Assign to local variable.
- BOOST_CHECK(f(1, 2) == 5);
+ BOOST_TEST(f(1, 2) == 5);
call1(lin); // Pass to other functions.
call0(lin);
@@ -35,17 +36,14 @@
void call(void) {
boost::function<int (int, int)> f = linear(2);
- BOOST_CHECK(f(1, 2) == 5);
+ BOOST_TEST(f(1, 2) == 5);
}
//]
-BOOST_AUTO_TEST_CASE(test_return_assign) {
+int main(void) {
call();
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/return_assign_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/return_assign_seq.cpp (original)
+++ trunk/libs/local_function/test/return_assign_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -7,12 +7,11 @@
#include <boost/local_function.hpp>
#include <boost/function.hpp>
-#define BOOST_TEST_MODULE TestReturnAssignSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <iostream>
-void call1(boost::function<int (int) > f) { BOOST_CHECK(f(1) == 5); }
-void call0(boost::function<int (void)> f) { BOOST_CHECK(f() == 5); }
+void call1(boost::function<int (int) > f) { BOOST_TEST(f(1) == 5); }
+void call0(boost::function<int (void)> f) { BOOST_TEST(f() == 5); }
boost::function<int (int, int)> linear(const int& slope) {
int BOOST_LOCAL_FUNCTION( (const bind& slope)
@@ -21,7 +20,7 @@
} BOOST_LOCAL_FUNCTION_NAME(lin)
boost::function<int (int, int)> f = lin;
- BOOST_CHECK(f(1, 2) == 5);
+ BOOST_TEST(f(1, 2) == 5);
call1(lin);
call0(lin);
@@ -31,10 +30,11 @@
void call(void) {
boost::function<int (int, int)> f = linear(2);
- BOOST_CHECK(f(1, 2) == 5);
+ BOOST_TEST(f(1, 2) == 5);
}
-BOOST_AUTO_TEST_CASE(test_return_assign_seq) {
+int main(void) {
call();
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/return_assign_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/return_assign_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "return_assign_seq.cpp"
+
Modified: trunk/libs/local_function/test/return_derivative.cpp
==============================================================================
--- trunk/libs/local_function/test/return_derivative.cpp (original)
+++ trunk/libs/local_function/test/return_derivative.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,12 +6,13 @@
// 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>
#include <boost/function.hpp>
-#define BOOST_TEST_MODULE TestReturnDerivative
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
boost::function<int (int)> derivative(boost::function<int (int)>& f, int dx) {
int BOOST_LOCAL_FUNCTION(bind& f, const bind dx, int x) {
@@ -21,7 +22,7 @@
return deriv;
}
-BOOST_AUTO_TEST_CASE(test_return_derivative) {
+int main(void) {
int BOOST_LOCAL_FUNCTION(int x) {
return x + 4;
} BOOST_LOCAL_FUNCTION_NAME(add2)
@@ -29,12 +30,9 @@
boost::function<int (int)> a2 = add2; // Reference valid where closure used.
boost::function<int (int)> d2 = derivative(a2, 2);
- BOOST_CHECK(d2(6) == 1);
+ BOOST_TEST(d2(6) == 1);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/return_derivative_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/return_derivative_seq.cpp (original)
+++ trunk/libs/local_function/test/return_derivative_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -7,8 +7,7 @@
#include <boost/local_function.hpp>
#include <boost/function.hpp>
-#define BOOST_TEST_MODULE TestReturnDerivativeSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
boost::function<int (int)> derivative(boost::function<int (int)>& f, int dx) {
int BOOST_LOCAL_FUNCTION( (bind& f) (const bind dx) (int x) ) {
@@ -18,7 +17,7 @@
return deriv;
}
-BOOST_AUTO_TEST_CASE(test_return_derivative_seq) {
+int main(void) {
int BOOST_LOCAL_FUNCTION( (int x) ) {
return x + 4;
} BOOST_LOCAL_FUNCTION_NAME(add2)
@@ -26,6 +25,7 @@
boost::function<int (int)> a2 = add2;
boost::function<int (int)> d2 = derivative(a2, 2);
- BOOST_CHECK(d2(6) == 1);
+ BOOST_TEST(d2(6) == 1);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/return_derivative_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/return_derivative_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "return_derivative_seq.cpp"
+
Modified: trunk/libs/local_function/test/return_inc.cpp
==============================================================================
--- trunk/libs/local_function/test/return_inc.cpp (original)
+++ trunk/libs/local_function/test/return_inc.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,12 +6,13 @@
// 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>
#include <boost/function.hpp>
-#define BOOST_TEST_MODULE TestReturnInc
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
boost::function<int (void)> inc(int& value) {
int BOOST_LOCAL_FUNCTION(bind& value) {
@@ -20,21 +21,18 @@
return i;
}
-BOOST_AUTO_TEST_CASE(test_return_inc) {
+int main(void) {
int value1 = 0; // Reference valid in scope where closure is used.
boost::function<int (void)> inc1 = inc(value1);
int value2 = 0;
boost::function<int (void)> inc2 = inc(value2);
- BOOST_CHECK(inc1() == 1);
- BOOST_CHECK(inc1() == 2);
- BOOST_CHECK(inc2() == 1);
- BOOST_CHECK(inc1() == 3);
+ BOOST_TEST(inc1() == 1);
+ BOOST_TEST(inc1() == 2);
+ BOOST_TEST(inc2() == 1);
+ BOOST_TEST(inc1() == 3);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/return_inc_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/return_inc_seq.cpp (original)
+++ trunk/libs/local_function/test/return_inc_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -7,8 +7,7 @@
#include <boost/local_function.hpp>
#include <boost/function.hpp>
-#define BOOST_TEST_MODULE TestReturnIncSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
boost::function<int (void)> inc(int& value) {
int BOOST_LOCAL_FUNCTION( (bind& value) ) {
@@ -17,15 +16,16 @@
return i;
}
-BOOST_AUTO_TEST_CASE(test_return_inc_seq) {
+int main(void) {
int value1 = 0;
boost::function<int (void)> inc1 = inc(value1);
int value2 = 0;
boost::function<int (void)> inc2 = inc(value2);
- BOOST_CHECK(inc1() == 1);
- BOOST_CHECK(inc1() == 2);
- BOOST_CHECK(inc2() == 1);
- BOOST_CHECK(inc1() == 3);
+ BOOST_TEST(inc1() == 1);
+ BOOST_TEST(inc1() == 2);
+ BOOST_TEST(inc2() == 1);
+ BOOST_TEST(inc1() == 3);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/return_inc_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/return_inc_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "return_inc_seq.cpp"
+
Modified: trunk/libs/local_function/test/return_setget.cpp
==============================================================================
--- trunk/libs/local_function/test/return_setget.cpp (original)
+++ trunk/libs/local_function/test/return_setget.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,12 +6,13 @@
// 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>
#include <boost/function.hpp>
-#define BOOST_TEST_MODULE TestReturnSetGet
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <string>
boost::function<void (const std::string&)> set;
@@ -19,12 +20,12 @@
void action(void) {
// State `message` hidden behind access functions from here.
- BOOST_CHECK(get() == "abc");
+ BOOST_TEST(get() == "abc");
set("xyz");
- BOOST_CHECK(get() == "xyz");
+ BOOST_TEST(get() == "xyz");
}
-BOOST_AUTO_TEST_CASE(test_return_setget) {
+int main(void) {
std::string message = "abc"; // Reference valid where closure used.
void BOOST_LOCAL_FUNCTION(bind& message, const std::string& text) {
@@ -38,11 +39,8 @@
get = g;
action();
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/return_setget_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/return_setget_seq.cpp (original)
+++ trunk/libs/local_function/test/return_setget_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -7,20 +7,19 @@
#include <boost/local_function.hpp>
#include <boost/function.hpp>
-#define BOOST_TEST_MODULE TestReturnSetgetSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <string>
boost::function<void (const std::string&)> set;
boost::function<const std::string& (void)> get;
void action(void) {
- BOOST_CHECK(get() == "abc");
+ BOOST_TEST(get() == "abc");
set("xyz");
- BOOST_CHECK(get() == "xyz");
+ BOOST_TEST(get() == "xyz");
}
-BOOST_AUTO_TEST_CASE(test_return_setget_seq) {
+int main(void) {
std::string message = "abc";
void BOOST_LOCAL_FUNCTION( (bind& message) (const std::string& text) ) {
@@ -34,5 +33,6 @@
get = g;
action();
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/return_setget_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/return_setget_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "return_setget_seq.cpp"
+
Modified: trunk/libs/local_function/test/return_this.cpp
==============================================================================
--- trunk/libs/local_function/test/return_this.cpp (original)
+++ trunk/libs/local_function/test/return_this.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,12 +6,13 @@
// 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>
#include <boost/function.hpp>
-#define BOOST_TEST_MODULE TestReturnThis
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
struct number {
number(int value) : value_(value) {}
@@ -27,21 +28,18 @@
int value_;
};
-BOOST_AUTO_TEST_CASE(test_return_this) {
+int main(void) {
number n1 = 0; // Object valid in scope where closure is used.
boost::function<int (void)> inc1 = n1.inc();
number n2 = 0;
boost::function<int (void)> inc2 = n2.inc();
- BOOST_CHECK(inc1() == 1);
- BOOST_CHECK(inc1() == 2);
- BOOST_CHECK(inc2() == 1);
- BOOST_CHECK(inc1() == 3);
+ BOOST_TEST(inc1() == 1);
+ BOOST_TEST(inc1() == 2);
+ BOOST_TEST(inc2() == 1);
+ BOOST_TEST(inc1() == 3);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/return_this_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/return_this_seq.cpp (original)
+++ trunk/libs/local_function/test/return_this_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -7,8 +7,7 @@
#include <boost/local_function.hpp>
#include <boost/function.hpp>
-#define BOOST_TEST_MODULE TestReturnThisSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
struct number {
number(int value) : value_(value) {}
@@ -24,15 +23,16 @@
int value_;
};
-BOOST_AUTO_TEST_CASE(test_return_this_seq) {
+int main(void) {
number n1 = 0; // Object valid in scope where closure is used.
boost::function<int (void)> inc1 = n1.inc();
number n2 = 0;
boost::function<int (void)> inc2 = n2.inc();
- BOOST_CHECK(inc1() == 1);
- BOOST_CHECK(inc1() == 2);
- BOOST_CHECK(inc2() == 1);
- BOOST_CHECK(inc1() == 3);
+ BOOST_TEST(inc1() == 1);
+ BOOST_TEST(inc1() == 2);
+ BOOST_TEST(inc2() == 1);
+ BOOST_TEST(inc1() == 3);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/return_this_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/return_this_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "return_this_seq.cpp"
+
Modified: trunk/libs/local_function/test/same_line.cpp
==============================================================================
--- trunk/libs/local_function/test/same_line.cpp (original)
+++ trunk/libs/local_function/test/same_line.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,12 +6,13 @@
// 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>
#include <boost/preprocessor/cat.hpp>
-#define BOOST_TEST_MODULE TestSameLine
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <iostream>
//[same_line
@@ -28,18 +29,14 @@
return x - offset; \
} BOOST_LOCAL_FUNCTION_NAME(dec)
-BOOST_AUTO_TEST_CASE(test_same_line)
-{
+int main(void) {
int delta = 10;
LOCAL_INC_DEC(delta) // Multiple local functions on same line.
- BOOST_CHECK(dec(inc(123)) == 123);
+ BOOST_TEST(dec(inc(123)) == 123);
+ return boost::report_errors();
}
//]
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/same_line_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/same_line_seq.cpp (original)
+++ trunk/libs/local_function/test/same_line_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -7,8 +7,7 @@
#include <boost/local_function.hpp>
#include <boost/preprocessor/cat.hpp>
-#define BOOST_TEST_MODULE TestSameLineSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <iostream>
#define LOCAL_INC_DEC(offset) \
@@ -24,11 +23,11 @@
return x - offset; \
} BOOST_LOCAL_FUNCTION_NAME(dec)
-BOOST_AUTO_TEST_CASE(test_same_line_seq)
-{
+int main(void) {
int delta = 10;
LOCAL_INC_DEC(delta) // Declare local functions on same line using `_ID`.
- BOOST_CHECK(dec(inc(123)) == 123);
+ BOOST_TEST(dec(inc(123)) == 123);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/same_line_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/same_line_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "same_line_seq.cpp"
+
Modified: trunk/libs/local_function/test/ten_void.cpp
==============================================================================
--- trunk/libs/local_function/test/ten_void.cpp (original)
+++ trunk/libs/local_function/test/ten_void.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,17 +6,16 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestTenVoid
-#include <boost/test/unit_test.hpp>
-#include <iostream>
+#include <boost/detail/lightweight_test.hpp>
-BOOST_AUTO_TEST_CASE(test_ten_void) {
+int main(void) {
//[ten_void
int BOOST_LOCAL_FUNCTION(void) { // No parameter.
return 10;
} BOOST_LOCAL_FUNCTION_NAME(ten)
- BOOST_CHECK(ten() == 10);
+ BOOST_TEST(ten() == 10);
//]
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/ten_void_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/ten_void_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "ten_void.cpp"
+
Modified: trunk/libs/local_function/test/transform.cpp
==============================================================================
--- trunk/libs/local_function/test/transform.cpp (original)
+++ trunk/libs/local_function/test/transform.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -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_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 @@
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
Modified: trunk/libs/local_function/test/transform_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/transform_seq.cpp (original)
+++ trunk/libs/local_function/test/transform_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,18 +6,17 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestTranformSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
#include <vector>
-BOOST_AUTO_TEST_CASE(test_transform_seq) {
+int main(void) {
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) ) {
@@ -25,7 +24,7 @@
} 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);
@@ -33,6 +32,8 @@
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();
}
Added: trunk/libs/local_function/test/transform_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/transform_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "transform_seq.cpp"
+
Modified: trunk/libs/local_function/test/typeof.cpp
==============================================================================
--- trunk/libs/local_function/test/typeof.cpp (original)
+++ trunk/libs/local_function/test/typeof.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,17 +6,18 @@
// 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 "addable.hpp"
#include <boost/local_function.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/concept_check.hpp>
-#define BOOST_TEST_MODULE TestTypeof
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
-BOOST_AUTO_TEST_CASE(test_typeof) {
+int main(void) {
//[typeof
int sum = 0, factor = 10;
@@ -32,12 +33,9 @@
add(6);
//]
- BOOST_CHECK(sum == 60);
+ BOOST_TEST(sum == 60);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/typeof_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/typeof_seq.cpp (original)
+++ trunk/libs/local_function/test/typeof_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -9,11 +9,10 @@
#include <boost/local_function.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/concept_check.hpp>
-#define BOOST_TEST_MODULE TestTypeofSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
-BOOST_AUTO_TEST_CASE(test_typeof_seq) {
+int main(void) {
int sum = 0, factor = 10;
void BOOST_LOCAL_FUNCTION( (const bind factor) (bind& sum) (int num) ) {
@@ -25,6 +24,7 @@
} BOOST_LOCAL_FUNCTION_NAME(add)
add(6);
- BOOST_CHECK(sum == 60);
+ BOOST_TEST(sum == 60);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/typeof_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/typeof_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "typeof_seq.cpp"
+
Modified: trunk/libs/local_function/test/typeof_template.cpp
==============================================================================
--- trunk/libs/local_function/test/typeof_template.cpp (original)
+++ trunk/libs/local_function/test/typeof_template.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -6,14 +6,15 @@
// 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 "addable.hpp"
#include <boost/local_function.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/concept_check.hpp>
-#define BOOST_TEST_MODULE TestTypeofTemplate
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
//[typeof_template
@@ -33,13 +34,10 @@
}
//]
-BOOST_AUTO_TEST_CASE(test_typeof_template) {
- BOOST_CHECK(calculate(10) == 60);
+int main(void) {
+ BOOST_TEST(calculate(10) == 60);
+ return boost::report_errors();
}
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // VARIADIC_MACROS
Modified: trunk/libs/local_function/test/typeof_template_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/typeof_template_seq.cpp (original)
+++ trunk/libs/local_function/test/typeof_template_seq.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -9,8 +9,7 @@
#include <boost/local_function.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/concept_check.hpp>
-#define BOOST_TEST_MODULE TestTypeofTemplateSeq
-#include <boost/test/unit_test.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
template<typename T>
@@ -27,7 +26,8 @@
return sum;
}
-BOOST_AUTO_TEST_CASE(test_typeof_template_seq) {
- BOOST_CHECK(calculate(10) == 60);
+int main(void) {
+ BOOST_TEST(calculate(10) == 60);
+ return boost::report_errors();
}
Added: trunk/libs/local_function/test/typeof_template_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/typeof_template_seq_nova.cpp 2012-04-03 15:40:20 EDT (Tue, 03 Apr 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/local_function
+
+#include "nova.hpp"
+#include "typeof_template_seq.cpp"
+
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk