add stress test, move common assets to assets folder

This commit is contained in:
Akash Mozumdar 2019-08-06 11:41:49 -04:00
parent b4c7abd0a8
commit 703fc47972
8 changed files with 15 additions and 8 deletions

View File

@ -14,19 +14,18 @@ add_compile_options(
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x64) set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x64)
set(LIBDIR x64libs) link_directories(x64libs)
else() else()
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x86) set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x86)
set(LIBDIR x86libs) link_directories(x86libs)
endif() endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>)
include_directories(include) include_directories(include)
link_directories(${LIBDIR}) file(GLOB ASSETS assets/*)
file(GLOB LIBS ${LIBDIR}/*) file(COPY ${ASSETS} DESTINATION ${CMAKE_FINAL_OUTPUT_DIRECTORY})
file(COPY ${LIBS} DESTINATION ${CMAKE_FINAL_OUTPUT_DIRECTORY})
add_library(text text.cpp) add_library(text text.cpp)
target_compile_definitions(text PRIVATE ${TEXT_LANGUAGE}) target_compile_definitions(text PRIVATE ${TEXT_LANGUAGE})

BIN
assets/StressTest.txt Normal file

Binary file not shown.

View File

@ -8,11 +8,12 @@
wchar_t buffer[1000] = {}; wchar_t buffer[1000] = {};
std::array<int, 10> vars = {}; std::array<int, 10> vars = {};
int& mode = vars.at(0);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int _) int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int _)
{ {
QApplication a(_ = 0, DUMMY); QApplication a(_ = 0, DUMMY);
static std::vector<AutoHandle<Functor<(void(__stdcall *)(void*))FreeLibrary>>> extensions; static std::vector<std::unique_ptr<std::remove_pointer_t<HMODULE>, Functor<FreeLibrary>>> extensions;
for (auto file : std::filesystem::directory_iterator(std::filesystem::current_path())) for (auto file : std::filesystem::directory_iterator(std::filesystem::current_path()))
if (file.path().extension() == L".dll" if (file.path().extension() == L".dll"
&& (std::stringstream() << std::ifstream(file.path(), std::ios::binary).rdbuf()).str().find("OnNewSentence") != std::string::npos) && (std::stringstream() << std::ifstream(file.path(), std::ios::binary).rdbuf()).str().find("OnNewSentence") != std::string::npos)
@ -39,7 +40,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int _)
GetWindowTextW((HWND)lParam, buffer, std::size(buffer)); GetWindowTextW((HWND)lParam, buffer, std::size(buffer));
try { vars.at(LOWORD(wParam) - IDC_EDIT1) = std::stoi(buffer); } try { vars.at(LOWORD(wParam) - IDC_EDIT1) = std::stoi(buffer); }
catch (...) {} catch (...) {}
if (vars.at(1)) extensions.clear(); //if (vars.at(1)) extensions.clear();
if (LOWORD(wParam) - IDC_EDIT1 == 1 && mode == 1)
{
std::wstring buffer(vars.at(1), 0);
std::wifstream("StressTest.txt", std::ios::in | std::ios::binary).read(buffer.data(), vars.at(1));
std::ignore = std::remove(buffer.begin(), buffer.end(), 0);
for (int i = 0; i < buffer.size(); i += 700) lstrlenW(buffer.c_str() + i);
}
} }
} }
break; break;
@ -47,7 +55,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int _)
return FALSE; return FALSE;
}, 0), SW_SHOW); }, 0), SW_SHOW);
std::thread([] { while (true) Sleep(vars.at(0)), lstrlenW(L"こんにちは\n (Hello)"); }).detach(); std::thread([] { while (true) Sleep(vars.at(2)), mode == 2 && lstrlenW(L"こんにちは\n (Hello)"); }).detach();
STARTUPINFOW info = { sizeof(info) }; STARTUPINFOW info = { sizeof(info) };
wchar_t commandLine[] = { L"Textractor -p\"Test.exe\"" }; wchar_t commandLine[] = { L"Textractor -p\"Test.exe\"" };

Binary file not shown.

Binary file not shown.

Binary file not shown.