]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/overlay/get_turns_linear_linear_sph.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / overlay / get_turns_linear_linear_sph.cpp
1 // Boost.Geometry
2 // Unit Test
3
4 // Copyright (c) 2016-2021, Oracle and/or its affiliates.
5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
6
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10
11
12 #include "test_get_turns.hpp"
13 #include <boost/geometry/geometries/geometries.hpp>
14
15
16 template <typename T>
17 void test_all()
18 {
19 typedef bg::model::point<T, 2, bg::cs::spherical_equatorial<bg::degree> > pt;
20 typedef bg::model::linestring<pt> ls;
21 typedef bg::model::multi_linestring<ls> mls;
22
23 // NOTE: currently for the first endpoint of the Linestring on collinear segment
24 // is_collinear flags are set to FALSE!
25 // E.g. in the first test tii++, NOT tii==
26
27 test_geometry<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(0 0,2 0)", "tii++", "txx==");
28 test_geometry<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(2 0,0 0)", "tix+=", "txi=+");
29
30 test_geometry<ls, ls>("LINESTRING(1 0,1 1)", "LINESTRING(0 0,1 0,2 0)", "tuu++");
31 test_geometry<ls, ls>("LINESTRING(1 0,0 0)", "LINESTRING(0 0,1 0,2 0)", "txi=+", "tiu+=");
32 test_geometry<ls, ls>("LINESTRING(1 0,2 0)", "LINESTRING(0 0,1 0,2 0)", "tii++", "txx==");
33 test_geometry<ls, ls>("LINESTRING(1 1,1 0)", "LINESTRING(0 0,1 0,2 0)", "txu++");
34 test_geometry<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(0 0,1 0,2 0)", "tii++", "txu==");
35 test_geometry<ls, ls>("LINESTRING(2 0,1 0)", "LINESTRING(0 0,1 0,2 0)", "txi=+", "tix+=");
36
37 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,1 1)", "tuu++");
38 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,0 0)", "tix+=", "tui=+");
39 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,2 0)", "tii++", "txx==");
40 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 1,1 0)", "tux++");
41 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(0 0,1 0)", "tii++", "tux==");
42 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(2 0,1 0)", "tix+=", "txi=+");
43
44 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(1 1,1 0,3 0,3 1)", "mii++", "ccc==", "muu==");
45 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(1 -1,1 0,3 0,3 -1)", "mii++", "ccc==", "muu==");
46 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(3 1,3 0,1 0,1 1)", "miu+=", "mui=+");
47 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(3 -1,3 0,1 0,1 -1)", "miu+=", "mui=+");
48 test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(2 1,2 0,4 0,4 1)", "tii++", "ccc==", "tuu==");
49 test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(2 -1,2 0,4 0,4 -1)", "tii++", "ccc==", "tuu==");
50 test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(4 1,4 0,2 0,2 1)", "tiu+=", "tui=+");
51 test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(4 -1,4 0,2 0,2 -1)", "tiu+=", "tui=+");
52
53 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 1,3 5,4 0)", "LINESTRING(1 0,2 1,3 5)", "tii++", "ecc==", "tux==");
54 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 1,3 5,4 0)", "LINESTRING(3 5,2 1,1 0)", "tix+=", "ecc==", "tui=+");
55 test_geometry<ls, ls>("LINESTRING(1 0,2 1,3 5)", "LINESTRING(0 0,1 0,2 1,3 5,4 0)", "txu==", "ecc==", "tii++");
56 test_geometry<ls, ls>("LINESTRING(3 5,2 1,1 0)", "LINESTRING(0 0,1 0,2 1,3 5,4 0)", "tiu+=", "ecc==", "txi=+");
57
58 test_geometry<ls, ls>("LINESTRING(0 0,10 0)", "LINESTRING(-1 -1,1 0,10 0,20 -1)", "mii++", "txu==");
59 test_geometry<ls, ls>("LINESTRING(0 0,10 0)", "LINESTRING(20 -1,10 0,1 0,-1 -1)", "miu+=", "txi=+");
60 test_geometry<ls, ls>("LINESTRING(-1 -1,1 0,10 0,20 -1)", "LINESTRING(0 0,10 0)", "mii++", "tux==");
61 test_geometry<ls, ls>("LINESTRING(20 -1,10 0,1 0,-1 -1)", "LINESTRING(0 0,10 0)", "mui=+", "tix+=");
62
63 test_geometry<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,31 0)",
64 "LINESTRING(-1 -1,0 0,1 0,2 0,2.5 1,3 0,30 0)",
65 expected("tii++")("ecc==")("muu==")("mii++")("muu==")("mii++")("mux=="));
66 test_geometry<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,31 0)",
67 "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)",
68 expected("tiu+=")("ecc==")("mui=+")("miu+=")("mui=+")("miu+=")("mui=+"));
69 test_geometry<ls, ls>("LINESTRING(31 0,15 0,10 5,5 5,4 0,1 0,0 0,-1 1)",
70 "LINESTRING(-1 -1,0 0,1 0,2 0,2.5 1,3 0,30 0)",
71 expected("tui=+")("ecc==")("miu+=")("mui=+")("miu+=")("mui=+")("mix+="));
72 test_geometry<ls, ls>("LINESTRING(31 0,15 0,10 5,5 5,4 0,1 0,0 0,-1 1)",
73 "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)",
74 expected("tuu==")("ecc==")("mii++")("muu==")("mii++")("muu==")("mii++"));
75
76 if (BOOST_GEOMETRY_CONDITION((std::is_same<T, double>::value)))
77 {
78 test_geometry<ls, ls>("LINESTRING(-1 0,1 0,2 1.0004570537241201524198894179384922,3 2)",
79 "LINESTRING(4 5,3 2,1 0,0 0)",
80 "mix+=", "txi=+", "ecc==");
81 test_geometry<ls, ls>("LINESTRING(4 5,3 2,1 0,0 0)",
82 "LINESTRING(-1 0,1 0,2 1.0004570537241201524198894179384922,3 2)",
83 "mxi=+", "tix+=", "ecc==");
84 }
85
86 test_geometry<ls, ls>("LINESTRING(30 0,20 0,1 1,-1 -1)", "LINESTRING(0 -1,0 0,1 -1,20 0,25 0)", "mix+=", "tui=+", "muu++");
87 test_geometry<ls, ls>("LINESTRING(0 -1,0 0,1 -1,20 0,25 0)", "LINESTRING(30 0,20 0,1 1,-1 -1)", "mxi=+", "tiu+=", "muu++");
88
89 test_geometry<ls, ls>("LINESTRING(0 0,30 0)", "LINESTRING(4 0,4 1,20 1,5 0,1 0)", "muu++", "mui=+", "mix+=");
90 test_geometry<ls, ls>("LINESTRING(4 0,4 1,20 1,5 0,1 0)", "LINESTRING(0 0,30 0)", "muu++", "miu+=", "mxi=+");
91
92 test_geometry<ls, ls>("LINESTRING(30 0,0 0)", "LINESTRING(1 0,5 0,20 1,4 1,4 0,5 0)",
93 expected("mui=+")("miu+=")("mui=+")("mix+="));
94 test_geometry<ls, ls>("LINESTRING(1 0,5 0,20 1,4 1,4 0,5 0)", "LINESTRING(30 0,0 0)",
95 expected("miu+=")("mui=+")("miu+=")("mxi=+"));
96
97 test_geometry<ls, ls>("LINESTRING(1 0,7 0,8 1)", "LINESTRING(0 0,10 0,10 10,4 -1)",
98 expected("mii++")("iuu++")("muu=="));
99 test_geometry<ls, ls>("LINESTRING(1 0,7 0,8 1)", "LINESTRING(0 0,10 0,10 10,5 0,4 1)",
100 expected("mii++")("muu++")("muu=="));
101
102 // non-collinear
103 test_geometry<ls, ls>("LINESTRING(0 1,0 0)", "LINESTRING(0 0,1 0,2 0)", "txu++");
104 test_geometry<ls, ls>("LINESTRING(0 1,0 0,1 1)", "LINESTRING(0 0,1 0,2 0)", "tuu++");
105 test_geometry<ls, ls>("LINESTRING(0 1,1 0,2 1)", "LINESTRING(0 0,1 0,2 0)", "tuu++");
106
107 // SPIKE - NON-ENDPOINT - NON-OPPOSITE
108
109 // spike - neq eq
110 test_geometry<ls, ls>("LINESTRING(0 2,0 4,0 1)", "LINESTRING(0 0,0 4,6 3)",
111 expected("mii++")("txu==")("tiu==")("mxi=+"));
112 // spike - eq eq
113 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 1)", "LINESTRING(0 0,0 4,6 3)",
114 expected("tii++")("txu==")("tiu==")("mxi=+"));
115 // spike - eq neq
116 test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 1)", "LINESTRING(0 0,0 4,6 3)",
117 expected("tii++")("mxu==")("miu==")("mxi=+"));
118 // spike - neq neq
119 test_geometry<ls, ls>("LINESTRING(0 1,0 3,0 2)", "LINESTRING(0 0,0 4,6 3)",
120 expected("mii++")("mxu==")("miu==")("mxi=+"));
121 // spike - out neq
122 test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 2)", "LINESTRING(0 1,0 4,6 3)",
123 expected("mii++")("mxu==")("miu==")("mxi=+"));
124 // spike - out eq
125 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(0 1,0 4,6 3)",
126 expected("mii++")("txu==")("tiu==")("mxi=+"));
127 // spike - out out/eq
128 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(1 0,0 4,6 3)",
129 expected("tuu++"));
130 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(-1 0,0 4,6 3)",
131 expected("tuu++"));
132 // spike - out out/neq
133 test_geometry<ls, ls>("LINESTRING(0 -2,0 0,0 -1)", "LINESTRING(-1 0,1 0,6 3)",
134 expected("muu++"));
135 test_geometry<ls, ls>("LINESTRING(0 -2,0 0,0 -1)", "LINESTRING(-1 0,1 0,6 3)",
136 expected("muu++"));
137
138 // SPIKE - NON-ENDPOINT - OPPOSITE
139
140 // opposite - eq eq
141 test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -1,0 0,0 4,6 3)",
142 expected("tiu+=")("txi=+")("tii=+")("mxu=="));
143 test_geometry<ls, ls>("LINESTRING(0 -1,0 0,0 4,6 3)", "LINESTRING(0 6,0 4,0 0,0 2)",
144 expected("tui=+")("tix+=")("tii+=")("mux=="));
145 // opposite - neq eq
146 test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -1,0 0,0 5,6 3)",
147 expected("miu+=")("txi=+")("tii=+")("mxu=="));
148 // opposite - eq neq
149 test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -2,0 -1,0 4,6 3)",
150 expected("tiu+=")("mxi=+")("mii=+")("mxu=="));
151 // opposite - neq neq
152 test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -2,0 -1,0 3,6 3)",
153 expected("miu+=")("mxi=+")("mii=+")("mxu=="));
154 // opposite - neq neq
155 test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -2,0 -1,0 3,0 5,6 3)",
156 expected("miu+=")("mxi=+")("mii=+")("mxu=="));
157 // opposite - neq eq
158 test_geometry<ls, ls>("LINESTRING(6 3,0 3,0 0)", "LINESTRING(0 0,0 2,0 3,0 1)",
159 expected("txi=+")("tix+=")("tii+=")("mux=="));
160
161 // SPIKE - ENDPOINT - NON-OPPOSITE
162
163 // spike - neq eq
164 test_geometry<ls, ls>("LINESTRING(0 2,0 4,0 1)", "LINESTRING(0 0,0 4)",
165 expected("mii++")("txx==")("tix==")("mxi=+"));
166 test_geometry<ls, ls>("LINESTRING(0 2,0 4,0 1)", "LINESTRING(0 4,0 0)",
167 expected("miu+=")("txi=+")("tii=+")("mxu=="));
168 // spike - eq eq
169 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 1)", "LINESTRING(0 0,0 4)",
170 expected("tii++")("txx==")("tix==")("mxi=+"));
171 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 1)", "LINESTRING(0 4,0 0)",
172 expected("tix+=")("txi=+")("tii=+")("mxu=="));
173 // spike - eq neq
174 test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 1)", "LINESTRING(0 0,0 4)",
175 expected("tii++")("mxu==")("miu==")("mxi=+"));
176 test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 1)", "LINESTRING(0 4,0 0)",
177 expected("tix+=")("mxi=+")("mii=+")("mxu=="));
178 // spike - neq neq
179 test_geometry<ls, ls>("LINESTRING(0 1,0 3,0 2)", "LINESTRING(0 0,0 4)",
180 expected("mii++")("mxu==")("miu==")("mxi=+"));
181 test_geometry<ls, ls>("LINESTRING(0 1,0 3,0 2)", "LINESTRING(0 4,0 0)",
182 expected("miu+=")("mxi=+")("mii=+")("mxu=="));
183 // spike - out neq
184 test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 2)", "LINESTRING(0 1,0 4)",
185 expected("mii++")("mxu==")("miu==")("mxi=+"));
186 test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 2)", "LINESTRING(0 4,0 1)",
187 expected("mix+=")("mxi=+")("mii=+")("mxu=="));
188 // spike - out eq
189 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(0 1,0 4)",
190 expected("mii++")("txx==")("tix==")("mxi=+"));
191 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(0 4,0 1)",
192 expected("mix+=")("txi=+")("tii=+")("mxu=="));
193 // spike - out out/eq
194 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(1 0,0 4)",
195 expected("tux++"));
196 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(-1 0,0 4)",
197 expected("tux++"));
198 // spike - out out/neq
199 test_geometry<ls, ls>("LINESTRING(0 -2,0 0,0 -1)", "LINESTRING(-1 0,1 0)",
200 expected("muu++"));
201 test_geometry<ls, ls>("LINESTRING(0 -2,0 0,0 -1)", "LINESTRING(1 0,-1 0)",
202 expected("muu++"));
203
204
205 test_geometry<ls, ls>("LINESTRING(3 0,0 0)",
206 "LINESTRING(4 2,1 0,9 0)",
207 expected("mui=+")("miu+="));
208
209
210 // 01.02.2015
211 test_geometry<ls, ls>("LINESTRING(6 0,0 0,5 0)",
212 "LINESTRING(2 0,0 0,-10 0)",
213 expected("mii++")("txu==")("tiu==")("mui=+"));
214 // the reversal could be automatic...
215 test_geometry<ls, ls>("LINESTRING(2 0,0 0,-10 0)",
216 "LINESTRING(6 0,0 0,5 0)",
217 expected("mii++")("tux==")("tui==")("miu+="));
218 // sanity check
219 test_geometry<ls, ls>("LINESTRING(6 0,0 0)",
220 "LINESTRING(2 0,0 0,-10 0)",
221 expected("mii++")("txu=="));
222 test_geometry<ls, ls>("LINESTRING(0 0,5 0)",
223 "LINESTRING(2 0,0 0,-10 0)",
224 expected("tiu+=")("mui=+"));
225
226 if ( BOOST_GEOMETRY_CONDITION((std::is_same<T, double>::value)) )
227 {
228 test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)",
229 "LINESTRING(12 10, 12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)",
230 expected("mii++")("ccc==")("mux=="));
231 test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)",
232 "LINESTRING(17.5 0.50051443471392, 15 0, 12.5 -0.50051443471392, 12 10)",
233 expected("miu+=")("mui=+"));
234 test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)",
235 "LINESTRING(12 10, 12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)",
236 expected("mui=+")("mix+="));
237 test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 0)",
238 "LINESTRING(17.5 0.50051443471392, 15 0, 12.5 -0.50051443471392, 12 10)",
239 expected("muu==")("ccc==")("mii++"));
240
241 test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)",
242 "LINESTRING(12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)",
243 expected("mii++")("ccc==")("mux=="));
244 test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)",
245 "LINESTRING(17.5 0.50051443471392, 15 0, 12.5 -0.50051443471392)",
246 expected("mix+=")("mui=+"));
247 test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)",
248 "LINESTRING(12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)",
249 expected("mui=+")("mix+="));
250 test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)",
251 "LINESTRING(17.5 0.50051443471392, 15 0, 12.5 -0.50051443471392)",
252 expected("mux==")("ccc==")("mii++"));
253
254 test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)",
255 "LINESTRING(12 10, 12.5 -0.50051443471392, 15 0)",
256 expected("mii++")("mux=="));
257 test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)",
258 "LINESTRING(15 0, 12.5 -0.50051443471392, 12 10)",
259 expected("miu+=")("mui=+"));
260 test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)",
261 "LINESTRING(12 10, 12.5 -0.50051443471392, 15 0)",
262 expected("mui=+")("mix+="));
263 test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)",
264 "LINESTRING(15 0, 12.5 -0.50051443471392, 12 10)",
265 expected("muu==")("mii++"));
266 }
267
268 // TODO:
269 //test_geometry<ls, ls>("LINESTRING(0 0,2 0,1 0)", "LINESTRING(0 1,0 0,2 0)", "1FF00F102");
270 //test_geometry<ls, ls>("LINESTRING(2 0,0 0,1 0)", "LINESTRING(0 1,0 0,2 0)", "1FF00F102");
271
272 //test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(3 0,3 3,3 1)", "0F1FF0102");
273 //test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(2 0,2 3,2 1)", "0F1FF0102");
274 //test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(2 0,2 2,2 1)", "0F1FF0102");
275
276 //test_geometry<ls, ls>("LINESTRING(0 0,2 2,3 3,4 4)", "LINESTRING(0 0,1 1,4 4)", "1FFF0FFF2");
277
278 // duplicated
279 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0,30 0))",
280 "MULTILINESTRING((0 10,5 0,20 0,20 0,30 0),(2 0,2 0),(3 0,3 0,3 0))",
281 expected("mii++")("ccc==")("ccc==")("txx=="));
282
283 // spike
284 test_geometry<ls, ls>("LINESTRING(2 2,5 -1,15 2,18 0,20 0)",
285 "LINESTRING(30 0,19 0,18 0,0 0)",
286 expected("iuu++")("iuu++")("tiu+=")("mxi=+"));
287 // spike
288 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0,5 0))",
289 "MULTILINESTRING((1 0,8 0,4 0))",
290 expected("mii++")("mix+=")("mux==")("mui==")("mix+=")("mii+=")("mxu==")("mxi=+"));
291
292 /*test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0,5 0))",
293 "MULTILINESTRING((1 0,8 0,4 0),(2 0,9 0,5 0))",
294 expected("mii")("ccc")("ccc")("txx"));*/
295
296 // spike vs endpoint
297 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
298 "MULTILINESTRING((-1 0,0 0,-2 0),(11 0,10 0,12 0))",
299 expected("tuu++")("txu++"));
300 // internal turning R vs spike
301 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
302 "MULTILINESTRING((0 1,1 1,0 1))",
303 expected("tuu++"));
304 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
305 "MULTILINESTRING((1 2,1 1,1 2))",
306 expected("tuu++"));
307 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 0,0 0))",
308 "MULTILINESTRING((2 0,1 0,2 0))",
309 expected("tuu++"));
310 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
311 "MULTILINESTRING((0 2,1 1,0 2))",
312 expected("tuu++"));
313 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
314 "MULTILINESTRING((2 0,1 1,2 0))",
315 expected("tuu++"));
316 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
317 "MULTILINESTRING((2 1,1 1,2 1))",
318 expected("txi=+")("tix+=")("tii+=")("txx=="));
319 // internal turning L vs spike
320 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
321 "MULTILINESTRING((2 1,1 1,2 1))",
322 expected("tuu++"));
323 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
324 "MULTILINESTRING((1 2,1 1,1 2))",
325 expected("tuu++"));
326 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
327 "MULTILINESTRING((2 2,1 1,2 2))",
328 expected("tuu++"));
329 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
330 "MULTILINESTRING((0 0,1 1,0 0))",
331 expected("tuu++"));
332 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
333 "MULTILINESTRING((0 1,1 1,0 1))",
334 expected("txi=+")("tix+=")("tii+=")("txx=="));
335 // spike vs internal turning R
336 test_geometry<mls, mls>("MULTILINESTRING((0 1,1 1,0 1))",
337 "MULTILINESTRING((1 0,1 1,2 1))",
338 expected("tuu++"));
339 test_geometry<mls, mls>("MULTILINESTRING((1 2,1 1,1 2))",
340 "MULTILINESTRING((1 0,1 1,2 1))",
341 expected("tuu++"));
342 test_geometry<mls, mls>("MULTILINESTRING((2 0,1 0,2 0))",
343 "MULTILINESTRING((0 0,1 0,0 0))",
344 expected("tuu++"));
345 test_geometry<mls, mls>("MULTILINESTRING((0 2,1 1,0 2))",
346 "MULTILINESTRING((1 0,1 1,2 1))",
347 expected("tuu++"));
348 test_geometry<mls, mls>("MULTILINESTRING((2 0,1 1,2 0))",
349 "MULTILINESTRING((1 0,1 1,2 1))",
350 expected("tuu++"));
351 test_geometry<mls, mls>("MULTILINESTRING((2 1,1 1,2 1))",
352 "MULTILINESTRING((1 0,1 1,2 1))",
353 expected("tix+=")("txi=+")("tii=+")("txx=="));
354 // spike vs internal turning L
355 test_geometry<mls, mls>("MULTILINESTRING((2 1,1 1,2 1))",
356 "MULTILINESTRING((1 0,1 1,0 1))",
357 expected("tuu++"));
358 test_geometry<mls, mls>("MULTILINESTRING((1 2,1 1,1 2))",
359 "MULTILINESTRING((1 0,1 1,0 1))",
360 expected("tuu++"));
361 test_geometry<mls, mls>("MULTILINESTRING((2 2,1 1,2 2))",
362 "MULTILINESTRING((1 0,1 1,0 1))",
363 expected("tuu++"));
364 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
365 "MULTILINESTRING((1 0,1 1,0 1))",
366 expected("tuu++"));
367 test_geometry<mls, mls>("MULTILINESTRING((0 1,1 1,0 1))",
368 "MULTILINESTRING((1 0,1 1,0 1))",
369 expected("tix+=")("txi=+")("tii=+")("txx=="));
370 // spike vs internal collinear
371 test_geometry<mls, mls>("MULTILINESTRING((0 1,1 1,0 1))",
372 "MULTILINESTRING((2 1,1 1,0 1))",
373 expected("tix+=")("txi=+")("tii=+")("txx=="));
374 // internal collinear vs spike
375 test_geometry<mls, mls>("MULTILINESTRING((2 1,1 1,0 1))",
376 "MULTILINESTRING((0 1,1 1,0 1))",
377 expected("txi=+")("tix+=")("tii+=")("txx=="));
378 // spike vs spike
379 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
380 "MULTILINESTRING((2 2,1 1,2 2))",
381 expected("tuu++"));
382 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
383 "MULTILINESTRING((2 0,1 1,2 0))",
384 expected("tuu++"));
385 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
386 "MULTILINESTRING((2 1,1 1,2 1))",
387 expected("tuu++"));
388 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
389 "MULTILINESTRING((0 1,1 1,0 1))",
390 expected("tuu++"));
391 // collinear spikes
392 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
393 "MULTILINESTRING((0 0,1 1,0 0))",
394 expected("tii++")("tix+=")("txi=+")("txx==")
395 ("ecc=="));
396 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
397 "MULTILINESTRING((1 1,0 0,1 1))",
398 expected("tix+=")("tii+=")("txx==")("txi==")
399 ("txi=+")("tii=+")("txx==")("tix=="));
400 // non-spike similar
401 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
402 "MULTILINESTRING((-1 0,0 0,2 0))",
403 expected("tii++")("mux=="));
404 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
405 "MULTILINESTRING((-1 -1,0 0,2 0))",
406 expected("tii++")("mux=="));
407 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
408 "MULTILINESTRING((2 0,0 0,-1 0))",
409 expected("tiu+=")("mui=+"));
410 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
411 "MULTILINESTRING((2 0,0 0,-1 -1))",
412 expected("tiu+=")("mui=+"));
413 }
414
415 int test_main(int, char* [])
416 {
417 test_all<float>();
418 test_all<double>();
419
420 #if ! defined(_MSC_VER)
421 test_all<long double>();
422 #endif
423
424 return 0;
425 }