is_mpi_op_test.cpp 1.3 KB

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