Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77078 - in trunk/libs/local_function: doc/html example test
From: lorcaminiti_at_[hidden]
Date: 2012-02-20 15:07:36


Author: lcaminiti
Date: 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
New Revision: 77078
URL: http://svn.boost.org/trac/boost/changeset/77078

Log:
Added test for sequence syntax (to run with and without variadic macro support) and disabled variadic syntax test when variadic macros are not supported.
Updated docs.
Added:
   trunk/libs/local_function/test/add_classifiers_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/add_default_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/add_except_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/add_inline_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/add_params_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/add_template_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/add_this_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/add_typed_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/add_with_default_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/all_decl.cpp (contents, props changed)
   trunk/libs/local_function/test/all_decl_seq.cpp
      - copied, changed from r77070, /trunk/libs/local_function/test/seq.cpp
   trunk/libs/local_function/test/factorial_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/goto_error_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/goto_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/macro_commas_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/nesting_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/operator_error_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/operator_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/overload_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/return_assign_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/return_derivative_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/return_inc_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/return_setget_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/return_this_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/transform_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/typeof_seq.cpp (contents, props changed)
   trunk/libs/local_function/test/typeof_template_seq.cpp (contents, props changed)
Removed:
   trunk/libs/local_function/test/add_seq.cpp
   trunk/libs/local_function/test/seq.cpp
Text files modified:
   trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION.html | 2
   trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html | 2
   trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html | 2
   trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_NAME.html | 2
   trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TPL.html | 2
   trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html | 2
   trunk/libs/local_function/doc/html/index.html | 2
   trunk/libs/local_function/example/Jamfile.v2 | 2
   trunk/libs/local_function/example/add_global_functor.cpp | 4
   trunk/libs/local_function/example/add_local_functor.cpp | 4
   trunk/libs/local_function/example/add_phoenix.cpp | 4
   trunk/libs/local_function/example/expensive_copy_lambda.cpp | 2
   trunk/libs/local_function/example/gcc_access.cpp | 8 +-
   trunk/libs/local_function/example/gcc_lambda.cpp | 12 ++--
   trunk/libs/local_function/example/gcc_lambda_cpp11.cpp | 10 ++--
   trunk/libs/local_function/example/gcc_square.cpp | 8 +-
   trunk/libs/local_function/example/gcc_store.cpp | 8 +-
   trunk/libs/local_function/example/impl_pp_keyword.cpp | 6 +-
   trunk/libs/local_function/example/impl_tparam_tricks.cpp | 6 +-
   trunk/libs/local_function/example/n2529_this.cpp | 8 +-
   trunk/libs/local_function/example/n2550_find_if.cpp | 8 +-
   trunk/libs/local_function/example/phoenix_factorial.cpp | 6 +-
   trunk/libs/local_function/example/phoenix_factorial_local.cpp | 6 +-
   trunk/libs/local_function/example/scope_exit.cpp | 8 +-
   trunk/libs/local_function/test/Jamfile.v2 | 82 ++++++++++++++++++++++-----------------
   trunk/libs/local_function/test/add.cpp | 13 +++++
   trunk/libs/local_function/test/add_classifiers.cpp | 10 ++--
   trunk/libs/local_function/test/add_default.cpp | 14 +++++-
   trunk/libs/local_function/test/add_except.cpp | 15 +++++-
   trunk/libs/local_function/test/add_inline.cpp | 14 +++++-
   trunk/libs/local_function/test/add_lambda.cpp | 6 +-
   trunk/libs/local_function/test/add_params.cpp | 14 +++++-
   trunk/libs/local_function/test/add_template.cpp | 13 +++++
   trunk/libs/local_function/test/add_this.cpp | 16 ++++++-
   trunk/libs/local_function/test/add_typed.cpp | 16 ++++++-
   trunk/libs/local_function/test/add_with_default.cpp | 14 +++++-
   trunk/libs/local_function/test/addable.hpp | 2
   trunk/libs/local_function/test/all_decl_seq.cpp | 5 -
   trunk/libs/local_function/test/factorial.cpp | 17 ++++++-
   trunk/libs/local_function/test/goto.cpp | 11 ++++
   trunk/libs/local_function/test/goto_error.cpp | 14 +++++-
   trunk/libs/local_function/test/macro_commas.cpp | 11 ++++
   trunk/libs/local_function/test/nesting.cpp | 14 +++++
   trunk/libs/local_function/test/operator.cpp | 13 +++++
   trunk/libs/local_function/test/operator_error.cpp | 15 +++++-
   trunk/libs/local_function/test/overload.cpp | 19 ++++++--
   trunk/libs/local_function/test/return_assign.cpp | 19 ++++++--
   trunk/libs/local_function/test/return_derivative.cpp | 15 ++++++
   trunk/libs/local_function/test/return_inc.cpp | 19 ++++++--
   trunk/libs/local_function/test/return_setget.cpp | 15 +++++-
   trunk/libs/local_function/test/return_this.cpp | 19 ++++++--
   trunk/libs/local_function/test/ten_void.cpp | 4
   trunk/libs/local_function/test/transform.cpp | 17 ++++++-
   trunk/libs/local_function/test/typeof.cpp | 17 ++++++-
   trunk/libs/local_function/test/typeof_template.cpp | 13 +++++
   55 files changed, 423 insertions(+), 187 deletions(-)

Modified: trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION.html
==============================================================================
--- trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION.html (original)
+++ trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION.html 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION(declarations)</pre></div>
 <div class="refsect1">
