File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
modules/core/util/func_tests Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 66
77#include " core/util/include/util.hpp"
88
9+ #ifdef _WIN32
10+ #include < Windows.h>
11+ inline int unsetenv (const char * name) { return SetEnvironmentVariableA (name, NULL ) ? 0 : -1 ; }
12+ inline int setenv (const char * name, const char * value, int /* overwrite*/ ) {
13+ return SetEnvironmentVariableA (name, value) ? 0 : -1 ;
14+ }
15+ #endif
16+
917TEST (util_tests, check_unset_env) {
10- #ifndef _WIN32
1118 int save_var = ppc::util::GetPPCNumThreads ();
1219
1320 unsetenv (" PPC_NUM_THREADS" ); // NOLINT(concurrency-mt-unsafe)
1421
1522 EXPECT_EQ (ppc::util::GetPPCNumThreads (), 1 );
1623
1724 setenv (" PPC_NUM_THREADS" , std::to_string (save_var).c_str (), 1 ); // NOLINT(concurrency-mt-unsafe)
18- #else
19- GTEST_SKIP ();
20- #endif
2125}
2226
2327TEST (util_tests, check_set_env) {
24- #ifndef _WIN32
2528 int save_var = ppc::util::GetPPCNumThreads ();
2629
2730 const int num_threads = static_cast <int >(std::thread::hardware_concurrency ());
@@ -30,7 +33,4 @@ TEST(util_tests, check_set_env) {
3033 EXPECT_EQ (ppc::util::GetPPCNumThreads (), num_threads);
3134
3235 setenv (" PPC_NUM_THREADS" , std::to_string (save_var).c_str (), 1 ); // NOLINT(concurrency-mt-unsafe)
33- #else
34- GTEST_SKIP ();
35- #endif
3636}
You can’t perform that action at this time.
0 commit comments