forked from organicmaps/organicmaps
Add polygon data tests.
This commit is contained in:
parent
c4e18de1fb
commit
bf694656b5
3 changed files with 109 additions and 0 deletions
|
@ -13,6 +13,7 @@ include($$ROOT_DIR/common.pri)
|
|||
HEADERS += \
|
||||
equality.hpp \
|
||||
large_polygon.hpp \
|
||||
test_regions.hpp \
|
||||
|
||||
SOURCES += \
|
||||
../../testing/testingmain.cpp \
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "../../base/SRC_FIRST.hpp"
|
||||
|
||||
#include "test_regions.hpp"
|
||||
|
||||
#include "../../testing/testing.hpp"
|
||||
|
||||
#include "../region2d/binary_operators.hpp"
|
||||
|
@ -82,3 +84,69 @@ UNIT_TEST(RegionDifference_Smoke)
|
|||
TEST_EQUAL(res[0].GetRect(), m2::RectI(0, 0, 1, 1), ());
|
||||
}
|
||||
}
|
||||
|
||||
UNIT_TEST(RegionDifference_Data1)
|
||||
{
|
||||
using namespace geom_test;
|
||||
|
||||
vector<R> vec;
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB1, arrB1 + ARRAY_SIZE(arrB1));
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB2, arrB2 + ARRAY_SIZE(arrB2));
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB3, arrB3 + ARRAY_SIZE(arrB3));
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB4, arrB4 + ARRAY_SIZE(arrB4));
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB5, arrB5 + ARRAY_SIZE(arrB5));
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB6, arrB6 + ARRAY_SIZE(arrB6));
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB7, arrB7 + ARRAY_SIZE(arrB7));
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB8, arrB8 + ARRAY_SIZE(arrB8));
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB9, arrB9 + ARRAY_SIZE(arrB9));
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB10, arrB10 + ARRAY_SIZE(arrB10));
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB11, arrB11 + ARRAY_SIZE(arrB11));
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB12, arrB12 + ARRAY_SIZE(arrB12));
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB13, arrB13 + ARRAY_SIZE(arrB13));
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB14, arrB14 + ARRAY_SIZE(arrB14));
|
||||
|
||||
vec.push_back(R());
|
||||
vec.back().Assign(arrB15, arrB15 + ARRAY_SIZE(arrB15));
|
||||
|
||||
vector<R> res;
|
||||
res.push_back(R());
|
||||
res.back().Assign(arrMain, arrMain + ARRAY_SIZE(arrMain));
|
||||
|
||||
for (size_t i = 0; i < vec.size(); ++i)
|
||||
{
|
||||
vector<R> local;
|
||||
|
||||
for (size_t j = 0; j < res.size(); ++j)
|
||||
m2::DiffRegions(res[j], vec[i], local);
|
||||
|
||||
local.swap(res);
|
||||
}
|
||||
}
|
||||
|
|
40
geometry/geometry_tests/test_regions.hpp
Normal file
40
geometry/geometry_tests/test_regions.hpp
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue