diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index e36add0ff..f7c302de6 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -23,7 +23,7 @@ target_include_directories(test_geos_unit file(GLOB_RECURSE _testfiles ${CMAKE_CURRENT_LIST_DIR}/**/*Test.cpp CONFIGURE_DEPEND) foreach(_testfile ${_testfiles}) string(REPLACE ${CMAKE_CURRENT_LIST_DIR}/ "" _testname ${_testfile}) - string(REPLACE "../../test.cpp" "" _testname ${_testname}) + string(REPLACE "Test.cpp" "" _testname ${_testname}) string(REPLACE "/" "-" _cmake_testname ${_testname}) string(REPLACE "/" "::" _testname ${_testname}) if (NOT ${_testname} MATCHES "^capi::") diff --git a/tests/unit/index/strtree/SimpleSTRtreeTest.cpp b/tests/unit/index/strtree/SimpleSTRtreeTest.cpp index af4138ed5..380785f2c 100644 --- a/tests/unit/index/strtree/SimpleSTRtreeTest.cpp +++ b/tests/unit/index/strtree/SimpleSTRtreeTest.cpp @@ -7,35 +7,8 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -#include -#include -//#include -#include -#include -#else -#include -//#include -#include -#include -#endif -#include -// get current process pid -inline int GetCurrentPid() -{ - return getpid(); -} - -#define VMRSS_LINE 22 +#include using namespace geos; @@ -181,76 +154,6 @@ void object::test<3> } -// get specific process physical memeory occupation size by pid (MB) -inline float GetMemoryUsage(int pid) -{ -#ifdef WIN32 - uint64_t mem = 0, vmem = 0; -PROCESS_MEMORY_COUNTERS pmc; - -// get process hanlde by pid -HANDLE process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid); -if (GetProcessMemoryInfo(process, &pmc, sizeof(pmc))) -{ - mem = pmc.WorkingSetSize; - vmem = pmc.PagefileUsage; -} -CloseHandle(process); - -// use GetCurrentProcess() can get current process and no need to close handle - -// convert mem from B to MB -return mem / 1024.0 / 1024.0; - -#else - char file_name[64] = { 0 }; - FILE* fd; - char line_buff[512] = { 0 }; - sprintf(file_name, "/proc/%d/status", pid); - - fd = fopen(file_name, "r"); - if (nullptr == fd) - return 0; - - char name[64]; - int vmrss = 0; - for (int i = 0; i < VMRSS_LINE - 1; i++) - fgets(line_buff, sizeof(line_buff), fd); - - fgets(line_buff, sizeof(line_buff), fd); - sscanf(line_buff, "%s %d", name, &vmrss); - fclose(fd); - - // cnvert VmRSS from KB to MB - return float(vmrss / 1024.0); -#endif -} - - - -template<> -template<> -void object::test<4> - () { - - index::strtree::SimpleSTRtree t(10); - std::vector> geoms; - const int gridSize = 100; - const int gap = 10; - auto gf = geom::GeometryFactory::create(); - - for (int i = 0; i < gridSize; ++i) { - for (int j = 0; j < gridSize; ++j) { - for (int k= 0; k < gridSize; ++k) { - geos::geom::Envelope3d e(i, i + gap, j, j + gap, k, k + gap); - const auto ep = &e; - t.insert(ep, static_cast(&e)); - } - } - } - t.getRoot3d(); - -} } // namespace tut