]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/geometries/point.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2020 Digvijay Janartha, Hamirpur, India.
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
11 #include <geometry_test_common.hpp>
13 #include <boost/core/ignore_unused.hpp>
14 #include <boost/geometry/algorithms/make.hpp>
15 #include <boost/geometry/geometries/concepts/point_concept.hpp>
16 #include <boost/geometry/geometries/point.hpp>
18 #include <test_common/test_point.hpp>
21 template <typename T
, typename CS
>
22 bg::model::point
<T
, 3, CS
> create_point()
27 return bg::model::point
<T
, 3, CS
>(t1
, t2
, t3
);
30 template <typename P
, typename T
>
31 void check_point(P
& to_check
, T x
, T y
, T z
)
33 BOOST_CHECK_EQUAL(bg::get
<0>(to_check
), x
);
34 BOOST_CHECK_EQUAL(bg::get
<1>(to_check
), y
);
35 BOOST_CHECK_EQUAL(bg::get
<2>(to_check
), z
);
38 template <typename T
, typename CS
>
39 void test_default_constructor()
41 bg::model::point
<T
, 3, CS
> p(create_point
<T
, CS
>());
42 check_point(p
, 1, 2, 3);
45 template <typename T
, typename CS
>
46 void test_copy_constructor()
48 bg::model::point
<T
, 3, CS
> p
= create_point
<T
, CS
>();
49 check_point(p
, 1, 2, 3);
52 template <typename T
, typename CS
>
53 void test_copy_assignment()
55 bg::model::point
<T
, 3, CS
> p(create_point
<T
, CS
>());
59 check_point(p
, 4, 5, 6);
62 template <typename T
, typename CS
>
65 typedef bg::model::point
<T
, 3, CS
> P
;
67 // Compilation tests, all things should compile.
68 BOOST_CONCEPT_ASSERT( (bg::concepts::ConstPoint
<P
>) );
69 BOOST_CONCEPT_ASSERT( (bg::concepts::Point
<P
>) );
71 typedef typename
bg::coordinate_type
<P
>::type T1
;
72 boost::ignore_unused
<T1
>();
75 template <typename T
, typename CS
>
78 test_default_constructor
<T
, CS
>();
79 test_copy_constructor
<T
, CS
>();
80 test_copy_assignment
<T
, CS
>();
81 test_concept
<T
, CS
>();
84 template <typename CS
>
88 test_all
<float, CS
>();
89 test_all
<double, CS
>();
93 int test_main(int, char* [])
95 test_cs
<bg::cs::cartesian
>();
96 test_cs
<bg::cs::spherical
<bg::degree
> >();
97 test_cs
<bg::cs::spherical_equatorial
<bg::degree
> >();
98 test_cs
<bg::cs::geographic
<bg::degree
> >();