1
/*=============================================================================
2
Copyright (c) 1999-2003 Jaakko Jarvi
3
Copyright (c) 2001-2011 Joel de Guzman
4
Copyright (c) 2006 Dan Marsden
6
Distributed under the Boost Software License, Version 1.0. (See accompanying
7
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8
==============================================================================*/
9
#include <boost/detail/lightweight_test.hpp>
11
#include <boost/fusion/container/deque/deque.hpp>
12
#include <boost/fusion/container/deque/back_extended_deque.hpp>
13
#include <boost/fusion/sequence/comparison.hpp>
14
#include <boost/fusion/container/generation/make_vector.hpp>
15
#include <boost/fusion/mpl.hpp>
17
#include <boost/fusion/sequence/intrinsic.hpp>
18
#include <boost/fusion/iterator.hpp>
20
#include <boost/mpl/assert.hpp>
21
#include <boost/type_traits/is_same.hpp>
25
using namespace boost::fusion;
27
typedef deque<int, char> initial_deque_type;
28
initial_deque_type initial_deque(1, 'a');
29
typedef back_extended_deque<initial_deque_type, long> extended_type;
30
extended_type extended(initial_deque, 101L);
32
BOOST_TEST(size(extended) == 3);
33
BOOST_TEST(extended == make_vector(1, 'a', 101L));
34
BOOST_TEST(*begin(extended) == 1);
35
BOOST_TEST(*next(begin(extended)) == 'a');
36
BOOST_TEST(*prior(end(extended)) == 101L);
37
BOOST_TEST(distance(begin(extended), end(extended)) == 3);
38
BOOST_TEST(*advance_c<2>(begin(extended)) == 101L);
41
namespace mpl = boost::mpl;
42
typedef deque<int, char> initial_deque_type;
43
typedef back_extended_deque<initial_deque_type, long> extended_type;
45
BOOST_MPL_ASSERT((boost::is_same<mpl::at_c<extended_type, 0>::type, int>));
46
BOOST_MPL_ASSERT((boost::is_same<mpl::at_c<extended_type, 1>::type, char>));
47
BOOST_MPL_ASSERT((boost::is_same<mpl::at_c<extended_type, 2>::type, long>));
48
BOOST_MPL_ASSERT((boost::is_same<mpl::deref<mpl::begin<extended_type>::type>::type, int>));
49
BOOST_MPL_ASSERT((mpl::equal_to<mpl::size<extended_type>::type, mpl::int_<3> >));
55
typedef deque<int&, char&> initial_deque_type;
56
initial_deque_type initial_deque(i, ch);
57
typedef back_extended_deque<initial_deque_type, long&> extended_type;
58
extended_type extended(initial_deque, l);
59
BOOST_TEST(extended == make_vector(1, 'a', 101L));
64
extended_type extended2(initial_deque_type(i2, ch2), l2);
68
BOOST_TEST(extended == make_vector(2, 'b', 202L));
71
BOOST_TEST(ch == ch2);
74
return boost::report_errors();