-<a name="id882010"></a><h2>Description</h2>
+<a name="id866718"></a><h2>Description</h2>
 <p>This macro must be used within a declarative context, it must follow the local function result type, it must be followed by the local function body code, and then by the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code> macro (see the <a class="link" href="boost_localfunction/Tutorial.html" title="Tutorial">Tutorial</a> and <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> sections): </p>
 <pre class="programlisting"><span class="special">{</span> <span class="comment">// Some declarative context.</span>
     <span class="special">...</span>

Modified: trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html
==============================================================================
--- trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html (original)
+++ trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX</pre></div>
 <div class="refsect1">
-<a name="id885243"></a><h2>Description</h2>
+<a name="id869951"></a><h2>Description</h2>
 <p>If programmers leave this configuration macro undefined, its default value is <code class="computeroutput">5</code> (increasing this number might increase compilation time). When defined by programmers, this macro must be a non-negative integer number.</p>
 <p><span class="bold"><strong>Note:</strong></span> This macro specifies the maximum number of local function parameters excluding bound variables (which are instead specified by <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html" title="Macro BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX">BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX</a></code>).</p>
 <p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_localfunction/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_localfunction/Getting_Started.html" title="Getting Started"> Getting Started</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html" title="Macro BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX">BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX</a></code>. </p>

Modified: trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html
==============================================================================
--- trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html (original)
+++ trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX</pre></div>
 <div class="refsect1">
-<a name="id885317"></a><h2>Description</h2>
+<a name="id870025"></a><h2>Description</h2>
 <p>If programmers leave this configuration macro undefined, its default value is <code class="computeroutput">10</code> (increasing this number might increase compilation time). When defined by programmers, this macro must be a non-negative integer number.</p>
 <p><span class="bold"><strong>Note:</strong></span> This macro specifies the maximum number of bound variables excluding local function parameters (which are instead specified by <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html" title="Macro BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX">BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX</a></code>).</p>
 <p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_localfunction/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_localfunction/Getting_Started.html" title="Getting Started"> Getting Started</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html" title="Macro BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX">BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX</a></code>. </p>

Modified: trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_NAME.html
==============================================================================
--- trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_NAME.html (original)
+++ trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_NAME.html 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION_NAME(qualified_function_name)</pre></div>
 <div class="refsect1">
-<a name="id884721"></a><h2>Description</h2>
+<a name="id869429"></a><h2>Description</h2>
 <p>This macro must follow the local function body code block <code class="computeroutput">{ ... }</code>: </p>
 <pre class="programlisting"><span class="special">{</span> <span class="comment">// Some declarative context.</span>
     <span class="special">...</span>

Modified: trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TPL.html
==============================================================================
--- trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TPL.html (original)
+++ trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TPL.html 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION_TPL(declarations)</pre></div>
 <div class="refsect1">
-<a name="id884543"></a><h2>Description</h2>
+<a name="id869251"></a><h2>Description</h2>
 <p>This macro must be used instead of <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION.html" title="Macro BOOST_LOCAL_FUNCTION">BOOST_LOCAL_FUNCTION</a></code> when declaring a local function within a template. A part from that, this macro has the exact same syntax as <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION.html" title="Macro BOOST_LOCAL_FUNCTION">BOOST_LOCAL_FUNCTION</a></code> (see <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION.html" title="Macro BOOST_LOCAL_FUNCTION">BOOST_LOCAL_FUNCTION</a></code> for more information): </p>
 <pre class="programlisting"><span class="special">{</span> <span class="comment">// Some declarative context with a template.</span>
     <span class="special">...</span>

Modified: trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html
==============================================================================
--- trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html (original)
+++ trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION_TYPEOF(bound_variable_name)</pre></div>
 <div class="refsect1">
-<a name="id885030"></a><h2>Description</h2>
+<a name="id869738"></a><h2>Description</h2>
 <p>This macro can be used within the local functions body to refer to the bound variable types so to declare local variables, check concepts (using Boost.ConceptCheck), etc (see the <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section). This way the local function can be programmed entirely without explicitly specifying the bound variable types thus facilitating maintenance (e.g., if the type of a bound variable changes in the enclosing scope, the local function code does not have to change).</p>
 <p><span class="bold"><strong>Parameters:</strong></span> </p>
 <div class="informaltable"><table class="table">

Modified: trunk/libs/local_function/doc/html/index.html
==============================================================================
--- trunk/libs/local_function/doc/html/index.html (original)
+++ trunk/libs/local_function/doc/html/index.html 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -222,7 +222,7 @@
 </div>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: February 17, 2012 at 19:11:44 GMT</small></p></td>
+<td align="left"><p><small>Last revised: February 17, 2012 at 22:11:08 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Modified: trunk/libs/local_function/example/Jamfile.v2
==============================================================================
--- trunk/libs/local_function/example/Jamfile.v2 (original)
+++ trunk/libs/local_function/example/Jamfile.v2 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -38,7 +38,7 @@
 run phoenix_factorial.cpp ;
 run phoenix_factorial_local.cpp ;
 
-# Only compile and do not run these programs (they take a long time to run).
+# Only compile but do not run profiling programs (they take a long time to run).
 exe profile_global_functor : profile_global_functor.cpp
     : <library>/boost/chrono//boost_chrono
         <library>/boost/system//boost_system

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -22,7 +22,7 @@
     const int factor; // Make `factor` constant.
 };
 
-BOOST_AUTO_TEST_CASE( test_add_global_functor ) {
+BOOST_AUTO_TEST_CASE(test_add_global_functor) {
     int sum = 0, factor = 10;
 
     global_add add(sum, factor);
@@ -31,7 +31,7 @@
     int nums[] = {2, 3};
     std::for_each(nums, nums + 2, add); // Passed as template parameter.
 
- BOOST_CHECK( sum == 60 );
+ BOOST_CHECK(sum == 60);
 }
 //]
 

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -8,7 +8,7 @@
 #define BOOST_TEST_MODULE TestAddLocalFunctor
 #include <boost/test/unit_test.hpp>
 
-BOOST_AUTO_TEST_CASE( test_add_local_functor )
+BOOST_AUTO_TEST_CASE(test_add_local_functor)
 //[add_local_functor
 {
     int sum = 0, factor = 10;
@@ -29,7 +29,7 @@
     // 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_CHECK(sum == 60);
 }
 //]
 

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -11,7 +11,7 @@
 #include <algorithm>
 #include <iostream>
     
-BOOST_AUTO_TEST_CASE( test_add_phoenix )
+BOOST_AUTO_TEST_CASE(test_add_phoenix)
 //[add_phoenix
 {
     using boost::phoenix::let;
@@ -29,7 +29,7 @@
         ref(sum) += _f * _1, _1 // Access `sum` by reference.
     ]);
 
- BOOST_CHECK( sum == 60 );
+ BOOST_CHECK(sum == 60);
 }
 //]
 

Modified: 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_lambda.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -34,7 +34,7 @@
 
 #else // NO_LAMBDAS
 
-int main(void) { return 0; } // Trivial program.
+int main(void) { return 0; } // Trivial test.
 
 #endif // NO_LAMBDAS
 

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -9,15 +9,15 @@
 #define BOOST_TEST_MODULE TestGccAccess
 #include <boost/test/unit_test.hpp>
 
-BOOST_AUTO_TEST_CASE( test_gcc_access ) {
+BOOST_AUTO_TEST_CASE(test_gcc_access) {
     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_CHECK(access(nums, 1) == 1);
+ BOOST_CHECK(access(nums, 2) == 2);
+ BOOST_CHECK(access(nums, 3) == 3);
 }
 

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -13,7 +13,7 @@
 #include <boost/test/unit_test.hpp>
 #include <algorithm>
 
-BOOST_AUTO_TEST_CASE( test_gcc_lambda ) {
+BOOST_AUTO_TEST_CASE(test_gcc_lambda) {
     //[gcc_lambda
     int val = 2;
     int nums[] = {1, 2, 3};
@@ -26,13 +26,13 @@
     );
     //]
 
- BOOST_CHECK( iter != end );
- BOOST_CHECK( *iter == val );
+ BOOST_CHECK(iter != end);
+ BOOST_CHECK(*iter == val);
 }
 
-#else // GCC || !NO_LAMBDAS
+#else
 
-int main(void) { return 0; }
+int main(void) { return 0; } // Trivial test.
 
-#endif // GCC || !NO_LAMBDAS
+#endif
 

Modified: trunk/libs/local_function/example/gcc_lambda_cpp11.cpp
==============================================================================
--- trunk/libs/local_function/example/gcc_lambda_cpp11.cpp (original)
+++ trunk/libs/local_function/example/gcc_lambda_cpp11.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -12,7 +12,7 @@
 #include <boost/test/unit_test.hpp>
 #include <algorithm>
 
-BOOST_AUTO_TEST_CASE( test_gcc_lambda_cpp11 ) {
+BOOST_AUTO_TEST_CASE(test_gcc_lambda_cpp11) {
     //[gcc_lambda_cpp11
     int val = 2;
     int nums[] = {1, 2, 3};
@@ -25,13 +25,13 @@
     );
     //]
 
- BOOST_CHECK( iter != end );
- BOOST_CHECK( *iter == val );
+ BOOST_CHECK(iter != end);
+ BOOST_CHECK(*iter == val);
 }
 
-#else // NO_LAMBDAS
+#else
 
 int main(void) { return 0; } // Trivial test.
 
-#endif // NO_LAMBDAS
+#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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -9,15 +9,15 @@
 #define BOOST_TEST_MODULE TestGccSquare
 #include <boost/test/unit_test.hpp>
 
-double add_square(double a, double b) {
- double BOOST_LOCAL_FUNCTION(double z) {
+int add_square(int a, int b) {
+ int BOOST_LOCAL_FUNCTION(int z) {
         return z * z;
     } BOOST_LOCAL_FUNCTION_NAME(square)
 
     return square(a) + square(b);
 }
 
-BOOST_AUTO_TEST_CASE( test_gcc_square ) {
- BOOST_CHECK( add_square(2.0, 4.0) == 20.0 );
+BOOST_AUTO_TEST_CASE(test_gcc_square) {
+ BOOST_CHECK(add_square(2, 4) == 20);
 }
 

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -22,12 +22,12 @@
     intermediate(store, size);
 }
 
-BOOST_AUTO_TEST_CASE( test_gcc_store ) {
+BOOST_AUTO_TEST_CASE(test_gcc_store) {
     int nums[] = {1, 2, 3};
     hack(nums, 3);
 
- BOOST_CHECK( nums[0] == 1 );
- BOOST_CHECK( nums[1] == 2 );
- BOOST_CHECK( nums[2] == -1 );
+ BOOST_CHECK(nums[0] == 1);
+ BOOST_CHECK(nums[1] == 2);
+ BOOST_CHECK(nums[2] == -1);
 }
 

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -20,9 +20,9 @@
         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 );
+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);
 }
 //]
 

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -34,7 +34,7 @@
     interface* func_;
 };
 
-BOOST_AUTO_TEST_CASE( test_impl_tparam_tricks ) {
+BOOST_AUTO_TEST_CASE(test_impl_tparam_tricks) {
     int sum = 0, factor = 10;
 
     // Local class for local function.
@@ -62,11 +62,11 @@
     std::vector<int> v(10);
     std::fill(v.begin(), v.end(), 1);
     
-// std::for_each(v.begin(), v.end(), add_local); // Error but OK on C++11.
+ // std::for_each(v.begin(), v.end(), add_local); // Error but OK on C++11.
     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_CHECK(sum == 200);
 }
 //]
 

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -25,7 +25,7 @@
     }
 };
 
-BOOST_AUTO_TEST_CASE( test_n2529_this ) {
+BOOST_AUTO_TEST_CASE(test_n2529_this) {
     std::vector<int> n(3);
     n[0] = 1; n[1] = 2; n[2] = 3;
 
@@ -35,8 +35,8 @@
     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_CHECK(vn.nums.at(0) == -1);
+ BOOST_CHECK(vn.nums.at(1) == 2);
+ BOOST_CHECK(vn.nums.at(2) == -3);
 }
 

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -16,9 +16,9 @@
     explicit employee(const int& a_salary): salary(a_salary) {}
 };
 
-BOOST_AUTO_TEST_CASE( test_n2550_find_if ) {
+BOOST_AUTO_TEST_CASE(test_n2550_find_if) {
     std::vector<employee> employees;
- employees.push_back(employee( 85000));
+ employees.push_back(employee(85000));
     employees.push_back(employee(100000));
     employees.push_back(employee(120000));
 
@@ -35,7 +35,7 @@
     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_CHECK(i != employees.end());
+ BOOST_CHECK(i->salary >= min_salary && i->salary < u_limit);
 }
 

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -27,14 +27,14 @@
     }
 };
 
-BOOST_AUTO_TEST_CASE( test_phoenix_factorial ) {
+BOOST_AUTO_TEST_CASE(test_phoenix_factorial) {
     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_CHECK(factorial(i)() == 24); // Call.
+ BOOST_CHECK(factorial(arg1)(i) == 24); // Lazy call.
 }
 //]
 

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -13,7 +13,7 @@
 #include <boost/test/unit_test.hpp>
 
 //[phoenix_factorial_local
-BOOST_AUTO_TEST_CASE( test_phoenix_factorial_local ) {
+BOOST_AUTO_TEST_CASE(test_phoenix_factorial_local) {
     using boost::phoenix::arg_names::arg1;
     
     int BOOST_LOCAL_FUNCTION(int n) { // Unfortunately, monomorphic.
@@ -24,8 +24,8 @@
             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_CHECK(factorial(i)() == 24); // Call.
+ BOOST_CHECK(factorial(arg1)(i) == 24); // Lazy call.
 }
 //]
 

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -87,17 +87,17 @@
     checkpoint = ++p.evolution_;
 }
 
-BOOST_AUTO_TEST_CASE( test_scope_exit ) {
+BOOST_AUTO_TEST_CASE(test_scope_exit) {
     person adam, eva;
     std::ostringstream oss;
     oss << adam;
     std::cout << oss.str() << std::endl;
- BOOST_CHECK( oss.str() == "person(0, 0)" );
+ BOOST_CHECK(oss.str() == "person(0, 0)");
 
     oss.str("");
     oss << eva;
     std::cout << oss.str() << std::endl;
- BOOST_CHECK( oss.str() == "person(0, 0)" );
+ BOOST_CHECK(oss.str() == "person(0, 0)");
 
     world w;
     w.add_person(adam);
@@ -105,6 +105,6 @@
     oss.str("");
     oss << w;
     std::cout << oss.str() << std::endl;
- BOOST_CHECK( oss.str() == "world(3, { person(1, 2), person(2, 2), })" );
+ BOOST_CHECK(oss.str() == "world(3, { person(1, 2), person(2, 2), })");
 }
 

Modified: trunk/libs/local_function/test/Jamfile.v2
==============================================================================
--- trunk/libs/local_function/test/Jamfile.v2 (original)
+++ trunk/libs/local_function/test/Jamfile.v2 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -9,42 +9,52 @@
 
 project : requirements <library>/boost//unit_test_framework ;
 
-run add.cpp ;
-run add_classifiers.cpp ;
-run add_default.cpp ;
-run add_except.cpp ;
-run add_inline.cpp ;
+# Run variadic and sequence syntax (also forcing no variadic macros).
+rule run-vaseq ( file_name )
+{
+ run $(file_name).cpp ;
+ run $(file_name)_seq.cpp ;
+ run $(file_name)_seq.cpp : : : <define>BOOST_NO_VARIADIC_MACROS :
+ $(file_name)_seq_nova : ;
+}
+
+# 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 ;
+}
+
+run-vaseq add ;
+run-vaseq add_classifiers ;
+run-vaseq add_default ;
+run-vaseq add_except ;
+run-vaseq add_inline ;
 run add_lambda.cpp ;
-run add_params.cpp ;
-run add_template.cpp ;
-run add_this.cpp ;
-run add_typed.cpp ;
-run add_with_default.cpp ;
-
-run factorial.cpp ;
-run goto.cpp ;
-compile-fail goto_error.cpp ;
-run macro_commas.cpp ;
-run nesting.cpp ;
-run operator.cpp ;
-compile-fail operator_error.cpp ;
-run overload.cpp ;
+run-vaseq add_params ;
+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 ten_void.cpp ;
-run transform.cpp ;
-run typeof.cpp ;
-run typeof_template.cpp ;
-
-run return_assign.cpp ;
-run return_derivative.cpp ;
-run return_inc.cpp ;
-run return_setget.cpp ;
-run return_this.cpp ;
-
-# Compile sequence syntax also forcing no variadic macros.
-run add_seq.cpp ;
-run add_seq.cpp : : : <define>BOOST_NO_VARIADIC_MACROS
- : add_seq_no_variadics : ;
-run seq.cpp ;
-run seq.cpp : : : <define>BOOST_NO_VARIADIC_MACROS
- : seq_no_variadics : ;
+run ten_void.cpp : : : <define>BOOST_NO_VARIADIC_MACROS : ten_void_nova : ;
+run-vaseq transform ;
+run-vaseq typeof ;
+run-vaseq typeof_template ;
 

Modified: trunk/libs/local_function/test/add.cpp
==============================================================================
--- trunk/libs/local_function/test/add.cpp (original)
+++ trunk/libs/local_function/test/add.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,12 +5,15 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestAdd
 #include <boost/test/unit_test.hpp>
 #include <algorithm>
 
-BOOST_AUTO_TEST_CASE( test_add )
+BOOST_AUTO_TEST_CASE(test_add)
 //[add
 { // Some local scope.
     int sum = 0, factor = 10; // Variables in scope to bind.
@@ -23,7 +26,13 @@
     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_CHECK(sum == 60); // Assert final summation value.
 }
 //]
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -6,25 +6,25 @@
 // Home at http://www.boost.org/libs/local_function
 
 #include <boost/config.hpp>
-#ifdef BOOST_NO_AUTO_DECLARATIONS // No C++11 auto declarations.
+#if defined(BOOST_NO_AUTO_DECLARATIONS) && !defined(BOOST_NO_VARIADIC_MACROS)
 
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestAddClassifiers
 #include <boost/test/unit_test.hpp>
 
-BOOST_AUTO_TEST_CASE( test_add_classifiers ) {
+BOOST_AUTO_TEST_CASE(test_add_classifiers) {
     //[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_CHECK(add(1, 2) == 3);
 }
 
-#else // C++11 auto declarations.
+#else
 
-int main(void) { return 0; } // Trivial program.
+int main(void) { return 0; } // Trivial test.
 
 #endif
 

Added: trunk/libs/local_function/test/add_classifiers_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_classifiers_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,28 @@
+
+// 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_AUTO_DECLARATIONS
+
+#include <boost/local_function.hpp>
+#define BOOST_TEST_MODULE TestAddClassifiersSeq
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE(test_add_classifiers_seq) {
+ int BOOST_LOCAL_FUNCTION( (auto int x) (register int y) ) {
+ return x + y;
+ } BOOST_LOCAL_FUNCTION_NAME(add)
+
+ BOOST_CHECK(add(1, 2) == 3);
+}
+
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,18 +5,26 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestAddDefault
 #include <boost/test/unit_test.hpp>
 
-BOOST_AUTO_TEST_CASE( test_add_default ) {
+BOOST_AUTO_TEST_CASE(test_add_default) {
     //[add_default
     int BOOST_LOCAL_FUNCTION(int x, int y, default 2) { // Default.
         return x + y;
     } BOOST_LOCAL_FUNCTION_NAME(add)
 
- BOOST_CHECK( add(1) == 3 );
+ BOOST_CHECK(add(1) == 3);
     //]
 }
-//]
+
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
 

Added: trunk/libs/local_function/test/add_default_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_default_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,19 @@
+
+// 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/local_function.hpp>
+#define BOOST_TEST_MODULE TestAddDefaultSeq
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE(test_add_default_seq) {
+ int BOOST_LOCAL_FUNCTION( (int x) (int y)(default 2) ) {
+ return x + y;
+ } BOOST_LOCAL_FUNCTION_NAME(add)
+
+ BOOST_CHECK(add(1) == 3);
+}
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,11 +5,14 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestAddExcept
 #include <boost/test/unit_test.hpp>
 
-BOOST_AUTO_TEST_CASE( test_except ) {
+BOOST_AUTO_TEST_CASE(test_except) {
     //[add_except
     double sum = 0.0;
     int factor = 10;
@@ -21,7 +24,13 @@
 
     add(100);
     //]
-
- BOOST_CHECK( sum == 1000 );
+
+ BOOST_CHECK(sum == 1000);
 }
 
+#else
+
+int main(void) { return 0; }
+
+#endif
+

Added: trunk/libs/local_function/test/add_except_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_except_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,25 @@
+
+// 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/local_function.hpp>
+#define BOOST_TEST_MODULE TestAddExceptSeq
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE(test_except_seq) {
+ double sum = 0.0;
+ int factor = 10;
+
+ void BOOST_LOCAL_FUNCTION( (const bind factor) (bind& sum)
+ (double num) ) throw() {
+ sum += factor * num;
+ } BOOST_LOCAL_FUNCTION_NAME(add)
+
+ add(100);
+
+ BOOST_CHECK(sum == 1000);
+}
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,14 +5,16 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
-//[ add_function_inline_cpp
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestAddInline
 #include <boost/test/unit_test.hpp>
 #include <vector>
 #include <algorithm>
 
-BOOST_AUTO_TEST_CASE( test_add_inline ) {
+BOOST_AUTO_TEST_CASE(test_add_inline) {
     //[add_inline
     int sum = 0, factor = 10;
 
@@ -26,6 +28,12 @@
     for(size_t i = 0; i < v.size(); ++i) add(v[i]); // Cannot use for_each.
     //]
 
- BOOST_CHECK( sum == 1000 );
+ BOOST_CHECK(sum == 1000);
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/add_inline_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_inline_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,28 @@
+
+// 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/local_function.hpp>
+#define BOOST_TEST_MODULE TestAddInlineSeq
+#include <boost/test/unit_test.hpp>
+#include <vector>
+#include <algorithm>
+
+BOOST_AUTO_TEST_CASE(test_add_inline_seq) {
+ int sum = 0, factor = 10;
+
+ void BOOST_LOCAL_FUNCTION( (const bind factor) (bind& sum) (int num) ) {
+ sum += factor * num;
+ } BOOST_LOCAL_FUNCTION_NAME(inline add)
+
+ std::vector<int> v(100);
+ std::fill(v.begin(), v.end(), 1);
+
+ for(size_t i = 0; i < v.size(); ++i) add(v[i]);
+
+ BOOST_CHECK(sum == 1000);
+}
+

Modified: trunk/libs/local_function/test/add_lambda.cpp
==============================================================================
--- trunk/libs/local_function/test/add_lambda.cpp (original)
+++ trunk/libs/local_function/test/add_lambda.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -29,9 +29,9 @@
 }
 //]
 
-#else // NO_LAMBDAS
+#else
 
-int main(void) { return 0; } // Trivial program.
+int main(void) { return 0; } // Trivial test.
 
-#endif // NO_LAMBDAS
+#endif
 

Modified: trunk/libs/local_function/test/add_params.cpp
==============================================================================
--- trunk/libs/local_function/test/add_params.cpp (original)
+++ trunk/libs/local_function/test/add_params.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,18 +5,26 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestAddParams
 #include <boost/test/unit_test.hpp>
 
-BOOST_AUTO_TEST_CASE( test_add_params ) {
+BOOST_AUTO_TEST_CASE(test_add_params) {
     //[add_params
     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_CHECK(add(1, 2) == 3); // Local function call.
     //]
 }
-//]
+
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
 

Added: trunk/libs/local_function/test/add_params_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_params_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,19 @@
+
+// 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/local_function.hpp>
+#define BOOST_TEST_MODULE TestAddParamsSeq
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE(test_add_params_seq) {
+ int BOOST_LOCAL_FUNCTION( (int x) (int y) ) {
+ return x + y;
+ } BOOST_LOCAL_FUNCTION_NAME(add)
+
+ BOOST_CHECK(add(1, 2) == 3);
+}
+

Deleted: trunk/libs/local_function/test/add_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/add_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
+++ (empty file)
@@ -1,29 +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/local_function.hpp>
-#define BOOST_TEST_MODULE TestAddSeq
-#include <boost/test/unit_test.hpp>
-#include <algorithm>
-
-BOOST_AUTO_TEST_CASE( test_add_seq )
-//[add_seq
-{ // Some local scope.
- int sum = 0, factor = 10; // Variables in scope to bind.
-
- void BOOST_LOCAL_FUNCTION( (const bind factor) (bind& sum) (int num) ) {
- sum += factor * num; // Parameters as sequence.
- } BOOST_LOCAL_FUNCTION_NAME(add)
-
- add(1); // Call the local function.
- int nums[] = {2, 3};
- std::for_each(nums, nums + 2, add); // Pass it to an algorithm.
-
- BOOST_CHECK( sum == 60 ); // Assert final summation value.
-}
-//]
-

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestAddTemplate
 #include <boost/test/unit_test.hpp>
@@ -28,7 +31,13 @@
 }
 //]
 
-BOOST_AUTO_TEST_CASE( test_add_template ) {
- BOOST_CHECK( total(1, 2, 3) == 60 );
+BOOST_AUTO_TEST_CASE(test_add_template) {
+ BOOST_CHECK(total(1, 2, 3) == 60);
 }
 
+#else
+
+int main(void) { return 0; }
+
+#endif
+

Added: trunk/libs/local_function/test/add_template_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_template_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,31 @@
+
+// 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/local_function.hpp>
+#define BOOST_TEST_MODULE TestAddTemplateSeq
+#include <boost/test/unit_test.hpp>
+#include <algorithm>
+
+template<typename T>
+T total(const T& x, const T& y, const T& z) {
+ T sum = T(), factor = 10;
+
+ T BOOST_LOCAL_FUNCTION_TPL( (const bind factor) (bind& sum) (T num) ) {
+ return sum += factor * num;
+ } BOOST_LOCAL_FUNCTION_NAME(add)
+
+ add(x);
+ T nums[2]; nums[0] = y; nums[1] = z;
+ std::for_each(nums, nums + 2, add);
+
+ return sum;
+}
+
+BOOST_AUTO_TEST_CASE(test_add_template_seq) {
+ BOOST_CHECK(total(1, 2, 3) == 60);
+}
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestAddThis
 #include <boost/test/unit_test.hpp>
@@ -13,7 +16,7 @@
 
 //[add_this
 struct adder {
- adder(): sum_(0) {}
+ adder() : sum_(0) {}
 
     int sum(const std::vector<int>& nums, const int factor = 10) {
 
@@ -24,15 +27,22 @@
         std::for_each(nums.begin(), nums.end(), add);
         return sum_;
     }
+
 private:
     int sum_;
 };
 //]
 
-BOOST_AUTO_TEST_CASE( test_add_this ) {
+BOOST_AUTO_TEST_CASE(test_add_this) {
     std::vector<int> v(3);
     v[0] = 1; v[1] = 2; v[2] = 3;
 
- BOOST_CHECK( adder().sum(v) == 60 );
+ BOOST_CHECK(adder().sum(v) == 60);
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/add_this_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_this_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,38 @@
+
+// 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/local_function.hpp>
+#define BOOST_TEST_MODULE TestAddThisSeq
+#include <boost/test/unit_test.hpp>
+#include <vector>
+#include <algorithm>
+
+struct adder {
+ adder() : sum_(0) {}
+
+ int sum(const std::vector<int>& nums, const int factor = 10) {
+
+ void BOOST_LOCAL_FUNCTION( (const bind factor) (bind this_)
+ (int num) ) {
+ this_->sum_ += factor * num;
+ } BOOST_LOCAL_FUNCTION_NAME(add)
+
+ std::for_each(nums.begin(), nums.end(), add);
+ return sum_;
+ }
+
+private:
+ int sum_;
+};
+
+BOOST_AUTO_TEST_CASE(test_add_this_seq) {
+ std::vector<int> v(3);
+ v[0] = 1; v[1] = 2; v[2] = 3;
+
+ BOOST_CHECK(adder().sum(v) == 60);
+}
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestAddTyped
 #include <boost/test/unit_test.hpp>
@@ -13,7 +16,7 @@
 
 //[add_typed
 struct adder {
- adder(): sum_(0) {}
+ adder() : sum_(0) {}
 
     int sum(const std::vector<int>& nums, const int& factor = 10) {
         // Explicitly specify bound variable and result types.
@@ -25,15 +28,22 @@
         std::for_each(nums.begin(), nums.end(), add);
         return sum_;
     }
+
 private:
     int sum_;
 };
 //]
 
-BOOST_AUTO_TEST_CASE( test_add_typed ) {
+BOOST_AUTO_TEST_CASE(test_add_typed) {
     std::vector<int> v(3);
     v[0] = 1; v[1] = 2; v[2] = 3;
 
- BOOST_CHECK( adder().sum(v) == 60 );
+ BOOST_CHECK(adder().sum(v) == 60);
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/add_typed_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_typed_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,37 @@
+
+// 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/local_function.hpp>
+#define BOOST_TEST_MODULE TestAddTypedSeq
+#include <boost/test/unit_test.hpp>
+#include <vector>
+#include <algorithm>
+
+struct adder {
+ adder() : sum_(0) {}
+
+ int sum(const std::vector<int>& nums, const int& factor = 10) {
+ BOOST_LOCAL_FUNCTION( (const bind(const int&) factor)
+ (bind(adder*) this_) (int num) (return int) ) {
+ return this_->sum_ += factor * num;
+ } BOOST_LOCAL_FUNCTION_NAME(add)
+
+ std::for_each(nums.begin(), nums.end(), add);
+ return sum_;
+ }
+
+private:
+ int sum_;
+};
+
+BOOST_AUTO_TEST_CASE(test_add_typed_seq) {
+ std::vector<int> v(3);
+ v[0] = 1; v[1] = 2; v[2] = 3;
+
+ BOOST_CHECK(adder().sum(v) == 60);
+}
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestAddWithDefault
 #include <boost/test/unit_test.hpp>
@@ -13,14 +16,19 @@
 #define WITH_DEFAULT , default
 //]
 
-BOOST_AUTO_TEST_CASE( test_add_with_default ) {
+BOOST_AUTO_TEST_CASE(test_add_with_default) {
     //[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_CHECK(add(1) == 3);
     //]
 }
-//]
+
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
 

Added: trunk/libs/local_function/test/add_with_default_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_with_default_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,21 @@
+
+// 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/local_function.hpp>
+#define BOOST_TEST_MODULE TestAddWithDefaultSeq
+#include <boost/test/unit_test.hpp>
+
+#define WITH_DEFAULT )(default
+
+BOOST_AUTO_TEST_CASE(test_add_with_default_seq) {
+ int BOOST_LOCAL_FUNCTION( (int x) (int y WITH_DEFAULT 2) ) {
+ return x + y;
+ } BOOST_LOCAL_FUNCTION_NAME(add)
+
+ BOOST_CHECK(add(1) == 3);
+}
+

Modified: trunk/libs/local_function/test/addable.hpp
==============================================================================
--- trunk/libs/local_function/test/addable.hpp (original)
+++ trunk/libs/local_function/test/addable.hpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -15,9 +15,11 @@
     BOOST_CONCEPT_USAGE(Addable) {
         return_type(x + y); // Check addition `T operator+(T x, T y)`.
     }
+
 private:
     T x;
     T y;
+
     void return_type(T const&); // Used to check addition returns type `T`.
 };
 

Added: trunk/libs/local_function/test/all_decl.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/all_decl.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,174 @@
+
+// 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_VARIADIC_MACROS
+
+#include <boost/local_function.hpp>
+
+// Compile all local function declaration combinations.
+struct s {
+ void f(double p = 1.23, double q = -1.23) {
+ { // Only params.
+ void BOOST_LOCAL_FUNCTION(int x, int y, default 0) {
+ } BOOST_LOCAL_FUNCTION_NAME(l)
+ l(1);
+ }
+ { // Only const binds.
+ int a, b;
+
+ const int& BOOST_LOCAL_FUNCTION(const bind a,
+ const bind& b, const bind& p, const bind q) {
+ return b;
+ } BOOST_LOCAL_FUNCTION_NAME(l)
+ l();
+
+ const s& BOOST_LOCAL_FUNCTION(const bind this_) {
+ return *this_;
+ } BOOST_LOCAL_FUNCTION_NAME(t)
+ t();
+
+ const int BOOST_LOCAL_FUNCTION(const bind a,
+ const bind& b, const bind& p, const bind q,
+ const bind this_) {
+ return a;
+ } BOOST_LOCAL_FUNCTION_NAME(lt)
+ lt();
+ }
+ { // Only plain binds.
+ int c, d;
+
+ int& BOOST_LOCAL_FUNCTION(bind c, bind& d,
+ bind& p, bind& q) {
+ return d;
+ } BOOST_LOCAL_FUNCTION_NAME(l)
+ l();
+
+ s& BOOST_LOCAL_FUNCTION(bind this_) {
+ return *this_;
+ } BOOST_LOCAL_FUNCTION_NAME(t)
+ t();
+
+ int BOOST_LOCAL_FUNCTION(bind c, bind& d,
+ bind& p, bind& q, bind this_) {
+ return c;
+ } BOOST_LOCAL_FUNCTION_NAME(lt)
+ lt();
+ }
+
+ { // Both params and const binds.
+ int a, b;
+
+ void BOOST_LOCAL_FUNCTION(const bind a, const bind& b,
+ const bind& p, const bind q,
+ int x, int y, default 0) {
+ } BOOST_LOCAL_FUNCTION_NAME(l)
+ l(1);
+
+ void BOOST_LOCAL_FUNCTION(const bind this_,
+ int x, int y, default 0) {
+ } BOOST_LOCAL_FUNCTION_NAME(t)
+ t(1);
+
+ void BOOST_LOCAL_FUNCTION(const bind a, const bind this_,
+ const bind& b, const bind& p, const bind q,
+ int x, int y, default 0) {
+ } BOOST_LOCAL_FUNCTION_NAME(lt)
+ lt(1);
+ }
+ { // Both params and plain binds.
+ int c, d;
+
+ void BOOST_LOCAL_FUNCTION(bind c, bind& d, bind& p, bind q,
+ int x, int y, default 0) {
+ } BOOST_LOCAL_FUNCTION_NAME(l)
+ l(1);
+
+ void BOOST_LOCAL_FUNCTION(bind this_,
+ int x, int y, default 0) {
+ } BOOST_LOCAL_FUNCTION_NAME(t)
+ t(1);
+
+ void BOOST_LOCAL_FUNCTION(bind c, bind& d,
+ bind& p, bind this_, bind q,
+ int x, int y, default 0) {
+ } BOOST_LOCAL_FUNCTION_NAME(lt)
+ lt(1);
+ }
+ { // Both const and plain binds.
+ int a, b, c, d;
+
+ void BOOST_LOCAL_FUNCTION(const bind a, const bind& b,
+ const bind p, bind c, bind& d, bind q) {
+ } BOOST_LOCAL_FUNCTION_NAME(l)
+ l();
+
+ void BOOST_LOCAL_FUNCTION(const bind this_,
+ bind c, bind& d, bind q) {
+ } BOOST_LOCAL_FUNCTION_NAME(ct)
+ ct();
+ void BOOST_LOCAL_FUNCTION(const bind this_,
+ const bind a, const bind& b, const bind p,
+ bind c, bind& d, bind q) {
+ } BOOST_LOCAL_FUNCTION_NAME(lct)
+ lct();
+
+ void BOOST_LOCAL_FUNCTION(const bind a, const bind& b,
+ const bind p, bind this_) {
+ } BOOST_LOCAL_FUNCTION_NAME(pt)
+ pt();
+ void BOOST_LOCAL_FUNCTION(const bind a, const bind& b,
+ const bind p, bind c, bind this_, bind& d, bind q) {
+ } BOOST_LOCAL_FUNCTION_NAME(lpt)
+ lpt();
+ }
+
+ { // All params, const binds, and plain binds.
+ int a, b, c, d;
+
+ void BOOST_LOCAL_FUNCTION(
+ const bind a, const bind& b, const bind& p,
+ bind c, bind& d, bind& q, int x, int y, default 0) {
+ } BOOST_LOCAL_FUNCTION_NAME(l)
+ l(1);
+
+ void BOOST_LOCAL_FUNCTION(const bind this_,
+ bind c, bind& d, bind& q,
+ int x, int y, default 0) {
+ } BOOST_LOCAL_FUNCTION_NAME(ct)
+ ct(1);
+ void BOOST_LOCAL_FUNCTION(
+ const bind a, const bind& b, const bind& p,
+ bind this_, int x, int y, default 0) {
+ } BOOST_LOCAL_FUNCTION_NAME(pt)
+ pt(1);
+
+ void BOOST_LOCAL_FUNCTION(const bind a, const bind this_,
+ const bind& b, const bind& p, bind c, bind& d,
+ bind& q, int x, int y, default 0) {
+ } BOOST_LOCAL_FUNCTION_NAME(lct)
+ lct(1);
+ void BOOST_LOCAL_FUNCTION(const bind a, const bind& b,
+ const bind& p, bind c, bind& d, bind this_, bind& q,
+ int x, int y, default 0) {
+ } BOOST_LOCAL_FUNCTION_NAME(lpt)
+ lpt(1);
+ }
+ }
+};
+
+int main(void) {
+ s().f();
+ return 0;
+}
+
+#else
+
+int main(void) { return 0; }
+
+#endif
+

Copied: trunk/libs/local_function/test/all_decl_seq.cpp (from r77070, /trunk/libs/local_function/test/seq.cpp)
==============================================================================
--- /trunk/libs/local_function/test/seq.cpp (original)
+++ trunk/libs/local_function/test/all_decl_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -7,7 +7,7 @@
 
 #include <boost/local_function.hpp>
 
-//[seq
+// Compile all local function declaration combinations.
 struct s {
     void f(double p = 1.23, double q = -1.23) {
         { // Only params.
@@ -157,8 +157,7 @@
         }
     }
 };
-//]
-
+
 int main(void) {
     s().f();
     return 0;

Modified: trunk/libs/local_function/test/factorial.cpp
==============================================================================
--- trunk/libs/local_function/test/factorial.cpp (original)
+++ trunk/libs/local_function/test/factorial.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestFactorial
 #include <boost/test/unit_test.hpp>
@@ -32,14 +35,20 @@
 };
 //]
 
-BOOST_AUTO_TEST_CASE( test_factorial ) {
+BOOST_AUTO_TEST_CASE(test_factorial) {
     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_CHECK(calc.results[0] == 1);
+ BOOST_CHECK(calc.results[1] == 6);
+ BOOST_CHECK(calc.results[2] == 24);
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/factorial_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/factorial_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,43 @@
+
+// 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/local_function.hpp>
+#define BOOST_TEST_MODULE TestFactorialSeq
+#include <boost/test/unit_test.hpp>
+#include <algorithm>
+#include <vector>
+
+struct calculator {
+ std::vector<int> results;
+
+ void factorials(const std::vector<int>& nums) {
+ int BOOST_LOCAL_FUNCTION( (bind this_) (int num)
+ (bool recursion)(default false) ) {
+ int result = 0;
+
+ if(num <= 0) result = 1;
+ else result = num * factorial(num - 1, true);
+
+ if(!recursion) this_->results.push_back(result);
+ return result;
+ } BOOST_LOCAL_FUNCTION_NAME(recursive factorial)
+
+ std::for_each(nums.begin(), nums.end(), factorial);
+ }
+};
+
+BOOST_AUTO_TEST_CASE(test_factorial_seq) {
+ 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);
+}
+

Modified: trunk/libs/local_function/test/goto.cpp
==============================================================================
--- trunk/libs/local_function/test/goto.cpp (original)
+++ trunk/libs/local_function/test/goto.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestGoto
 #include <boost/test/unit_test.hpp>
@@ -22,7 +25,13 @@
 }
 //]
 
-BOOST_AUTO_TEST_CASE( test_goto ) {
+BOOST_AUTO_TEST_CASE(test_goto) {
     error(1, 2);
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,8 +5,11 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestGotoErr
+#define BOOST_TEST_MODULE TestGotoError
 #include <boost/test/unit_test.hpp>
 
 //[goto_error
@@ -14,7 +17,6 @@
     int BOOST_LOCAL_FUNCTION(int x) {
         if(x <= 0) goto failure; // Error: Cannot jump to enclosing scope.
         else goto success; // OK: Can jump within local function.
-
     success:
         return 0;
     } BOOST_LOCAL_FUNCTION_NAME(validate)
@@ -25,7 +27,13 @@
 }
 //]
 
-BOOST_AUTO_TEST_CASE( test_goto_err ) {
+BOOST_AUTO_TEST_CASE(test_goto_error) {
     error(1, 2);
 }
 
+#else
+
+#error "Trivial error."
+
+#endif
+

Added: trunk/libs/local_function/test/goto_error_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/goto_error_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,28 @@
+
+// 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/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) ) {
+ if(x <= 0) goto failure;
+ else goto success;
+ success:
+ return 0;
+ } BOOST_LOCAL_FUNCTION_NAME(validate)
+
+ return validate(x + y);
+faliure:
+ return -1;
+}
+
+BOOST_AUTO_TEST_CASE(test_goto_error_seq) {
+ error(1, 2);
+}
+

Added: trunk/libs/local_function/test/goto_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/goto_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,26 @@
+
+// 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/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) ) {
+ if(x > 0) goto success;
+ return -1;
+ success:
+ return 0;
+ } BOOST_LOCAL_FUNCTION_NAME(validate)
+
+ return validate(x + y);
+}
+
+BOOST_AUTO_TEST_CASE(test_goto_seq) {
+ error(1, 2);
+}
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #include <boost/utility/identity_type.hpp>
 #include <boost/config.hpp>
@@ -22,7 +25,7 @@
 
 typedef int sign_t;
 
-BOOST_AUTO_TEST_CASE( test_macro_commas ) {
+BOOST_AUTO_TEST_CASE(test_macro_commas) {
     //[macro_commas
     void BOOST_LOCAL_FUNCTION(
         BOOST_IDENTITY_TYPE((const std::map<std::string, size_t>&)) m,
@@ -40,3 +43,9 @@
     f(m, sign);
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/macro_commas_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/macro_commas_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,40 @@
+
+// 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/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>
+
+std::string cat(const std::string& x, const std::string& y) { return x + y; }
+
+template<typename V, typename K>
+struct key_sizeof {
+ BOOST_STATIC_CONSTANT(int, value = sizeof(K));
+};
+
+typedef int sign_t;
+
+BOOST_AUTO_TEST_CASE(test_macro_commas_seq) {
+ void BOOST_LOCAL_FUNCTION(
+ (BOOST_IDENTITY_TYPE((const std::map<std::string, size_t>&)) m)
+ (BOOST_IDENTITY_TYPE((::sign_t)) sign)
+ (const size_t& factor)
+ (default (key_sizeof<std::string, size_t>::value))
+ (const std::string& separator)(default cat(":", " "))
+ ) {
+ // Do something...
+ } BOOST_LOCAL_FUNCTION_NAME(f)
+
+ std::map<std::string, size_t> m;
+ ::sign_t sign = -1;
+ f(m, sign);
+}
+

Modified: trunk/libs/local_function/test/nesting.cpp
==============================================================================
--- trunk/libs/local_function/test/nesting.cpp (original)
+++ trunk/libs/local_function/test/nesting.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,11 +5,14 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestNesting
 #include <boost/test/unit_test.hpp>
 
-BOOST_AUTO_TEST_CASE( test_nesting ) {
+BOOST_AUTO_TEST_CASE(test_nesting) {
     //[nesting
     int x = 0;
 
@@ -24,6 +27,13 @@
     
     f();
     //]
- BOOST_CHECK( x == 0 );
+
+ BOOST_CHECK(x == 0);
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/nesting_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/nesting_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,28 @@
+
+// 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/local_function.hpp>
+#define BOOST_TEST_MODULE TestNestingSeq
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE(test_nesting_seq) {
+ int x = 0;
+
+ void BOOST_LOCAL_FUNCTION( (bind& x) ) {
+ void BOOST_LOCAL_FUNCTION( (bind& x) ) {
+ x++;
+ } BOOST_LOCAL_FUNCTION_NAME(g)
+
+ x--;
+ g();
+ } BOOST_LOCAL_FUNCTION_NAME(f)
+
+ f();
+
+ BOOST_CHECK(x == 0);
+}
+

Modified: trunk/libs/local_function/test/operator.cpp
==============================================================================
--- trunk/libs/local_function/test/operator.cpp (original)
+++ trunk/libs/local_function/test/operator.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestOperator
 #include <boost/test/unit_test.hpp>
@@ -15,14 +18,20 @@
     int y;
 };
 
-BOOST_AUTO_TEST_CASE( test_operator ) {
+BOOST_AUTO_TEST_CASE(test_operator) {
     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_CHECK(equal(a, b));
 }
 //]
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,8 +5,11 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestOperatorErr
+#define BOOST_TEST_MODULE TestOperatorError
 #include <boost/test/unit_test.hpp>
 
 //[operator_error
@@ -15,14 +18,20 @@
     int y;
 };
 
-BOOST_AUTO_TEST_CASE( test_operator_err ) {
+BOOST_AUTO_TEST_CASE(test_operator_error) {
     bool BOOST_LOCAL_FUNCTION(const point& p, const point& q) {
         return p.x == q.x && p.y == q.y;
     } BOOST_LOCAL_FUNCTION_NAME(operator==) // Error: Cannot use `operator...`.
 
     point a; a.x = 1; a.y = 2;
     point b = a;
- BOOST_CHECK( a == b );
+ BOOST_CHECK(a == b);
 }
 //]
 
+#else
+
+#error "Trivial error."
+
+#endif
+

Added: trunk/libs/local_function/test/operator_error_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/operator_error_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,26 @@
+
+// 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/local_function.hpp>
+#define BOOST_TEST_MODULE TestOperatorErrorSeq
+#include <boost/test/unit_test.hpp>
+
+struct point {
+ int x;
+ int y;
+};
+
+BOOST_AUTO_TEST_CASE(test_operator_error_seq) {
+ 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);
+}
+

Added: trunk/libs/local_function/test/operator_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/operator_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,26 @@
+
+// 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/local_function.hpp>
+#define BOOST_TEST_MODULE TestOperatorSeq
+#include <boost/test/unit_test.hpp>
+
+struct point {
+ int x;
+ int y;
+};
+
+BOOST_AUTO_TEST_CASE(test_operator_seq) {
+ 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));
+}
+

Modified: trunk/libs/local_function/test/overload.cpp
==============================================================================
--- trunk/libs/local_function/test/overload.cpp (original)
+++ trunk/libs/local_function/test/overload.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #include <boost/functional/overloaded_function.hpp> // For overloading.
 #define BOOST_TEST_MODULE TestOverload
@@ -15,7 +18,7 @@
 //[overload
 int add_i(int x, int y) { return x + y; }
 
-BOOST_AUTO_TEST_CASE( test_overload ) {
+BOOST_AUTO_TEST_CASE(test_overload) {
     std::string s = "abc";
     std::string BOOST_LOCAL_FUNCTION(
             const bind& s, const std::string& x) {
@@ -34,10 +37,16 @@
         , 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_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`.
 }
 //]
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/overload_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/overload_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,42 @@
+
+// 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/local_function.hpp>
+#include <boost/functional/overloaded_function.hpp>
+#define BOOST_TEST_MODULE TestOverloadSeq
+#include <boost/test/unit_test.hpp>
+#include <string>
+#include <cmath>
+
+int add_i(int x, int y) { return x + y; }
+
+BOOST_AUTO_TEST_CASE(test_overload_seq) {
+ std::string s = "abc";
+ std::string BOOST_LOCAL_FUNCTION(
+ (const bind& s) (const std::string& x) ) {
+ return s + x;
+ } BOOST_LOCAL_FUNCTION_NAME(add_s)
+
+ double d = 1.23;
+ double BOOST_LOCAL_FUNCTION( (const bind d) (double x)
+ (double y)(default 0) ) {
+ return d + x + y;
+ } BOOST_LOCAL_FUNCTION_NAME(add_d)
+
+ boost::overloaded_function<
+ std::string (const std::string&)
+ , double (double)
+ , double (double, double)
+ , 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);
+}
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #include <boost/function.hpp>
 #define BOOST_TEST_MODULE TestReturnAssign
@@ -12,8 +15,8 @@
 #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_CHECK(f(1) == 5); }
+void call0(boost::function<int (void)> f) { BOOST_CHECK(f() == 5); }
 
 boost::function<int (int, int)> linear(const int& slope) {
     int BOOST_LOCAL_FUNCTION(const bind& slope,
@@ -22,7 +25,7 @@
     } BOOST_LOCAL_FUNCTION_NAME(lin)
 
     boost::function<int (int, int)> f = lin; // Assign to local variable.
- BOOST_CHECK( f(1, 2) == 5 );
+ BOOST_CHECK(f(1, 2) == 5);
 
     call1(lin); // Pass to other functions.
     call0(lin);
@@ -32,11 +35,17 @@
 
 void call(void) {
     boost::function<int (int, int)> f = linear(2);
- BOOST_CHECK( f(1, 2) == 5 );
+ BOOST_CHECK(f(1, 2) == 5);
 }
 //]
 
-BOOST_AUTO_TEST_CASE( test_return_assign ) {
+BOOST_AUTO_TEST_CASE(test_return_assign) {
     call();
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/return_assign_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/return_assign_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,40 @@
+
+// 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/local_function.hpp>
+#include <boost/function.hpp>
+#define BOOST_TEST_MODULE TestReturnAssignSeq
+#include <boost/test/unit_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); }
+
+boost::function<int (int, int)> linear(const int& slope) {
+ int BOOST_LOCAL_FUNCTION( (const bind& slope)
+ (int x)(default 1) (int y)(default 2) ) {
+ return x + slope * y;
+ } BOOST_LOCAL_FUNCTION_NAME(lin)
+
+ boost::function<int (int, int)> f = lin;
+ BOOST_CHECK(f(1, 2) == 5);
+
+ call1(lin);
+ call0(lin);
+
+ return lin;
+}
+
+void call(void) {
+ boost::function<int (int, int)> f = linear(2);
+ BOOST_CHECK(f(1, 2) == 5);
+}
+
+BOOST_AUTO_TEST_CASE(test_return_assign_seq) {
+ call();
+}
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #include <boost/function.hpp>
 #define BOOST_TEST_MODULE TestReturnDerivative
@@ -14,16 +17,24 @@
     int BOOST_LOCAL_FUNCTION(bind& f, const bind dx, int x) {
         return (f(x + dx) - f(x)) / dx;
     } BOOST_LOCAL_FUNCTION_NAME(deriv)
+
     return deriv;
 }
 
-BOOST_AUTO_TEST_CASE( test_return_derivative ) {
+BOOST_AUTO_TEST_CASE(test_return_derivative) {
     int BOOST_LOCAL_FUNCTION(int x) {
         return x + 4;
     } BOOST_LOCAL_FUNCTION_NAME(add2)
+
     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_CHECK(d2(6) == 1);
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/return_derivative_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/return_derivative_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,31 @@
+
+// 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/local_function.hpp>
+#include <boost/function.hpp>
+#define BOOST_TEST_MODULE TestReturnDerivativeSeq
+#include <boost/test/unit_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) ) {
+ return (f(x + dx) - f(x)) / dx;
+ } BOOST_LOCAL_FUNCTION_NAME(deriv)
+
+ return deriv;
+}
+
+BOOST_AUTO_TEST_CASE(test_return_derivative_seq) {
+ int BOOST_LOCAL_FUNCTION( (int x) ) {
+ return x + 4;
+ } BOOST_LOCAL_FUNCTION_NAME(add2)
+
+ boost::function<int (int)> a2 = add2;
+
+ boost::function<int (int)> d2 = derivative(a2, 2);
+ BOOST_CHECK(d2(6) == 1);
+}
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #include <boost/function.hpp>
 #define BOOST_TEST_MODULE TestReturnInc
@@ -17,15 +20,21 @@
     return i;
 }
 
-BOOST_AUTO_TEST_CASE( test_return_inc ) {
+BOOST_AUTO_TEST_CASE(test_return_inc) {
     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_CHECK(inc1() == 1);
+ BOOST_CHECK(inc1() == 2);
+ BOOST_CHECK(inc2() == 1);
+ BOOST_CHECK(inc1() == 3);
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/return_inc_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/return_inc_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,31 @@
+
+// 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/local_function.hpp>
+#include <boost/function.hpp>
+#define BOOST_TEST_MODULE TestReturnIncSeq
+#include <boost/test/unit_test.hpp>
+
+boost::function<int (void)> inc(int& value) {
+ int BOOST_LOCAL_FUNCTION( (bind& value) ) {
+ return ++value;
+ } BOOST_LOCAL_FUNCTION_NAME(i)
+ return i;
+}
+
+BOOST_AUTO_TEST_CASE(test_return_inc_seq) {
+ 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);
+}
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #include <boost/function.hpp>
 #define BOOST_TEST_MODULE TestReturnSetGet
@@ -16,12 +19,12 @@
 
 void action(void) {
     // State `message` hidden behind access functions from here.
- BOOST_CHECK( get() == "abc" );
+ BOOST_CHECK(get() == "abc");
     set("xyz");
- BOOST_CHECK( get() == "xyz" );
+ BOOST_CHECK(get() == "xyz");
 }
 
-BOOST_AUTO_TEST_CASE( test_return_setget ) {
+BOOST_AUTO_TEST_CASE(test_return_setget) {
     std::string message = "abc"; // Reference valid where closure used.
     
     void BOOST_LOCAL_FUNCTION(bind& message, const std::string& text) {
@@ -37,3 +40,9 @@
     action();
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/return_setget_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/return_setget_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,38 @@
+
+// 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/local_function.hpp>
+#include <boost/function.hpp>
+#define BOOST_TEST_MODULE TestReturnSetgetSeq
+#include <boost/test/unit_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");
+ set("xyz");
+ BOOST_CHECK(get() == "xyz");
+}
+
+BOOST_AUTO_TEST_CASE(test_return_setget_seq) {
+ std::string message = "abc";
+
+ void BOOST_LOCAL_FUNCTION( (bind& message) (const std::string& text) ) {
+ message = text;
+ } BOOST_LOCAL_FUNCTION_NAME(s)
+ set = s;
+
+ const std::string& BOOST_LOCAL_FUNCTION( (const bind& message) ) {
+ return message;
+ } BOOST_LOCAL_FUNCTION_NAME(g)
+ get = g;
+
+ action();
+}
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #include <boost/function.hpp>
 #define BOOST_TEST_MODULE TestReturnThis
@@ -24,15 +27,21 @@
     int value_;
 };
 
-BOOST_AUTO_TEST_CASE( test_return_this ) {
+BOOST_AUTO_TEST_CASE(test_return_this) {
     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_CHECK(inc1() == 1);
+ BOOST_CHECK(inc1() == 2);
+ BOOST_CHECK(inc2() == 1);
+ BOOST_CHECK(inc1() == 3);
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/return_this_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/return_this_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,38 @@
+
+// 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/local_function.hpp>
+#include <boost/function.hpp>
+#define BOOST_TEST_MODULE TestReturnThisSeq
+#include <boost/test/unit_test.hpp>
+
+struct number {
+ number(int value) : value_(value) {}
+
+ boost::function<int (void)> inc(void) {
+ int BOOST_LOCAL_FUNCTION( (bind this_) ) {
+ return ++this_->value_;
+ } BOOST_LOCAL_FUNCTION_NAME(i)
+ return i;
+ }
+
+private:
+ int value_;
+};
+
+BOOST_AUTO_TEST_CASE(test_return_this_seq) {
+ 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);
+}
+

Deleted: trunk/libs/local_function/test/seq.cpp
==============================================================================
--- trunk/libs/local_function/test/seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
+++ (empty file)
@@ -1,166 +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/local_function.hpp>
-
-//[seq
-struct s {
- void f(double p = 1.23, double q = -1.23) {
- { // Only params.
- void BOOST_LOCAL_FUNCTION( (int x) (int y)(default 0) ) {
- } BOOST_LOCAL_FUNCTION_NAME(l)
- l(1);
- }
- { // Only const binds.
- int a, b;
-
- const int& BOOST_LOCAL_FUNCTION( (const bind a)
- (const bind& b) (const bind& p) (const bind q) ) {
- return b;
- } BOOST_LOCAL_FUNCTION_NAME(l)
- l();
-
- const s& BOOST_LOCAL_FUNCTION( (const bind this_) ) {
- return *this_;
- } BOOST_LOCAL_FUNCTION_NAME(t)
- t();
-
- const int BOOST_LOCAL_FUNCTION( (const bind a)
- (const bind& b) (const bind& p) (const bind q)
- (const bind this_) ) {
- return a;
- } BOOST_LOCAL_FUNCTION_NAME(lt)
- lt();
- }
- { // Only plain binds.
- int c, d;
-
- int& BOOST_LOCAL_FUNCTION( (bind c) (bind& d)
- (bind& p) (bind& q) ) {
- return d;
- } BOOST_LOCAL_FUNCTION_NAME(l)
- l();
-
- s& BOOST_LOCAL_FUNCTION( (bind this_) ) {
- return *this_;
- } BOOST_LOCAL_FUNCTION_NAME(t)
- t();
-
- int BOOST_LOCAL_FUNCTION( (bind c) (bind& d)
- (bind& p) (bind& q) (bind this_) ) {
- return c;
- } BOOST_LOCAL_FUNCTION_NAME(lt)
- lt();
- }
-
- { // Both params and const binds.
- int a, b;
-
- void BOOST_LOCAL_FUNCTION( (const bind a) (const bind& b)
- (const bind& p) (const bind q)
- (int x) (int y)(default 0) ) {
- } BOOST_LOCAL_FUNCTION_NAME(l)
- l(1);
-
- void BOOST_LOCAL_FUNCTION( (const bind this_)
- (int x) (int y)(default 0) ) {
- } BOOST_LOCAL_FUNCTION_NAME(t)
- t(1);
-
- void BOOST_LOCAL_FUNCTION( (const bind a) (const bind this_)
- (const bind& b) (const bind& p) (const bind q)
- (int x) (int y)(default 0) ) {
- } BOOST_LOCAL_FUNCTION_NAME(lt)
- lt(1);
- }
- { // Both params and plain binds.
- int c, d;
-
- void BOOST_LOCAL_FUNCTION( (bind c) (bind& d) (bind& p) (bind q)
- (int x) (int y)(default 0) ) {
- } BOOST_LOCAL_FUNCTION_NAME(l)
- l(1);
-
- void BOOST_LOCAL_FUNCTION( (bind this_)
- (int x) (int y)(default 0) ) {
- } BOOST_LOCAL_FUNCTION_NAME(t)
- t(1);
-
- void BOOST_LOCAL_FUNCTION( (bind c) (bind& d)
- (bind& p) (bind this_) (bind q)
- (int x) (int y)(default 0) ) {
- } BOOST_LOCAL_FUNCTION_NAME(lt)
- lt(1);
- }
- { // Both const and plain binds.
- int a, b, c, d;
-
- void BOOST_LOCAL_FUNCTION( (const bind a) (const bind& b)
- (const bind p) (bind c) (bind& d) (bind q) ) {
- } BOOST_LOCAL_FUNCTION_NAME(l)
- l();
-
- void BOOST_LOCAL_FUNCTION( (const bind this_)
- (bind c) (bind& d) (bind q) ) {
- } BOOST_LOCAL_FUNCTION_NAME(ct)
- ct();
- void BOOST_LOCAL_FUNCTION( (const bind this_)
- (const bind a) (const bind& b) (const bind p)
- (bind c) (bind& d) (bind q) ) {
- } BOOST_LOCAL_FUNCTION_NAME(lct)
- lct();
-
- void BOOST_LOCAL_FUNCTION( (const bind a) (const bind& b)
- (const bind p) (bind this_) ) {
- } BOOST_LOCAL_FUNCTION_NAME(pt)
- pt();
- void BOOST_LOCAL_FUNCTION( (const bind a) (const bind& b)
- (const bind p) (bind c) (bind this_) (bind& d) (bind q) ) {
- } BOOST_LOCAL_FUNCTION_NAME(lpt)
- lpt();
- }
-
- { // All params, const binds, and plain binds.
- int a, b, c, d;
-
- void BOOST_LOCAL_FUNCTION(
- (const bind a) (const bind& b) (const bind& p)
- (bind c) (bind& d) (bind& q) (int x) (int y)(default 0) ) {
- } BOOST_LOCAL_FUNCTION_NAME(l)
- l(1);
-
- void BOOST_LOCAL_FUNCTION( (const bind this_)
- (bind c) (bind& d) (bind& q)
- (int x) (int y)(default 0) ) {
- } BOOST_LOCAL_FUNCTION_NAME(ct)
- ct(1);
- void BOOST_LOCAL_FUNCTION(
- (const bind a) (const bind& b) (const bind& p)
- (bind this_) (int x) (int y)(default 0) ) {
- } BOOST_LOCAL_FUNCTION_NAME(pt)
- pt(1);
-
- void BOOST_LOCAL_FUNCTION( (const bind a) (const bind this_)
- (const bind& b) (const bind& p) (bind c) (bind& d)
- (bind& q) (int x) (int y)(default 0) ) {
- } BOOST_LOCAL_FUNCTION_NAME(lct)
- lct(1);
- void BOOST_LOCAL_FUNCTION( (const bind a) (const bind& b)
- (const bind& p) (bind c) (bind& d) (bind this_) (bind& q)
- (int x) (int y)(default 0) ) {
- } BOOST_LOCAL_FUNCTION_NAME(lpt)
- lpt(1);
- }
- }
-};
-//]
-
-int main(void) {
- s().f();
- return 0;
-}
-

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -10,13 +10,13 @@
 #include <boost/test/unit_test.hpp>
 #include <iostream>
 
-BOOST_AUTO_TEST_CASE( test_ten_void ) {
+BOOST_AUTO_TEST_CASE(test_ten_void) {
     //[ten_void
     int BOOST_LOCAL_FUNCTION(void) { // No parameter.
         return 10;
     } BOOST_LOCAL_FUNCTION_NAME(ten)
 
- BOOST_CHECK( ten() == 10 );
+ BOOST_CHECK(ten() == 10);
     //]
 }
 

Modified: trunk/libs/local_function/test/transform.cpp
==============================================================================
--- trunk/libs/local_function/test/transform.cpp (original)
+++ trunk/libs/local_function/test/transform.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,20 +5,23 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include <boost/local_function.hpp>
 #define BOOST_TEST_MODULE TestTranform
 #include <boost/test/unit_test.hpp>
 #include <algorithm>
 #include <vector>
 
-BOOST_AUTO_TEST_CASE( test_transform ) {
+BOOST_AUTO_TEST_CASE(test_transform) {
     //[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_CHECK(v[0] == 10); BOOST_CHECK(v[1] == 20);
     w.resize(v.size());
 
     int BOOST_LOCAL_FUNCTION(const bind& offset, int i) {
@@ -26,7 +29,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_CHECK(w[0] == 16); BOOST_CHECK(w[1] == 26);
 
     int BOOST_LOCAL_FUNCTION(bind& inc, int i, int j) {
         return inc(i + j); // Call the other bound local function.
@@ -34,7 +37,13 @@
     
     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_CHECK(v[0] == 27); BOOST_CHECK(v[1] == 47);
     //]
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/transform_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/transform_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,38 @@
+
+// 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/local_function.hpp>
+#define BOOST_TEST_MODULE TestTranformSeq
+#include <boost/test/unit_test.hpp>
+#include <algorithm>
+#include <vector>
+
+BOOST_AUTO_TEST_CASE(test_transform_seq) {
+ 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);
+ w.resize(v.size());
+
+ int BOOST_LOCAL_FUNCTION( (const bind& offset) (int i) ) {
+ return ++i + offset;
+ } BOOST_LOCAL_FUNCTION_NAME(inc)
+
+ std::transform(v.begin(), v.end(), w.begin(), inc);
+ BOOST_CHECK(w[0] == 16); BOOST_CHECK(w[1] == 26);
+
+ int BOOST_LOCAL_FUNCTION( (bind& inc) (int i) (int j) ) {
+ return inc(i + j);
+ } BOOST_LOCAL_FUNCTION_NAME(inc_sum)
+
+ offset = 0;
+ std::transform(v.begin(), v.end(), w.begin(), v.begin(), inc_sum);
+ BOOST_CHECK(v[0] == 27); BOOST_CHECK(v[1] == 47);
+}
+

Modified: trunk/libs/local_function/test/typeof.cpp
==============================================================================
--- trunk/libs/local_function/test/typeof.cpp (original)
+++ trunk/libs/local_function/test/typeof.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include "addable.hpp"
 #include <boost/local_function.hpp>
 #include <boost/type_traits/remove_reference.hpp>
@@ -13,15 +16,15 @@
 #include <boost/test/unit_test.hpp>
 #include <algorithm>
 
-BOOST_AUTO_TEST_CASE( test_typeof ) {
+BOOST_AUTO_TEST_CASE(test_typeof) {
     //[typeof
     int sum = 0, factor = 10;
 
     void BOOST_LOCAL_FUNCTION(const bind factor, bind& sum, int num) {
- // Typeof for concept checking.
+ // Type-of for concept checking.
         BOOST_CONCEPT_ASSERT((Addable<boost::remove_reference<
                 BOOST_LOCAL_FUNCTION_TYPEOF(sum)>::type>));
- // Typeof for declarations.
+ // Type-of for declarations.
         boost::remove_reference<BOOST_LOCAL_FUNCTION_TYPEOF(
                 factor)>::type mult = factor * num;
         sum += mult;
@@ -29,6 +32,12 @@
 
     add(6);
     //]
- BOOST_CHECK( sum == 60 );
+ BOOST_CHECK(sum == 60);
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/typeof_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/typeof_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,30 @@
+
+// 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 "addable.hpp"
+#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 <algorithm>
+
+BOOST_AUTO_TEST_CASE(test_typeof_seq) {
+ int sum = 0, factor = 10;
+
+ void BOOST_LOCAL_FUNCTION( (const bind factor) (bind& sum) (int num) ) {
+ BOOST_CONCEPT_ASSERT((Addable<boost::remove_reference<
+ BOOST_LOCAL_FUNCTION_TYPEOF(sum)>::type>));
+ boost::remove_reference<BOOST_LOCAL_FUNCTION_TYPEOF(
+ factor)>::type mult = factor * num;
+ sum += mult;
+ } BOOST_LOCAL_FUNCTION_NAME(add)
+
+ add(6);
+ BOOST_CHECK(sum == 60);
+}
+

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-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -5,6 +5,9 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 // Home at http://www.boost.org/libs/local_function
 
+#include <boost/config.hpp>
+#ifndef BOOST_NO_VARIADIC_MACROS
+
 #include "addable.hpp"
 #include <boost/local_function.hpp>
 #include <boost/type_traits/remove_reference.hpp>
@@ -30,7 +33,13 @@
 }
 //]
 
-BOOST_AUTO_TEST_CASE( test_typeof_template ) {
- BOOST_CHECK( calculate(10) == 60 );
+BOOST_AUTO_TEST_CASE(test_typeof_template) {
+ BOOST_CHECK(calculate(10) == 60);
 }
 
+#else
+
+int main(void) { return 0; } // Trivial test.
+
+#endif
+

Added: trunk/libs/local_function/test/typeof_template_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/typeof_template_seq.cpp 2012-02-20 15:07:29 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,33 @@
+
+// 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 "addable.hpp"
+#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 <algorithm>
+
+template<typename T>
+T calculate(const T& factor) {
+ T sum = 0;
+
+ void BOOST_LOCAL_FUNCTION_TPL( (const bind factor) (bind& sum) (T num) ) {
+ BOOST_CONCEPT_ASSERT((Addable<typename boost::remove_reference<
+ BOOST_LOCAL_FUNCTION_TYPEOF(sum)>::type>));
+ sum += factor * num;
+ } BOOST_LOCAL_FUNCTION_NAME(add)
+
+ add(6);
+ return sum;
+}
+
+BOOST_AUTO_TEST_CASE(test_typeof_template_seq) {
+ BOOST_CHECK(calculate(10) == 60);
+}
+


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