From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- .../libs/geometry/test/geometries/adapted.cpp | 112 +++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 src/boost/libs/geometry/test/geometries/adapted.cpp (limited to 'src/boost/libs/geometry/test/geometries/adapted.cpp') diff --git a/src/boost/libs/geometry/test/geometries/adapted.cpp b/src/boost/libs/geometry/test/geometries/adapted.cpp new file mode 100644 index 00000000..17331439 --- /dev/null +++ b/src/boost/libs/geometry/test/geometries/adapted.cpp @@ -0,0 +1,112 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. + +// 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) + +#include +#include + +#include +#include + +#include + +#include +#include + +#include + +#define BOOST_GEOMETRY_TEST_RING + + + +#if defined(BOOST_GEOMETRY_TEST_RING) + + #include + #include + + BOOST_GEOMETRY_REGISTER_RING_TEMPLATED(std::vector) + BOOST_GEOMETRY_REGISTER_RING_TEMPLATED(std::deque) + +#elif defined(BOOST_GEOMETRY_TEST_MULTI_POINT) + + #include + #include + + BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED(std::vector) + BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED(std::deque) + +#else + + #include + #include + + BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector) + BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque) + +#endif + + +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + + +// ---------------------------------------------------------------------------- + +template +void test_geometry(G const& geometry, std::size_t expected_size = 0) +{ +#if defined(BOOST_GEOMETRY_TEST_RING) + BOOST_CONCEPT_ASSERT( (bg::concepts::ConstRing) ); +#elif defined(BOOST_GEOMETRY_TEST_MULTI_POINT) + BOOST_CONCEPT_ASSERT( (bg::concepts::ConstMultiPoint) ); +#else + BOOST_CONCEPT_ASSERT( (bg::concepts::ConstLinestring) ); +#endif + + typedef typename bg::point_type::type P; + typedef typename bg::coordinate_type

::type C; + boost::ignore_unused(); + + // Check range-like behaviour + BOOST_CHECK_EQUAL(boost::size(geometry), expected_size); +} + +template +void test_all() +{ + test_geometry(std::vector

()); + test_geometry(std::deque

()); + //test_geometry(std::list

()); + + /*** + double vertices[][3] = { + {-1, -1, 1}, {1, -1, 1}, {1, 1, 1}, {-1, 1, 1}, + {-1, -1, -1}, {1, -1, -1}, {1, 1, -1}, {-1, 1, -1} + }; + + test_geometry(vertices, 8); + ***/ +} + +int test_main(int, char* []) +{ + test_all(); + test_all >(); + test_all >(); + test_all >(); + test_all >(); + test_all >(); + + test_all >(); + test_all >(); + test_all >(); + + test_all >(); + + return 0; +} -- cgit v1.2.3