fix(UnitTest): fixes unit tests not compiling under windows (#21299)
This commit is contained in:
parent
e28384b059
commit
f89a8e0b81
@ -17,7 +17,8 @@
|
||||
|
||||
#ifndef Random_h__
|
||||
#define Random_h__
|
||||
|
||||
#undef max
|
||||
#undef min
|
||||
#include "Define.h"
|
||||
#include "Duration.h"
|
||||
#include <limits>
|
||||
|
||||
@ -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");
|
||||
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user