Skip to content

Commit 82ef735

Browse files
committed
test: add set_ops_areal_areal which tests all operations
1 parent 54b300a commit 82ef735

11 files changed

+244
-112
lines changed

test/algorithms/overlay/multi_overlay_cases.hpp

+12-6
Original file line numberDiff line numberDiff line change
@@ -1594,18 +1594,24 @@ static std::string issue_1288[3] =
15941594
"POLYGON((-0.5 -1.49999999, -2.0 -0.1, -1.99999999 -1.5))"
15951595
};
15961596

1597-
static std::string bug_21155501[2] =
1598-
{
1599-
"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)))",
1600-
"MULTIPOLYGON(((4.9658203125 18.729501999072138,-3.4868710311820115 24.246968623627644,8.3589904332912 33.833614418115445,8.3056640625 32.99023555965106,9.8876953125 31.728167146023935,9.7119140625 25.48295117535531,11.8212890625 23.563987128451217,4.9658203125 18.729501999072138)),((-3.88714525609152 24.508246314579743,-8.3935546875 27.449790329784214,-8.9208984375 29.458731185355344,-0.5712890625 32.02670629333614,-1.8896484375 35.60371874069731,8.5693359375 37.16031654673677,8.362166569827938 33.883846345901595,-3.88714525609152 24.508246314579743)))",
1601-
};
1602-
16031597
static std::string issue_1299[2] =
16041598
{
16051599
"MULTIPOLYGON(((1.2549999979079400 0.85000000411847698, -1.2550000020920500 0.84999999897038103, -1.2549999999999999 -0.85000000102961903, 1.2549999999999999 -0.84999999999999998)))",
16061600
"MULTIPOLYGON(((-0.87500000000000000 -0.84999999999999998, -0.87500000000000000 -0.070000000000000201, -1.2549999999999999 -0.070000000000000201, -1.2549999999999999 -0.84999999999999998)))"
16071601
};
16081602

1603+
static std::string issue_1350_comment[2] =
1604+
{
1605+
"MULTIPOLYGON(((2 10,2 8,0 8,0 10,2 10)),((10 8,10 2,8 2,8 0,0 0,0 4,2 4,2 8,4 8,4 10,6 10,6 8,6 6,8 6,8 8,10 8),(8 2,8 4,4 4,4 2,8 2)))",
1606+
"MULTIPOLYGON(((2 6,2 4,2 2,2 0,0 0,0 6,2 6)),((2 10,2 8,0 8,0 10,2 10)),((6 8,6 6,2 6,2 8,6 8)),((8 4,8 2,6 2,6 4,8 4)),((10 8,10 6,8 6,8 8,10 8)),((8 10,8 8,6 8,6 10,8 10)))"
1607+
};
1608+
1609+
static std::string bug_21155501[2] =
1610+
{
1611+
"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)))",
1612+
"MULTIPOLYGON(((4.9658203125 18.729501999072138,-3.4868710311820115 24.246968623627644,8.3589904332912 33.833614418115445,8.3056640625 32.99023555965106,9.8876953125 31.728167146023935,9.7119140625 25.48295117535531,11.8212890625 23.563987128451217,4.9658203125 18.729501999072138)),((-3.88714525609152 24.508246314579743,-8.3935546875 27.449790329784214,-8.9208984375 29.458731185355344,-0.5712890625 32.02670629333614,-1.8896484375 35.60371874069731,8.5693359375 37.16031654673677,8.362166569827938 33.883846345901595,-3.88714525609152 24.508246314579743)))",
1613+
};
1614+
16091615
static std::string mysql_21965285_b[2] =
16101616
{
16111617
"MULTIPOLYGON(((3 0, -19 -19, -7 3, -2 10, 15 0, 3 0)))",

test/algorithms/overlay/overlay_cases.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,8 @@ static std::string issue_1226[2] =
11881188
"POLYGON((-0.91943242964602156508 0.55292377741135378955,-0.90478776881879174887 0.51756843862590162786,-0.91 0.48,-0.91943242964602156508 0.55292377741135378955))"
11891189
};
11901190

