]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/geometry/test/algorithms/set_operations/union/union_multi.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / set_operations / union / union_multi.cpp
index 988b4af0117a92501042df7a10e7fec8eb102dca..c76bbcd5e8fce9625e959b7010eb7a05dd6c1442 100644 (file)
@@ -130,11 +130,7 @@ void test_areal()
         case_108_multi[0], case_108_multi[1],
         1, 1, 20, 22.75);
 
-#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
     TEST_UNION(case_109_multi, 1, 2, 14, 1400);
-#else
-    TEST_UNION_IGNORE(case_109_multi, 1, 1, 14, 1400);
-#endif
 
     // Should have 9 holes, they are all separate and touching
     test_one<Polygon, MultiPolygon, MultiPolygon>("case_110_multi",
@@ -183,11 +179,7 @@ void test_areal()
     TEST_UNION(case_125_multi, 1, 0, 9, 2.75);
     TEST_UNION(case_126_multi, 1, 2, 27, 52.0);
 
-#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
     TEST_UNION(case_131_multi, 1, 2, 15, 14.0);
-#else
-    TEST_UNION_IGNORE(case_131_multi, 1, 1, 15, 14.0);
-#endif
 
     // SQL Server returns: MULTIPOLYGON (((4 4, 5.5 4.5, 6 6, 4.5 5.5, 4 4)), ((2 2, 3.5 2.5, 4 4, 2.5 3.5, 2 2)), ((0 0, 8 0, 8 8, 0 8, 0 0), (2 2, 2 4, 4 4, 4 6, 6 6, 6 4, 4 4, 4 2, 2 2)))
     // Which is one self-connected hole with two island polygons in both parts, basically identical to what Boost.Geometry delivers
@@ -221,11 +213,7 @@ void test_areal()
         case_recursive_boxes_4[0], case_recursive_boxes_4[1],
         1, 2, 26, 96.75);
 
-#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
     TEST_UNION(case_recursive_boxes_5, 3, 10, 98, 70.0);
-#else
-    TEST_UNION_IGNORE(case_recursive_boxes_5, 3, 9, 115, 70.0);
-#endif
 
     test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_6",
         case_recursive_boxes_6[0], case_recursive_boxes_6[1],
@@ -264,10 +252,7 @@ void test_areal()
     // to break regions at self-intersection points (postponed)
 
     TEST_UNION_IGNORE(case_recursive_boxes_12_invalid, 5, 0, -1, 6.0);
-#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
-    // Only apply it with self-turns. Without them a whole part is missed
     TEST_UNION_IGNORE(case_recursive_boxes_13_invalid, 2, 0, -1, 10.25);
-#endif
     TEST_UNION_IGNORE(case_recursive_boxes_14_invalid, 4, 0, -1, 4.5);
 
     test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_15",
@@ -346,42 +331,17 @@ void test_areal()
     TEST_UNION(case_recursive_boxes_46, 1, 4, 51, 33.0);
     TEST_UNION(case_recursive_boxes_47, 1, 0, -1, 22.0);
     TEST_UNION(case_recursive_boxes_48, 1, 1, -1, 10.0);
-#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
     TEST_UNION(case_recursive_boxes_49, 1, 3, -1, 59.0);
-#else
-    TEST_UNION_IGNORE(case_recursive_boxes_49, 1, 2, -1, 59.0);
-#endif
-
     TEST_UNION(case_recursive_boxes_50, 7, 4, -1, 68.0);
-
-#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
     TEST_UNION(case_recursive_boxes_51, 2, 6, -1, 75.0);
-#else
-    TEST_UNION_IGNORE(case_recursive_boxes_51, 2, 5, -1, 75.0);
-#endif
-
     TEST_UNION(case_recursive_boxes_52, 2, 6, -1, 77.0);
     TEST_UNION(case_recursive_boxes_53, 1, 1, -1, 24.75);
-#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
     TEST_UNION(case_recursive_boxes_54, 1, 2, -1, 22.5);
-#else
-    TEST_UNION_IGNORE(case_recursive_boxes_54, 1, 1, -1, 22.5);
-#endif
-
     TEST_UNION(case_recursive_boxes_55, 3, 1, -1, 15.5);
-#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
     TEST_UNION(case_recursive_boxes_56, 5, 1, -1, 7.75);
-#else
-    TEST_UNION_IGNORE(case_recursive_boxes_56, 5, 0, -1, 7.75);
-#endif
     TEST_UNION(case_recursive_boxes_57, 3, 4, -1, 19.75);
     TEST_UNION(case_recursive_boxes_58, 6, 1, -1, 6.25);
-
-#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
-    // If there are no self-turns, an interior ring is missed
     TEST_UNION(case_recursive_boxes_59, 1, 3, -1, 21.75);
