]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/geometry/test/algorithms/buffer/buffer_linestring.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / buffer / buffer_linestring.cpp
index 6cc99260c00173999b6c3706de2a64e87e838c9a..2e88a34830fe546f45e7da85926d70bb029df216 100644 (file)
@@ -113,6 +113,7 @@ void test_all()
 {
     typedef bg::model::linestring<P> linestring;
     typedef bg::model::polygon<P, Clockwise> polygon;
+    typedef typename bg::coordinate_type<P>::type coor_type;
 
     bg::strategy::buffer::join_miter join_miter;
     bg::strategy::buffer::join_round join_round(100);
@@ -138,23 +139,23 @@ void test_all()
     test_one<linestring, polygon>("simplex_vertical32", simplex_vertical, join_round32, end_round32, 5.12145, 1);
     test_one<linestring, polygon>("simplex_horizontal32", simplex_horizontal, join_round32, end_round32, 5.12145, 1);
 
-    test_one<linestring, polygon>("simplex_asym_neg", simplex, join_miter, end_flat, 3.202, +1.5, settings, -1.0);
-    test_one<linestring, polygon>("simplex_asym_pos", simplex, join_miter, end_flat, 3.202, -1.0, settings, +1.5);
+    test_one<linestring, polygon>("simplex_asym_neg", simplex, join_miter, end_flat, 3.2016, +1.5, settings, -1.0);
+    test_one<linestring, polygon>("simplex_asym_pos", simplex, join_miter, end_flat, 3.2016, -1.0, settings, +1.5);
     // Do not work yet:
     //    test_one<linestring, polygon>("simplex_asym_neg", simplex, join_miter, end_round, 3.202, +1.5, settings, -1.0);
     //    test_one<linestring, polygon>("simplex_asym_pos", simplex, join_miter, end_round, 3.202, -1.0, settings, +1.5);
 
     // Generates (initially) a reversed polygon, with a negative area, which is reversed afterwards in assign_parents
-    test_one<linestring, polygon>("simplex_asym_neg_rev", simplex, join_miter, end_flat, 3.202, +1.0, settings, -1.5);
-    test_one<linestring, polygon>("simplex_asym_pos_rev", simplex, join_miter, end_flat, 3.202, -1.5, settings, +1.0);
+    test_one<linestring, polygon>("simplex_asym_neg_rev", simplex, join_miter, end_flat, 3.2016, +1.0, settings, -1.5);
+    test_one<linestring, polygon>("simplex_asym_pos_rev", simplex, join_miter, end_flat, 3.2016, -1.5, settings, +1.0);
 
     test_one<linestring, polygon>("straight", straight, join_round, end_flat, 38.4187, 1.5);
     test_one<linestring, polygon>("straight", straight, join_miter, end_flat, 38.4187, 1.5);
 
     // One bend/two bends (tests join-type)
-    test_one<linestring, polygon>("one_bend", one_bend, join_round, end_flat, 28.488, 1.5);
+    test_one<linestring, polygon>("one_bend", one_bend, join_round, end_flat, 28.496, 1.5);
     test_one<linestring, polygon>("one_bend", one_bend, join_miter, end_flat, 28.696, 1.5);
-    test_one<linestring, polygon>("one_bend", one_bend, join_round_by_divide, end_flat, 28.488, 1.5);
+    test_one<linestring, polygon>("one_bend", one_bend, join_round_by_divide, end_flat, 28.497, 1.5);
 
     test_one<linestring, polygon>("one_bend", one_bend, join_round, end_round, 35.5603, 1.5);
     test_one<linestring, polygon>("one_bend", one_bend, join_miter, end_round, 35.7601, 1.5);
@@ -163,7 +164,7 @@ void test_all()
     test_one<linestring, polygon>("two_bends", two_bends, join_round, end_flat, 39.235, 1.5);
     test_one<linestring, polygon>("two_bends", two_bends, join_round_by_divide, end_flat, 39.235, 1.5);
     test_one<linestring, polygon>("two_bends", two_bends, join_miter, end_flat, 39.513, 1.5);
-    test_one<linestring, polygon>("two_bends_left", two_bends, join_round, end_flat, 20.028, 1.5, settings, 0.0);
+    test_one<linestring, polygon>("two_bends_left", two_bends, join_round, end_flat, 20.025, 1.5, settings, 0.0);
     test_one<linestring, polygon>("two_bends_left", two_bends, join_miter, end_flat, 20.225, 1.5, settings, 0.0);
     test_one<linestring, polygon>("two_bends_right", two_bends, join_round, end_flat, 19.211, 0.0, settings, 1.5);
     test_one<linestring, polygon>("two_bends_right", two_bends, join_miter, end_flat, 19.288, 0.0, settings, 1.5);
@@ -207,8 +208,8 @@ void test_all()
     test_one<linestring, polygon>("chained4", chained4, join_round, end_flat, 22.6274, 2.5, settings, 1.5);
 
     test_one<linestring, polygon>("field_sprayer1", field_sprayer1, join_round, end_flat, 324.3550, 16.5, settings, 6.5);
-    test_one<linestring, polygon>("field_sprayer1", field_sprayer1, join_round, end_round, 718.761877, 16.5, settings, 6.5);
-    test_one<linestring, polygon>("field_sprayer1", field_sprayer1, join_miter, end_round, 718.939628, 16.5, settings, 6.5);
+    test_one<linestring, polygon>("field_sprayer1", field_sprayer1, join_round, end_round, {718.686, 718.762}, 16.5, settings, 6.5);
+    test_one<linestring, polygon>("field_sprayer1", field_sprayer1, join_miter, end_round, {718.845, 718.940}, 16.5, settings, 6.5);
 
     test_one<linestring, polygon>("degenerate0", degenerate0, join_round, end_round, 0.0, 3.0);
     test_one<linestring, polygon>("degenerate1", degenerate1, join_round, end_round, 28.25, 3.0);
@@ -254,8 +255,9 @@ void test_all()
     }
 
     {
-        // Check on validity, with high precision because areas are all very small
-        ut_settings settings(1.0e-10, true);
+        ut_settings settings;
+        settings.tolerance = 0.1;
+        settings.use_ln_area = true;
 
         test_one<linestring, polygon>("aimes120", aimes120, join_miter, end_flat, 1.62669948622351512e-08, 0.000018, settings);
         test_one<linestring, polygon>("aimes120", aimes120, join_round, end_round, 1.72842078427493107e-08, 0.000018, settings);
@@ -299,9 +301,12 @@ void test_all()
             27862.733459829971,
             5.9518403867035365);
 