1191-
// Triangle, nearly a line
1191+
// Triangle, nearly a line.
1192+
// Still gives an error in difference
11921193
static std::string issue_1229[2] =
11931194
{
11941195
"POLYGON((38436.758 22765.61,930.538 -10523.68,925.121 -10507.965,38436.758 22765.61))",

test/algorithms/set_operations/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ add_subdirectory(union)
88
add_subdirectory(intersection)
99
add_subdirectory(difference)
1010
add_subdirectory(sym_difference)
11+
12+
foreach(item IN ITEMS
13+
set_ops_areal_areal
14+
)
15+
boost_geometry_add_unit_test("algorithms" ${item})
16+
endforeach()

test/algorithms/set_operations/Jamfile

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Boost.Geometry (aka GGL, Generic Geometry Library)
22
#
3-
# Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
3+
# Copyright (c) 2007-2024 Barend Gehrels, Amsterdam, the Netherlands.
44
# Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
55
# Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
66
#
@@ -14,6 +14,11 @@
1414
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
1515
# http://www.boost.org/LICENSE_1_0.txt)
1616

17+
test-suite boost-geometry-algorithms
18+
:
19+
[ run set_ops_areal_areal.cpp : : : : algorithms_set_ops_areal_areal ]
20+
;
21+
1722
build-project difference ;
1823
build-project intersection ;
1924
build-project sym_difference ;

test/algorithms/set_operations/difference/difference.cpp

-37
Original file line numberDiff line numberDiff line change
@@ -562,43 +562,6 @@ void test_all()
562562

563563
TEST_DIFFERENCE(issue_1138, 1, 203161.751, 2, 1237551.0171, 1);
564564

565-
{
566-
ut_settings settings;
567-
settings.set_test_validity(false);
568-
settings.validity_of_sym = false;
569-
TEST_DIFFERENCE_WITH(issue_1226, 1, 0.238037722, 0, 0.0, 1, settings);
570-
}
571-
572-
TEST_DIFFERENCE(issue_1231, 2, 36.798659456837477, 3, 195.2986, 5);
573-
574-
TEST_DIFFERENCE(issue_1244, 3, 8, 3, 2, 6);
575-
576-
{
577-
// The symmetric difference reports an invalidity since the choice of
578-
// discarding start/touch turns.
579-
// This might be a false negative.
580-
// Clockwise: "method: t; operations: u/x"
581-
// CCW: "method: m; operations: i/x"
582-
ut_settings settings;
583-
settings.validity_of_sym = false;
584-
TEST_DIFFERENCE_WITH(issue_1293, 1, 1.40999, 1, 2.318951, 2, settings);
585-
}
586-
587-
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
588-
// Difference fails for this case. This was not reported for this case.
589-
// Reported as a failing intersection, which is fixed.
590-
// The failing difference should be investigated more thoroughly.
591-
TEST_DIFFERENCE(issue_1295, 1, 9.999, 1, 9.999, 1);
592-
#endif
593-
594-
TEST_DIFFERENCE(issue_1326, 3, 6.7128537626409130468, 6, 0.00372806966532758478, 9);
595-
596-
TEST_DIFFERENCE(issue_1342_a, 2, 5.762381026454777, 0, 0.0, 2);
597-
TEST_DIFFERENCE(issue_1342_b, 2, 5.762381026454777, 1, 2.55e-14, 3);
598-
599-
TEST_DIFFERENCE(issue_1345_a, 1, 0.059308854, 0, 0.0, 1);
600-
TEST_DIFFERENCE(issue_1345_b, 2, 0.024048025, 0, 0.0, 2);
601-
602565
TEST_DIFFERENCE(mysql_21977775, 2, 160.856568913, 2, 92.3565689126, 4);
603566
TEST_DIFFERENCE(mysql_21965285, 1, 92.0, 1, 14.0, 1);
604567
TEST_DIFFERENCE(mysql_23023665_1, 1, 92.0, 1, 142.5, 2);

test/algorithms/set_operations/difference/difference_multi.cpp

-12
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,6 @@ void test_areal()
172172

173173
TEST_DIFFERENCE(issue_900, 0, 0.0, 2, 35, 2);
174174

175-
TEST_DIFFERENCE(issue_1222, 2, 32.0, 1, 4.0, 1);
176-
{
177-
// "method: t; operations: c/c;" still happening in the result
178-
// for multi/multi
179-
ut_settings settings;
180-
settings.set_test_validity(BG_IF_TEST_FAILURES);
181-
settings.validity_of_sym = BG_IF_TEST_FAILURES;
182-
TEST_DIFFERENCE_WITH(0, 1, issue_1288, 2, 10.95, 0, 0.0, 2);
183-
}
184-
185175
// Areas and #clips correspond with POSTGIS (except sym case)
186176
test_one<Polygon, MultiPolygon, MultiPolygon>("case_101_multi",
187177
case_101_multi[0], case_101_multi[1],
@@ -371,8 +361,6 @@ void test_areal()
371361
TEST_DIFFERENCE(mysql_regression_1_65_2017_08_31,
372362
optional(), optional_sliver(1e-6),
373363
3, 152.064185, count_set(3, 4));
374-
375-
TEST_DIFFERENCE(issue_1299, 1, 3.9706, 0, 0, 1);
376364
}
377365

378366

test/algorithms/set_operations/intersection/intersection.cpp

-15
Original file line numberDiff line numberDiff line change
@@ -293,23 +293,8 @@ void test_areal()
293293

294294
TEST_INTERSECTION(issue_893, 1, -1, 473001.5082956461);
295295

296-
TEST_INTERSECTION(issue_1226, 1, -1, 0.00036722862);
297296
TEST_INTERSECTION(issue_1229, 0, -1, 0);
298297

299-
TEST_INTERSECTION(issue_1231, 1, -1, 54.701340543162516);
300-
301-
TEST_INTERSECTION(issue_1244, 1, -1, 7);
302-
303-
TEST_INTERSECTION(issue_1293, 1, -1, 1.49123);
304-
TEST_INTERSECTION(issue_1295, 1, -1, 4.90121);
305-
TEST_INTERSECTION(issue_1326, 1, -1, 16.4844);
306-
307-
TEST_INTERSECTION(issue_1342_a, 1, -1, 43.05575);
308-
TEST_INTERSECTION(issue_1342_b, 1, -1, 43.05575);
309-
310-
TEST_INTERSECTION(issue_1345_a, 1, -1, 0.00062682687);
311-
TEST_INTERSECTION(issue_1345_b, 1, -1, 0.010896761);
312-
313298
test_one<Polygon, Polygon, Polygon>("buffer_mp1", buffer_mp1[0], buffer_mp1[1],
314299
1, 31, 2.271707796);
315300
test_one<Polygon, Polygon, Polygon>("buffer_mp2", buffer_mp2[0], buffer_mp2[1],

test/algorithms/set_operations/intersection/intersection_multi.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,9 @@ void test_areal()
362362
TEST_INTERSECTION(issue_888_34, 7, -1, 0.0256838);
363363
TEST_INTERSECTION(issue_888_37, 13, -1, 0.0567043);
364364

365-
TEST_INTERSECTION(issue_1222, 1, -1, 4.0);
366-
TEST_INTERSECTION(issue_1288, 1, -1, 1.05);
367-
368365
TEST_INTERSECTION(mysql_23023665_7, 2, 11, 9.80505786783);
369366
TEST_INTERSECTION(mysql_23023665_12, 2, 0, 11.812440191387557);
370367
TEST_INTERSECTION(mysql_regression_1_65_2017_08_31, 2, -1, 29.9022122);
371-
372-
TEST_INTERSECTION(issue_1299, 1, -1, 0.2964);
373368
}
374369

375370
template <typename Polygon, typename MultiPolygon, typename Box>

0 commit comments

Comments
 (0)