From 12b1ad9e799c8767aeb021e7e6893e47fe42e52a Mon Sep 17 00:00:00 2001 From: barendgehrels Date: Sat, 18 Mar 2017 20:14:19 +0100 Subject: [PATCH] [test] avoid testing too much when one type is tested (compilation time) --- .../difference/test_difference.hpp | 39 +++++++++++++------ .../intersection/test_intersection.hpp | 2 +- .../set_operations/union/test_union.hpp | 22 ++++++----- .../algorithms/set_operations/union/union.cpp | 2 +- .../set_operations/union/union_multi.cpp | 2 +- 5 files changed, 44 insertions(+), 23 deletions(-) diff --git a/test/algorithms/set_operations/difference/test_difference.hpp b/test/algorithms/set_operations/difference/test_difference.hpp index 69c296b5a..23a686fd4 100644 --- a/test/algorithms/set_operations/difference/test_difference.hpp +++ b/test/algorithms/set_operations/difference/test_difference.hpp @@ -131,30 +131,48 @@ std::string test_difference(std::string const& caseid, G1 const& g1, G2 const& g typedef typename bg::coordinate_type::type coordinate_type; boost::ignore_unused(); - bg::model::multi_polygon result, result_s; + bg::model::multi_polygon result; - typedef typename bg::strategy::relate::services::default_strategy - < - G1, G2 - >::type strategy_type; if (sym) { bg::sym_difference(g1, g2, result); - bg::sym_difference(g1, g2, result_s, strategy_type()); } else { bg::difference(g1, g2, result); - bg::difference(g1, g2, result_s, strategy_type()); } if (settings.remove_spikes) { bg::remove_spikes(result); - bg::remove_spikes(result_s); } +#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) + { + bg::model::multi_polygon result_s; + typedef typename bg::strategy::relate::services::default_strategy + < + G1, G2 + >::type strategy_type; + if (sym) + { + bg::sym_difference(g1, g2, result_s, strategy_type()); + } + else + { + bg::difference(g1, g2, result_s, strategy_type()); + } + + if (settings.remove_spikes) + { + bg::remove_spikes(result_s); + } + BOOST_CHECK_EQUAL(bg::num_points(result), bg::num_points(result_s)); + } +#endif + + std::ostringstream return_string; return_string << bg::wkt(result); @@ -175,7 +193,8 @@ std::string test_difference(std::string const& caseid, G1 const& g1, G2 const& g difference_output(caseid, g1, g2, result); -#ifndef BOOST_GEOMETRY_DEBUG_ASSEMBLE +#if ! (defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) \ + || defined(BOOST_GEOMETRY_DEBUG_ASSEMBLE)) { // Test inserter functionality // Test if inserter returns output-iterator (using Boost.Range copy) @@ -241,8 +260,6 @@ std::string test_difference(std::string const& caseid, G1 const& g1, G2 const& g } BOOST_CHECK_CLOSE(area, expected_area, settings.percentage); - - BOOST_CHECK_EQUAL(bg::num_points(result), bg::num_points(result_s)); #endif diff --git a/test/algorithms/set_operations/intersection/test_intersection.hpp b/test/algorithms/set_operations/intersection/test_intersection.hpp index 5d50d91ce..7f914fc42 100644 --- a/test/algorithms/set_operations/intersection/test_intersection.hpp +++ b/test/algorithms/set_operations/intersection/test_intersection.hpp @@ -170,9 +170,9 @@ typename bg::default_area_result::type test_intersection(std::string const& } typedef typename setop_output_type::type result_type; + typedef typename bg::point_type::type point_type; #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) - typedef typename bg::point_type::type point_type; if (! settings.debug) { // Check _inserter behaviour with stratey diff --git a/test/algorithms/set_operations/union/test_union.hpp b/test/algorithms/set_operations/union/test_union.hpp index 32bc72aba..d1f275938 100644 --- a/test/algorithms/set_operations/union/test_union.hpp +++ b/test/algorithms/set_operations/union/test_union.hpp @@ -94,7 +94,7 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2, // Declare output (vector of rings or multi_polygon) typedef typename setop_output_type::type result_type; - result_type clip, clip_s; + result_type clip; #if defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS) std::cout << "*** UNION " << caseid << std::endl; @@ -108,12 +108,18 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2, // Check normal behaviour bg::union_(g1, g2, clip); - // Check strategy passed explicitly - typedef typename bg::strategy::intersection::services::default_strategy - < - typename bg::cs_tag::type - >::type strategy_type; - bg::union_(g1, g2, clip_s, strategy_type()); +#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) + { + // Check strategy passed explicitly + result_type clip_s; + typedef typename bg::strategy::intersection::services::default_strategy + < + typename bg::cs_tag::type + >::type strategy_type; + bg::union_(g1, g2, clip_s, strategy_type()); + BOOST_CHECK_EQUAL(num_points(clip), num_points(clip_s)); + } +#endif typename bg::default_area_result::type area = 0; std::size_t n = 0; @@ -198,8 +204,6 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2, BOOST_CHECK_CLOSE(area, expected_area, settings.percentage); - BOOST_CHECK_EQUAL(num_points(clip), num_points(clip_s)); - #if defined(TEST_WITH_SVG) { bool const ccw = diff --git a/test/algorithms/set_operations/union/union.cpp b/test/algorithms/set_operations/union/union.cpp index aa0155604..c6c17e61b 100644 --- a/test/algorithms/set_operations/union/union.cpp +++ b/test/algorithms/set_operations/union/union.cpp @@ -484,13 +484,13 @@ void test_all() test_areal(); +#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) // Open test_areal, bg::model::polygon >(); // Counter clockwise test_areal, bg::model::polygon >(); -#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) // Counter clockwise and open test_areal, bg::model::polygon >(); #endif diff --git a/test/algorithms/set_operations/union/union_multi.cpp b/test/algorithms/set_operations/union/union_multi.cpp index bc8a47655..d0f7ea723 100644 --- a/test/algorithms/set_operations/union/union_multi.cpp +++ b/test/algorithms/set_operations/union/union_multi.cpp @@ -425,11 +425,11 @@ void test_specific() int test_main(int, char* []) { test_all, true, true>(); +#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) test_all, false, false>(); test_specific, false, false>(); -#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) test_all, true, true>(); #if defined(HAVE_TTMATH)