Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76520 - in trunk/libs/geometry/test: algorithms geometries
From: barend.gehrels_at_[hidden]
Date: 2012-01-15 10:41:32


Author: barendgehrels
Date: 2012-01-15 10:41:29 EST (Sun, 15 Jan 2012)
New Revision: 76520
URL: http://svn.boost.org/trac/boost/changeset/76520

Log:
Fixes for clang in unit tests
Text files modified:
   trunk/libs/geometry/test/algorithms/test_union.hpp | 11 ++++++++---
   trunk/libs/geometry/test/geometries/boost_polygon.cpp | 7 ++++++-
   2 files changed, 14 insertions(+), 4 deletions(-)

Modified: trunk/libs/geometry/test/algorithms/test_union.hpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/test_union.hpp (original)
+++ trunk/libs/geometry/test/algorithms/test_union.hpp 2012-01-15 10:41:29 EST (Sun, 15 Jan 2012)
@@ -53,7 +53,6 @@
     {
         area += bg::area(*it);
         holes += bg::num_interior_rings(*it);
-
         n += bg::num_points(*it, true);
     }
 
@@ -65,10 +64,16 @@
         boost::copy(array_with_one_empty_geometry, bg::detail::union_::union_insert<OutputType>(g1, g2, std::back_inserter(inserted)));
 
         typename bg::default_area_result<G1>::type area_inserted = 0;
+ int index = 0;
         for (typename std::vector<OutputType>::iterator it = inserted.begin();
- it != inserted.end(); ++it)
+ it != inserted.end();
+ ++it, ++index)
         {
- area_inserted += bg::area(*it);
+ // Skip the empty polygon created above to avoid the empty_input_exception
+ if (bg::num_points(*it) > 0)
+ {
+ area_inserted += bg::area(*it);
+ }
         }
         BOOST_CHECK_EQUAL(boost::size(clip), boost::size(inserted) - 1);
         BOOST_CHECK_CLOSE(area_inserted, expected_area, percentage);

Modified: trunk/libs/geometry/test/geometries/boost_polygon.cpp
==============================================================================
--- trunk/libs/geometry/test/geometries/boost_polygon.cpp (original)
+++ trunk/libs/geometry/test/geometries/boost_polygon.cpp 2012-01-15 10:41:29 EST (Sun, 15 Jan 2012)
@@ -7,6 +7,11 @@
 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
+// geometry::num_points does not accept the ring_proxy for adaptation, like
+// centroid and probably many more algorithms. TODO: fix that. Until then we
+// define it such that num_points is not called.
+#define BOOST_GEOMETRY_EMPTY_INPUT_NO_THROW
+
 #include <geometry_test_common.hpp>
 
 
@@ -166,4 +171,4 @@
     //test_coordinate_type<float>(); // compiles, but "BOOST_CHECK_EQUAL" fails
     test_coordinate_type<double>();
     return 0;
-}
\ No newline at end of file
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk