Branch data Line data Source code
1 : : /*
2 : : * ----------------- BEGIN LICENSE BLOCK ---------------------------------
3 : : *
4 : : * Copyright (C) 2018-2021 Intel Corporation
5 : : *
6 : : * SPDX-License-Identifier: MIT
7 : : *
8 : : * ----------------- END LICENSE BLOCK -----------------------------------
9 : : */
10 : :
11 : : /*
12 : : * Generated file
13 : : */
14 : :
15 : : #if defined(__clang__) && (__clang_major__ >= 7)
16 : : #pragma GCC diagnostic push
17 : : #pragma GCC diagnostic ignored "-Wself-assign-overloaded"
18 : : #endif
19 : :
20 : : #include <gtest/gtest.h>
21 : : #include <limits>
22 : : #include "ad/map/landmark/TrafficLightType.hpp"
23 : :
24 : 2 : TEST(TrafficLightTypeTests, testFromString)
25 : : {
26 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("INVALID"),
+ - - + -
- - - -
- ]
27 : : ::ad::map::landmark::TrafficLightType::INVALID);
28 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("::ad::map::landmark::TrafficLightType::INVALID"),
+ - - + -
- - - -
- ]
29 : : ::ad::map::landmark::TrafficLightType::INVALID);
30 : :
31 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("UNKNOWN"),
+ - - + -
- - - -
- ]
32 : : ::ad::map::landmark::TrafficLightType::UNKNOWN);
33 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("::ad::map::landmark::TrafficLightType::UNKNOWN"),
+ - - + -
- - - -
- ]
34 : : ::ad::map::landmark::TrafficLightType::UNKNOWN);
35 : :
36 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("SOLID_RED_YELLOW"),
+ - - + -
- - - -
- ]
37 : : ::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW);
38 [ + - + - : 1 : ASSERT_EQ(
+ - - + -
- - - -
- ]
39 : : fromString<::ad::map::landmark::TrafficLightType>("::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW"),
40 : : ::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW);
41 : :
42 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("SOLID_RED_YELLOW_GREEN"),
+ - - + -
- - - -
- ]
43 : : ::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW_GREEN);
44 [ + - + - : 1 : ASSERT_EQ(
+ - - + -
- - - -
- ]
45 : : fromString<::ad::map::landmark::TrafficLightType>("::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW_GREEN"),
46 : : ::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW_GREEN);
47 : :
48 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("LEFT_RED_YELLOW_GREEN"),
+ - - + -
- - - -
- ]
49 : : ::ad::map::landmark::TrafficLightType::LEFT_RED_YELLOW_GREEN);
50 [ + - + - : 1 : ASSERT_EQ(
+ - - + -
- - - -
- ]
51 : : fromString<::ad::map::landmark::TrafficLightType>("::ad::map::landmark::TrafficLightType::LEFT_RED_YELLOW_GREEN"),
52 : : ::ad::map::landmark::TrafficLightType::LEFT_RED_YELLOW_GREEN);
53 : :
54 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("RIGHT_RED_YELLOW_GREEN"),
+ - - + -
- - - -
- ]
55 : : ::ad::map::landmark::TrafficLightType::RIGHT_RED_YELLOW_GREEN);
56 [ + - + - : 1 : ASSERT_EQ(
+ - - + -
- - - -
- ]
57 : : fromString<::ad::map::landmark::TrafficLightType>("::ad::map::landmark::TrafficLightType::RIGHT_RED_YELLOW_GREEN"),
58 : : ::ad::map::landmark::TrafficLightType::RIGHT_RED_YELLOW_GREEN);
59 : :
60 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("STRAIGHT_RED_YELLOW_GREEN"),
+ - - + -
- - - -
- ]
61 : : ::ad::map::landmark::TrafficLightType::STRAIGHT_RED_YELLOW_GREEN);
62 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>(
+ - - + -
- - - -
- ]
63 : : "::ad::map::landmark::TrafficLightType::STRAIGHT_RED_YELLOW_GREEN"),
64 : : ::ad::map::landmark::TrafficLightType::STRAIGHT_RED_YELLOW_GREEN);
65 : :
66 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("LEFT_STRAIGHT_RED_YELLOW_GREEN"),
+ - - + -
- - - -
- ]
67 : : ::ad::map::landmark::TrafficLightType::LEFT_STRAIGHT_RED_YELLOW_GREEN);
68 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>(
+ - - + -
- - - -
- ]
69 : : "::ad::map::landmark::TrafficLightType::LEFT_STRAIGHT_RED_YELLOW_GREEN"),
70 : : ::ad::map::landmark::TrafficLightType::LEFT_STRAIGHT_RED_YELLOW_GREEN);
71 : :
72 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("RIGHT_STRAIGHT_RED_YELLOW_GREEN"),
+ - - + -
- - - -
- ]
73 : : ::ad::map::landmark::TrafficLightType::RIGHT_STRAIGHT_RED_YELLOW_GREEN);
74 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>(
+ - - + -
- - - -
- ]
75 : : "::ad::map::landmark::TrafficLightType::RIGHT_STRAIGHT_RED_YELLOW_GREEN"),
76 : : ::ad::map::landmark::TrafficLightType::RIGHT_STRAIGHT_RED_YELLOW_GREEN);
77 : :
78 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("PEDESTRIAN_RED_GREEN"),
+ - - + -
- - - -
- ]
79 : : ::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_GREEN);
80 [ + - + - : 1 : ASSERT_EQ(
+ - - + -
- - - -
- ]
81 : : fromString<::ad::map::landmark::TrafficLightType>("::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_GREEN"),
82 : : ::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_GREEN);
83 : :
84 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("BIKE_RED_GREEN"),
+ - - + -
- - - -
- ]
85 : : ::ad::map::landmark::TrafficLightType::BIKE_RED_GREEN);
86 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("::ad::map::landmark::TrafficLightType::BIKE_RED_GREEN"),
+ - - + -
- - - -
- ]
87 : : ::ad::map::landmark::TrafficLightType::BIKE_RED_GREEN);
88 : :
89 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("BIKE_PEDESTRIAN_RED_GREEN"),
+ - - + -
- - - -
- ]
90 : : ::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_GREEN);
91 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>(
+ - - + -
- - - -
- ]
92 : : "::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_GREEN"),
93 : : ::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_GREEN);
94 : :
95 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("PEDESTRIAN_RED_YELLOW_GREEN"),
+ - - + -
- - - -
- ]
96 : : ::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_YELLOW_GREEN);
97 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>(
+ - - + -
- - - -
- ]
98 : : "::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_YELLOW_GREEN"),
99 : : ::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_YELLOW_GREEN);
100 : :
101 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("BIKE_RED_YELLOW_GREEN"),
+ - - + -
- - - -
- ]
102 : : ::ad::map::landmark::TrafficLightType::BIKE_RED_YELLOW_GREEN);
103 [ + - + - : 1 : ASSERT_EQ(
+ - - + -
- - - -
- ]
104 : : fromString<::ad::map::landmark::TrafficLightType>("::ad::map::landmark::TrafficLightType::BIKE_RED_YELLOW_GREEN"),
105 : : ::ad::map::landmark::TrafficLightType::BIKE_RED_YELLOW_GREEN);
106 : :
107 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>("BIKE_PEDESTRIAN_RED_YELLOW_GREEN"),
+ - - + -
- - - -
- ]
108 : : ::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_YELLOW_GREEN);
109 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::landmark::TrafficLightType>(
+ - - + -
- - - -
- ]
110 : : "::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_YELLOW_GREEN"),
111 : : ::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_YELLOW_GREEN);
112 : :
113 [ + - + - : 4 : EXPECT_ANY_THROW({ fromString<::ad::map::landmark::TrafficLightType>("NOT A VALID ENUM LITERAL"); });
+ - + - -
+ - + - -
- - ]
114 : : }
115 : :
116 : 2 : TEST(TrafficLightTypeTests, testToString)
117 : : {
118 : 1 : int32_t minValue = std::numeric_limits<int32_t>::max();
119 : 1 : int32_t maxValue = std::numeric_limits<int32_t>::min();
120 : :
121 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::INVALID), "::ad::map::landmark::TrafficLightType::INVALID");
- + - - -
- - - ]
122 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::INVALID));
123 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::INVALID));
124 : :
125 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::UNKNOWN), "::ad::map::landmark::TrafficLightType::UNKNOWN");
- + - - -
- - - ]
126 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::UNKNOWN));
127 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::UNKNOWN));
128 : :
129 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW),
- + - - -
- - - ]
130 : : "::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW");
131 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW));
132 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW));
133 : :
134 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW_GREEN),
- + - - -
- - - ]
135 : : "::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW_GREEN");
136 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW_GREEN));
137 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW_GREEN));
138 : :
139 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::LEFT_RED_YELLOW_GREEN),
- + - - -
- - - ]
140 : : "::ad::map::landmark::TrafficLightType::LEFT_RED_YELLOW_GREEN");
141 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::LEFT_RED_YELLOW_GREEN));
142 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::LEFT_RED_YELLOW_GREEN));
143 : :
144 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::RIGHT_RED_YELLOW_GREEN),
- + - - -
- - - ]
145 : : "::ad::map::landmark::TrafficLightType::RIGHT_RED_YELLOW_GREEN");
146 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::RIGHT_RED_YELLOW_GREEN));
147 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::RIGHT_RED_YELLOW_GREEN));
148 : :
149 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::STRAIGHT_RED_YELLOW_GREEN),
- + - - -
- - - ]
150 : : "::ad::map::landmark::TrafficLightType::STRAIGHT_RED_YELLOW_GREEN");
151 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::STRAIGHT_RED_YELLOW_GREEN));
152 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::STRAIGHT_RED_YELLOW_GREEN));
153 : :
154 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::LEFT_STRAIGHT_RED_YELLOW_GREEN),
- + - - -
- - - ]
155 : : "::ad::map::landmark::TrafficLightType::LEFT_STRAIGHT_RED_YELLOW_GREEN");
156 : : minValue
157 : 1 : = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::LEFT_STRAIGHT_RED_YELLOW_GREEN));
158 : : maxValue
159 : 1 : = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::LEFT_STRAIGHT_RED_YELLOW_GREEN));
160 : :
161 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::RIGHT_STRAIGHT_RED_YELLOW_GREEN),
- + - - -
- - - ]
162 : : "::ad::map::landmark::TrafficLightType::RIGHT_STRAIGHT_RED_YELLOW_GREEN");
163 : : minValue
164 : 1 : = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::RIGHT_STRAIGHT_RED_YELLOW_GREEN));
165 : : maxValue
166 : 1 : = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::RIGHT_STRAIGHT_RED_YELLOW_GREEN));
167 : :
168 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_GREEN),
- + - - -
- - - ]
169 : : "::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_GREEN");
170 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_GREEN));
171 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_GREEN));
172 : :
173 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::BIKE_RED_GREEN),
- + - - -
- - - ]
174 : : "::ad::map::landmark::TrafficLightType::BIKE_RED_GREEN");
175 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::BIKE_RED_GREEN));
176 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::BIKE_RED_GREEN));
177 : :
178 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_GREEN),
- + - - -
- - - ]
179 : : "::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_GREEN");
180 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_GREEN));
181 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_GREEN));
182 : :
183 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_YELLOW_GREEN),
- + - - -
- - - ]
184 : : "::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_YELLOW_GREEN");
185 : : minValue
186 : 1 : = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_YELLOW_GREEN));
187 : : maxValue
188 : 1 : = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_YELLOW_GREEN));
189 : :
190 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::BIKE_RED_YELLOW_GREEN),
- + - - -
- - - ]
191 : : "::ad::map::landmark::TrafficLightType::BIKE_RED_YELLOW_GREEN");
192 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::BIKE_RED_YELLOW_GREEN));
193 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::BIKE_RED_YELLOW_GREEN));
194 : :
195 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_YELLOW_GREEN),
- + - - -
- - - ]
196 : : "::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_YELLOW_GREEN");
197 : : minValue
198 : 1 : = std::min(minValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_YELLOW_GREEN));
199 : : maxValue
200 : 1 : = std::max(maxValue, static_cast<int32_t>(::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_YELLOW_GREEN));
201 : :
202 [ + - + - : 2 : ASSERT_EQ(toString(static_cast<::ad::map::landmark::TrafficLightType>(minValue - 1)), "UNKNOWN ENUM VALUE");
- + - - -
- - - ]
203 [ + - + - : 2 : ASSERT_EQ(toString(static_cast<::ad::map::landmark::TrafficLightType>(maxValue + 1)), "UNKNOWN ENUM VALUE");
- + - - -
- - - ]
204 : : }
205 : :
206 : 2 : TEST(TrafficLightTypeTests, ostreamOperatorTest)
207 : : {
208 [ + - ]: 1 : std::stringstream stream;
209 : 1 : ::ad::map::landmark::TrafficLightType value(::ad::map::landmark::TrafficLightType::INVALID);
210 [ + - ]: 1 : stream << value;
211 [ + - + - : 1 : ASSERT_GT(stream.str().size(), 0u);
- + - - -
- - - ]
212 : : }
213 : :
214 : : #if defined(__clang__) && (__clang_major__ >= 7)
215 : : #pragma GCC diagnostic pop
216 : : #endif
|