]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/distance/test_empty_geometry.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / distance / test_empty_geometry.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3
4 // Copyright (c) 2018, Oracle and/or its affiliates.
5
6 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
7
8 // Licensed under the Boost Software License version 1.0.
9 // http://www.boost.org/users/license.html
10
11
12 #ifndef BOOST_GEOMETRY_TEST_EMPTY_GEOMETRY_HPP
13 #define BOOST_GEOMETRY_TEST_EMPTY_GEOMETRY_HPP
14
15 template <typename Point, typename Strategy>
16 void test_more_empty_input_pointlike_pointlike(Strategy const& strategy)
17 {
18 #ifdef BOOST_GEOMETRY_TEST_DEBUG
19 std::cout << std::endl;
20 std::cout << "testing on empty inputs... " << std::flush;
21 #endif
22 bg::model::multi_point<Point> multipoint_empty;
23
24 Point point = from_wkt<Point>("point(0 0)");
25
26 // 1st geometry is empty
27 test_empty_input(multipoint_empty, point, strategy);
28
29 // 2nd geometry is empty
30 test_empty_input(point, multipoint_empty, strategy);
31
32 // both geometries are empty
33 test_empty_input(multipoint_empty, multipoint_empty, strategy);
34
35 #ifdef BOOST_GEOMETRY_TEST_DEBUG
36 std::cout << "done!" << std::endl;
37 #endif
38 }
39
40
41 template <typename Point, typename Strategy>
42 void test_more_empty_input_pointlike_linear(Strategy const& strategy)
43 {
44 #ifdef BOOST_GEOMETRY_TEST_DEBUG
45 std::cout << std::endl;
46 std::cout << "testing on empty inputs... " << std::flush;
47 #endif
48 bg::model::linestring<Point> line_empty;
49 bg::model::multi_point<Point> multipoint_empty;
50 bg::model::multi_linestring<bg::model::linestring<Point> > multiline_empty;
51
52 Point point = from_wkt<Point>("POINT(0 0)");
53 bg::model::linestring<Point> line =
54 from_wkt<bg::model::linestring<Point> >("LINESTRING(0 0,1 1,2 2)");
55
56 // 1st geometry is empty
57 test_empty_input(multipoint_empty, line, strategy);
58
59 // 2nd geometry is empty
60 test_empty_input(line, multipoint_empty, strategy);
61 test_empty_input(point, line_empty, strategy);
62 test_empty_input(point, multiline_empty, strategy);
63
64 // both geometries are empty
65 test_empty_input(multipoint_empty, line_empty, strategy);
66 test_empty_input(multipoint_empty, multiline_empty, strategy);
67
68 #ifdef BOOST_GEOMETRY_TEST_DEBUG
69 std::cout << "done!" << std::endl;
70 #endif
71 }
72
73
74 template <typename Point, typename Strategy>
75 void test_more_empty_input_pointlike_areal(Strategy const& strategy)
76 {
77 #ifdef BOOST_GEOMETRY_TEST_DEBUG
78 std::cout << std::endl;
79 std::cout << "testing on empty inputs... " << std::flush;
80 #endif
81 bg::model::multi_point<Point> multipoint_empty;
82
83 bg::model::polygon<Point> polygon_empty;
84 bg::model::multi_polygon<bg::model::polygon<Point> > multipolygon_empty;
85
86 Point point = from_wkt<Point>("POINT(0 0)");
87 bg::model::polygon<Point> polygon =
88 from_wkt<bg::model::polygon<Point> >("POLYGON((0 0,1 0,1 1,0 1,0 0))");
89
90 // 1st geometry is empty
91 test_empty_input(multipoint_empty, polygon, strategy);
92 test_empty_input(polygon_empty, point, strategy);
93 test_empty_input(multipolygon_empty, point, strategy);
94
95 // 2nd geometry is empty
96 test_empty_input(point, polygon_empty, strategy);
97 test_empty_input(point, multipolygon_empty, strategy);
98 test_empty_input(polygon, multipoint_empty, strategy);
99
100 // both geometries are empty
101 test_empty_input(multipoint_empty, polygon_empty, strategy);
102 test_empty_input(multipoint_empty, multipolygon_empty, strategy);
103
104 #ifdef BOOST_GEOMETRY_TEST_DEBUG
105 std::cout << "done!" << std::endl;
106 #endif
107 }
108
109
110 template <typename Point, typename Strategy>
111 void test_more_empty_input_linear_linear(Strategy const& strategy)
112 {
113 #ifdef BOOST_GEOMETRY_TEST_DEBUG
114 std::cout << std::endl;
115 std::cout << "testing on empty inputs... " << std::flush;
116 #endif
117 bg::model::linestring<Point> line_empty;
118 bg::model::multi_linestring<bg::model::linestring<Point> > multiline_empty;
119
120 bg::model::linestring<Point> line =
121 from_wkt<bg::model::linestring<Point> >("LINESTRING(0 0,1 1)");
122
123 // 1st geometry is empty
124 test_empty_input(line_empty, line, strategy);
125 test_empty_input(multiline_empty, line, strategy);
126
127 // 2nd geometry is empty
128 test_empty_input(line, line_empty, strategy);
129 test_empty_input(line, multiline_empty, strategy);
130
131 // both geometries are empty
132 test_empty_input(line_empty, line_empty, strategy);
133 test_empty_input(multiline_empty, line_empty, strategy);
134 test_empty_input(multiline_empty, multiline_empty, strategy);
135
136 #ifdef BOOST_GEOMETRY_TEST_DEBUG
137 std::cout << "done!" << std::endl;
138 #endif
139 }
140
141
142 template <typename Point, typename Strategy>
143 void test_more_empty_input_linear_areal(Strategy const& strategy)
144 {
145 #ifdef BOOST_GEOMETRY_TEST_DEBUG
146 std::cout << std::endl;
147 std::cout << "testing on empty inputs... " << std::flush;
148 #endif
149 bg::model::linestring<Point> line_empty;
150 bg::model::multi_linestring<bg::model::linestring<Point> > multiline_empty;
151
152 bg::model::polygon<Point> polygon_empty;
153 bg::model::multi_polygon<bg::model::polygon<Point> > multipolygon_empty;
154
155 bg::model::linestring<Point> line =
156 from_wkt<bg::model::linestring<Point> >("LINESTRING(0 0,1 1)");
157 bg::model::polygon<Point> polygon =
158 from_wkt<bg::model::polygon<Point> >("POLYGON((0 0,1 0,1 1,0 1,0 0))");
159
160 // 1st geometry is empty
161 test_empty_input(line_empty, polygon, strategy);
162 test_empty_input(multiline_empty, polygon, strategy);
163 test_empty_input(polygon_empty, line, strategy);
164 test_empty_input(multipolygon_empty, line, strategy);
165
166 // 2nd geometry is empty
167 test_empty_input(line, polygon_empty, strategy);
168 test_empty_input(line, multipolygon_empty, strategy);
169 test_empty_input(polygon, line_empty, strategy);
170 test_empty_input(polygon, multiline_empty, strategy);
171
172 // both geometries are empty
173 test_empty_input(line_empty, polygon_empty, strategy);
174 test_empty_input(line_empty, multipolygon_empty, strategy);
175 test_empty_input(multiline_empty, polygon_empty, strategy);
176 test_empty_input(multiline_empty, multipolygon_empty, strategy);
177
178 #ifdef BOOST_GEOMETRY_TEST_DEBUG
179 std::cout << "done!" << std::endl;
180 #endif
181 }
182
183
184 template <typename Point, typename Strategy>
185 void test_more_empty_input_areal_areal(Strategy const& strategy)
186 {
187 #ifdef BOOST_GEOMETRY_TEST_DEBUG
188 std::cout << std::endl;
189 std::cout << "testing on empty inputs... " << std::flush;
190 #endif
191 bg::model::polygon<Point> polygon_empty;
192 bg::model::multi_polygon<bg::model::polygon<Point> > multipolygon_empty;
193
194 bg::model::polygon<Point> polygon =
195 from_wkt<bg::model::polygon<Point> >("POLYGON((0 0,1 0,1 1,0 1,0 0))");
196
197 // 1st geometry is empty
198 test_empty_input(polygon_empty, polygon, strategy);
199 test_empty_input(multipolygon_empty, polygon, strategy);
200
201 // 2nd geometry is empty
202 test_empty_input(polygon, polygon_empty, strategy);
203 test_empty_input(polygon, multipolygon_empty, strategy);
204
205 // both geometries are empty
206 test_empty_input(polygon_empty, multipolygon_empty, strategy);
207
208 #ifdef BOOST_GEOMETRY_TEST_DEBUG
209 std::cout << "done!" << std::endl;
210 #endif
211 }
212
213 #endif // BOOST_GEOMETRY_TEST_EMPTY_GEOMETRY_HPP