1 // Boost.Geometry Index
2 // Unit Test
3
4 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
5
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)
9
10 #ifndef BOOST_GEOMETRY_INDEX_TEST_CONTENT_HPP
11 #define BOOST_GEOMETRY_INDEX_TEST_CONTENT_HPP
12
13 #include <geometry_index_test_common.hpp>
14
15 #include <boost/geometry/index/detail/algorithms/content.hpp>
16
17 //#include <boost/geometry/io/wkt/read.hpp>
18
19
20 template <typename Geometry>
test_content(Geometry const & geometry,typename bgi::detail::default_content_result<Geometry>::type expected_value)21 void test_content(Geometry const& geometry,
22 typename bgi::detail::default_content_result<Geometry>::type expected_value)
23 {
24 typename bgi::detail::default_content_result<Geometry>::type value = bgi::detail::content(geometry);
25
26 #ifdef BOOST_GEOMETRY_TEST_DEBUG
27 std::ostringstream out;
28 out << typeid(typename bg::coordinate_type<Geometry>::type).name()
29 << " "
30 << typeid(typename bgi::detail::default_content_result<Geometry>::type).name()
31 << " "
32 << "content : " << value
33 << std::endl;
34 std::cout << out.str();
35 #endif
36
37 BOOST_CHECK_CLOSE(value, expected_value, 0.0001);
38 }
39
40 template <typename Geometry>
test_geometry(std::string const & wkt,typename bgi::detail::default_content_result<Geometry>::type expected_value)41 void test_geometry(std::string const& wkt,
42 typename bgi::detail::default_content_result<Geometry>::type expected_value)
43 {
44 Geometry geometry;
45 bg::read_wkt(wkt, geometry);
46 test_content(geometry, expected_value);
47 }
48
49 #endif
50