Skip to content

Commit 3f07eab

Browse files
committed
revert the changes in test/unit
1 parent 02e0b2e commit 3f07eab

File tree

2 files changed

+2
-99
lines changed

2 files changed

+2
-99
lines changed

tests/unit/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ target_include_directories(test_geos_unit
2323
file(GLOB_RECURSE _testfiles ${CMAKE_CURRENT_LIST_DIR}/**/*Test.cpp CONFIGURE_DEPEND)
2424
foreach(_testfile ${_testfiles})
2525
string(REPLACE ${CMAKE_CURRENT_LIST_DIR}/ "" _testname ${_testfile})
26-
string(REPLACE "../../test.cpp" "" _testname ${_testname})
26+
string(REPLACE "Test.cpp" "" _testname ${_testname})
2727
string(REPLACE "/" "-" _cmake_testname ${_testname})
2828
string(REPLACE "/" "::" _testname ${_testname})
2929
if (NOT ${_testname} MATCHES "^capi::")

tests/unit/index/strtree/SimpleSTRtreeTest.cpp

Lines changed: 1 addition & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,8 @@
77
#include <geos/index/strtree/GeometryItemDistance.h>
88
#include <geos/index/ItemVisitor.h>
99
#include <geos/io/WKTReader.h>
10-
#include <geos/geom/Envelope3d.h>
11-
#include <iostream>
12-
#include <ctime>
13-
#include <iostream>
14-
#include <thread>
15-
#include <chrono>
16-
#include <string.h>
17-
18-
#ifdef WIN32
19-
#include <windows.h>
20-
#include <psapi.h>
21-
//#include <tlhelp32.h>
22-
#include <direct.h>
23-
#include <process.h>
24-
#else
25-
#include <sys/stat.h>
26-
//#include <sys/sysinfo.h>
27-
#include <sys/time.h>
28-
#include <unistd.h>
29-
#endif
30-
#include <google/protobuf/io/coded_stream.h>
31-
// get current process pid
32-
inline int GetCurrentPid()
33-
{
34-
return getpid();
35-
}
36-
37-
#define VMRSS_LINE 22
3810

11+
#include <iostream>
3912

4013
using namespace geos;
4114

@@ -181,76 +154,6 @@ void object::test<3>
181154
}
182155

183156

184-
// get specific process physical memeory occupation size by pid (MB)
185-
inline float GetMemoryUsage(int pid)
186-
{
187-
#ifdef WIN32
188-
uint64_t mem = 0, vmem = 0;
189-
PROCESS_MEMORY_COUNTERS pmc;
190-
191-
// get process hanlde by pid
192-
HANDLE process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
193-
if (GetProcessMemoryInfo(process, &pmc, sizeof(pmc)))
194-
{
195-
mem = pmc.WorkingSetSize;
196-
vmem = pmc.PagefileUsage;
197-
}
198-
CloseHandle(process);
199-
200-
// use GetCurrentProcess() can get current process and no need to close handle
201-
202-
// convert mem from B to MB
203-
return mem / 1024.0 / 1024.0;
204-
205-
#else
206-
char file_name[64] = { 0 };
207-
FILE* fd;
208-
char line_buff[512] = { 0 };
209-
sprintf(file_name, "/proc/%d/status", pid);
210-
211-
fd = fopen(file_name, "r");
212-
if (nullptr == fd)
213-
return 0;
214-
215-
char name[64];
216-
int vmrss = 0;
217-
for (int i = 0; i < VMRSS_LINE - 1; i++)
218-
fgets(line_buff, sizeof(line_buff), fd);
219-
220-
fgets(line_buff, sizeof(line_buff), fd);
221-
sscanf(line_buff, "%s %d", name, &vmrss);
222-
fclose(fd);
223-
224-
// cnvert VmRSS from KB to MB
225-
return float(vmrss / 1024.0);
226-
#endif
227-
}
228-
229-
230-
231-
template<>
232-
template<>
233-
void object::test<4>
234-
() {
235-
236-
index::strtree::SimpleSTRtree t(10);
237-
std::vector<std::unique_ptr<geom::Geometry>> geoms;
238-
const int gridSize = 100;
239-
const int gap = 10;
240-
auto gf = geom::GeometryFactory::create();
241-
242-
for (int i = 0; i < gridSize; ++i) {
243-
for (int j = 0; j < gridSize; ++j) {
244-
for (int k= 0; k < gridSize; ++k) {
245-
geos::geom::Envelope3d e(i, i + gap, j, j + gap, k, k + gap);
246-
const auto ep = &e;
247-
t.insert(ep, static_cast<void*>(&e));
248-
}
249-
}
250-
}
251-
t.getRoot3d();
252-
253-
}
254157

255158
} // namespace tut
256159

0 commit comments

Comments
 (0)