Skip to content
Snippets Groups Projects
Select Git revision
  • 2ac64322c29c559003fa26e5ae11e6205c9c5607
  • develop default protected
  • feature/variational-hydro
  • origin/stage/bouguettaia
  • feature/gmsh-reader
  • feature/reconstruction
  • save_clemence
  • feature/kinetic-schemes
  • feature/local-dt-fsi
  • feature/composite-scheme-sources
  • feature/composite-scheme-other-fluxes
  • feature/serraille
  • feature/composite-scheme
  • hyperplastic
  • feature/polynomials
  • feature/gks
  • feature/implicit-solver-o2
  • feature/coupling_module
  • feature/implicit-solver
  • feature/merge-local-dt-fsi
  • master protected
  • v0.5.0 protected
  • v0.4.1 protected
  • v0.4.0 protected
  • v0.3.0 protected
  • v0.2.0 protected
  • v0.1.0 protected
  • Kidder
  • v0.0.4 protected
  • v0.0.3 protected
  • v0.0.2 protected
  • v0 protected
  • v0.0.1 protected
33 results

Resume.cpp

Blame
  • test_BuildInfo.cpp 1.56 KiB
    #include <catch2/catch_test_macros.hpp>
    #include <catch2/matchers/catch_matchers_all.hpp>
    
    #include <utils/BuildInfo.hpp>
    #include <utils/Stringify.hpp>
    #include <utils/pugs_build_info.hpp>
    #include <utils/pugs_config.hpp>
    
    #include <sstream>
    
    #ifdef PUGS_HAS_MPI
    #include <mpi.h>
    #endif   //  PUGS_HAS_MPI
    
    #ifdef PUGS_HAS_PETSC
    #include <petsc.h>
    #endif   // PUGS_HAS_PETSC
    
    // clazy:excludeall=non-pod-global-static
    
    TEST_CASE("BuildInfo", "[utils]")
    {
      SECTION("type")
      {
        REQUIRE(BuildInfo::type() == PUGS_BUILD_TYPE);
      }
    
      SECTION("compiler")
      {
        std::stringstream compiler_info;
        compiler_info << PUGS_BUILD_COMPILER << " (" << PUGS_BUILD_COMPILER_VERSION << ")";
        REQUIRE(BuildInfo::compiler() == compiler_info.str());
      }
    
      SECTION("kokkos")
      {
        REQUIRE(BuildInfo::kokkosDevices() == PUGS_BUILD_KOKKOS_DEVICES);
      }
    
      SECTION("mpi")
      {
    #ifdef PUGS_HAS_MPI
        const std::string mpi_library = []() {
          int length;
          char mpi_version[MPI_MAX_LIBRARY_VERSION_STRING];
          MPI_Get_library_version(mpi_version, &length);
          return std::string(mpi_version);
        }();
    
        REQUIRE(BuildInfo::mpiLibrary() == mpi_library);
    #else
        REQUIRE(BuildInfo::mpiLibrary() == "none");
    #endif   // PUGS_HAS_MPI
      }
    
      SECTION("petsc")
      {
    #ifdef PUGS_HAS_PETSC
        const std::string petsc_library =
          stringify(PETSC_VERSION_MAJOR) + "." + stringify(PETSC_VERSION_MINOR) + "." + stringify(PETSC_VERSION_SUBMINOR);
    
        REQUIRE(BuildInfo::petscLibrary() == petsc_library);
    #else
        REQUIRE(BuildInfo::petscLibrary() == "none");
    #endif   // PUGS_HAS_PETSC
      }
    }