1 // Boost.Geometry Index
4 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_GEOMETRY_INDEX_TEST_MARGIN_HPP
11 #define BOOST_GEOMETRY_INDEX_TEST_MARGIN_HPP
13 #include <geometry_index_test_common.hpp>
15 #include <boost/geometry/index/detail/algorithms/margin.hpp>
17 //#include <boost/geometry/io/wkt/read.hpp>
19 template <typename Geometry>
20 void test_margin(Geometry const& geometry,
21 typename bgi::detail::default_margin_result<Geometry>::type expected_value)
23 typename bgi::detail::default_margin_result<Geometry>::type value = bgi::detail::comparable_margin(geometry);
25 #ifdef BOOST_GEOMETRY_TEST_DEBUG
26 std::ostringstream out;
27 out << typeid(typename bg::coordinate_type<Geometry>::type).name()
29 << typeid(typename bgi::detail::default_margin_result<Geometry>::type).name()
31 << "content : " << value
33 std::cout << out.str();
36 BOOST_CHECK_CLOSE(value, expected_value, 0.0001);
39 template <typename Geometry>
40 void test_geometry(std::string const& wkt,
41 typename bgi::detail::default_margin_result<Geometry>::type expected_value)
44 bg::read_wkt(wkt, geometry);
45 test_margin(geometry, expected_value);