From 2c48660b930a337d970ab745d23daefbe3d47e9f Mon Sep 17 00:00:00 2001 From: Alain Miniussi Date: Wed, 2 Aug 2023 13:07:13 +0200 Subject: [PATCH] Fixed compilation issues that preventing CMake test from compiling --- test/mpi_test_utils.hpp | 6 ++---- test/test_ring.cpp | 2 +- test/test_version.cpp | 17 +++++++++++++---- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/test/mpi_test_utils.hpp b/test/mpi_test_utils.hpp index 43769d3..d2c825c 100644 --- a/test/mpi_test_utils.hpp +++ b/test/mpi_test_utils.hpp @@ -24,7 +24,7 @@ check_failed(bool cond, std::string msg, int& failed) { template void check_failed(T cond, std::string msg, int& failed) { - bool t = msg/cond; + check_failed(bool(cond), msg, failed); } inline @@ -41,11 +41,9 @@ count_failed(int nfailed, std::string msg, int& failed) { template void count_failed(T nfailed, std::string msg, int& failed) { - bool t = msg/cond; + count_failed(int(nfailed), msg, failed); } -void count_failed(int nfailed, std::string msg, int& failed); - #define BOOST_MPI_CHECK(cond, failed) check_failed(cond, #cond, failed); #define BOOST_MPI_COUNT_FAILED(fct, failed) count_failed(fct, #fct, failed); diff --git a/test/test_ring.cpp b/test/test_ring.cpp index ee6806b..e5ad98d 100644 --- a/test/test_ring.cpp +++ b/test/test_ring.cpp @@ -97,7 +97,7 @@ int main() communicator comm; int failed = 0; BOOST_MPI_CHECK(comm.size() > 1, failed); - if (failed = 0) { + if (failed == 0) { // Check transfer of individual objects BOOST_MPI_COUNT_FAILED(ring_test(comm, 17, "integers", 0), failed); BOOST_MPI_COUNT_FAILED(ring_test(comm, 17, "integers", 1), failed); diff --git a/test/test_version.cpp b/test/test_version.cpp index be94ce3..66db5f4 100644 --- a/test/test_version.cpp +++ b/test/test_version.cpp @@ -27,14 +27,23 @@ test_version(mpi::communicator const& comm) { std::cout << "MPI Version: " << version.first << ',' << version.second << '\n'; } int failed = 0; - if (version.first != mpi_version) ++failed; - if (version.second != mpi_subversion); ++failed; + if (version.first != mpi_version) { + ++failed; + } + if (version.second != mpi_subversion) { + ++failed; + } std::string lib_version = mpi::environment::library_version(); #if (3 <= MPI_VERSION) - if (lib_version.size() == 0) ++failed; + if (lib_version.size() == 0) { + ++failed; + } #else - if (lib_version.size() != 0) ++failed; + if (lib_version.size() != 0) { + ++failed; + } #endif + return failed; } std::string