| 1 | /* |
| 2 | Copyright (c) 2020, 2026, Oracle and/or its affiliates. |
| 3 | |
| 4 | This program is free software; you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License, version 2.0, |
| 6 | as published by the Free Software Foundation. |
| 7 | |
| 8 | This program is designed to work with certain software (including |
| 9 | but not limited to OpenSSL) that is licensed under separate terms, |
| 10 | as designated in a particular file or component or in included license |
| 11 | documentation. The authors of MySQL hereby grant you an additional |
| 12 | permission to link the program and your derivative works with the |
| 13 | separately licensed software that they have either included with |
| 14 | the program or referenced in the documentation. |
| 15 | |
| 16 | This program is distributed in the hope that it will be useful, |
| 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | GNU General Public License, version 2.0, for more details. |
| 20 | |
| 21 | You should have received a copy of the GNU General Public License |
| 22 | along with this program; if not, write to the Free Software |
| 23 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 24 | */ |
| 25 | |
| 26 | #include <gtest/gtest.h> |
| 27 | #include <memory> // unique_ptr |
| 28 | #include <ostream> // << |
| 29 | |
| 30 | #include "sql/dd/dd.h" |
| 31 | #include "sql/dd/impl/types/spatial_reference_system_impl.h" |
| 32 | #include "sql/dd/properties.h" |
| 33 | #include "sql/dd/types/spatial_reference_system.h" |
| 34 | #include "sql/gis/geometries.h" |
| 35 | #include "sql/gis/geometries_cs.h" |
| 36 | #include "sql/gis/relops.h" |
| 37 | #include "sql/gis/setops.h" |
| 38 | #include "template_utils.h" // down_cast |
| 39 | #include "unittest/gunit/gis_setops_testshapes.h" |
| 40 | #include "unittest/gunit/gis_test.h" |
| 41 | #include "unittest/gunit/gis_typeset.h" |
| 42 | |
| 43 | namespace gis_union_unittest { |
| 44 | |
| 45 | template <typename Types> |
| 46 | struct UnionTest : Gis_test<Types> { |
| 47 | void test_valid_input(const gis::Geometry &g1, const gis::Geometry &g2, |
| 48 | gis::Geometry &expected_result) { |
| 49 | std::unique_ptr<gis::Geometry> result; |
| 50 | bool is_null = false; |
| 51 | bool error = |
| 52 | gis::union_(this->m_srs.get(), &g1, &g2, "unittest", &result, &is_null); |
| 53 | EXPECT_FALSE(error); |
| 54 | EXPECT_FALSE(is_null); |
| 55 | |
| 56 | // Verify geometry return type. |
| 57 | const std::string type_res(gis::type_to_name(result->type())); |
| 58 | const std::string type_exp(gis::type_to_name(expected_result.type())); |
| 59 | EXPECT_EQ(type_exp, type_res); |
| 60 | |
| 61 | // Verify result is correct. |
| 62 | bool is_equals = false; |
| 63 | bool equals_error = |
| 64 | gis::equals(this->m_srs.get(), &expected_result, result.get(), |
| 65 | "unittest", &is_equals, &is_null); |
| 66 | EXPECT_FALSE(equals_error); |
| 67 | EXPECT_FALSE(is_null); |
| 68 | EXPECT_TRUE(is_equals); |
| 69 | } |
| 70 | }; |
| 71 | |
| 72 | // The purpose of these tests is to check that the result returned from |
| 73 | // gis::union_ is correct. The tests test all combinations of geometries. |
| 74 | TYPED_TEST_SUITE(UnionTest, gis_typeset::Test_both); |
| 75 | |
| 76 | // union_(... ,point, *, ...) |
| 77 | |
| 78 | TYPED_TEST(UnionTest, PointPoint) { |
| 79 | typename TypeParam::Point pt1{0, 0}; |
| 80 | typename TypeParam::Point pt2{0, 0.1}; |
| 81 | typename TypeParam::Multipoint expected_result{}; |
| 82 | |
| 83 | expected_result.push_back(pt1); |
| 84 | expected_result.push_back(pt2); |
| 85 | |
| 86 | this->test_valid_input(pt1, pt1, pt1); |
| 87 | this->test_valid_input(pt1, pt2, expected_result); |
| 88 | } |
| 89 | |
| 90 | TYPED_TEST(UnionTest, PointMultipoint) { |
| 91 | typename TypeParam::Point pt1{0, 0}; |
| 92 | typename TypeParam::Point pt2{0, 0.1}; |
| 93 | typename TypeParam::Point pt3{0.1, 0.1}; |
| 94 | typename TypeParam::Multipoint mpt = simple_mpt<TypeParam>(); |
| 95 | typename TypeParam::Multipoint expected_result{}; |
| 96 | |
| 97 | mpt.push_back(pt2); |
| 98 | expected_result.push_back(pt1); |
| 99 | expected_result.push_back(pt2); |
| 100 | expected_result.push_back(pt3); |
| 101 | |
| 102 | this->test_valid_input(pt3, mpt, expected_result); |
| 103 | this->test_valid_input(mpt, pt3, expected_result); |
| 104 | } |
| 105 | |
| 106 | TYPED_TEST(UnionTest, PointLinestring) { |
| 107 | typename TypeParam::Point pt1{0, 0}; |
| 108 | typename TypeParam::Point pt2{0.1, 0.1}; |
| 109 | typename TypeParam::Linestring ls = simple_ls<TypeParam>(); |
| 110 | typename TypeParam::Geometrycollection expected_result{}; |
| 111 | |
| 112 | expected_result.push_back(ls); |
| 113 | expected_result.push_back(pt2); |
| 114 | |
| 115 | this->test_valid_input(pt1, ls, ls); |
| 116 | this->test_valid_input(ls, pt1, ls); |
| 117 | this->test_valid_input(pt2, ls, expected_result); |
| 118 | this->test_valid_input(ls, pt2, expected_result); |
| 119 | } |
| 120 | |
| 121 | TYPED_TEST(UnionTest, PointMultiLinestring) { |
| 122 | typename TypeParam::Point pt1{0, 0}; |
| 123 | typename TypeParam::Point pt2{0.1, 0.1}; |
| 124 | typename TypeParam::Multilinestring mls = simple_mls<TypeParam>(); |
| 125 | typename TypeParam::Geometrycollection expected_result{}; |
| 126 | |
| 127 | expected_result.push_back(mls[0]); |
| 128 | expected_result.push_back(pt2); |
| 129 | |
| 130 | this->test_valid_input(pt1, mls, mls[0]); |
| 131 | this->test_valid_input(mls, pt1, mls[0]); |
| 132 | this->test_valid_input(pt2, mls, expected_result); |
| 133 | this->test_valid_input(mls, pt2, expected_result); |
| 134 | } |
| 135 | |
| 136 | TYPED_TEST(UnionTest, PointPolygon) { |
| 137 | typename TypeParam::Point pt1{0, 0}; |
| 138 | typename TypeParam::Point pt2{0, 0.2}; |
| 139 | typename TypeParam::Polygon py = base_py<TypeParam>(); |
| 140 | typename TypeParam::Geometrycollection expected_result{}; |
| 141 | |
| 142 | expected_result.push_back(py); |
| 143 | expected_result.push_back(pt2); |
| 144 | |
| 145 | this->test_valid_input(pt1, py, py); |
| 146 | this->test_valid_input(py, pt1, py); |
| 147 | this->test_valid_input(pt2, py, expected_result); |
| 148 | this->test_valid_input(py, pt2, expected_result); |
| 149 | } |
| 150 | |
| 151 | TYPED_TEST(UnionTest, PointMultipolygon) { |
| 152 | typename TypeParam::Point pt1{0, 0}; |
| 153 | typename TypeParam::Point pt2{0, 0.2}; |
| 154 | typename TypeParam::Multipolygon mpy = simple_mpy<TypeParam>(); |
| 155 | typename TypeParam::Geometrycollection expected_result{}; |
| 156 | |
| 157 | expected_result.push_back(mpy[0]); |
| 158 | expected_result.push_back(pt2); |
| 159 | |
| 160 | this->test_valid_input(pt1, mpy, mpy[0]); |
| 161 | this->test_valid_input(mpy, pt1, mpy[0]); |
| 162 | this->test_valid_input(pt2, mpy, expected_result); |
| 163 | this->test_valid_input(mpy, pt2, expected_result); |
| 164 | } |
| 165 | |
| 166 | // union_(..., multipoint, *, ...) |
| 167 | |
| 168 | TYPED_TEST(UnionTest, MultipointMultipoint) { |
| 169 | typename TypeParam::Multipoint mpt1 = simple_mpt<TypeParam>(); |
| 170 | typename TypeParam::Multipoint mpt2 = simple_mpt<TypeParam>(); |
| 171 | typename TypeParam::Multipoint expected_result = simple_mpt<TypeParam>(); |
| 172 | |
| 173 | mpt1.push_back(typename TypeParam::Point{0.0, 0.1}); |
| 174 | mpt2.push_back(typename TypeParam::Point{0.1, 0.1}); |
| 175 | expected_result.push_back(typename TypeParam::Point{0.0, 0.1}); |
| 176 | expected_result.push_back(typename TypeParam::Point{0.1, 0.1}); |
| 177 | |
| 178 | this->test_valid_input(mpt1, mpt2, expected_result); |
| 179 | } |
| 180 | |
| 181 | TYPED_TEST(UnionTest, MultipointLinestring) { |
| 182 | typename TypeParam::Multipoint mpt = simple_mpt<TypeParam>(); |
| 183 | typename TypeParam::Linestring ls = simple_ls<TypeParam>(); |
| 184 | typename TypeParam::Geometrycollection expected_result{}; |
| 185 | |
| 186 | this->test_valid_input(ls, mpt, ls); |
| 187 | this->test_valid_input(mpt, ls, ls); |
| 188 | |
| 189 | mpt.push_back(typename TypeParam::Point{0.1, 0.1}); |
| 190 | expected_result.push_back(ls); |
| 191 | expected_result.push_back(typename TypeParam::Point{0.1, 0.1}); |
| 192 | |
| 193 | this->test_valid_input(mpt, ls, expected_result); |
| 194 | this->test_valid_input(ls, mpt, expected_result); |
| 195 | } |
| 196 | |
| 197 | TYPED_TEST(UnionTest, MultipointMultilinestring) { |
| 198 | typename TypeParam::Multipoint mpt = simple_mpt<TypeParam>(); |
| 199 | typename TypeParam::Multilinestring mls = simple_mls<TypeParam>(); |
| 200 | typename TypeParam::Geometrycollection expected_result{}; |
| 201 | |
| 202 | mpt.push_back(typename TypeParam::Point{0.1, 0.1}); |
| 203 | expected_result.push_back(mls[0]); |
| 204 | expected_result.push_back(typename TypeParam::Point{0.1, 0.1}); |
| 205 | |
| 206 | this->test_valid_input(mls, mpt, expected_result); |
| 207 | this->test_valid_input(mpt, mls, expected_result); |
| 208 | } |
| 209 | |
| 210 | TYPED_TEST(UnionTest, MultipointPolygon) { |
| 211 | typename TypeParam::Multipoint mpt = simple_mpt<TypeParam>(); |
| 212 | typename TypeParam::Polygon py = base_py<TypeParam>(); |
| 213 | typename TypeParam::Geometrycollection expected_result{}; |
| 214 | |
| 215 | mpt.push_back(typename TypeParam::Point{0.0, 0.2}); |
| 216 | expected_result.push_back(py); |
| 217 | expected_result.push_back(typename TypeParam::Point{0.0, 0.2}); |
| 218 | |
| 219 | this->test_valid_input(mpt, py, expected_result); |
| 220 | this->test_valid_input(py, mpt, expected_result); |
| 221 | } |
| 222 | |
| 223 | TYPED_TEST(UnionTest, MultipointMultipolygon) { |
| 224 | typename TypeParam::Multipoint mpt = simple_mpt<TypeParam>(); |
| 225 | typename TypeParam::Multipolygon mpy = simple_mpy<TypeParam>(); |
| 226 | typename TypeParam::Geometrycollection expected_result{}; |
| 227 | |
| 228 | mpt.push_back(typename TypeParam::Point{0.0, 0.2}); |
| 229 | expected_result.push_back(mpy[0]); |
| 230 | expected_result.push_back(typename TypeParam::Point{0.0, 0.2}); |
| 231 | |
| 232 | this->test_valid_input(mpt, mpy, expected_result); |
| 233 | this->test_valid_input(mpy, mpt, expected_result); |
| 234 | } |
| 235 | |
| 236 | // union_(..., linestring, *, ...) |
| 237 | |
| 238 | TYPED_TEST(UnionTest, LinestringLinestring) { |
| 239 | typename TypeParam::Linestring ls1 = simple_ls<TypeParam>(); |
| 240 | typename TypeParam::Linestring ls2 = diagonal_ls<TypeParam>(); |
| 241 | typename TypeParam::Multilinestring expected_result{}; |
| 242 | |
| 243 | expected_result.push_back(ls1); |
| 244 | expected_result.push_back(ls2); |
| 245 | |
| 246 | this->test_valid_input(ls1, ls1, ls1); |
| 247 | this->test_valid_input(ls1, ls2, expected_result); |
| 248 | } |
| 249 | |
| 250 | TYPED_TEST(UnionTest, LinestringMultilinestring) { |
| 251 | typename TypeParam::Multilinestring mls = simple_mls<TypeParam>(); |
| 252 | typename TypeParam::Linestring ls2 = diagonal_ls<TypeParam>(); |
| 253 | typename TypeParam::Multilinestring expected_result{}; |
| 254 | |
| 255 | this->test_valid_input(mls[0], mls, mls[0]); |
| 256 | this->test_valid_input(mls, mls[0], mls[0]); |
| 257 | |
| 258 | mls.push_back(ls2); |
| 259 | expected_result.push_back(mls[0]); |
| 260 | expected_result.push_back(ls2); |
| 261 | |
| 262 | this->test_valid_input(ls2, mls, expected_result); |
| 263 | this->test_valid_input(mls, ls2, expected_result); |
| 264 | } |
| 265 | |
| 266 | TYPED_TEST(UnionTest, LinestringPolygon) { |
| 267 | typename TypeParam::Linestring ls1 = diagonal_ls<TypeParam>(); |
| 268 | typename TypeParam::Linestring ls2 = ls_crossing_base_py<TypeParam>(); |
| 269 | typename TypeParam::Polygon py = base_py<TypeParam>(); |
| 270 | typename TypeParam::Geometrycollection expected_result{}; |
| 271 | typename TypeParam::Multilinestring ls_result = |
| 272 | ls_crossing_base_py_difference<TypeParam>(); |
| 273 | |
| 274 | expected_result.push_back(py); |
| 275 | for (typename TypeParam::Linestring ls : ls_result) |
| 276 | expected_result.push_back(ls); |
| 277 | |
| 278 | this->test_valid_input(ls1, py, py); |
| 279 | this->test_valid_input(py, ls1, py); |
| 280 | this->test_valid_input(ls2, py, expected_result); |
| 281 | this->test_valid_input(py, ls2, expected_result); |
| 282 | } |
| 283 | |
| 284 | TYPED_TEST(UnionTest, LinestringMultiPolygon) { |
| 285 | typename TypeParam::Linestring ls1 = diagonal_ls<TypeParam>(); |
| 286 | typename TypeParam::Linestring ls2 = ls_overlapping_base_py<TypeParam>(); |
| 287 | typename TypeParam::Multipolygon mpy = simple_mpy<TypeParam>(); |
| 288 | typename TypeParam::Geometrycollection expected_result{}; |
| 289 | |
| 290 | expected_result.push_back(mpy[0]); |
| 291 | expected_result.push_back(ls_overlapping_base_py_difference<TypeParam>()); |
| 292 | |
| 293 | this->test_valid_input(ls1, mpy, mpy[0]); |
| 294 | this->test_valid_input(mpy, ls1, mpy[0]); |
| 295 | this->test_valid_input(ls2, mpy, expected_result); |
| 296 | this->test_valid_input(mpy, ls2, expected_result); |
| 297 | } |
| 298 | |
| 299 | // union_(..., multilinestring, *, ...) |
| 300 | |
| 301 | TYPED_TEST(UnionTest, MultilinestringMultilinestring) { |
| 302 | typename TypeParam::Multilinestring mls1 = simple_mls<TypeParam>(); |
| 303 | typename TypeParam::Multilinestring mls2 = simple_mls<TypeParam>(); |
| 304 | typename TypeParam::Multilinestring expected_result{}; |
| 305 | typename TypeParam::Linestring expected_result_ls{}; |
| 306 | |
| 307 | mls2.push_back(offset_simple_ls<TypeParam>()); |
| 308 | mls1.push_back(diagonal_ls<TypeParam>()); |
| 309 | expected_result_ls.push_back(typename TypeParam::Point{0.0, 0.0}); |
| 310 | expected_result_ls.push_back(typename TypeParam::Point{0.15, 0.0}); |
| 311 | expected_result.push_back(expected_result_ls); |
| 312 | expected_result.push_back(diagonal_ls<TypeParam>()); |
| 313 | |
| 314 | this->test_valid_input(mls1, mls2, expected_result); |
| 315 | } |
| 316 | |
| 317 | TYPED_TEST(UnionTest, MultilinestringPolygon) { |
| 318 | typename TypeParam::Multilinestring mls = simple_mls<TypeParam>(); |
| 319 | typename TypeParam::Polygon py = base_py<TypeParam>(); |
| 320 | typename TypeParam::Geometrycollection expected_result{}; |
| 321 | |
| 322 | mls.push_back(ls_overlapping_base_py<TypeParam>()); |
| 323 | expected_result.push_back(py); |
| 324 | expected_result.push_back(ls_overlapping_base_py_difference<TypeParam>()); |
| 325 | |
| 326 | this->test_valid_input(py, mls, expected_result); |
| 327 | this->test_valid_input(mls, py, expected_result); |
| 328 | } |
| 329 | |
| 330 | TYPED_TEST(UnionTest, MultilinestringMultipolygon) { |
| 331 | typename TypeParam::Multilinestring mls = simple_mls<TypeParam>(); |
| 332 | typename TypeParam::Multipolygon mpy = simple_mpy<TypeParam>(); |
| 333 | typename TypeParam::Geometrycollection expected_result{}; |
| 334 | |
| 335 | mls.push_back(ls_overlapping_base_py<TypeParam>()); |
| 336 | expected_result.push_back(mpy[0]); |
| 337 | expected_result.push_back(ls_overlapping_base_py_difference<TypeParam>()); |
| 338 | |
| 339 | this->test_valid_input(mpy, mls, expected_result); |
| 340 | this->test_valid_input(mls, mpy, expected_result); |
| 341 | } |
| 342 | |
| 343 | // union_(..., polygon, *, ...) |
| 344 | |
| 345 | TYPED_TEST(UnionTest, PolygonPolygon) { |
| 346 | typename TypeParam::Polygon py1 = base_py<TypeParam>(); |
| 347 | typename TypeParam::Polygon py2 = overlapping_py<TypeParam>(); |
| 348 | typename TypeParam::Polygon py3 = disjoint_py<TypeParam>(); |
| 349 | typename TypeParam::Polygon expected_result_py = |
| 350 | base_union_overlapping_py<TypeParam>(); |
| 351 | typename TypeParam::Multipolygon expected_result_mpy{}; |
| 352 | |
| 353 | expected_result_mpy.push_back(py1); |
| 354 | expected_result_mpy.push_back(py3); |
| 355 | |
| 356 | this->test_valid_input(py1, py2, expected_result_py); |
| 357 | this->test_valid_input(py1, py3, expected_result_mpy); |
| 358 | } |
| 359 | |
| 360 | TYPED_TEST(UnionTest, PolygonMultipolygon) { |
| 361 | typename TypeParam::Polygon py1 = base_py<TypeParam>(); |
| 362 | typename TypeParam::Polygon py2 = overlapping_py<TypeParam>(); |
| 363 | typename TypeParam::Polygon py3 = disjoint_py<TypeParam>(); |
| 364 | typename TypeParam::Multipolygon mpy{}; |
| 365 | typename TypeParam::Multipolygon expected_result{}; |
| 366 | |
| 367 | mpy.push_back(py2); |
| 368 | mpy.push_back(py3); |
| 369 | expected_result.push_back(base_union_overlapping_py<TypeParam>()); |
| 370 | expected_result.push_back(py3); |
| 371 | |
| 372 | this->test_valid_input(py1, mpy, expected_result); |
| 373 | this->test_valid_input(mpy, py1, expected_result); |
| 374 | } |
| 375 | |
| 376 | // union_(..., multipolygon, *, ...) |
| 377 | |
| 378 | TYPED_TEST(UnionTest, MultipolygonMultipolygon) { |
| 379 | typename TypeParam::Polygon py1 = base_py<TypeParam>(); |
| 380 | typename TypeParam::Polygon py2 = overlapping_py<TypeParam>(); |
| 381 | typename TypeParam::Polygon py3 = disjoint_py<TypeParam>(); |
| 382 | typename TypeParam::Multipolygon mpy1 = simple_mpy<TypeParam>(); |
| 383 | typename TypeParam::Multipolygon mpy2{}; |
| 384 | typename TypeParam::Polygon expected_result_py = |
| 385 | base_union_overlapping_py<TypeParam>(); |
| 386 | typename TypeParam::Multipolygon expected_result_mpy{}; |
| 387 | |
| 388 | mpy2.push_back(py2); |
| 389 | mpy2.push_back(py3); |
| 390 | expected_result_mpy.push_back(expected_result_py); |
| 391 | expected_result_mpy.push_back(py3); |
| 392 | |
| 393 | this->test_valid_input(mpy1, mpy2, expected_result_mpy); |
| 394 | } |
| 395 | |
| 396 | // union_(..., geometrycollection, *, ...) |
| 397 | |
| 398 | TYPED_TEST(UnionTest, GeometrycollectionPoint) { |
| 399 | typename TypeParam::Geometrycollection gc{}; |
| 400 | typename TypeParam::Point pt{0, 0}; |
| 401 | this->test_valid_input(gc, pt, pt); |
| 402 | this->test_valid_input(pt, gc, pt); |
| 403 | } |
| 404 | |
| 405 | TYPED_TEST(UnionTest, GeometrycollectionMultipoint) { |
| 406 | typename TypeParam::Geometrycollection gc{}; |
| 407 | typename TypeParam::Multipoint mpt = simple_mpt<TypeParam>(); |
| 408 | this->test_valid_input(gc, mpt, mpt[0]); |
| 409 | this->test_valid_input(mpt, gc, mpt[0]); |
| 410 | } |
| 411 | |
| 412 | TYPED_TEST(UnionTest, GeometrycollectionLinestring) { |
| 413 | typename TypeParam::Geometrycollection gc{}; |
| 414 | typename TypeParam::Linestring ls = simple_ls<TypeParam>(); |
| 415 | this->test_valid_input(gc, ls, ls); |
| 416 | this->test_valid_input(ls, gc, ls); |
| 417 | } |
| 418 | |
| 419 | TYPED_TEST(UnionTest, GeometrycollectionMultilinestring) { |
| 420 | typename TypeParam::Geometrycollection gc{}; |
| 421 | typename TypeParam::Multilinestring mls = simple_mls<TypeParam>(); |
| 422 | this->test_valid_input(gc, mls, mls[0]); |
| 423 | this->test_valid_input(mls, gc, mls[0]); |
| 424 | } |
| 425 | |
| 426 | TYPED_TEST(UnionTest, GeometrycollectionPolygon) { |
| 427 | typename TypeParam::Geometrycollection gc{}; |
| 428 | typename TypeParam::Polygon py = base_py<TypeParam>(); |
| 429 | this->test_valid_input(gc, py, py); |
| 430 | this->test_valid_input(py, gc, py); |
| 431 | } |
| 432 | |
| 433 | TYPED_TEST(UnionTest, GeometrycollectionMultipolygon) { |
| 434 | typename TypeParam::Geometrycollection gc{}; |
| 435 | typename TypeParam::Multipolygon mpy = simple_mpy<TypeParam>(); |
| 436 | this->test_valid_input(gc, mpy, mpy[0]); |
| 437 | this->test_valid_input(mpy, gc, mpy[0]); |
| 438 | } |
| 439 | |
| 440 | TYPED_TEST(UnionTest, GeometrycollectionGeometrycollection) { |
| 441 | typename TypeParam::Geometrycollection gc{}; |
| 442 | this->test_valid_input(gc, gc, gc); |
| 443 | |
| 444 | typename TypeParam::Point pt{0, 0}; |
| 445 | typename TypeParam::Linestring ls = ls_overlapping_base_py<TypeParam>(); |
| 446 | typename TypeParam::Polygon py = overlapping_py<TypeParam>(); |
| 447 | typename TypeParam::Multipoint mpt = simple_mpt<TypeParam>(); |
| 448 | typename TypeParam::Multilinestring mls = simple_mls<TypeParam>(); |
| 449 | typename TypeParam::Multipolygon mpy = simple_mpy<TypeParam>(); |
| 450 | typename TypeParam::Geometrycollection gc1{}; |
| 451 | gc1.push_back(typename TypeParam::Point{0.0, 0.5}); |
| 452 | gc.push_back(pt); |
| 453 | gc.push_back(ls); |
| 454 | gc.push_back(py); |
| 455 | gc.push_back(mpt); |
| 456 | gc.push_back(mls); |
| 457 | gc.push_back(mpy); |
| 458 | gc.push_back(gc1); |
| 459 | |
| 460 | typename TypeParam::Geometrycollection expected_result{}; |
| 461 | expected_result.push_back(base_union_overlapping_py<TypeParam>()); |
| 462 | expected_result.push_back(ls_overlapping_base_py_difference<TypeParam>()); |
| 463 | expected_result.push_back(typename TypeParam::Point{0.0, 0.5}); |
| 464 | |
| 465 | this->test_valid_input(gc, gc, expected_result); |
| 466 | } |
| 467 | |
| 468 | } // namespace gis_union_unittest |