]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/geometry/test/robustness/overlay/areal_areal/intersection_pies.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / geometry / test / robustness / overlay / areal_areal / intersection_pies.cpp
index dce301c12cb495ac91b966923403618c6c51b366..2312d4cb29c528134a4a51860879397b2e611dc9 100644 (file)
@@ -1,24 +1,24 @@
 // Boost.Geometry (aka GGL, Generic Geometry Library)
-// Unit Test
+// Robustness Test
 
-// Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2009-2020 Barend Gehrels, Amsterdam, the Netherlands.
 
 // Use, modification and distribution is subject to the Boost Software License,
 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-
-#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
 #define BOOST_GEOMETRY_NO_BOOST_TEST
 
 #include <test_overlay_p_q.hpp>
 
+#include <sstream>
+#include <chrono>
+
 #include <boost/program_options.hpp>
-#include <boost/timer.hpp>
 
-template <typename Polygon>
+template <typename Polygon, typename T>
 inline void make_pie(Polygon& polygon,
-    int count, int offset, int offset_y, double factor1, int total_segment_count = 36)
+    int count, int offset, int offset_y, T factor1, int total_segment_count = 36)
 {
     typedef typename bg::point_type<Polygon>::type p;
     typedef typename bg::select_most_precise
@@ -133,7 +133,7 @@ template <typename T, bool Clockwise, bool Closed>
 void test_pie(int total_segment_count, T factor_p, T factor_q,
             bool multi, bool single_selftangent, p_q_settings const& settings)
 {
-    boost::timer t;
+    auto const t0 = std::chrono::high_resolution_clock::now();
     typedef bg::model::d2::point_xy<T> point_type;
     typedef bg::model::polygon<point_type, Clockwise, Closed> polygon;
     typedef bg::model::multi_polygon<polygon> multi_polygon;
@@ -223,8 +223,10 @@ void test_pie(int total_segment_count, T factor_p, T factor_q,
             }
         }
     }
+    auto const t = std::chrono::high_resolution_clock::now();
+    auto const elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(t - t0).count();
     std::cout
-        << "Time: " << t.elapsed()  << std::endl
+        << " time: " << elapsed_ms / 1000.0 << std::endl
         << "Good: " << good_count << std::endl
         << "Bad: " << bad_count << std::endl;
 }
@@ -238,6 +240,7 @@ void test_all(bool multi, bool single_selftangent, p_q_settings const& settings)
 
 int main(int argc, char** argv)
 {
+    BoostGeometryWriteTestConfiguration();
     try
     {
         namespace po = boost::program_options;
@@ -272,21 +275,20 @@ int main(int argc, char** argv)
         // template par's are: CoordinateType, Clockwise, Closed
         if (ccw && open)
         {
-            test_all<double, false, false>(multi, single_selftangent, settings);
+            test_all<default_test_type, false, false>(multi, single_selftangent, settings);
         }
         else if (ccw)
         {
-            test_all<double, false, true>(multi, single_selftangent, settings);
+            test_all<default_test_type, false, true>(multi, single_selftangent, settings);
         }
         else if (open)
         {
-            test_all<double, true, false>(multi, single_selftangent, settings);
+            test_all<default_test_type, true, false>(multi, single_selftangent, settings);
         }
         else
         {
-            test_all<double, true, true>(multi, single_selftangent, settings);
+            test_all<default_test_type, true, true>(multi, single_selftangent, settings);
         }
-        //test_all<long double>();
     }
     catch(std::exception const& e)
     {