From 996a4da2d6224878529438f0f5a34ff201ca487b Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Fri, 22 Jun 2007 18:02:58 +0000 Subject: [PATCH] testing fusion transform and fold work with free functions now that only Boost.ResultOf support is required [SVN r38063] --- test/algorithm/fold.cpp | 15 +++++++++++++++ test/algorithm/transform.cpp | 11 +++++++++++ 2 files changed, 26 insertions(+) diff --git a/test/algorithm/fold.cpp b/test/algorithm/fold.cpp index 9545cd0e..933eadb3 100644 --- a/test/algorithm/fold.cpp +++ b/test/algorithm/fold.cpp @@ -115,6 +115,11 @@ struct lvalue_adder } }; +int add(int lhs, int rhs) +{ + return lhs + rhs; +} + int main() { @@ -164,6 +169,11 @@ main() BOOST_TEST(fusion::fold(vec, 0, lvalue_adder()) == 3); } + { + vector vec(1,2); + BOOST_TEST(fusion::fold(vec, 0, add) == 3); + } + { typedef vector vector_type; vector_type v(12345, 'x', 678910, 3.36); @@ -202,6 +212,11 @@ main() == "abcde"); } + { + vector vec(1,2); + BOOST_TEST(fusion::accumulate(vec, 0, add) == 3); + } + return boost::report_errors(); } diff --git a/test/algorithm/transform.cpp b/test/algorithm/transform.cpp index 24cccd83..c7ce3625 100644 --- a/test/algorithm/transform.cpp +++ b/test/algorithm/transform.cpp @@ -71,6 +71,11 @@ struct unary_lvalue_transform } }; +int twice(int v) +{ + return v*2; +} + struct binary_lvalue_transform { template @@ -141,6 +146,12 @@ main() BOOST_TEST(*begin(transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1)); } + { + vector tup1(1, 2, 3); + BOOST_TEST(transform(tup1, twice) == make_vector(2,4,6)); + } + + return boost::report_errors(); }