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