File: is_mpi_op_test.cpp

package info (click to toggle)
boost1.90 1.90.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 593,120 kB
  • sloc: cpp: 4,190,908; xml: 196,648; python: 34,618; ansic: 23,145; asm: 5,468; sh: 3,774; makefile: 1,161; perl: 1,020; sql: 728; ruby: 676; yacc: 478; java: 77; lisp: 24; csh: 6
file content (33 lines) | stat: -rw-r--r-- 1,341 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (C) 2005-2006 Douglas Gregor <doug.gregor@gmail.com>

// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

// A test of the is_mpi_op functionality.
#include <boost/mpi/operations.hpp>
#include <boost/mpi/environment.hpp>
#include <boost/type_traits/is_base_and_derived.hpp>

#define BOOST_TEST_MODULE mpi_is_mpi_op_test
#include <boost/test/included/unit_test.hpp>

using namespace boost::mpi;
using namespace std;
using boost::is_base_and_derived;

BOOST_AUTO_TEST_CASE(mpi_basic_op)
{
  boost::mpi::environment env;

  // Check each predefined MPI_Op type that we support directly.
  BOOST_TEST((is_mpi_op<minimum<float>, float>::op() == MPI_MIN));
  BOOST_TEST((is_mpi_op<plus<double>, double>::op() == MPI_SUM));
  BOOST_TEST((is_mpi_op<multiplies<long>, long>::op() == MPI_PROD));
  BOOST_TEST((is_mpi_op<logical_and<int>, int>::op() == MPI_LAND));
  BOOST_TEST((is_mpi_op<bitwise_and<int>, int>::op() == MPI_BAND));
  BOOST_TEST((is_mpi_op<logical_or<int>, int>::op() == MPI_LOR));
  BOOST_TEST((is_mpi_op<bitwise_or<int>, int>::op() == MPI_BOR));
  BOOST_TEST((is_mpi_op<logical_xor<int>, int>::op() == MPI_LXOR));
  BOOST_TEST((is_mpi_op<bitwise_xor<int>, int>::op() == MPI_BXOR));
}