Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / mpl / test / joint_view.cpp
1
2 // Copyright Aleksey Gurtovoy 2001-2004
3 //
4 // Distributed under the Boost Software License, Version 1.0. 
5 // (See accompanying file LICENSE_1_0.txt or copy at 
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //
8 // See http://www.boost.org/libs/mpl for documentation.
9
10 // $Id$
11 // $Date$
12 // $Revision$
13
14 #include <boost/mpl/joint_view.hpp>
15
16 #include <boost/mpl/range_c.hpp>
17 #include <boost/mpl/list.hpp>
18 #include <boost/mpl/equal.hpp>
19 #include <boost/mpl/size.hpp>
20 #include <boost/mpl/aux_/test.hpp>
21
22
23 MPL_TEST_CASE()
24 {
25     typedef joint_view<
26           range_c<int,0,10>
27         , range_c<int,10,15>
28         > numbers;
29
30     typedef range_c<int,0,15> answer;
31
32     MPL_ASSERT(( equal<numbers,answer> ));
33     MPL_ASSERT_RELATION( size<numbers>::value, ==, 15 );
34 }
35
36 template< typename View > struct test_is_empty
37 {
38     typedef typename begin<View>::type first_;
39     typedef typename end<View>::type last_;
40     
41     MPL_ASSERT_RELATION( size<View>::value, ==, 0 );
42     MPL_ASSERT(( is_same< first_,last_> ));
43     
44     MPL_ASSERT_INSTANTIATION( View );
45     MPL_ASSERT_INSTANTIATION( first_ );
46     MPL_ASSERT_INSTANTIATION( last_ );
47 };
48
49 MPL_TEST_CASE()
50 {
51     test_is_empty< joint_view< list0<>,list0<> > >();
52     test_is_empty< joint_view< list<>,list0<> > >();
53     test_is_empty< joint_view< list<>,list<> > >();
54     test_is_empty< joint_view< list<>, joint_view< list0<>,list0<> > > >();
55 }