]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/geometries/point_xy.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2020 Digvijay Janartha, Hamirpur, India.
6 // This file was modified by Oracle on 2020.
7 // Modifications copyright (c) 2020, Oracle and/or its affiliates.
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
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)
15 #include <geometry_test_common.hpp>
17 #include <boost/geometry/algorithms/make.hpp>
18 #include <boost/geometry/geometries/point.hpp>
19 #include <boost/geometry/geometries/point_xy.hpp>
21 #include <test_common/test_point.hpp>
25 bg::model::d2::point_xy
<T
> create_point_xy()
29 return bg::model::d2::point_xy
<T
>(t1
, t2
);
32 template <typename P
, typename T
>
33 void check_point_xy(P
& to_check
, T x
, T y
)
35 BOOST_CHECK_EQUAL(bg::get
<0>(to_check
), x
);
36 BOOST_CHECK_EQUAL(bg::get
<1>(to_check
), y
);
37 BOOST_CHECK_EQUAL(to_check
.x(), x
);
38 BOOST_CHECK_EQUAL(to_check
.y(), y
);
42 void test_default_constructor()
44 bg::model::d2::point_xy
<T
> p(create_point_xy
<T
>());
45 check_point_xy(p
, 1, 2);
49 void test_copy_constructor()
51 bg::model::d2::point_xy
<T
> p(create_point_xy
<T
>());
52 check_point_xy(p
, 1, 2);
56 void test_copy_assignment()
58 bg::model::d2::point_xy
<T
> p(create_point_xy
<T
>());
61 check_point_xy(p
, 4, 5);
67 typedef bg::model::d2::point_xy
<T
> P
;
68 constexpr P p
= P(1, 2);
69 constexpr T c
= bg::get
<0>(p
);
70 BOOST_CHECK_EQUAL(c
, 1);
71 check_point_xy(p
, 1, 2);
77 test_default_constructor
<T
>();
78 test_copy_constructor
<T
>();
79 test_copy_assignment
<T
>();
83 int test_main(int, char* [])