// Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // This file was modified by Oracle on 2021. // Modifications copyright (c) 2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_TEST_CONVERT_HPP #define BOOST_GEOMETRY_TEST_CONVERT_HPP #include #include #include #include #include #include #include #include #include #include #include BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) template void check(Geometry1 const& geometry1, std::string const& expected, int expected_point_count = -1) { Geometry2 geometry2; bg::convert(geometry1, geometry2); std::ostringstream out; out << bg::wkt(geometry2); BOOST_CHECK_EQUAL(out.str(), expected); std::size_t n = bg::num_points(geometry2); BOOST_CHECK_MESSAGE(expected_point_count < 0 || int(n) == expected_point_count, "convert: " << " #points expected: " << expected_point_count << " detected: " << n << " expected wkt: " << expected ); } template void check(std::string const& wkt, std::string const& expected = "", int expected_point_count = -1) { Geometry1 geometry1; bg::read_wkt(wkt, geometry1); std::string const& used_expected = expected.empty() ? wkt : expected; check(geometry1, used_expected, expected_point_count); check(boost::variant(geometry1), used_expected, expected_point_count); } #endif // BOOST_GEOMETRY_TEST_CONVERT_HPP