Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes unit tests not compiling under windows #21299

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/common/Utilities/Random.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

#ifndef Random_h__
#define Random_h__

#undef max
#undef min
#include "Define.h"
#include "Duration.h"
#include <limits>
Expand Down
13 changes: 12 additions & 1 deletion src/test/common/Configuration/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
#include <fstream>
#include <string>

#if WIN32
void inline setenv(const char* name, const char* value, int overwrite)
{
_putenv_s(name, value);
}
#endif

std::string CreateConfigWithMap(std::map<std::string, std::string> const& map)
{
auto mTempFileRel = boost::filesystem::unique_path("deleteme.ini");
Expand All @@ -36,8 +43,12 @@ std::string CreateConfigWithMap(std::map<std::string, std::string> const& map)
iniStream << itr.first << " = " << itr.second << "\n";

iniStream.close();

#if WIN32
auto tmp = mTempFileAbs.native();
return std::string(tmp.begin(), tmp.end());;
#else
return mTempFileAbs.native();
#endif
}

class ConfigEnvTest : public testing::Test {
Expand Down
Loading