Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77082 - trunk/libs/local_function/test
From: lorcaminiti_at_[hidden]
Date: 2012-02-20 15:20:37


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

Log:
Added sequence syntax for a test.
Added:
   trunk/libs/local_function/test/add_seq.cpp (contents, props changed)

Added: trunk/libs/local_function/test/add_seq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/local_function/test/add_seq.cpp 2012-02-20 15:20:36 EST (Mon, 20 Feb 2012)
@@ -0,0 +1,29 @@
+
+// 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
+{
+ int sum = 0, factor = 10;
+
+ void BOOST_LOCAL_FUNCTION( (const bind factor) (bind& sum) (int num) ) {
+ sum += factor * num;
+ } BOOST_LOCAL_FUNCTION_NAME(add)
+
+ add(1);
+ int nums[] = {2, 3};
+ std::for_each(nums, nums + 2, add);
+
+ BOOST_CHECK(sum == 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