reverse_dispatch.cpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Unit Test
  3. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  4. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
  5. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
  6. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  7. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  8. // Use, modification and distribution is subject to the Boost Software License,
  9. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  10. // http://www.boost.org/LICENSE_1_0.txt)
  11. #include <geometry_test_common.hpp>
  12. #include <boost/geometry/core/reverse_dispatch.hpp>
  13. #include <boost/geometry/geometries/geometries.hpp>
  14. template <typename Geometry1, typename Geometry2, bool Expected>
  15. void test_reversed()
  16. {
  17. BOOST_CHECK_EQUAL((bg::reverse_dispatch<Geometry1, Geometry2>::type::value),
  18. Expected);
  19. }
  20. template <typename P>
  21. void test_all()
  22. {
  23. test_reversed<P, P, false>();
  24. test_reversed<P, bg::model::linestring<P>, false>();
  25. test_reversed<bg::model::linestring<P>, P, true>();
  26. test_reversed<bg::model::ring<P>, P, true>();
  27. test_reversed<bg::model::linestring<P>, bg::model::ring<P>, false>();
  28. test_reversed<bg::model::ring<P>, bg::model::linestring<P>, true>();
  29. }
  30. template <typename P1, typename P2>
  31. void test_mixed()
  32. {
  33. test_reversed<P1, P2, false>();
  34. }
  35. int test_main(int, char* [])
  36. {
  37. test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
  38. test_mixed
  39. <
  40. bg::model::point<int, 2, bg::cs::cartesian>,
  41. bg::model::point<int, 2, bg::cs::spherical<bg::degree> >
  42. >();
  43. test_mixed
  44. <
  45. bg::model::point<int, 2, bg::cs::spherical<bg::degree> >,
  46. bg::model::point<int, 2, bg::cs::spherical<bg::radian> >
  47. >();
  48. return 0;
  49. }