]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/test/single_view.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / mpl / test / single_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/single_view.hpp>
15 #include <boost/mpl/advance.hpp>
16 #include <boost/mpl/size.hpp>
17 #include <boost/mpl/begin_end.hpp>
18 #include <boost/mpl/equal.hpp>
19 #include <boost/mpl/aux_/test.hpp>
20
21 MPL_TEST_CASE()
22 {
23 typedef single_view<int> view;
24 typedef begin<view>::type first;
25 typedef end<view>::type last;
26
27 MPL_ASSERT(( is_same< deref<first>::type, int > ));
28 MPL_ASSERT(( is_same< next<first>::type, last > ));
29 MPL_ASSERT(( is_same< prior<last>::type, first > ));
30
31 MPL_ASSERT(( is_same< mpl::advance<first, int_<0> >::type, first > ));
32 MPL_ASSERT(( is_same< mpl::advance<first, int_<1> >::type, last > ));
33 MPL_ASSERT(( is_same< mpl::advance<last, int_<0> >::type, last > ));
34 MPL_ASSERT(( is_same< mpl::advance<last, int_<-1> >::type, first > ));
35
36 MPL_ASSERT_RELATION( (mpl::distance<first,first>::value), ==, 0 );
37 MPL_ASSERT_RELATION( (mpl::distance<first,last>::value), ==, 1 );
38 MPL_ASSERT_RELATION( (mpl::distance<last,last>::value), ==, 0 );
39
40 MPL_ASSERT_RELATION( size<view>::value, ==, 1 );
41
42 MPL_ASSERT(( equal< view, view::type > ));
43 }