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/route/RouteCreationMode.hpp"
23 : :
24 : 2 : TEST(RouteCreationModeTests, testFromString)
25 : : {
26 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::route::RouteCreationMode>("Undefined"),
+ - - + -
- - - -
- ]
27 : : ::ad::map::route::RouteCreationMode::Undefined);
28 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::route::RouteCreationMode>("::ad::map::route::RouteCreationMode::Undefined"),
+ - - + -
- - - -
- ]
29 : : ::ad::map::route::RouteCreationMode::Undefined);
30 : :
31 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::route::RouteCreationMode>("SameDrivingDirection"),
+ - - + -
- - - -
- ]
32 : : ::ad::map::route::RouteCreationMode::SameDrivingDirection);
33 [ + - + - : 1 : ASSERT_EQ(
+ - - + -
- - - -
- ]
34 : : fromString<::ad::map::route::RouteCreationMode>("::ad::map::route::RouteCreationMode::SameDrivingDirection"),
35 : : ::ad::map::route::RouteCreationMode::SameDrivingDirection);
36 : :
37 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::route::RouteCreationMode>("AllRoutableLanes"),
+ - - + -
- - - -
- ]
38 : : ::ad::map::route::RouteCreationMode::AllRoutableLanes);
39 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::route::RouteCreationMode>("::ad::map::route::RouteCreationMode::AllRoutableLanes"),
+ - - + -
- - - -
- ]
40 : : ::ad::map::route::RouteCreationMode::AllRoutableLanes);
41 : :
42 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::route::RouteCreationMode>("AllNeighborLanes"),
+ - - + -
- - - -
- ]
43 : : ::ad::map::route::RouteCreationMode::AllNeighborLanes);
44 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::route::RouteCreationMode>("::ad::map::route::RouteCreationMode::AllNeighborLanes"),
+ - - + -
- - - -
- ]
45 : : ::ad::map::route::RouteCreationMode::AllNeighborLanes);
46 : :
47 [ + - + - : 4 : EXPECT_ANY_THROW({ fromString<::ad::map::route::RouteCreationMode>("NOT A VALID ENUM LITERAL"); });
+ - + - -
+ - + - -
- - ]
48 : : }
49 : :
50 : 2 : TEST(RouteCreationModeTests, testToString)
51 : : {
52 : 1 : int32_t minValue = std::numeric_limits<int32_t>::max();
53 : 1 : int32_t maxValue = std::numeric_limits<int32_t>::min();
54 : :
55 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::route::RouteCreationMode::Undefined), "::ad::map::route::RouteCreationMode::Undefined");
- + - - -
- - - ]
56 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::route::RouteCreationMode::Undefined));
57 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::route::RouteCreationMode::Undefined));
58 : :
59 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::route::RouteCreationMode::SameDrivingDirection),
- + - - -
- - - ]
60 : : "::ad::map::route::RouteCreationMode::SameDrivingDirection");
61 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::route::RouteCreationMode::SameDrivingDirection));
62 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::route::RouteCreationMode::SameDrivingDirection));
63 : :
64 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::route::RouteCreationMode::AllRoutableLanes),
- + - - -
- - - ]
65 : : "::ad::map::route::RouteCreationMode::AllRoutableLanes");
66 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::route::RouteCreationMode::AllRoutableLanes));
67 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::route::RouteCreationMode::AllRoutableLanes));
68 : :
69 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::route::RouteCreationMode::AllNeighborLanes),
- + - - -
- - - ]
70 : : "::ad::map::route::RouteCreationMode::AllNeighborLanes");
71 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::route::RouteCreationMode::AllNeighborLanes));
72 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::route::RouteCreationMode::AllNeighborLanes));
73 : :
74 [ + - + - : 2 : ASSERT_EQ(toString(static_cast<::ad::map::route::RouteCreationMode>(minValue - 1)), "UNKNOWN ENUM VALUE");
- + - - -
- - - ]
75 [ + - + - : 2 : ASSERT_EQ(toString(static_cast<::ad::map::route::RouteCreationMode>(maxValue + 1)), "UNKNOWN ENUM VALUE");
- + - - -
- - - ]
76 : : }
77 : :
78 : 2 : TEST(RouteCreationModeTests, ostreamOperatorTest)
79 : : {
80 [ + - ]: 1 : std::stringstream stream;
81 : 1 : ::ad::map::route::RouteCreationMode value(::ad::map::route::RouteCreationMode::Undefined);
82 [ + - ]: 1 : stream << value;
83 [ + - + - : 1 : ASSERT_GT(stream.str().size(), 0u);
- + - - -
- - - ]
84 : : }
85 : :
86 : : #if defined(__clang__) && (__clang_major__ >= 7)
87 : : #pragma GCC diagnostic pop
88 : : #endif
|