]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/test/arithmetic.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / mpl / test / arithmetic.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/arithmetic.hpp>
15 #include <boost/mpl/int.hpp>
16 #include <boost/mpl/aux_/test.hpp>
17
18 MPL_TEST_CASE()
19 {
20 typedef int_<0> _0;
21 typedef int_<1> _1;
22 typedef int_<3> _3;
23 typedef int_<10> _10;
24
25 MPL_ASSERT_RELATION( (plus<_0,_10>::value), ==, 10 );
26 MPL_ASSERT_RELATION( (plus<_10,_0>::value), ==, 10 );
27
28 MPL_ASSERT_RELATION( (minus<_0,_10>::value), ==, -10 );
29 MPL_ASSERT_RELATION( (minus<_10,_0>::value), ==, 10 );
30
31 MPL_ASSERT_RELATION( (times<_1,_10>::value), ==, 10 );
32 MPL_ASSERT_RELATION( (times<_10,_1>::value), ==, 10 );
33 MPL_ASSERT_RELATION( (multiplies<_1,_10>::value), ==, 10 );
34 MPL_ASSERT_RELATION( (multiplies<_10,_1>::value), ==, 10 );
35
36 MPL_ASSERT_RELATION( (divides<_10,_1>::value), ==, 10 );
37 MPL_ASSERT_RELATION( (divides<_10,_1>::value), ==, 10 );
38
39 MPL_ASSERT_RELATION( (modulus<_10,_1>::value), ==, 0 );
40 MPL_ASSERT_RELATION( (modulus<_10,_3>::value), ==, 1 );
41
42 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
43 MPL_ASSERT_RELATION( (minus<_10,_1,_10>::value), ==, -1 );
44 MPL_ASSERT_RELATION( (plus<_10,_1,_10>::value), ==, 21 );
45 MPL_ASSERT_RELATION( (divides<_10,_1,_10>::value), ==, 1 );
46 MPL_ASSERT_RELATION( (divides<_10,_1,_10>::value), ==, 1 );
47 #endif
48
49 MPL_ASSERT_RELATION( negate<_10>::value, ==, -10 );
50 }