unique.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Unit Test
  3. // Copyright (c) 2010-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. #include <algorithms/test_unique.hpp>
  8. #include <boost/geometry/geometries/geometries.hpp>
  9. #include <boost/geometry/geometries/point_xy.hpp>
  10. template <typename Point>
  11. void test_all()
  12. {
  13. test_geometry<bg::model::linestring<Point> >(
  14. "LINESTRING(0 0,1 1)",
  15. "LINESTRING(0 0,1 1)");
  16. test_geometry<bg::model::linestring<Point> >(
  17. "LINESTRING(0 0,1 1,1 1)",
  18. "LINESTRING(0 0,1 1)");
  19. test_geometry<bg::model::linestring<Point> >(
  20. "LINESTRING(0 0,0 0,1 1)",
  21. "LINESTRING(0 0,1 1)");
  22. // Consecutive points
  23. test_geometry<bg::model::linestring<Point> >(
  24. "LINESTRING(0 0,0 0,0 0,0 0,1 1,1 1,1 1)",
  25. "LINESTRING(0 0,1 1)");
  26. // Other types
  27. test_geometry<bg::model::ring<Point> >(
  28. "POLYGON((0 0,0 1,1 1,1 1,1 1,1 0,0 0,0 0))",
  29. "POLYGON((0 0,0 1,1 1,1 0,0 0))");
  30. // With holes
  31. test_geometry<bg::model::polygon<Point> >(
  32. "POLYGON((0 0,0 10,10 10,10 10,10 10,10 0,0 0,0 0))",
  33. "POLYGON((0 0,0 10,10 10,10 0,0 0))");
  34. }
  35. int test_main(int, char* [])
  36. {
  37. test_all<bg::model::d2::point_xy<int> >();
  38. test_all<bg::model::d2::point_xy<double> >();
  39. #if defined(HAVE_TTMATH)
  40. test_all<bg::model::d2::point_xy<ttmath_big> >();
  41. #endif
  42. return 0;
  43. }