Fixes for unit tests on Windows #10255
6 changed files with 42 additions and 23 deletions
|
@ -32,7 +32,7 @@ void Smoke()
|
|||
|
||||
vector<double> expected;
|
||||
for (size_t i = 0; i < kCapacity; ++i)
|
||||
expected.emplace_back(kTotal - 1 - i);
|
||||
expected.emplace_back(static_cast<double>(kTotal - 1 - i));
|
||||
|
||||
vector<double> actual;
|
||||
actual.reserve(kCapacity);
|
||||
|
|
|
@ -58,11 +58,7 @@ string GetDirectory(string const & name)
|
|||
|
||||
string::value_type GetNativeSeparator()
|
||||
{
|
||||
#ifdef OMIM_OS_WINDOWS
|
||||
return '\\';
|
||||
#else
|
||||
return '/';
|
||||
#endif
|
||||
return '/';
|
||||
![]()
biodranik
commented
Review
1. Why?
2. If it is not needed, then is the GetNativeSeparator function needed?
|
||||
}
|
||||
|
||||
string AddSlashIfNeeded(string const & path)
|
||||
|
|
|
@ -10,12 +10,12 @@ endif()
|
|||
# TestServer fixture configuration
|
||||
add_test(
|
||||
NAME OmimStartTestServer
|
||||
COMMAND start_server.py
|
||||
COMMAND Python3::Interpreter start_server.py
|
||||
WORKING_DIRECTORY ${OMIM_ROOT}/tools/python/test_server
|
||||
)
|
||||
add_test(
|
||||
NAME OmimStopTestServer
|
||||
COMMAND stop_server.py
|
||||
COMMAND Python3::Interpreter stop_server.py
|
||||
WORKING_DIRECTORY ${OMIM_ROOT}/tools/python/test_server
|
||||
)
|
||||
set_tests_properties(OmimStartTestServer PROPERTIES FIXTURES_SETUP TestServer)
|
||||
|
|
|
@ -66,25 +66,27 @@ UNIT_CLASS_TEST(GenerateTest, GenerateDeprecatedTypes)
|
|||
MakeFeature(builder, {{"leisure", "playground"}, {"sport", "tennis"}}, {1.0, 1.0});
|
||||
}
|
||||
|
||||
FrozenDataSource dataSource;
|
||||
TEST_EQUAL(dataSource.Register(file).second, MwmSet::RegResult::Success, ());
|
||||
{
|
||||
FrozenDataSource dataSource;
|
||||
TEST_EQUAL(dataSource.Register(file).second, MwmSet::RegResult::Success, ());
|
||||
|
||||
// New types.
|
||||
base::StringIL arr[] = {{"leisure", "dog_park"}, {"leisure", "playground"}, {"sport", "tennis"}};
|
||||
// New types.
|
||||
base::StringIL arr[] = {{"leisure", "dog_park"}, {"leisure", "playground"}, {"sport", "tennis"}};
|
||||
|
||||
Classificator const & cl = classif();
|
||||
set<uint32_t> types;
|
||||
for (auto const & s : arr)
|
||||
types.insert(cl.GetTypeByPath(s));
|
||||
Classificator const & cl = classif();
|
||||
set<uint32_t> types;
|
||||
for (auto const & s : arr)
|
||||
types.insert(cl.GetTypeByPath(s));
|
||||
|
||||
int count = 0;
|
||||
auto const fn = [&](FeatureType & ft) {
|
||||
++count;
|
||||
ft.ForEachType([&](uint32_t t) { TEST(types.count(t) > 0, (cl.GetReadableObjectName(t))); });
|
||||
};
|
||||
dataSource.ForEachInScale(fn, scales::GetUpperScale());
|
||||
int count = 0;
|
||||
auto const fn = [&](FeatureType & ft) {
|
||||
++count;
|
||||
ft.ForEachType([&](uint32_t t) { TEST(types.count(t) > 0, (cl.GetReadableObjectName(t))); });
|
||||
};
|
||||
dataSource.ForEachInScale(fn, scales::GetUpperScale());
|
||||
|
||||
TEST_EQUAL(count, 2, ());
|
||||
TEST_EQUAL(count, 2, ());
|
||||
}
|
||||
|
||||
file.DeleteFromDisk(MapFileType::Map);
|
||||
}
|
||||
|
|
|
@ -122,6 +122,8 @@ void FakeMapFilesDownloader::OnFileDownloaded(QueuedCountry const & queuedCountr
|
|||
auto const country = queuedCountry;
|
||||
m_queue.PopFront();
|
||||
|
||||
m_writer.reset();
|
||||
|
||||
m_taskRunner.PostTask([country, status]() { country.OnDownloadFinished(status); });
|
||||
|
||||
if (!m_queue.IsEmpty())
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
# include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
#ifdef OMIM_OS_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifndef OMIM_UNIT_TEST_DISABLE_PLATFORM_INIT
|
||||
# include "platform/platform.hpp"
|
||||
#endif
|
||||
|
@ -164,6 +168,21 @@ int main(int argc, char * argv[])
|
|||
UNUSED_VALUE(argv);
|
||||
#endif
|
||||
|
||||
#if defined(OMIM_OS_WINDOWS)
|
||||
if (!IsDebuggerPresent())
|
||||
{
|
||||
DWORD const dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
|
||||
SetErrorMode(dwMode | SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
|
||||
|
||||
_set_error_mode(_OUT_TO_STDERR);
|
||||
|
||||
_set_abort_behavior(0x0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
||||
|
||||
(void)_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
|
||||
(void)_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
|
||||
}
|
||||
#endif
|
||||
|
||||
base::ScopedLogLevelChanger const infoLogLevel(LINFO);
|
||||
#if defined(OMIM_OS_DESKTOP) || defined(OMIM_OS_IPHONE)
|
||||
base::SetLogMessageFn(base::LogMessageTests);
|
||||
|
|
Reference in a new issue