From 3272220a3cc9e0dde39db39ef8034a8f9f18a4db Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 30 Sep 2020 11:05:28 +0200 Subject: [PATCH] [test][doc] Clean up numeric types in tests and adapt documentation --- .../pages/doxygen_d_robustness.hpp | 25 +-- test/algorithms/buffer/buffer.cpp | 3 - test/algorithms/buffer/buffer_linestring.cpp | 4 - .../buffer/buffer_multi_polygon.cpp | 6 +- .../algorithms/buffer/buffer_piece_border.cpp | 2 +- test/algorithms/buffer/buffer_polygon.cpp | 22 +- .../buffer/buffer_with_strategies.cpp | 4 +- test/algorithms/overlay/traverse_gmp.cpp | 208 ------------------ .../set_operations/difference/difference.cpp | 12 +- .../difference/difference_areal_linear.cpp | 4 - .../difference/difference_multi.cpp | 6 - .../difference_multi_areal_linear.cpp | 1 - .../difference/difference_multi_spike.cpp | 7 - .../intersection/intersection.cpp | 10 +- .../intersection/intersection_multi.cpp | 6 - .../algorithms/set_operations/union/union.cpp | 27 +-- .../set_operations/union/union_multi.cpp | 18 +- test/geometry_test_common.hpp | 37 +--- .../buffer/recursive_polygons_buffer.cpp | 4 - test/string_from_type.hpp | 35 --- 20 files changed, 51 insertions(+), 390 deletions(-) delete mode 100644 test/algorithms/overlay/traverse_gmp.cpp diff --git a/doc/doxy/doxygen_input/pages/doxygen_d_robustness.hpp b/doc/doxy/doxygen_input/pages/doxygen_d_robustness.hpp index 7cf9d8b2c..45d38ae39 100644 --- a/doc/doxy/doxygen_input/pages/doxygen_d_robustness.hpp +++ b/doc/doxy/doxygen_input/pages/doxygen_d_robustness.hpp @@ -57,20 +57,7 @@ a long double, not standa By default, algorithms select the coordinate type of the input geometries. If there are two input geometries, and they have different coordinate types, the coordinate type with the most precision is selected. This is done by the meta-function \b select_most_precise. -Boost.Geometry supports also high precision arithmetic types, by adaption. The numeric_adaptor, used for adaption, is not part of Boost.Geometry itself but developed by us and sent (as preview) to the Boost List (as it turned out, that functionality might also be provided by Boost.Math bindings, but the mechanism is the same). Types from the following libraries are supported: - -- GMP (http://gmplib.org) -- CLN (http://www.ginac.de/CLN) - -Note that the libraries themselves are not included in Boost.Geometry, they are completely independant of each other. - -These numeric types can be used as following: -\code -boost::geometry::point_xy p4; -boost::geometry::point_xy p5; -\endcode - -All algorithms using these points will use the \b GMP resp. \b CLN library for calculations. +Boost.Geometry supports also high precision arithmetic types, by adaption. For example from Boost.Multiprecision. \section robustness_par4 Calculation types @@ -81,21 +68,21 @@ Example: \code { - typedef boost::geometry::point_xy point_type; - boost::geometry::linear_ring ring; + using point_type = bg::model::point ; + boost::geometry::model::ring ring; ring.push_back(boost::geometry::make(0.0, 0.0)); ring.push_back(boost::geometry::make(0.0, 0.0012)); ring.push_back(boost::geometry::make(1234567.89012345, 0.0)); ring.push_back(ring.front()); - typedef boost::numeric_adaptor::gmp_value_type gmp; + using mp = boost::multiprecision::cpp_bin_float_100; - gmp area = boost::geometry::area(ring, boost::geometry::strategy::area::by_triangles()); + auto area = boost::geometry::area(ring, boost::geometry::strategies::area::cartesian()); std::cout << area << std::endl; } \endcode -Above shows how this is used to use \b GMP or \b CLN for double coordinates. Exactly the same mechanism works (of course) also to do calculation in double, where coordinates are stored in float. +Above shows how this is used to use Boost.Multiprecision with double coordinates. Exactly the same mechanism works (of course) also to do calculation in double, where coordinates are stored in float. \section robustness_par5 Strategies diff --git a/test/algorithms/buffer/buffer.cpp b/test/algorithms/buffer/buffer.cpp index 04e1055e0..1122ddf06 100644 --- a/test/algorithms/buffer/buffer.cpp +++ b/test/algorithms/buffer/buffer.cpp @@ -66,8 +66,5 @@ int test_main(int, char* []) test_all >(); #endif -#ifdef HAVE_TTMATH - test_all >(); -#endif return 0; } diff --git a/test/algorithms/buffer/buffer_linestring.cpp b/test/algorithms/buffer/buffer_linestring.cpp index 4309bcf0e..12bff4144 100644 --- a/test/algorithms/buffer/buffer_linestring.cpp +++ b/test/algorithms/buffer/buffer_linestring.cpp @@ -390,10 +390,6 @@ void test_invalid() test_one("mysql_report_2015_04_10g", mysql_report_2015_04_10g, join_round32, end_round32, 86527.871, 100.0); } -#ifdef HAVE_TTMATH -#include -#endif - int test_main(int, char* []) { diff --git a/test/algorithms/buffer/buffer_multi_polygon.cpp b/test/algorithms/buffer/buffer_multi_polygon.cpp index 8750960cb..b4e77f25b 100644 --- a/test/algorithms/buffer/buffer_multi_polygon.cpp +++ b/test/algorithms/buffer/buffer_multi_polygon.cpp @@ -534,7 +534,11 @@ int test_main(int, char* []) #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_ORDER) test_all >(); #endif - + +#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) + test_all >(); +#endif + #if defined(BOOST_GEOMETRY_TEST_FAILURES) BoostGeometryWriteExpectedFailures(1, 1); #endif diff --git a/test/algorithms/buffer/buffer_piece_border.cpp b/test/algorithms/buffer/buffer_piece_border.cpp index 362085ebd..fd0e8f72d 100644 --- a/test/algorithms/buffer/buffer_piece_border.cpp +++ b/test/algorithms/buffer/buffer_piece_border.cpp @@ -137,7 +137,7 @@ void test_rectangle_properties() "piece should not be empty"); // Check border-properties functionality (envelope, radius) - double const area = bg::area(border.m_envelope); + auto const area = bg::area(border.m_envelope); BOOST_CHECK_MESSAGE(area > 1.0 && area < 1.01, "detected: " << area); diff --git a/test/algorithms/buffer/buffer_polygon.cpp b/test/algorithms/buffer/buffer_polygon.cpp index 24f272ff2..a80a43a14 100644 --- a/test/algorithms/buffer/buffer_polygon.cpp +++ b/test/algorithms/buffer/buffer_polygon.cpp @@ -212,12 +212,11 @@ public : OutputRange& output_range) { // Generate a block along (left or right of) the segment - - double const dx = bg::get<0>(input_p2) - bg::get<0>(input_p1); - double const dy = bg::get<1>(input_p2) - bg::get<1>(input_p1); + auto const dx = bg::get<0>(input_p2) - bg::get<0>(input_p1); + auto const dy = bg::get<1>(input_p2) - bg::get<1>(input_p1); // For normalization [0,1] (=dot product d.d, sqrt) - double const length = bg::math::sqrt(dx * dx + dy * dy); + auto const length = bg::math::sqrt(dx * dx + dy * dy); if (bg::math::equals(length, 0)) { @@ -225,9 +224,9 @@ public : } // Generate the perpendicular p, to the left (ccw), and use an adapted distance - double const d = 1.1 * distance.apply(input_p1, input_p2, side); - double const px = d * -dy / length; - double const py = d * dx / length; + auto const d = 1.1 * distance.apply(input_p1, input_p2, side); + auto const px = d * -dy / length; + auto const py = d * dx / length; output_range.resize(2); @@ -835,10 +834,6 @@ void test_mixed() simplex, join_round, end_flat, 47.4831, 1.5); } -#ifdef HAVE_TTMATH -#include -#endif - int test_main(int, char* []) { BoostGeometryWriteTestConfiguration(); @@ -867,11 +862,6 @@ int test_main(int, char* []) test_mixed(); test_mixed(); test_mixed(); - -#ifdef HAVE_TTMATH - test_all >(); -#endif - #endif #if defined(BOOST_GEOMETRY_TEST_FAILURES) diff --git a/test/algorithms/buffer/buffer_with_strategies.cpp b/test/algorithms/buffer/buffer_with_strategies.cpp index 2fd10dad1..31130dd4b 100644 --- a/test/algorithms/buffer/buffer_with_strategies.cpp +++ b/test/algorithms/buffer/buffer_with_strategies.cpp @@ -74,8 +74,8 @@ void test_with_strategies(std::string const& caseid, << " detected: " << bg::num_points(result) ); - double const area = bg::area(result); - double const difference = area - expected_area; + auto const area = bg::area(result); + auto const difference = area - expected_area; BOOST_CHECK_MESSAGE ( diff --git a/test/algorithms/overlay/traverse_gmp.cpp b/test/algorithms/overlay/traverse_gmp.cpp deleted file mode 100644 index 335e8ce34..000000000 --- a/test/algorithms/overlay/traverse_gmp.cpp +++ /dev/null @@ -1,208 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// Unit Test - -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. - -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, 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) - -#error This unit test is not updated for several years - - -#if defined(_MSC_VER) -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4267 ) -#endif - -//#define GEOMETRY_DEBUG_INTERSECTION - - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - - -#include - -#if defined(TEST_WITH_SVG) -# include -#endif - - - -template -void test_traverse(std::string const& caseid, G1 const& g1, G2 const& g2) -{ - typedef bg::detail::intersection::intersection_point - ::type> ip; - typedef typename boost::range_const_iterator >::type iterator; - typedef std::vector ip_vector; - ip_vector ips; - - typedef typename bg::strategy::side::services::default_strategy - < - typename bg::cs_tag::type - >::type strategy_type; - - - typedef bg::detail::overlay::traversal_turn_info - < - typename bg::point_type::type - > turn_info; - typedef typename boost::range_iterator >::type iterator; - std::vector ips; - - bg::get_turns(g1, g2, ips); - bg::enrich_intersection_points(ips, g1, g2, strategy_type()); - - typedef bg::model::ring::type> ring_type; - typedef std::vector out_vector; - out_vector v; - - - - bg::traverse - < - strategy_type, - ring_type - > - ( - g1, g2, -1, ips, std::back_inserter(v) - ); - - - -#if defined(TEST_WITH_SVG) - { - std::ostringstream filename; - filename << "intersection_" << caseid << ".svg"; - - std::ofstream svg(filename.str().c_str()); - - // Trick to have this always LongDouble - //typedef bg::model::d2::point_xy P; - typedef typename bg::point_type::type P; - //typename bg::replace_point_type::type rg1; - //typename bg::replace_point_type::type rg2; - - bg::svg_mapper

mapper(svg, 1000, 800); - - mapper.add(g1); - mapper.add(g2); - - // Input shapes in green/blue - mapper.map(g1, "opacity:0.8;fill:rgb(0,255,0);" - "stroke:rgb(0,0,0);stroke-width:1"); - mapper.map(g2, "opacity:0.8;fill:rgb(0,0,255);" - "stroke:rgb(0,0,0);stroke-width:1"); - - // Traversal rings in red - for (typename out_vector::const_iterator it = boost::begin(v); - it != boost::end(v); - ++it) - { - mapper.map(*it, "fill-opacity:0.1;stroke-opacity:0.9;" - "fill:rgb(255,0,0);stroke:rgb(255,0,0);stroke-width:5"); - - std::cout << bg::wkt(*it) << std::endl; - std::cout << bg::area(*it) << std::endl; - } - - // IP's in orange - for (iterator it = boost::begin(ips); it != boost::end(ips); ++it) - { - mapper.map(it->point, "fill:rgb(255,128,0);" - "stroke:rgb(0,0,100);stroke-width:1"); - } - } -#endif -} - -template -void test_one(std::string const& caseid, std::string const& wkt1, std::string const& wkt2) -{ - G1 g1; - bg::read_wkt(wkt1, g1); - - G2 g2; - bg::read_wkt(wkt2, g2); - - bg::correct(g1); - bg::correct(g2); - std::cout << "area1 " << bg::area(g1) << " " << " area2: " << bg::area(g2) << std::endl; - - test_traverse(caseid, g1, g2); -} - - -#if ! defined(GEOMETRY_TEST_MULTI) - -template -void test_traverse_gmp(std::string const& caseid) -{ - typedef bg::model::polygon

polygon; - std::cout << typeid(typename bg::coordinate_type

::type).name() << std::endl; - std::cout << std::setprecision(30) << std::numeric_limits::epsilon() << std::endl; - std::cout << std::setprecision(30) << std::numeric_limits::epsilon() << std::endl; - std::cout << std::setprecision(30) << std::numeric_limits::epsilon() << std::endl; - - static std::string brandon[3] = - { - //37.43402099609375 1.470055103302002, - "POLYGON((37.29449462890625 1.7902572154998779,37.000419616699219 1.664225697517395,37.140213012695313 1.3446992635726929,50.974888957147442 -30.277285722290763,57.297810222148939 -37.546793343968417,41.590042114257813 -7.2021245956420898,40.6978759765625 -5.4500408172607422,40.758884429931641 -5.418975830078125,42.577911376953125 -4.4901103973388672,42.577877044677734 -4.4900407791137695,42.699958801269531 -4.4278755187988281,46.523914387974358 -8.5152102535033496,47.585065917176543 -6.1314922196594779,45.389434814453125 -4.5143837928771973,46.296027072709599 -2.4984308554828116,37.29449462890625 1.7902572154998779))", - "POLYGON((42.399410247802734 1.4956772327423096,42.721500396728516 2.2342472076416016,42.721500396728516 3.6584999561309814,51.20102152843122 7.1738039562841562,51.370888500897557 7.4163459734570729,37.43402099609375 1.470055103302002,37.29449462890625 1.7902572154998779,37.000419616699219 1.664225697517395,37.140213012695313 1.3446992635726929,36.954700469970703 1.2597870826721191,26.472516656201325 -3.5380830513658776,27.069889344709196 -4.2926591211028242,30.501169204711914 -2.3718316555023193,32.708126068115234 -2.3611266613006592,32.708126068115234 -2.3611700534820557,32.708168029785156 -2.3611698150634766,32.718830108642578 -4.3281683921813965,29.135100397190627 -8.9262827849488211,29.619997024536133 -9.5368013381958008,30.339155197143555 -8.9838371276855469,30.670633316040039 -8.8180980682373047,30.896280288696289 -9.1206979751586914,30.207040612748258 -10.275926149505661,30.947774887084961 -11.208560943603516,31.669155120849609 -10.653837203979492,32.000633239746094 -10.488097190856934,32.226280212402344 -10.790698051452637,31.682494778186321 -12.133624901803865,32.274600982666016 -12.879127502441406,32.998821258544922 -12.323249816894531,33.339523315429688 -12.147735595703125,33.566280364990234 -12.450697898864746,33.164891643669634 -14.000060288415174,33.598796844482422 -14.546377182006836,34.328716278076172 -13.992490768432617,34.658355712890625 -13.81736946105957,34.886280059814453 -14.120697975158691,34.634240447128811 -15.85007183479255,34.931102752685547 -16.223842620849609,35.656356811523438 -15.66030216217041,35.963497161865234 -15.476018905639648,37.326129913330078 -17.190576553344727,38.823680877685547 -16.296066284179688,39.966808319091797 -17.625011444091797,40.800632476806641 -17.208097457885742,41.821544647216797 -19.211688995361328,41.988733475572282 -19.945838749437218,57.524304765518266 -37.807195733984784,41.590042114257813 -7.2021245956420898,40.6978759765625 -5.4500408172607422,40.758884429931641 -5.418975830078125,42.577911376953125 -4.4901103973388672,42.577877044677734 -4.4900407791137695,42.699958801269531 -4.4278755187988281,46.559533858616469 -8.435196445683264,47.604561877161387 -6.087697464505224,45.389434814453125 -4.5143837928771973,46.695858001708984 -1.6093428134918213,47.263670054709685 -1.784876824891044,47.830955505371094 -0.69758313894271851,48.43512638981781 -0.81299959072453376,49.071769542946825 0.61489892713413252,43.764598846435547 0.93951499462127686,43.644271850585938 0.96149998903274536,42.399410247802734 1.4956772327423096))", - "POLYGON((43.644271850585938 0.96149998903274536,43.764598846435547 0.93951499462127686,49.071769542946825 0.61489892713413252,48.43512638981781 -0.81299959072453376,47.830955505371094 -0.69758313894271851,47.263670054709685 -1.784876824891044,46.695858001708984 -1.6093428134918213,45.389434814453125 -4.5143837928771973,47.604561877161387 -6.087697464505224,46.559533858616469 -8.435196445683264,42.699958801269531 -4.4278755187988281,42.577877044677734 -4.4900407791137695,42.577911376953125 -4.4901103973388672,40.758884429931641 -5.418975830078125,40.6978759765625 -5.4500408172607422,41.590042114257813 -7.2021245956420898,57.524304765518266 -37.807195733984784,41.988733475572282 -19.945838749437218,41.821544647216797 -19.211688995361328,40.800632476806641 -17.208097457885742,39.966808319091797 -17.625011444091797,38.823680877685547 -16.296066284179688,37.326129913330078 -17.190576553344727,35.963497161865234 -15.476018905639648,35.656356811523438 -15.66030216217041,34.931102752685547 -16.223842620849609,34.634240447128811 -15.85007183479255,34.886280059814453 -14.120697975158691,34.658355712890625 -13.81736946105957,34.328716278076172 -13.992490768432617,33.598796844482422 -14.546377182006836,33.164891643669634 -14.000060288415174,33.566280364990234 -12.450697898864746,33.339523315429688 -12.147735595703125,32.998821258544922 -12.323249816894531,32.274600982666016 -12.879127502441406,31.682494778186321 -12.133624901803865,32.226280212402344 -10.790698051452637,32.000633239746094 -10.488097190856934,31.669155120849609 -10.653837203979492,30.947774887084961 -11.208560943603516,30.207040612748258 -10.275926149505661,30.896280288696289 -9.1206979751586914,30.670633316040039 -8.8180980682373047,30.339155197143555 -8.9838371276855469,29.619997024536133 -9.5368013381958008,29.135100397190627 -8.9262827849488211,32.718830108642578 -4.3281683921813965,32.708168029785156 -2.3611698150634766,32.708126068115234 -2.3611700534820557,32.708126068115234 -2.3611266613006592,30.501169204711914 -2.3718316555023193,27.069889344709196 -4.2926591211028242,26.472516656201325 -3.5380830513658776,36.954700469970703 1.2597870826721191,37.140213012695313 1.3446992635726929,37.000419616699219 1.664225697517395,37.29449462890625 1.7902572154998779,37.43402099609375 1.470055103302002,51.370888500897557 7.4163459734570729,51.20102152843122 7.1738039562841562,42.721500396728516 3.6584999561309814,42.721500396728516 2.2342472076416016,42.399410247802734 1.4956772327423096,43.644271850585938 0.96149998903274536))" - }; - - - // Test the FORWARD case - test_one(caseid, brandon[0], brandon[1]); -} -#endif - - - -int main(int argc, char** argv) -{ - int mode = (argc > 1) ? atol(argv[1]) : 1; - switch(mode) - { - case 1 : - test_traverse_gmp >("float"); - break; - case 2 : - test_traverse_gmp >("double"); - break; - case 3 : - test_traverse_gmp >("long double"); - break; - case 4 : - #if defined(HAVE_TTMATH) - test_traverse_gmp >("ttmath_big"); - #endif - break; - } - return 0; -} diff --git a/test/algorithms/set_operations/difference/difference.cpp b/test/algorithms/set_operations/difference/difference.cpp index 854e8a044..a56bcce3d 100644 --- a/test/algorithms/set_operations/difference/difference.cpp +++ b/test/algorithms/set_operations/difference/difference.cpp @@ -30,11 +30,6 @@ #include -#ifdef HAVE_TTMATH -# include -#endif - - // Convenience macros (points are not checked) #define TEST_DIFFERENCE(caseid, clips1, area1, clips2, area2, clips3) \ (test_one) \ @@ -428,7 +423,7 @@ void test_all() test_one("ggl_list_20110627_phillip", ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1], BG_IF_RESCALED(1, 0), -1, - BG_IF_RESCALED(if_typed_tt(0.0000000000001105367, 0.000125137888971949), 0), + BG_IF_RESCALED(0.000125137888971949, 0), 1, -1, 3577.40960816756, tolerance(0.01) ); @@ -640,11 +635,6 @@ int test_main(int, char* []) #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) test_all >(); - -#ifdef HAVE_TTMATH - std::cout << "Testing TTMATH" << std::endl; - test_all >(); -#endif #endif #if defined(BOOST_GEOMETRY_TEST_FAILURES) diff --git a/test/algorithms/set_operations/difference/difference_areal_linear.cpp b/test/algorithms/set_operations/difference/difference_areal_linear.cpp index a44193e6e..80e535130 100644 --- a/test/algorithms/set_operations/difference/difference_areal_linear.cpp +++ b/test/algorithms/set_operations/difference/difference_areal_linear.cpp @@ -31,10 +31,6 @@ #include -#ifdef HAVE_TTMATH -# include -#endif - template void test_ticket_10835(std::string const& wkt_out1, std::string const& wkt_out2) { diff --git a/test/algorithms/set_operations/difference/difference_multi.cpp b/test/algorithms/set_operations/difference/difference_multi.cpp index 2e53e920c..a6ffc647d 100644 --- a/test/algorithms/set_operations/difference/difference_multi.cpp +++ b/test/algorithms/set_operations/difference/difference_multi.cpp @@ -520,12 +520,6 @@ int test_main(int, char* []) #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) test_all >(); - -#if defined(HAVE_TTMATH) - std::cout << "Testing TTMATH" << std::endl; - test_all >(); -#endif - #endif #if defined(BOOST_GEOMETRY_TEST_FAILURES) diff --git a/test/algorithms/set_operations/difference/difference_multi_areal_linear.cpp b/test/algorithms/set_operations/difference/difference_multi_areal_linear.cpp index 2a15e555c..aa2903728 100644 --- a/test/algorithms/set_operations/difference/difference_multi_areal_linear.cpp +++ b/test/algorithms/set_operations/difference/difference_multi_areal_linear.cpp @@ -10,7 +10,6 @@ #include #include -//#define HAVE_TTMATH //#define BOOST_GEOMETRY_DEBUG_ASSEMBLE //#define BOOST_GEOMETRY_CHECK_WITH_SQLSERVER diff --git a/test/algorithms/set_operations/difference/difference_multi_spike.cpp b/test/algorithms/set_operations/difference/difference_multi_spike.cpp index 60b27ed00..a6b2fea1b 100644 --- a/test/algorithms/set_operations/difference/difference_multi_spike.cpp +++ b/test/algorithms/set_operations/difference/difference_multi_spike.cpp @@ -109,13 +109,6 @@ int test_main(int, char* []) test_spikes_in_ticket_8364, false, false>(); test_spikes_in_ticket_8365, true, true >(); test_spikes_in_ticket_8365, false, false >(); - -#ifdef HAVE_TTMATH - std::cout << "Testing TTMATH" << std::endl; - test_spikes_in_ticket_8364, true, true>(); - test_spikes_in_ticket_8365, true, true>(); -#endif - return 0; } diff --git a/test/algorithms/set_operations/intersection/intersection.cpp b/test/algorithms/set_operations/intersection/intersection.cpp index d232a6101..ec5e985e0 100644 --- a/test/algorithms/set_operations/intersection/intersection.cpp +++ b/test/algorithms/set_operations/intersection/intersection.cpp @@ -177,7 +177,7 @@ void test_areal() 1, 4, 163292.679042133, ut_settings(0.1)); { - ut_settings settings(if_typed_tt(0.01, 0.1)); + ut_settings settings(0.1); settings.set_test_validity(BG_IF_RESCALED(true, false)); // SQL Server gives: 88.1920416352664 @@ -234,7 +234,7 @@ void test_areal() test_one("ggl_list_20110627_phillip", ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1], - 1, if_typed_tt(6, 5), 11151.6618); + 1, 5, 11151.6618); test_one("ggl_list_20110716_enrico", ggl_list_20110716_enrico[0], ggl_list_20110716_enrico[1], @@ -935,12 +935,6 @@ int test_main(int, char* []) #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) test_all >(); -#if defined(HAVE_TTMATH) - std::cout << "Testing TTMATH" << std::endl; - test_all >(); -#endif - - // Commented, because exception is now disabled: // test_exception >(); diff --git a/test/algorithms/set_operations/intersection/intersection_multi.cpp b/test/algorithms/set_operations/intersection/intersection_multi.cpp index a661db774..4cacabd5c 100644 --- a/test/algorithms/set_operations/intersection/intersection_multi.cpp +++ b/test/algorithms/set_operations/intersection/intersection_multi.cpp @@ -503,12 +503,6 @@ int test_main(int, char* []) #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) test_all >(); - -#if defined(HAVE_TTMATH) - std::cout << "Testing TTMATH" << std::endl; - test_all >(); -#endif - #endif #if defined(BOOST_GEOMETRY_TEST_FAILURES) diff --git a/test/algorithms/set_operations/union/union.cpp b/test/algorithms/set_operations/union/union.cpp index edf799d80..cdec14a9b 100644 --- a/test/algorithms/set_operations/union/union.cpp +++ b/test/algorithms/set_operations/union/union.cpp @@ -64,7 +64,7 @@ void test_areal() // This sample was selected because of the border case, and ttmath generates one point more. test_one("star_poly", example_star, example_polygon, 1, 1, - if_typed_tt(28, 27), 5.647949); + 27, 5.647949); // Pseudo-box as Polygon // (note, internally, the intersection points is different, so yes, @@ -160,7 +160,7 @@ void test_areal() test_one("distance_zero", distance_zero[0], distance_zero[1], - 1, 0, 8, 9.0098387); + 1, 0, -1, 9.0098387); test_one("wrapped_a", wrapped[0], wrapped[1], @@ -370,7 +370,7 @@ void test_areal() ggl_list_20110820_christophe[0], ggl_list_20110820_christophe[1], -1, // Either 1 or 2, depending if the intersection/turn point (eps.region) is missed 0, - if_typed_tt(9, 8), + 8, 67.3550722317627); #endif @@ -508,14 +508,14 @@ void test_areal() 1, 0, -1, 19.3995); test_one("buffer_rt_m1", buffer_rt_m1[0], buffer_rt_m1[1], - 1, 0, 9, 19.4852); + 1, 0, -1, 19.4852); test_one("buffer_rt_m1_rev", buffer_rt_m1[1], buffer_rt_m1[0], - 1, 0, 9, 19.4852); + 1, 0, -1, 19.4852); test_one("buffer_rt_m2", buffer_rt_m2[0], buffer_rt_m2[1], 1, 0, -1, 21.4853); test_one("buffer_rt_m2_rev", buffer_rt_m2[1], buffer_rt_m2[0], - 1, 0, 15, 21.4853); + 1, 0, -1, 21.4853); test_one("buffer_rt_q", buffer_rt_q[0], buffer_rt_q[1], 1, 0, -1, 18.5710); @@ -531,7 +531,7 @@ void test_areal() 1, 0, -1, 15.6569); test_one("buffer_mp1", buffer_mp1[0], buffer_mp1[1], - 1, 0, if_typed_tt(93, 91), 22.815); + 1, 0, 91, 22.815); test_one("buffer_mp2", buffer_mp2[0], buffer_mp2[1], 1, -1, 217, 36.752837); @@ -618,17 +618,12 @@ void test_all() int test_main(int, char* []) { BoostGeometryWriteTestConfiguration(); - test_all >(); + test_all>(); #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) - - test_all >(); - test_all >(); - -#if defined(HAVE_TTMATH) - std::cout << "Testing TTMATH" << std::endl; - test_all >(); -#endif + test_all>(); + test_all>(); + test_all>(); #endif #if defined(BOOST_GEOMETRY_TEST_FAILURES) diff --git a/test/algorithms/set_operations/union/union_multi.cpp b/test/algorithms/set_operations/union/union_multi.cpp index 0cf81ee39..0051f6b05 100644 --- a/test/algorithms/set_operations/union/union_multi.cpp +++ b/test/algorithms/set_operations/union/union_multi.cpp @@ -43,6 +43,8 @@ template void test_areal() { + using ct = typename bg::coordinate_type::type; + test_one("simplex_multi", case_multi_simplex[0], case_multi_simplex[1], 1, 0, 20, 14.58); @@ -364,7 +366,7 @@ void test_areal() TEST_UNION(case_recursive_boxes_79, 1, 2, -1, 14.75); // 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_80, 2, BG_IF_RESCALED(bg_if_mp(0, 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); @@ -384,7 +386,7 @@ void test_areal() test_one("ggl_list_20140212_sybren", ggl_list_20140212_sybren[0], ggl_list_20140212_sybren[1], - 2, 0, 16, 0.002471626); + 2, bg_if_mp(1, 0), -1, 0.002471626); { // Generates either 4 or 3 output polygons @@ -393,7 +395,7 @@ void test_areal() settings.set_test_validity(BG_IF_RESCALED(false, true)); test_one("ticket_9081", ticket_9081[0], ticket_9081[1], - BG_IF_RESCALED(4, 3), 0, 31, 0.2187385, + BG_IF_RESCALED(bg_if_mp(3, 4), 3), 0, -1, 0.2187385, settings); } @@ -480,16 +482,10 @@ int test_main(int, char* []) #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) test_all, false, false>(); + test_all, true, true>(); + test_all, true, true>(); test_specific, false, false>(); - - test_all, true, true>(); - -#if defined(HAVE_TTMATH) - std::cout << "Testing TTMATH" << std::endl; - test_all >(); -#endif - #endif #if defined(BOOST_GEOMETRY_TEST_FAILURES) diff --git a/test/geometry_test_common.hpp b/test/geometry_test_common.hpp index deef3b90f..5f88e9635 100644 --- a/test/geometry_test_common.hpp +++ b/test/geometry_test_common.hpp @@ -80,22 +80,8 @@ #endif - -#if defined(HAVE_TTMATH) -# include -#endif - -#if defined(HAVE_CLN) || defined(HAVE_GMP) -# include -#endif - - -#if defined(HAVE_GMP) -# include -#endif -#if defined(HAVE_CLN) -# include -#endif +// For testing high precision numbers +#include // For all tests: // - do NOT use "using namespace boost::geometry" to make clear what is Boost.Geometry @@ -108,17 +94,6 @@ namespace bg = boost::geometry; -template -inline T1 if_typed_tt(T1 value_tt, T2 value) -{ -#if defined(HAVE_TTMATH) - return boost::is_same::type::value ? value_tt : value; -#else - boost::ignore_unused(value_tt); - return value; -#endif -} - template inline T if_typed(T value_typed, T value) { @@ -188,8 +163,16 @@ private : }; +typedef boost::multiprecision::cpp_bin_float_100 mp_test_type; typedef double default_test_type; +template +inline T1 const& bg_if_mp(T1 const& value_mp, T2 const& value) +{ + return boost::is_same::type::value ? value_mp : value; +} + + #if defined(BOOST_GEOMETRY_USE_RESCALING) #define BG_IF_RESCALED(a, b) a #else diff --git a/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp b/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp index 420afb2a9..391dfe2ec 100644 --- a/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp +++ b/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp @@ -353,10 +353,6 @@ int main(int argc, char** argv) { test_all(seed, count, level, settings); } - -#if defined(HAVE_TTMATH) - // test_all(seed, count, max, svg, level); -#endif } catch(std::exception const& e) { diff --git a/test/string_from_type.hpp b/test/string_from_type.hpp index 4c3da5f8d..8d2bd6db8 100644 --- a/test/string_from_type.hpp +++ b/test/string_from_type.hpp @@ -23,24 +23,6 @@ #include -#if defined(HAVE_TTMATH) -# include -#endif - -#if defined(HAVE_CLN) || defined(HAVE_GMP) -# include -#endif - - -#if defined(HAVE_GMP) -# include -#endif -#if defined(HAVE_CLN) -# include -#endif - - - template struct string_from_type {}; @@ -80,26 +62,9 @@ template <> struct string_from_type { static std::string name() { return "n"; } }; #endif -#if defined(HAVE_TTMATH) - template <> struct string_from_type - { static std::string name() { return "t"; } }; -#endif - #if defined(BOOST_RATIONAL_HPP) template struct string_from_type > { static std::string name() { return "r"; } }; #endif - -#if defined(HAVE_GMP) -template <> struct string_from_type -{ static std::string name() { return "g"; } }; -#endif - -#if defined(HAVE_CLN) -template <> struct string_from_type -{ static std::string name() { return "c"; } }; -#endif - - #endif // GEOMETRY_TEST_STRING_FROM_TYPE_HPP