]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/test/joint_view.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / 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(( equal<numbers::type,answer> ));
34 MPL_ASSERT_RELATION( size<numbers>::value, ==, 15 );
35 }
36
37 template< typename View > struct test_is_empty
38 {
39 typedef typename begin<View>::type first_;
40 typedef typename end<View>::type last_;
41
42 MPL_ASSERT_RELATION( size<View>::value, ==, 0 );
43 MPL_ASSERT(( is_same< first_,last_> ));
44
45 MPL_ASSERT_INSTANTIATION( View );
46 MPL_ASSERT_INSTANTIATION( first_ );
47 MPL_ASSERT_INSTANTIATION( last_ );
48 };
49
50 MPL_TEST_CASE()
51 {
52 test_is_empty< joint_view< list0<>,list0<> > >();
53 test_is_empty< joint_view< list<>,list0<> > >();
54 test_is_empty< joint_view< list<>,list<> > >();
55 test_is_empty< joint_view< list<>, joint_view< list0<>,list0<> > > >();
56 }