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