test_unique.hpp 997 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Unit Test
  3. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  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_TEST_UNIQUE_HPP
  8. #define BOOST_GEOMETRY_TEST_UNIQUE_HPP
  9. // Test-functionality, shared between single and multi tests
  10. #include <geometry_test_common.hpp>
  11. #include <boost/geometry/algorithms/unique.hpp>
  12. #include <boost/geometry/io/wkt/wkt.hpp>
  13. template <typename Geometry>
  14. void test_geometry(std::string const& wkt, std::string const& expected)
  15. {
  16. Geometry geometry;
  17. bg::read_wkt(wkt, geometry);
  18. bg::unique(geometry);
  19. std::ostringstream out;
  20. out << bg::wkt(geometry);
  21. BOOST_CHECK_MESSAGE(out.str() == expected,
  22. "unique: " << wkt
  23. << " expected " << expected
  24. << " got " << out.str());
  25. }
  26. #endif