Branch data Line data Source code
1 : : // ----------------- BEGIN LICENSE BLOCK ---------------------------------
2 : : //
3 : : // Copyright (C) 2019-2021 Intel Corporation
4 : : //
5 : : // SPDX-License-Identifier: LGPL-2.1-only
6 : : //
7 : : // ----------------- END LICENSE BLOCK -----------------------------------
8 : :
9 : : #include <ad/rss/map/test_support/RssWorldModelCreationTest.hpp>
10 : :
11 : : struct RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East
12 : : : public ad::rss::map::test_support::RssWorldModelCreationTestWithRoute
13 : : {
14 : : /*
15 : : * | O0 |
16 : : * | |
17 : : * | |
18 : : * | O1 |___________
19 : : * |
20 : : * |
21 : : * | O2
22 : : * | E2 E3/O3 E4/O4
23 : : * | ____________
24 : : * | E1 |
25 : : * | |
26 : : * | |
27 : : * | E0 |
28 : : */
29 : : };
30 : :
31 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e0_o0)
32 : : {
33 [ + - + - ]: 4 : performConstellationTest(
34 [ + - ]: 1 : locationSouthIncoming(),
35 [ + - ]: 2 : locationNorthIncoming(),
36 : : std::initializer_list<ExpectedResultTuple>{
37 : : // in case the other turns left
38 : 0 : std::make_tuple(
39 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionEgoHasPriority, 2u, 2u, ::ad::physics::Speed(15.2778)),
40 : : // in case the other drives straight
41 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 4u, 0u, ::ad::physics::Speed(15.2778))});
42 : 1 : }
43 : :
44 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e0_o1)
45 : : {
46 [ + - + - ]: 4 : performConstellationTest(
47 [ + - ]: 1 : locationSouthIncoming(),
48 [ + - ]: 2 : locationNorthEntering(),
49 : : std::initializer_list<ExpectedResultTuple>{
50 : : // in case the other turns left
51 : 0 : std::make_tuple(
52 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionEgoHasPriority, 2u, 2u, ::ad::physics::Speed(15.2778)),
53 : : // in case the other drives straight
54 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 3u, 0u, ::ad::physics::Speed(15.2778))});
55 : 1 : }
56 : :
57 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e0_o2)
58 : : {
59 [ + - + - ]: 4 : performConstellationTest(
60 [ + - ]: 1 : locationSouthIncoming(),
61 [ + - ]: 2 : locationNorth2East(),
62 : : std::initializer_list<ExpectedResultTuple>{
63 : : // in case the other turns left
64 : 0 : std::make_tuple(
65 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionEgoHasPriority, 2u, 1u, ::ad::physics::Speed(15.2778)),
66 : : // in case the other drives straight
67 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778))});
68 : 1 : }
69 : :
70 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e0_o3)
71 : : {
72 [ + - + - ]: 3 : performConstellationTest(
73 [ + - ]: 1 : locationSouthIncoming(),
74 [ + - ]: 2 : locationEastExiting(),
75 : : std::initializer_list<ExpectedResultTuple>{
76 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 2u, 0u, ::ad::physics::Speed(15.2778))});
77 : 1 : }
78 : :
79 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e0_o4)
80 : : {
81 [ + - + - ]: 3 : performConstellationTest(
82 [ + - ]: 1 : locationSouthIncoming(),
83 [ + - ]: 2 : locationEastOutgoing(),
84 : : std::initializer_list<ExpectedResultTuple>{
85 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 3u, 0u, ::ad::physics::Speed(15.2778))});
86 : 1 : }
87 : :
88 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e1_o0)
89 : : {
90 [ + - + - ]: 4 : performConstellationTest(
91 [ + - ]: 1 : locationSouthEntering(),
92 [ + - ]: 2 : locationNorthIncoming(),
93 : : std::initializer_list<ExpectedResultTuple>{
94 : : // in case the other turns left
95 : 0 : std::make_tuple(
96 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionEgoHasPriority, 2u, 2u, ::ad::physics::Speed(15.2778)),
97 : : // in case the other drives straight
98 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 3u, 0u, ::ad::physics::Speed(15.2778))});
99 : 1 : }
100 : :
101 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e1_o1)
102 : : {
103 [ + - + - ]: 4 : performConstellationTest(
104 [ + - ]: 1 : locationSouthEntering(),
105 [ + - ]: 2 : locationNorthEntering(),
106 : : std::initializer_list<ExpectedResultTuple>{
107 : : // in case the other turns left
108 : 0 : std::make_tuple(
109 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionEgoHasPriority, 2u, 2u, ::ad::physics::Speed(15.2778)),
110 : : // in case the other drives straight
111 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778))});
112 : 1 : }
113 : :
114 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e1_o2)
115 : : {
116 [ + - + - ]: 4 : performConstellationTest(
117 [ + - ]: 1 : locationSouthEntering(),
118 [ + - ]: 2 : locationNorth2East(),
119 : : std::initializer_list<ExpectedResultTuple>{
120 : : // in case the other turns left
121 : 0 : std::make_tuple(
122 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionEgoHasPriority, 2u, 1u, ::ad::physics::Speed(15.2778)),
123 : : // in case the other drives straight
124 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778))});
125 : 1 : }
126 : :
127 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e1_o3)
128 : : {
129 [ + - + - ]: 3 : performConstellationTest(
130 [ + - ]: 1 : locationSouthEntering(),
131 [ + - ]: 2 : locationEastExiting(),
132 : : std::initializer_list<ExpectedResultTuple>{
133 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 1u, 0u, ::ad::physics::Speed(15.2778))});
134 : 1 : }
135 : :
136 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e1_o4)
137 : : {
138 [ + - + - ]: 3 : performConstellationTest(
139 [ + - ]: 1 : locationSouthEntering(),
140 [ + - ]: 2 : locationEastOutgoing(),
141 : : std::initializer_list<ExpectedResultTuple>{
142 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 2u, 0u, ::ad::physics::Speed(15.2778))});
143 : 1 : }
144 : :
145 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e2_o0)
146 : : {
147 [ + - + - ]: 4 : performConstellationTest(
148 [ + - ]: 1 : locationSouth2East(),
149 [ + - ]: 2 : locationNorthIncoming(),
150 : : std::initializer_list<ExpectedResultTuple>{
151 : : // in case the other turns left
152 : 0 : std::make_tuple(
153 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionEgoHasPriority, 2u, 2u, ::ad::physics::Speed(15.2778)),
154 : : // in case the other drives straight
155 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 3u, 0u, ::ad::physics::Speed(15.2778))});
156 : 1 : }
157 : :
158 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e2_o1)
159 : : {
160 [ + - + - ]: 4 : performConstellationTest(
161 [ + - ]: 1 : locationSouth2East(),
162 [ + - ]: 2 : locationNorthEntering(),
163 : : std::initializer_list<ExpectedResultTuple>{
164 : : // in case the other turns left
165 : 0 : std::make_tuple(
166 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionEgoHasPriority, 2u, 2u, ::ad::physics::Speed(15.2778)),
167 : : // in case the other drives straight
168 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778))});
169 : 1 : }
170 : :
171 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e2_o2)
172 : : {
173 [ + - + - ]: 4 : performConstellationTest(
174 [ + - ]: 1 : locationSouth2East(),
175 [ + - ]: 2 : locationNorth2East(),
176 : : std::initializer_list<ExpectedResultTuple>{
177 : : // in case the other turns left
178 : 0 : std::make_tuple(
179 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionEgoHasPriority, 2u, 1u, ::ad::physics::Speed(15.2778)),
180 : : // in case the other drives straight
181 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778))});
182 : 1 : }
183 : :
184 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e2_o3)
185 : : {
186 [ + - + - ]: 3 : performConstellationTest(
187 [ + - ]: 1 : locationSouth2East(),
188 [ + - ]: 2 : locationEastExiting(),
189 : : std::initializer_list<ExpectedResultTuple>{
190 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 1u, 0u, ::ad::physics::Speed(15.2778))});
191 : 1 : }
192 : :
193 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e2_o4)
194 : : {
195 [ + - + - ]: 3 : performConstellationTest(
196 [ + - ]: 1 : locationSouth2East(),
197 [ + - ]: 2 : locationEastOutgoing(),
198 : : std::initializer_list<ExpectedResultTuple>{
199 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 2u, 0u, ::ad::physics::Speed(15.2778))});
200 : 1 : }
201 : :
202 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e3_o0)
203 : : {
204 [ + - + - ]: 3 : performConstellationTest(
205 [ + - ]: 1 : locationEastExiting(),
206 [ + - ]: 2 : locationNorthIncoming(),
207 : : std::initializer_list<ExpectedResultTuple>{
208 : : // the other is behind us when turning left leading to same direction case
209 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 2u, 0u, ::ad::physics::Speed(15.2778))});
210 : 1 : }
211 : :
212 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e3_o1)
213 : : {
214 [ + - + - ]: 3 : performConstellationTest(
215 [ + - ]: 1 : locationEastExiting(),
216 [ + - ]: 2 : locationNorthEntering(),
217 : : std::initializer_list<ExpectedResultTuple>{
218 : : // the other is behind us when turning left leading to same direction case
219 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 1u, 0u, ::ad::physics::Speed(15.2778))});
220 : 1 : }
221 : :
222 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e3_o2)
223 : : {
224 [ + - + - ]: 4 : performConstellationTest(
225 [ + - ]: 1 : locationEastExiting(),
226 [ + - ]: 2 : locationNorth2East(),
227 : : // other behind, potentially following us
228 : : std::initializer_list<ExpectedResultTuple>{
229 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 1u, 0u, ::ad::physics::Speed(15.27786)),
230 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 1u, 0u, ::ad::physics::Speed(15.27786))});
231 : 1 : }
232 : :
233 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e3_o3)
234 : : {
235 [ + - + - ]: 7 : performConstellationTest(
236 [ + - ]: 1 : locationEastExiting(),
237 [ + - ]: 2 : locationEastExiting(),
238 : : std::initializer_list<ExpectedResultTuple>{
239 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 1u, 0u, ::ad::physics::Speed(12.2936)),
240 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 1u, 0u, ::ad::physics::Speed(15.27786)),
241 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 1u, 0u, ::ad::physics::Speed(15.27786)),
242 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 2u, 0u, ::ad::physics::Speed(15.27786)),
243 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 2u, 0u, ::ad::physics::Speed(15.27786))});
244 : 1 : }
245 : :
246 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e3_o4)
247 : : {
248 [ + - + - ]: 3 : performConstellationTest(
249 [ + - ]: 1 : locationEastExiting(),
250 [ + - ]: 2 : locationEastOutgoing(),
251 : : std::initializer_list<ExpectedResultTuple>{
252 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 1u, 0u, ::ad::physics::Speed(12.2936))});
253 : 1 : }
254 : :
255 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e4_o0)
256 : : {
257 [ + - + - ]: 3 : performConstellationTest(
258 [ + - ]: 1 : locationEastOutgoing(),
259 [ + - ]: 2 : locationNorthIncoming(),
260 : : // other behind, potentially following us
261 : : std::initializer_list<ExpectedResultTuple>{
262 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 3u, 0u, ::ad::physics::Speed(15.27786))});
263 : 1 : }
264 : :
265 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e4_o1)
266 : : {
267 [ + - + - ]: 3 : performConstellationTest(
268 [ + - ]: 1 : locationEastOutgoing(),
269 [ + - ]: 2 : locationNorthEntering(),
270 : : std::initializer_list<ExpectedResultTuple>{
271 : : // the other is behind us when turning left leading to same direction case
272 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 2u, 0u, ::ad::physics::Speed(15.2778))});
273 : 1 : }
274 : :
275 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e4_o2)
276 : : {
277 [ + - + - ]: 4 : performConstellationTest(
278 [ + - ]: 1 : locationEastOutgoing(),
279 [ + - ]: 2 : locationNorth2East(),
280 : : // other behind, potentially following us
281 : : std::initializer_list<ExpectedResultTuple>{
282 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 2u, 0u, ::ad::physics::Speed(15.27786)),
283 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 2u, 0u, ::ad::physics::Speed(15.27786))});
284 : 1 : }
285 : :
286 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e4_o3)
287 : : {
288 [ + - + - ]: 3 : performConstellationTest(
289 [ + - ]: 1 : locationEastOutgoing(),
290 [ + - ]: 2 : locationEastExiting(),
291 : : // other behind, potentially following us
292 : : std::initializer_list<ExpectedResultTuple>{
293 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 1u, 0u, ::ad::physics::Speed(12.2936))});
294 : 1 : }
295 : :
296 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherNorth2East, e4_o4)
297 : : {
298 [ + - + - ]: 3 : performConstellationTest(
299 [ + - ]: 1 : locationEastOutgoing(),
300 [ + - ]: 2 : locationEastOutgoing(),
301 : : // same position
302 : : std::initializer_list<ExpectedResultTuple>{
303 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::SameDirection, 1u, 0u, ::ad::physics::Speed(12.2936))});
304 : 1 : }
305 : :
306 : : struct RssWorldModelCreationTestWithoutRouteEgoSouth2EastOtherNorth2East
307 : : : public ad::rss::map::test_support::RssWorldModelCreationTestWithoutRoute
308 : : {
309 : : /*
310 : : * | O0 |
311 : : * | |
312 : : * | |
313 : : * | O1 |___________
314 : : * |
315 : : * |
316 : : * | O2
317 : : * | E2 E3/O3 E4/O4
318 : : * | ____________
319 : : * | E1 |
320 : : * | |
321 : : * | |
322 : : * | E0 |
323 : : */
324 : : };
325 : :
326 : 4 : TEST_F(RssWorldModelCreationTestWithoutRouteEgoSouth2EastOtherNorth2East, e0_o0)
327 : : {
328 [ + - + - ]: 6 : performConstellationTest(
329 [ + - ]: 1 : locationSouthIncoming(),
330 [ + - ]: 2 : locationNorthIncoming(),
331 : : // here we get 2 object predictions and 2 ego predictions
332 : : std::initializer_list<ExpectedResultTuple>{
333 : : // ego-turn-right: other-turn-left
334 : 0 : std::make_tuple(
335 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionEgoHasPriority, 2u, 2u, ::ad::physics::Speed(100.)),
336 : : // ego-turn-right: other-straight
337 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 4u, 0u, ::ad::physics::Speed(100.)),
338 : : // ego-straight: other-turn-left
339 : 0 : std::make_tuple(
340 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionEgoHasPriority, 3u, 2u, ::ad::physics::Speed(100.)),
341 : : // ego-straight: other-straight
342 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 4u, 0u, ::ad::physics::Speed(100.))});
343 : 1 : }
344 : :
345 : 4 : TEST_F(RssWorldModelCreationTestWithoutRouteEgoSouth2EastOtherNorth2East, e2_o0)
346 : : {
347 [ + - + - ]: 6 : performConstellationTest(
348 [ + - ]: 1 : locationSouth2East(),
349 [ + - ]: 2 : locationNorthIncoming(),
350 : : // here we get 2 object predictions and 2 ego predictions
351 : : std::initializer_list<ExpectedResultTuple>{
352 : : // ego-turn-right: other-turn-left
353 : 0 : std::make_tuple(
354 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionEgoHasPriority, 1u, 2u, ::ad::physics::Speed(100.)),
355 : : // ego-turn-right: other-straight
356 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 3u, 0u, ::ad::physics::Speed(100.)),
357 : : // ego-straight: other-turn-left
358 : 0 : std::make_tuple(
359 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionEgoHasPriority, 2u, 2u, ::ad::physics::Speed(100.)),
360 : : // ego-straight: other-straight
361 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 3u, 0u, ::ad::physics::Speed(100.))});
362 : 1 : }
363 : :
364 : 4 : TEST_F(RssWorldModelCreationTestWithoutRouteEgoSouth2EastOtherNorth2East, e0_o4)
365 : : {
366 [ + - + - : 3 : performConstellationTest(locationSouthIncoming(),
+ - ]
367 [ + - ]: 2 : locationEastOutgoing(),
368 : 0 : std::initializer_list<ExpectedResultTuple>{std::make_tuple(
369 [ + - ]: 2 : ::ad::rss::world::ConstellationType::SameDirection, 3u, 0u, ::ad::physics::Speed(100.))});
370 : 1 : }
371 : :
372 : : //@TODO fill in between steps of RssWorldModelCreationTestWithoutRouteEgoSouth2EastOtherNorth2East
|