Skip to content

Commit f0b0dc3

Browse files
committed
[test] add cases for issues boostorg#869 and boostorg#861
1 parent 14aa054 commit f0b0dc3

File tree

6 files changed

+43
-3
lines changed

6 files changed

+43
-3
lines changed

test/algorithms/overlay/multi_overlay_cases.hpp

+21
Original file line numberDiff line numberDiff line change
@@ -1500,6 +1500,27 @@ static std::string issue_643[2] =
15001500
"MULTIPOLYGON(((4.75985680877701196159479187986e-16 -0.26112514220036736611874061964,0 0,0.72337592336357892097709054724 0.600648602980154100450249643472,1.223386680467822174023240222 1.19163154396839887638748223253,1.72339743757206620422550713556 2.1342216197599452875977021904,1.72339742847305732453833115869 -2.01889900623749607433410346857,4.75985680877701196159479187986e-16 -0.26112514220036736611874061964)))"
15011501
};
15021502

1503+
// For difference
1504+
static std::string issue_869_a[2] =
1505+
{
1506+
"MULTIPOLYGON(((70 50,70 10,10 10,10 70,50 70,50 90,70 90,70 70,90 70,90 50,70 50)))",
1507+
"MULTIPOLYGON(((50 50,50 70,70 70,70 50,50 50)),((50 50,50 30,30 30,30 50,50 50)))"
1508+
};
1509+
1510+
// For union
1511+
static std::string issue_869_b[2] =
1512+
{
1513+
"MULTIPOLYGON(((10 10,10 70,50 70,50 50,70 50,70 10,10 10),(30 30,50 30,50 50,30 50,30 30)))",
1514+
"MULTIPOLYGON(((50 70,50 90,70 90,70 70,50 70)),((70 70,90 70,90 50,70 50,70 70)))"
1515+
};
1516+
1517+
// For intersection
1518+
static std::string issue_869_c[2] =
1519+
{
1520+
"MULTIPOLYGON(((10 10,10 90,90 90,90 10,10 10),(30 30,50 30,50 50,30 50,30 30),(50 50,70 50,70 70,50 70,50 50)))",
1521+
"MULTIPOLYGON(((10 10,10 70,50 70,50 90,70 90,70 70,90 70,90 50,70 50,70 10,10 10)))"
1522+
};
1523+
15031524
static std::string bug_21155501[2] =
15041525
{
15051526
"MULTIPOLYGON(((-8.3935546875 27.449790329784214,4.9658203125 18.729501999072138,11.8212890625 23.563987128451217,9.7119140625 25.48295117535531,9.8876953125 31.728167146023935,8.3056640625 32.99023555965106,8.5693359375 37.16031654673677,-1.8896484375 35.60371874069731,-0.5712890625 32.02670629333614,-8.9208984375 29.458731185355344,-8.3935546875 27.449790329784214)))",

test/algorithms/overlay/overlay_cases.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,12 @@ static std::string issue_838[2] =
10471047
"POLYGON((27164.783474018484 -40044.371515841653,27165.010815897258 -40044.854409784071,27162.750625155277 -40045.918184556889,27162.523283276503 -40045.43529061447,27164.783474018484 -40044.371515841653))"
10481048
};
10491049

1050+
static std::string issue_861[2] =
1051+
{
1052+
"POLYGON((0.000000000000000000000000000000 1.000000000000000000000000000000 , 1.000001713207607556554989969300 -0.000001713207607420577826331251 , 0.000000000000000000000000000000 0.230455148580528512702869647910 , 0.000000000000000000000000000000 1.000000000000000000000000000000))",
1053+
"POLYGON((0.999994299999858893279736093973 0.000000000000000000000000000000 , 0.239056281157559169514570385218 0.000000000000000000000000000000 , 0.073239184141848157061360780062 0.213576637616646664019626200570 , 0.999994299999858893279736093973 0.000000000000000000000000000000))"
1054+
};
1055+
10501056
static std::string ggl_list_20120229_volker[3] =
10511057
{
10521058
"POLYGON((1716 1554,2076 2250,2436 2352,2796 1248,3156 2484,3516 2688,3516 2688,3156 2484,2796 1248,2436 2352,2076 2250, 1716 1554))",

test/algorithms/set_operations/difference/difference_multi.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ void test_areal()
209209
#endif
210210
}
211211

212+
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
213+
// Generates a polygon with two interiors, i/o a multipoly with 3 rings
214+
TEST_DIFFERENCE(issue_869_a, 3, 3600, 0, 0, 1);
215+
#endif
212216
// Areas and #clips correspond with POSTGIS (except sym case)
213217
test_one<Polygon, MultiPolygon, MultiPolygon>("case_101_multi",
214218
case_101_multi[0], case_101_multi[1],

test/algorithms/set_operations/intersection/intersection.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,11 @@ void test_areal()
307307

308308
TEST_INTERSECTION(issue_838, 1, -1, (expectation_limits{0.6582, 0.6650}));
309309

310+
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
311+
// With rescaling the output is wrong
312+
TEST_INTERSECTION(issue_861, 1, -1, 1.4715007684573677693e-10);
313+
#endif
314+
310315
test_one<Polygon, Polygon, Polygon>("buffer_mp1", buffer_mp1[0], buffer_mp1[1],
311316
1, 31, 2.271707796);
312317
test_one<Polygon, Polygon, Polygon>("buffer_mp2", buffer_mp2[0], buffer_mp2[1],

test/algorithms/set_operations/intersection/intersection_multi.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,9 @@ void test_areal()
378378
TEST_INTERSECTION(issue_643, 1, -1, 3.4615);
379379
#endif
380380

381-
test_one<Polygon, MultiPolygon, MultiPolygon>("mysql_23023665_7",
382-
mysql_23023665_7[0], mysql_23023665_7[1],
383-
2, 11, 9.80505786783);
381+
TEST_INTERSECTION(issue_869_c, 3, -1, 3600);
384382

383+
TEST_INTERSECTION(mysql_23023665_7, 2, 11, 9.80505786783);
385384
TEST_INTERSECTION(mysql_23023665_12, 2, 0, 11.812440191387557);
386385
TEST_INTERSECTION(mysql_regression_1_65_2017_08_31, 2, -1, 29.9022122);
387386
}

test/algorithms/set_operations/union/union_multi.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,11 @@ void test_areal()
433433
TEST_UNION(issue_643, 1, 0, -1, 80.0);
434434
#endif
435435

436+
// It returns 3 polygons, the first with an interior
437+
// This is correct (the difference, resulting in the same spatial coverage,
438+
// generates only one polygon with two interiors)
439+
TEST_UNION(issue_869_b, 3, 1, -1, 3600);
440+
436441
#if defined(BOOST_GEOMETRY_USE_KRAMER_RULE)
437442
// Two polygons, should ideally be merged
438443
TEST_UNION(mail_2019_01_21_johan, 2, 0, -1, 0.00058896);

0 commit comments

Comments
 (0)