forked from boostorg/fusion
Add convert tests for non-assoc containers.
This commit is contained in:
@ -65,6 +65,12 @@ project
|
|||||||
[ run sequence/boost_tuple.cpp : : : : ]
|
[ run sequence/boost_tuple.cpp : : : : ]
|
||||||
[ run sequence/boost_tuple_iterator.cpp : : : : ]
|
[ run sequence/boost_tuple_iterator.cpp : : : : ]
|
||||||
[ run sequence/cons.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/filter_view.cpp : : : : ]
|
||||||
[ run sequence/hash.cpp : : : : ]
|
[ run sequence/hash.cpp : : : : ]
|
||||||
[ run sequence/io.cpp : : : : ]
|
[ run sequence/io.cpp : : : : ]
|
||||||
|
51
test/sequence/convert.hpp
Normal file
51
test/sequence/convert.hpp
Normal file
@ -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 <string>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
#include <boost/fusion/include/convert.hpp>
|
||||||
|
#include <boost/fusion/include/at.hpp>
|
||||||
|
|
||||||
|
#include <boost/fusion/include/vector.hpp>
|
||||||
|
#include <boost/fusion/include/deque.hpp>
|
||||||
|
#include <boost/fusion/include/list.hpp>
|
||||||
|
#include <boost/fusion/include/boost_tuple.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
#include <boost/fusion/include/std_tuple.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <typename Tag>
|
||||||
|
void test(FUSION_SEQUENCE<int, std::string> const& seq)
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
boost::fusion::result_of::convert<
|
||||||
|
Tag
|
||||||
|
, FUSION_SEQUENCE<int, std::string>
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
type v = boost::fusion::convert<Tag>(seq);
|
||||||
|
BOOST_TEST((boost::fusion::at_c<0>(v) == 123));
|
||||||
|
BOOST_TEST((boost::fusion::at_c<1>(v) == "Hola!!!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
FUSION_SEQUENCE<int, std::string> seq(123, "Hola!!!");
|
||||||
|
test<boost::fusion::vector_tag>(seq);
|
||||||
|
test<boost::fusion::deque_tag>(seq);
|
||||||
|
test<boost::fusion::cons_tag>(seq);
|
||||||
|
test<boost::fusion::boost_tuple_tag>(seq);
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
test<boost::fusion::std_tuple_tag>(seq);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
|
|
14
test/sequence/convert_boost_tuple.cpp
Normal file
14
test/sequence/convert_boost_tuple.cpp
Normal file
@ -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 <boost/tuple/tuple.hpp>
|
||||||
|
#include <boost/fusion/include/boost_tuple.hpp>
|
||||||
|
|
||||||
|
#define FUSION_SEQUENCE boost::tuples::tuple
|
||||||
|
#include "convert.hpp"
|
||||||
|
|
13
test/sequence/convert_deque.cpp
Normal file
13
test/sequence/convert_deque.cpp
Normal file
@ -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 <boost/fusion/include/deque.hpp>
|
||||||
|
|
||||||
|
#define FUSION_SEQUENCE boost::fusion::deque
|
||||||
|
#include "convert.hpp"
|
||||||
|
|
13
test/sequence/convert_list.cpp
Normal file
13
test/sequence/convert_list.cpp
Normal file
@ -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 <boost/fusion/include/list.hpp>
|
||||||
|
|
||||||
|
#define FUSION_SEQUENCE boost::fusion::list
|
||||||
|
#include "convert.hpp"
|
||||||
|
|
14
test/sequence/convert_std_pair.cpp
Normal file
14
test/sequence/convert_std_pair.cpp
Normal file
@ -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 <utility>
|
||||||
|
#include <boost/fusion/include/std_pair.hpp>
|
||||||
|
|
||||||
|
#define FUSION_SEQUENCE std::pair
|
||||||
|
#include "convert.hpp"
|
||||||
|
|
25
test/sequence/convert_std_tuple.cpp
Normal file
25
test/sequence/convert_std_tuple.cpp
Normal file
@ -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 <boost/config.hpp>
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
|
||||||
|
#include <tuple>
|
||||||
|
#include <boost/fusion/include/std_tuple.hpp>
|
||||||
|
|
||||||
|
#define FUSION_SEQUENCE std::tuple
|
||||||
|
#include "convert.hpp"
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
13
test/sequence/convert_vector.cpp
Normal file
13
test/sequence/convert_vector.cpp
Normal file
@ -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 <boost/fusion/include/vector.hpp>
|
||||||
|
|
||||||
|
#define FUSION_SEQUENCE boost::fusion::vector
|
||||||
|
#include "convert.hpp"
|
||||||
|
|
Reference in New Issue
Block a user