-    test_one<linestring, polygon>("mysql_report_2015_09_08a", mysql_report_2015_09_08a, join_round32, end_round32, 0.0, 1.0);
-    test_one<linestring, polygon>("mysql_report_2015_09_08b", mysql_report_2015_09_08b, join_round32, end_round32, 0.0, 1099511627778.0);
-    test_one<linestring, polygon>("mysql_report_2015_09_08c", mysql_report_2015_09_08c, join_round32, end_round32, 0.0, 0xbe);
+    if (BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, double>::value)))
+    {
+        test_one<linestring, polygon>("mysql_report_2015_09_08a", mysql_report_2015_09_08a, join_round32, end_round32, 0.0, 1.0);
+        test_one<linestring, polygon>("mysql_report_2015_09_08b", mysql_report_2015_09_08b, join_round32, end_round32, 0.0, 1099511627778.0);
+        test_one<linestring, polygon>("mysql_report_2015_09_08c", mysql_report_2015_09_08c, join_round32, end_round32, 0.0, 0xbe);
+    }
 
     test_one<linestring, polygon>("mysql_23023665_1", mysql_23023665, join_round32, end_flat, 459.1051, 10);
     test_one<linestring, polygon>("mysql_23023665_2", mysql_23023665, join_round32, end_flat, 6877.7097, 50);
@@ -372,6 +377,11 @@ void test_all()
 template <bool Clockwise, typename P>
 void test_invalid()
 {
+    typedef typename bg::coordinate_type<P>::type coor_type;
+    if (! BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, double>::value)))
+    {
+        return;
+    }
     typedef bg::model::linestring<P> linestring;
     typedef bg::model::polygon<P, Clockwise> polygon;
 
@@ -390,10 +400,6 @@ void test_invalid()
     test_one<linestring, polygon>("mysql_report_2015_04_10g", mysql_report_2015_04_10g, join_round32, end_round32, 86527.871, 100.0);
 }
 
-#ifdef HAVE_TTMATH
-#include <ttmath_stub.hpp>
-#endif
-
 
 int test_main(int, char* [])
 {
@@ -410,5 +416,10 @@ int test_main(int, char* [])
 #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
     test_invalid<true, bg::model::point<long double, 2, bg::cs::cartesian> >();
 #endif
+
+#if defined(BOOST_GEOMETRY_TEST_FAILURES)
+    BoostGeometryWriteExpectedFailures(2, 4, 17, 4);
+#endif
+
     return 0;
 }