mirror of
https://github.com/boostorg/geometry.git
synced 2026-01-27 19:02:12 +00:00
[buffer][test] test tests with many points only in release mode
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2012-2015 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
|
||||
@@ -73,44 +73,76 @@ void test_all()
|
||||
distance_strategy(0.54), side_strategy, point_strategy, 99);
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
test_with_custom_strategies<multi_point_type, polygon>("mysql_report_2015_02_25_1_800",
|
||||
mysql_report_2015_02_25_1, join_miter, end_flat,
|
||||
distance_strategy(6051788), side_strategy,
|
||||
bg::strategy::buffer::point_circle(800), 115057490003226.125, 1.0);
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_many_points_per_circle()
|
||||
{
|
||||
// Tests for large distances / many points in circles.
|
||||
// Before Boost 1.58, this would (seem to) hang. It is solved by using monotonic sections in get_turns for buffer
|
||||
// This is more time consuming, only calculate this for counter clockwise
|
||||
if (! BOOST_GEOMETRY_CONDITION(Clockwise))
|
||||
{
|
||||
// Reported by MySQL 2015-02-25
|
||||
// SELECT ST_ASTEXT(ST_BUFFER(ST_GEOMFROMTEXT(''), 6051788, ST_BUFFER_STRATEGY('point_circle', 83585)));
|
||||
// SELECT ST_ASTEXT(ST_BUFFER(ST_GEOMFROMTEXT(''), 5666962, ST_BUFFER_STRATEGY('point_circle', 46641))) ;
|
||||
// Reported by MySQL 2015-02-25
|
||||
// SELECT ST_ASTEXT(ST_BUFFER(ST_GEOMFROMTEXT(''), 6051788, ST_BUFFER_STRATEGY('point_circle', 83585)));
|
||||
// SELECT ST_ASTEXT(ST_BUFFER(ST_GEOMFROMTEXT(''), 5666962, ST_BUFFER_STRATEGY('point_circle', 46641))) ;
|
||||
|
||||
using bg::strategy::buffer::point_circle;
|
||||
test_with_custom_strategies<multi_point_type, polygon>("mysql_report_2015_02_25_1_800",
|
||||
mysql_report_2015_02_25_1, join_miter, end_flat,
|
||||
distance_strategy(6051788), side_strategy, point_circle(800), 115057490003226.125, 1.0);
|
||||
typedef bg::model::polygon<P, false> polygon;
|
||||
typedef bg::model::multi_point<P> multi_point_type;
|
||||
|
||||
test_with_custom_strategies<multi_point_type, polygon>("mysql_report_2015_02_25_1_8000",
|
||||
mysql_report_2015_02_25_1, join_miter, end_flat,
|
||||
distance_strategy(6051788), side_strategy, point_circle(8000), 115058661065242.812, 1.0);
|
||||
bg::strategy::buffer::join_miter join_miter;
|
||||
bg::strategy::buffer::end_flat end_flat;
|
||||
typedef bg::strategy::buffer::distance_symmetric
|
||||
<
|
||||
typename bg::coordinate_type<P>::type
|
||||
> distance_strategy;
|
||||
bg::strategy::buffer::side_straight side_strategy;
|
||||
|
||||
test_with_custom_strategies<multi_point_type, polygon>("mysql_report_2015_02_25_1",
|
||||
mysql_report_2015_02_25_1, join_miter, end_flat,
|
||||
distance_strategy(6051788), side_strategy, point_circle(83585), 115058672785611.219, 1.0);
|
||||
using bg::strategy::buffer::point_circle;
|
||||
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
|
||||
// Try to specify even more points per circle
|
||||
// Turns are calculated in 23 seconds
|
||||
// But the follow-up still takes too long (there are 63409 turns), this might be improved too
|
||||
test_with_custom_strategies<multi_point_type, polygon>("mysql_report_2015_02_25_1",
|
||||
mysql_report_2015_02_25_1, join_miter, end_flat,
|
||||
distance_strategy(6051788), side_strategy, point_circle(800000), 115058672799999.999, 1.0); // area to be determined
|
||||
double const tolerance = 1.0;
|
||||
|
||||
// Strategies with many points, which are (very) slow in debug mode
|
||||
test_with_custom_strategies<multi_point_type, polygon>(
|
||||
"mysql_report_2015_02_25_1_8000",
|
||||
mysql_report_2015_02_25_1, join_miter, end_flat,
|
||||
distance_strategy(6051788), side_strategy, point_circle(8000),
|
||||
115058661065242.812, tolerance);
|
||||
|
||||
test_with_custom_strategies<multi_point_type, polygon>(
|
||||
"mysql_report_2015_02_25_1",
|
||||
mysql_report_2015_02_25_1, join_miter, end_flat,
|
||||
distance_strategy(6051788), side_strategy, point_circle(83585),
|
||||
115058672785611.219, tolerance);
|
||||
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_SLOW_TESTS)
|
||||
// Takes about 60 seconds in release mode
|
||||
test_with_custom_strategies<multi_point_type, polygon>(
|
||||
"mysql_report_2015_02_25_1_250k",
|
||||
mysql_report_2015_02_25_1, join_miter, end_flat,
|
||||
distance_strategy(6051788), side_strategy, point_circle(250000),
|
||||
115058672880671.531, tolerance);
|
||||
#endif
|
||||
|
||||
test_with_custom_strategies<multi_point_type, polygon>("mysql_report_2015_02_25_2",
|
||||
mysql_report_2015_02_25_2, join_miter, end_flat,
|
||||
distance_strategy(5666962), side_strategy, point_circle(46641), 100891031341757.344, 1.0);
|
||||
}
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
|
||||
// Takes too long, TODO improve turn_in_piece_visitor
|
||||
test_with_custom_strategies<multi_point_type, polygon>(
|
||||
"mysql_report_2015_02_25_1",
|
||||
mysql_report_2015_02_25_1, join_miter, end_flat,
|
||||
distance_strategy(6051788), side_strategy, point_circle(800000),
|
||||
115058672799999.999, tolerance); // area to be determined
|
||||
#endif
|
||||
|
||||
test_with_custom_strategies<multi_point_type, polygon>(
|
||||
"mysql_report_2015_02_25_2",
|
||||
mysql_report_2015_02_25_2, join_miter, end_flat,
|
||||
distance_strategy(5666962), side_strategy, point_circle(46641),
|
||||
100891031341757.344, tolerance);
|
||||
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
@@ -118,5 +150,11 @@ int test_main(int, char* [])
|
||||
test_all<true, bg::model::point<double, 2, bg::cs::cartesian> >();
|
||||
test_all<false, bg::model::point<double, 2, bg::cs::cartesian> >();
|
||||
|
||||
#if defined(BOOST_GEOMETRY_COMPILER_MODE_RELEASE) && ! defined(BOOST_GEOMETRY_COMPILER_MODE_DEBUG)
|
||||
test_many_points_per_circle<bg::model::point<double, 2, bg::cs::cartesian> >();
|
||||
#else
|
||||
std::cout << "Skipping some tests in debug or unknown mode" << std::endl;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user