]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a test.
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 1 Mar 2022 21:23:09 +0000 (14:23 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 1 Mar 2022 21:23:09 +0000 (14:23 -0700)
tests/mpi/is_mpi_type.cc [new file with mode: 0644]
tests/mpi/is_mpi_type.output [new file with mode: 0644]

diff --git a/tests/mpi/is_mpi_type.cc b/tests/mpi/is_mpi_type.cc
new file mode 100644 (file)
index 0000000..1864c89
--- /dev/null
@@ -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 <deal.II/base/mpi.h>
+
+#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<char> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<signed short> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<signed int> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<signed long> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<signed long long> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<signed char> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<unsigned char> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<unsigned short> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<unsigned int> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<unsigned long int> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<unsigned long long> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<float> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<double> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<long double> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<bool> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<std::complex<float>> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<std::complex<double>> << std::endl;
+  deallog
+    << Utilities::MPI::is_mpi_type<std::complex<long double>> << std::endl;
+  deallog << Utilities::MPI::is_mpi_type<wchar_t> << std::endl;
+
+
+  // Then also check a non-native type:
+  struct X
+  {};
+  deallog << Utilities::MPI::is_mpi_type<X> << 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 (file)
index 0000000..3dd6a51
--- /dev/null
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.