/Src/Dependencies/Boost/libs/geometry/test/algorithms/for_each.cpp

http://hadesmem.googlecode.com/ · C++ · 81 lines · 55 code · 18 blank · 8 comment · 0 complexity · 74d49c09b941964971d4eb2bf9d40e80 MD5 · raw file

  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Unit Test
  3. // Copyright (c) 2007-2011 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_for_each.hpp>
  8. #include <boost/geometry/geometries/geometries.hpp>
  9. template <typename P>
  10. void test_all()
  11. {
  12. test_geometry<P>
  13. (
  14. "POINT(1 1)"
  15. // per point
  16. , 1
  17. , "POINT(101 1)"
  18. , "POINT(101 100)"
  19. // per segment
  20. , ""
  21. , 0
  22. , "POINT(1 1)"
  23. );
  24. test_geometry<bg::model::linestring<P> >
  25. (
  26. "LINESTRING(1 1,2 2)"
  27. , 3
  28. , "LINESTRING(101 1,102 2)"
  29. , "LINESTRING(101 100,102 200)"
  30. , "((1, 1), (2, 2))"
  31. , std::sqrt(2.0)
  32. , "LINESTRING(10 1,2 2)"
  33. );
  34. test_geometry<bg::model::ring<P> >
  35. (
  36. "POLYGON((1 1,1 4,4 4,4 1,1 1))"
  37. , 11
  38. , "POLYGON((101 1,101 4,104 4,104 1,101 1))"
  39. , "POLYGON((101 100,101 400,104 400,104 100,101 100))"
  40. , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
  41. , 4 * 3.0
  42. , "POLYGON((10 1,10 4,4 4,4 1,1 1))"
  43. );
  44. test_geometry<bg::model::polygon<P> >
  45. (
  46. "POLYGON((1 1,1 4,4 4,4 1,1 1),(2 2,3 2,3 3,2 3,2 2))"
  47. , 23
  48. , "POLYGON((101 1,101 4,104 4,104 1,101 1),(102 2,103 2,103 3,102 3,102 2))"
  49. , "POLYGON((101 100,101 400,104 400,104 100,101 100),(102 200,103 200,103 300,102 300,102 200))"
  50. , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1)) "
  51. "((2, 2), (3, 2)) ((3, 2), (3, 3)) ((3, 3), (2, 3)) ((2, 3), (2, 2))"
  52. , 4 * 3.0 + 4 * 1.0
  53. , "POLYGON((10 1,10 4,4 4,4 1,1 1),(2 2,3 2,3 3,2 3,2 2))"
  54. );
  55. }
  56. int test_main(int, char* [])
  57. {
  58. test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
  59. #if defined(HAVE_TTMATH)
  60. test_all<bg::model::point<ttmath_big, 2, bg::cs::cartesian> >();
  61. #endif
  62. return 0;
  63. }