]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright (C) 2013 Alain Miniussi <alain.miniussi@oca.eu> |
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 | // test threading::level operations | |
8 | ||
92f5a8d4 | 9 | #include <boost/mpi.hpp> |
7c673cae FG |
10 | #include <iostream> |
11 | #include <sstream> | |
12 | ||
92f5a8d4 TL |
13 | #define BOOST_TEST_MODULE mpi_mt_init |
14 | #include <boost/test/included/unit_test.hpp> | |
15 | ||
7c673cae FG |
16 | namespace mpi = boost::mpi; |
17 | ||
92f5a8d4 TL |
18 | void |
19 | test_mt_init(std::string s) | |
20 | { | |
7c673cae | 21 | mpi::threading::level required = mpi::threading::level(-1); |
92f5a8d4 TL |
22 | std::istringstream in(s); |
23 | in >> required; | |
24 | BOOST_CHECK(!in.bad()); | |
25 | BOOST_CHECK(mpi::environment::thread_level() >= mpi::threading::single); | |
26 | BOOST_CHECK(mpi::environment::thread_level() <= mpi::threading::multiple); | |
27 | } | |
28 | ||
29 | BOOST_AUTO_TEST_CASE(mt_init) | |
30 | { | |
31 | mpi::environment env; | |
32 | mpi::communicator comm; | |
33 | test_mt_init("single"); | |
34 | test_mt_init("funneled"); | |
35 | test_mt_init("serialized"); | |
36 | test_mt_init("multiple"); | |
7c673cae | 37 | } |