diff --git a/test/Jamfile b/test/Jamfile index 33701cb6..fbfea3c9 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -65,6 +65,12 @@ project [ run sequence/boost_tuple.cpp : : : : ] [ run sequence/boost_tuple_iterator.cpp : : : : ] [ run sequence/cons.cpp : : : : ] + [ run sequence/convert_boost_tuple.cpp : : : : ] + [ run sequence/convert_deque.cpp : : : : ] + [ run sequence/convert_list.cpp : : : : ] + [ run sequence/convert_std_pair.cpp : : : : ] + [ run sequence/convert_std_tuple.cpp : : : : ] + [ run sequence/convert_vector.cpp : : : : ] [ run sequence/filter_view.cpp : : : : ] [ run sequence/hash.cpp : : : : ] [ run sequence/io.cpp : : : : ] diff --git a/test/sequence/convert.hpp b/test/sequence/convert.hpp new file mode 100644 index 00000000..233fabfb --- /dev/null +++ b/test/sequence/convert.hpp @@ -0,0 +1,51 @@ +/*============================================================================= + Copyright (c) 2015 Kohei Takahashi + + Use modification and distribution are subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +==============================================================================*/ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#include +#endif + +template +void test(FUSION_SEQUENCE const& seq) +{ + typedef typename + boost::fusion::result_of::convert< + Tag + , FUSION_SEQUENCE + >::type + type; + + type v = boost::fusion::convert(seq); + BOOST_TEST((boost::fusion::at_c<0>(v) == 123)); + BOOST_TEST((boost::fusion::at_c<1>(v) == "Hola!!!")); +} + +int main() +{ + FUSION_SEQUENCE seq(123, "Hola!!!"); + test(seq); + test(seq); + test(seq); + test(seq); +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + test(seq); +#endif + + return boost::report_errors(); +} + diff --git a/test/sequence/convert_boost_tuple.cpp b/test/sequence/convert_boost_tuple.cpp new file mode 100644 index 00000000..588ee4d7 --- /dev/null +++ b/test/sequence/convert_boost_tuple.cpp @@ -0,0 +1,14 @@ +/*============================================================================= + Copyright (c) 2015 Kohei Takahashi + + Use modification and distribution are subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +==============================================================================*/ + +#include +#include + +#define FUSION_SEQUENCE boost::tuples::tuple +#include "convert.hpp" + diff --git a/test/sequence/convert_deque.cpp b/test/sequence/convert_deque.cpp new file mode 100644 index 00000000..5be34d3f --- /dev/null +++ b/test/sequence/convert_deque.cpp @@ -0,0 +1,13 @@ +/*============================================================================= + Copyright (c) 2015 Kohei Takahashi + + Use modification and distribution are subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +==============================================================================*/ + +#include + +#define FUSION_SEQUENCE boost::fusion::deque +#include "convert.hpp" + diff --git a/test/sequence/convert_list.cpp b/test/sequence/convert_list.cpp new file mode 100644 index 00000000..57ad0507 --- /dev/null +++ b/test/sequence/convert_list.cpp @@ -0,0 +1,13 @@ +/*============================================================================= + Copyright (c) 2015 Kohei Takahashi + + Use modification and distribution are subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +==============================================================================*/ + +#include + +#define FUSION_SEQUENCE boost::fusion::list +#include "convert.hpp" + diff --git a/test/sequence/convert_std_pair.cpp b/test/sequence/convert_std_pair.cpp new file mode 100644 index 00000000..aa350025 --- /dev/null +++ b/test/sequence/convert_std_pair.cpp @@ -0,0 +1,14 @@ +/*============================================================================= + Copyright (c) 2015 Kohei Takahashi + + Use modification and distribution are subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +==============================================================================*/ + +#include +#include + +#define FUSION_SEQUENCE std::pair +#include "convert.hpp" + diff --git a/test/sequence/convert_std_tuple.cpp b/test/sequence/convert_std_tuple.cpp new file mode 100644 index 00000000..3e28276c --- /dev/null +++ b/test/sequence/convert_std_tuple.cpp @@ -0,0 +1,25 @@ +/*============================================================================= + Copyright (c) 2015 Kohei Takahashi + + Use modification and distribution are subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +==============================================================================*/ + +#include + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#include +#include + +#define FUSION_SEQUENCE std::tuple +#include "convert.hpp" + +#else + +int main() +{ +} + +#endif diff --git a/test/sequence/convert_vector.cpp b/test/sequence/convert_vector.cpp new file mode 100644 index 00000000..b39014df --- /dev/null +++ b/test/sequence/convert_vector.cpp @@ -0,0 +1,13 @@ +/*============================================================================= + Copyright (c) 2015 Kohei Takahashi + + Use modification and distribution are subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +==============================================================================*/ + +#include + +#define FUSION_SEQUENCE boost::fusion::vector +#include "convert.hpp" +