]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/core/tag.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / geometry / test / core / tag.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3
4 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5
6 // This file was modified by Oracle on 2014-2021.
7 // Modifications copyright (c) 2014-2021 Oracle and/or its affiliates.
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
9
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
13
14
15 #include <geometry_test_common.hpp>
16
17 #include <boost/geometry/core/tag.hpp>
18
19 #include <boost/geometry/geometries/geometries.hpp>
20
21 #include <boost/geometry/geometries/adapted/c_array.hpp>
22 #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
23
24 #include <boost/geometry/geometries/register/linestring.hpp>
25
26 #include <vector>
27 #include <deque>
28
29 BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
30 BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
31
32 BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
33 BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
34
35
36 template <typename G, typename Expected>
37 void test_geometry()
38 {
39 BOOST_CHECK_EQUAL(typeid(typename bg::tag<G>::type).name(),
40 typeid(Expected).name());
41
42 static const bool is_same = std::is_same<typename bg::tag<G>::type, Expected>::value;
43 BOOST_CHECK(is_same);
44 }
45
46 template <typename P, size_t D>
47 void test_all()
48 {
49 test_geometry<P, bg::point_tag>();
50 test_geometry<P const, bg::point_tag>();
51 test_geometry<P*, bg::point_tag>();
52 test_geometry<P&, bg::point_tag>();
53 test_geometry<P*&, bg::point_tag>();
54 test_geometry<const P *, bg::point_tag>();
55 test_geometry<bg::model::linestring<P> , bg::linestring_tag>();
56 test_geometry<bg::model::linestring<P> *&, bg::linestring_tag>();
57 test_geometry<bg::model::ring<P> , bg::ring_tag>();
58 test_geometry<bg::model::polygon<P> , bg::polygon_tag>();
59 test_geometry<bg::model::box<P> , bg::box_tag>();
60 test_geometry<bg::model::segment<P> , bg::segment_tag>();
61 test_geometry<bg::model::referring_segment<P const> , bg::segment_tag>();
62
63 test_geometry<std::vector<P>, bg::linestring_tag>();
64 test_geometry<std::deque<P>, bg::linestring_tag>();
65
66 }
67
68 int test_main(int, char* [])
69 {
70 test_geometry<int[2], bg::point_tag>();
71 test_geometry<float[2], bg::point_tag>();
72 test_geometry<double[2], bg::point_tag>();
73
74 test_geometry<int[3], bg::point_tag>();
75 test_geometry<float[3], bg::point_tag>();
76 test_geometry<double[3], bg::point_tag>();
77
78 test_geometry<boost::tuple<double, double>, bg::point_tag>();
79 test_geometry<boost::tuple<double, double, double>, bg::point_tag>();
80
81 test_all<bg::model::point<int, 2, bg::cs::cartesian>, 2 >();
82 test_all<bg::model::point<float, 2, bg::cs::cartesian>, 2 >();
83 test_all<bg::model::point<double, 2, bg::cs::cartesian>, 2 >();
84
85 return 0;
86 }