We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e8c853a commit cf8179cCopy full SHA for cf8179c
1 file changed
modules/core/util/tests/util.cpp
@@ -2,6 +2,8 @@
2
3
#include <gtest/gtest.h>
4
5
+#include <cstdlib>
6
+#include <libenvpp/detail/get.hpp>
7
#include <string_view>
8
9
#include "omp.h"
@@ -26,6 +28,16 @@ TEST(util_tests, threads_control_check_openmp_disabled_valgrind) {
26
28
ASSERT_EQ(ppc_num_threads, omp_num_threads);
27
29
}
30
31
+TEST(util_tests, GetNumThreadsEnvUnsetReturnsOne) {
32
+ const auto num_threads_env_var = env::get<int>("PPC_NUM_THREADS");
33
+
34
+ if (num_threads_env_var.has_value()) {
35
+ EXPECT_EQ(ppc::util::GetNumThreads(), 1);
36
+ } else {
37
+ GTEST_SKIP() << "PPC_NUM_THREADS environment variable is set, skipping test";
38
+ }
39
+}
40
41
namespace test_ns {
42
struct TypeInNamespace {};
43
} // namespace test_ns
0 commit comments