Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / mpi / test / is_mpi_op_test.cpp
1 // Copyright (C) 2005-2006 Douglas Gregor <doug.gregor@gmail.com>
2
3 // Use, modification and distribution is subject to the Boost Software
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6
7 // A test of the is_mpi_op functionality.
8 #include <boost/mpi/operations.hpp>
9 #include <boost/mpi/environment.hpp>
10 #include <boost/type_traits/is_base_and_derived.hpp>
11
12 #define BOOST_TEST_MODULE mpi_is_mpi_op_test
13 #include <boost/test/included/unit_test.hpp>
14
15 using namespace boost::mpi;
16 using namespace std;
17 using boost::is_base_and_derived;
18
19 BOOST_AUTO_TEST_CASE(mpi_basic_op)
20 {
21   boost::mpi::environment env;
22
23   // Check each predefined MPI_Op type that we support directly.
24   BOOST_TEST((is_mpi_op<minimum<float>, float>::op() == MPI_MIN));
25   BOOST_TEST((is_mpi_op<plus<double>, double>::op() == MPI_SUM));
26   BOOST_TEST((is_mpi_op<multiplies<long>, long>::op() == MPI_PROD));
27   BOOST_TEST((is_mpi_op<logical_and<int>, int>::op() == MPI_LAND));
28   BOOST_TEST((is_mpi_op<bitwise_and<int>, int>::op() == MPI_BAND));
29   BOOST_TEST((is_mpi_op<logical_or<int>, int>::op() == MPI_LOR));
30   BOOST_TEST((is_mpi_op<bitwise_or<int>, int>::op() == MPI_BOR));
31   BOOST_TEST((is_mpi_op<logical_xor<int>, int>::op() == MPI_LXOR));
32   BOOST_TEST((is_mpi_op<bitwise_xor<int>, int>::op() == MPI_BXOR));
33 }