Branch data Line data Source code
1 : : // ----------------- BEGIN LICENSE BLOCK ---------------------------------
2 : : //
3 : : // Copyright (C) 2018-2021 Intel Corporation
4 : : //
5 : : // SPDX-License-Identifier: MIT
6 : : //
7 : : // ----------------- END LICENSE BLOCK -----------------------------------
8 : :
9 : : #include <ad/map/landmark/LandmarkOperation.hpp>
10 : : #include <ad/map/lane/LaneOperation.hpp>
11 : : #include "KnownTrafficSigns.hpp"
12 : : #include "LandmarkTestBase.hpp"
13 : :
14 : : struct TrafficSignTests : public LandmarkTestBase
15 : : {
16 : : };
17 : :
18 : 2 : TEST_F(TrafficSignTests, generate_traffic_signs)
19 : : {
20 [ + - ]: 2 : access::Factory factory(access::getStore());
21 : :
22 [ + + ]: 74 : for (std::size_t signIndex = 0u; signIndex < landmark::knownTrafficSigns.size(); ++signIndex)
23 : : {
24 : 73 : landmark::LandmarkId landmarkId(100 + signIndex);
25 : : ECEFPoint position
26 : 73 : = createECEFPoint(8.44 + static_cast<double>(signIndex) * 0.000002, 49.000002, 115.); // approx. every 2 meter
27 : 73 : ECEFPoint orientation = createECEFPoint(8.4399 + static_cast<double>(signIndex) * 0.000002, 49.000002, 115.);
28 [ + - ]: 146 : ECEFEdge boundingBoxGeometry{position, orientation};
29 [ + - ]: 146 : Geometry bounding_box = createGeometry(boundingBoxGeometry, true);
30 [ + - + - : 73 : EXPECT_TRUE(factory.addTrafficSign(mPartitionId,
- + - - -
- - - -
- ]
31 : : landmarkId,
32 : : landmark::knownTrafficSigns[signIndex],
33 : : position,
34 : : orientation,
35 : : bounding_box,
36 : : std::to_string(signIndex)));
37 [ + - - + : 73 : EXPECT_TRUE(factory.add(mLaneId, landmarkId));
- - - - -
- - - ]
38 : : }
39 : :
40 [ + - + - : 1 : EXPECT_EQ(landmark::getLandmarks().size(), landmark::knownTrafficSigns.size());
- + - - -
- - - ]
41 [ + - + - : 2 : EXPECT_EQ(lane::getLanes().front(), mLaneId);
- + - - -
- - - ]
42 [ + - + - ]: 2 : auto lane = lane::getLane(mLaneId);
43 [ + - - + : 1 : EXPECT_EQ(lane.visibleLandmarks.size(), 73u);
- - - - -
- ]
44 [ + - - + : 1 : EXPECT_EQ(lane.visibleLandmarks.front(), landmark::LandmarkId(100));
- - - - -
- ]
45 : :
46 : : // write the map
47 : 1 : size_t version_major = 0;
48 : 1 : size_t version_minor = 0;
49 [ + - ]: 2 : serialize::SerializerFileCRC32 serializer(true);
50 [ + - + - ]: 1 : serializer.open("test_files/test_traffic_signs.adm", version_major, version_minor);
51 [ + - + - ]: 1 : access::getStore().save(serializer);
52 [ + - ]: 1 : serializer.close();
53 : 1 : }
|