1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3 
4 // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Use, modification and distribution is subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 
9 #ifndef BOOST_GEOMETRY_TEST_REVERSE_HPP
10 #define BOOST_GEOMETRY_TEST_REVERSE_HPP
11 
12 // Test-functionality, shared between single and multi tests
13 
14 #include <geometry_test_common.hpp>
15 #include <boost/geometry/algorithms/reverse.hpp>
16 #include <boost/geometry/io/wkt/wkt.hpp>
17 #include <boost/variant/variant.hpp>
18 
19 
20 template <typename Geometry>
check_geometry(Geometry & geometry,std::string const & wkt,std::string const & expected)21 void check_geometry(Geometry& geometry, std::string const& wkt, std::string const& expected)
22 {
23     bg::reverse(geometry);
24 
25     std::ostringstream out;
26     out << bg::wkt(geometry);
27 
28     BOOST_CHECK_MESSAGE(out.str() == expected,
29         "reverse: " << wkt
30         << " expected " << expected
31         << " got " << out.str());
32 }
33 
34 template <typename Geometry>
test_geometry(std::string const & wkt,std::string const & expected)35 void test_geometry(std::string const& wkt, std::string const& expected)
36 {
37     Geometry geometry;
38     bg::read_wkt(wkt, geometry);
39     boost::variant<Geometry> v(geometry);
40 
41     check_geometry(geometry, wkt, expected);
42     check_geometry(v, wkt, expected);
43 }
44 
45 
46 #endif
47