]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/test/vector_c.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / mpl / test / vector_c.cpp
1
2 // Copyright Aleksey Gurtovoy 2000-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/vector_c.hpp>
15 #include <boost/mpl/front.hpp>
16 #include <boost/mpl/size.hpp>
17
18 #include <boost/mpl/aux_/test.hpp>
19
20 #if !BOOST_WORKAROUND(BOOST_MSVC, <=1200)
21 MPL_TEST_CASE()
22 {
23 typedef vector_c<bool,true>::type v1;
24 typedef vector_c<bool,false>::type v2;
25
26 MPL_ASSERT(( is_same< v1::value_type, bool > ));
27 MPL_ASSERT(( is_same< v2::value_type, bool > ));
28
29 MPL_ASSERT_RELATION( front<v1>::type::value, ==, true );
30 MPL_ASSERT_RELATION( front<v2>::type::value, ==, false );
31 }
32 #endif
33
34 MPL_TEST_CASE()
35 {
36 typedef vector_c<int,-1> v1;
37 typedef vector_c<int,0,1> v2;
38 typedef vector_c<int,1,2,3> v3;
39
40 MPL_ASSERT(( is_same< v1::value_type, int > ));
41 MPL_ASSERT(( is_same< v2::value_type, int > ));
42 MPL_ASSERT(( is_same< v3::value_type, int > ));
43
44 MPL_ASSERT_RELATION( size<v1>::value, ==, 1 );
45 MPL_ASSERT_RELATION( size<v2>::value, ==, 2 );
46 MPL_ASSERT_RELATION( size<v3>::value, ==, 3 );
47
48 MPL_ASSERT_RELATION( front<v1>::type::value, ==, -1 );
49 MPL_ASSERT_RELATION( front<v2>::type::value, ==, 0 );
50 MPL_ASSERT_RELATION( front<v3>::type::value, ==, 1 );
51 }
52
53 MPL_TEST_CASE()
54 {
55 typedef vector_c<unsigned,0> v1;
56 typedef vector_c<unsigned,1,2> v2;
57
58 MPL_ASSERT(( is_same< v1::value_type, unsigned > ));
59 MPL_ASSERT(( is_same< v2::value_type, unsigned > ));
60
61 MPL_ASSERT_RELATION( size<v1>::type::value, ==, 1 );
62 MPL_ASSERT_RELATION( size<v2>::type::value, ==, 2 );
63
64 MPL_ASSERT_RELATION( front<v1>::type::value, ==, 0 );
65 MPL_ASSERT_RELATION( front<v2>::type::value, ==, 1 );
66 }