-#endif
-
     TEST_UNION(case_recursive_boxes_60, 3, 0, -1, 20.5);
     TEST_UNION(case_recursive_boxes_61, 1, 1, -1, 23.5);
     TEST_UNION(case_recursive_boxes_62, 2, 3, -1, 21.25);
@@ -403,13 +363,8 @@ void test_areal()
     TEST_UNION(case_recursive_boxes_78, 2, 5, -1, 18.0);
     TEST_UNION(case_recursive_boxes_79, 1, 2, -1, 14.75);
 
-#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
-    // This is correct: no holes generated
-    TEST_UNION(case_recursive_boxes_80, 2, 0, -1, 1.5);
-#else
-    // See comment for this testcase
-    TEST_UNION(case_recursive_boxes_80, 2, 1, -1, 1.5);
-#endif
+    // No hole should be generated (but rescaling generates one hole)
+    TEST_UNION(case_recursive_boxes_80, 2, BG_IF_RESCALED(1, 0), -1, 1.5);
 
     TEST_UNION(case_recursive_boxes_81, 5, 0, -1, 15.5);
     TEST_UNION(case_recursive_boxes_82, 2, 2, -1, 20.25);
@@ -431,14 +386,16 @@ void test_areal()
          ggl_list_20140212_sybren[0], ggl_list_20140212_sybren[1],
          2, 0, 16, 0.002471626);
 
-    test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_9081",
-        ticket_9081[0], ticket_9081[1],
-#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
-        3,
-#else
-        4,
-#endif
-        0, 31, 0.2187385);
+    {
+        // Generates either 4 or 3 output polygons
+        // With rescaling the result is invalid.
+        ut_settings settings;
+        settings.test_validity = BG_IF_RESCALED(false, true);
+        test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_9081",
+            ticket_9081[0], ticket_9081[1],
+            BG_IF_RESCALED(4, 3), 0, 31, 0.2187385,
+            settings);
+    }
 
     test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_10803",
         ticket_10803[0], ticket_10803[1],
@@ -446,12 +403,11 @@ void test_areal()
     test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_11984",
         ticket_11984[0], ticket_11984[1],
         1, 2, 134, 60071.08077);
-
     test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_12118",
         ticket_12118[0], ticket_12118[1],
-        1, 1, 27, 2221.38713);
+        1, -1, 27, 2221.38713);
 
-#if defined(BOOST_GEOMETRY_ENABLE_FAILING_TESTS) || defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+#if defined(BOOST_GEOMETRY_TEST_FAILURES) || ! defined(BOOST_GEOMETRY_USE_RESCALING)
     // No output if rescaling is done
     test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_12125",
         ticket_12125[0], ticket_12125[1],
@@ -460,18 +416,32 @@ void test_areal()
 
     TEST_UNION(ticket_12503, 42, 1, -1, 945.625);
 
-#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
-    TEST_UNION(mysql_23023665_7, 1, 1, -1, 99.19494);
-#else
-    TEST_UNION_IGNORE(mysql_23023665_7, 1, 0, -1, 99.19494);
+#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
+    // Failure with rescaling
+    TEST_UNION(issue_630_a, 1, 0, -1, 2.200326);
+#endif
+    TEST_UNION(issue_630_b, 1, 0, -1, 1.675976);
+#if ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) || defined(BOOST_GEOMETRY_TEST_FAILURES)
+    // Failure with Kramer rule
+    TEST_UNION(issue_630_c, 1, 0, -1, 1.670367);
 #endif
 
-#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
-    TEST_UNION(mysql_23023665_8, 1, 2, -1, 1400.0);
+#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
+    // With rescaling the small polygon is added on top of the outer polygon
+    TEST_UNION(issue_643, 1, 0, -1, 80.0);
+#endif
+
+#if defined(BOOST_GEOMETRY_USE_KRAMER_RULE)
+    // Two polygons, should ideally be merged
+    TEST_UNION(mail_2019_01_21_johan, 2, 0, -1, 0.00058896);
 #else
-    TEST_UNION_IGNORE(mysql_23023665_8, 1, 1, -1, 1400.0);
+    // Correct: one polygon
+    TEST_UNION(mail_2019_01_21_johan, 1, 0, -1, 0.00058896);
 #endif
 
+    TEST_UNION(mysql_23023665_7, 1, 1, -1, 99.19494);
+    TEST_UNION(mysql_23023665_8, 1, 2, -1, 1400.0);
+
     test_one<Polygon, MultiPolygon, MultiPolygon>("mysql_23023665_9",
         mysql_23023665_9[0], mysql_23023665_9[1],
         1, 9, -1, 1250.0);
@@ -508,7 +478,9 @@ void test_specific()
 
 int test_main(int, char* [])
 {
-    test_all<bg::model::d2::point_xy<double>, true, true>();
+    BoostGeometryWriteTestConfiguration();
+    test_all<bg::model::d2::point_xy<default_test_type>, true, true>();
+
 #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
     test_all<bg::model::d2::point_xy<double>, false, false>();