From 2be6b3fd447b7feb4ef11ff856689e952a75f7b1 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 1 Mar 2022 14:23:09 -0700 Subject: [PATCH] Add a test. --- tests/mpi/is_mpi_type.cc | 67 ++++++++++++++++++++++++++++++++++++ tests/mpi/is_mpi_type.output | 21 +++++++++++ 2 files changed, 88 insertions(+) create mode 100644 tests/mpi/is_mpi_type.cc create mode 100644 tests/mpi/is_mpi_type.output diff --git a/tests/mpi/is_mpi_type.cc b/tests/mpi/is_mpi_type.cc new file mode 100644 index 0000000000..1864c8970c --- /dev/null +++ b/tests/mpi/is_mpi_type.cc @@ -0,0 +1,67 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2020 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + +// Test the Utilities::MPI::is_mpi_type template variable. + +#include + +#include "../tests.h" + +using namespace dealii; + +void +test() +{ + deallog << std::boolalpha; + + // Verify that the following types are all supported: + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + deallog << Utilities::MPI::is_mpi_type> << std::endl; + deallog << Utilities::MPI::is_mpi_type> << std::endl; + deallog + << Utilities::MPI::is_mpi_type> << std::endl; + deallog << Utilities::MPI::is_mpi_type << std::endl; + + + // Then also check a non-native type: + struct X + {}; + deallog << Utilities::MPI::is_mpi_type << std::endl; +} + + +int +main(int argc, char *argv[]) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); + MPILogInitAll all; + + test(); +} diff --git a/tests/mpi/is_mpi_type.output b/tests/mpi/is_mpi_type.output new file mode 100644 index 0000000000..3dd6a513b6 --- /dev/null +++ b/tests/mpi/is_mpi_type.output @@ -0,0 +1,21 @@ + +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::true +DEAL:0::false -- 2.39.5