diff --git a/test/algorithm/fold.cpp b/test/algorithm/fold.cpp index 6cefb99d..627ca01f 100644 --- a/test/algorithm/fold.cpp +++ b/test/algorithm/fold.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -18,6 +19,8 @@ #include #include +#include + using boost::mpl::if_; using boost::mpl::int_; using boost::is_same; @@ -73,6 +76,16 @@ struct count_ints } }; +struct appender +{ + typedef std::string result_type; + + std::string operator()(char c, std::string const& str) const + { + return str + c; + } +}; + int main() { @@ -112,6 +125,11 @@ main() BOOST_TEST(n == 3); } + { + BOOST_TEST(fusion::fold(fusion::make_vector('a','b','c','d','e'), std::string(""), appender()) + == "abcde"); + } + { typedef vector vector_type; vector_type v(12345, 'x', 678910, 3.36); @@ -145,6 +163,10 @@ main() BOOST_TEST(n == 3); } + { + BOOST_TEST(fusion::accumulate(fusion::make_vector('a','b','c','d','e'), std::string(""), appender()) + == "abcde"); + } return boost::report_errors(); }