Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
f3262d97
Commit
f3262d97
authored
4 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for BuildInfo
parent
8b1c2965
No related branches found
No related tags found
1 merge request
!63
Feature/utils coverage
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/CMakeLists.txt
+1
-0
1 addition, 0 deletions
tests/CMakeLists.txt
tests/test_BuildInfo.cpp
+70
-0
70 additions, 0 deletions
tests/test_BuildInfo.cpp
with
71 additions
and
0 deletions
tests/CMakeLists.txt
+
1
−
0
View file @
f3262d97
...
@@ -45,6 +45,7 @@ add_executable (unit_tests
...
@@ -45,6 +45,7 @@ add_executable (unit_tests
test_BinaryExpressionProcessor_equality.cpp
test_BinaryExpressionProcessor_equality.cpp
test_BinaryExpressionProcessor_logic.cpp
test_BinaryExpressionProcessor_logic.cpp
test_BiCGStab.cpp
test_BiCGStab.cpp
test_BuildInfo.cpp
test_BuiltinFunctionEmbedder.cpp
test_BuiltinFunctionEmbedder.cpp
test_BuiltinFunctionEmbedderTable.cpp
test_BuiltinFunctionEmbedderTable.cpp
test_BuiltinFunctionProcessor.cpp
test_BuiltinFunctionProcessor.cpp
...
...
This diff is collapsed.
Click to expand it.
tests/test_BuildInfo.cpp
0 → 100644
+
70
−
0
View file @
f3262d97
#ifndef TEST_BUILD_INFO_HPP
#define TEST_BUILD_INFO_HPP
#include
<catch2/catch.hpp>
#include
<utils/BuildInfo.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
<<
")"
<<
std
::
ends
;
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
=
std
::
to_string
(
PETSC_VERSION_MAJOR
)
+
"."
+
std
::
to_string
(
PETSC_VERSION_MINOR
)
+
"."
+
std
::
to_string
(
PETSC_VERSION_SUBMINOR
);
REQUIRE
(
BuildInfo
::
petscLibrary
()
==
petsc_library
);
#else
REQUIRE
(
BuildInfo
::
petscLibrary
()
==
"none"
);
#endif // PUGS_HAS_PETSC
}
}
#endif // TEST_BUILD_INFO_HPP
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment