test_content.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Boost.Geometry Index
  2. // Unit Test
  3. // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
  4. // Use, modification and distribution is subject to the Boost Software License,
  5. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. #ifndef BOOST_GEOMETRY_INDEX_TEST_CONTENT_HPP
  8. #define BOOST_GEOMETRY_INDEX_TEST_CONTENT_HPP
  9. #include <geometry_index_test_common.hpp>
  10. #include <boost/geometry/index/detail/algorithms/content.hpp>
  11. //#include <boost/geometry/io/wkt/read.hpp>
  12. template <typename Geometry>
  13. void test_content(Geometry const& geometry,
  14. typename bgi::detail::default_content_result<Geometry>::type expected_value)
  15. {
  16. typename bgi::detail::default_content_result<Geometry>::type value = bgi::detail::content(geometry);
  17. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  18. std::ostringstream out;
  19. out << typeid(typename bg::coordinate_type<Geometry>::type).name()
  20. << " "
  21. << typeid(typename bgi::detail::default_content_result<Geometry>::type).name()
  22. << " "
  23. << "content : " << value
  24. << std::endl;
  25. std::cout << out.str();
  26. #endif
  27. BOOST_CHECK_CLOSE(value, expected_value, 0.0001);
  28. }
  29. template <typename Geometry>
  30. void test_geometry(std::string const& wkt,
  31. typename bgi::detail::default_content_result<Geometry>::type expected_value)
  32. {
  33. Geometry geometry;
  34. bg::read_wkt(wkt, geometry);
  35. test_content(geometry, expected_value);
  36. }
  37. #endif