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/ContactLocation.hpp"
23 : :
24 : 2 : TEST(ContactLocationTests, testFromString)
25 : : {
26 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::lane::ContactLocation>("INVALID"), ::ad::map::lane::ContactLocation::INVALID);
+ - - + -
- - - -
- ]
27 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::lane::ContactLocation>("::ad::map::lane::ContactLocation::INVALID"),
+ - - + -
- - - -
- ]
28 : : ::ad::map::lane::ContactLocation::INVALID);
29 : :
30 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::lane::ContactLocation>("UNKNOWN"), ::ad::map::lane::ContactLocation::UNKNOWN);
+ - - + -
- - - -
- ]
31 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::lane::ContactLocation>("::ad::map::lane::ContactLocation::UNKNOWN"),
+ - - + -
- - - -
- ]
32 : : ::ad::map::lane::ContactLocation::UNKNOWN);
33 : :
34 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::lane::ContactLocation>("LEFT"), ::ad::map::lane::ContactLocation::LEFT);
+ - - + -
- - - -
- ]
35 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::lane::ContactLocation>("::ad::map::lane::ContactLocation::LEFT"),
+ - - + -
- - - -
- ]
36 : : ::ad::map::lane::ContactLocation::LEFT);
37 : :
38 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::lane::ContactLocation>("RIGHT"), ::ad::map::lane::ContactLocation::RIGHT);
+ - - + -
- - - -
- ]
39 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::lane::ContactLocation>("::ad::map::lane::ContactLocation::RIGHT"),
+ - - + -
- - - -
- ]
40 : : ::ad::map::lane::ContactLocation::RIGHT);
41 : :
42 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::lane::ContactLocation>("SUCCESSOR"), ::ad::map::lane::ContactLocation::SUCCESSOR);
+ - - + -
- - - -
- ]
43 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::lane::ContactLocation>("::ad::map::lane::ContactLocation::SUCCESSOR"),
+ - - + -
- - - -
- ]
44 : : ::ad::map::lane::ContactLocation::SUCCESSOR);
45 : :
46 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::lane::ContactLocation>("PREDECESSOR"), ::ad::map::lane::ContactLocation::PREDECESSOR);
+ - - + -
- - - -
- ]
47 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::lane::ContactLocation>("::ad::map::lane::ContactLocation::PREDECESSOR"),
+ - - + -
- - - -
- ]
48 : : ::ad::map::lane::ContactLocation::PREDECESSOR);
49 : :
50 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::lane::ContactLocation>("OVERLAP"), ::ad::map::lane::ContactLocation::OVERLAP);
+ - - + -
- - - -
- ]
51 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::map::lane::ContactLocation>("::ad::map::lane::ContactLocation::OVERLAP"),
+ - - + -
- - - -
- ]
52 : : ::ad::map::lane::ContactLocation::OVERLAP);
53 : :
54 [ + - + - : 4 : EXPECT_ANY_THROW({ fromString<::ad::map::lane::ContactLocation>("NOT A VALID ENUM LITERAL"); });
+ - + - -
+ - + - -
- - ]
55 : : }
56 : :
57 : 2 : TEST(ContactLocationTests, 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::ContactLocation::INVALID), "::ad::map::lane::ContactLocation::INVALID");
- + - - -
- - - ]
63 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::lane::ContactLocation::INVALID));
64 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::lane::ContactLocation::INVALID));
65 : :
66 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::lane::ContactLocation::UNKNOWN), "::ad::map::lane::ContactLocation::UNKNOWN");
- + - - -
- - - ]
67 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::lane::ContactLocation::UNKNOWN));
68 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::lane::ContactLocation::UNKNOWN));
69 : :
70 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::lane::ContactLocation::LEFT), "::ad::map::lane::ContactLocation::LEFT");
- + - - -
- - - ]
71 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::lane::ContactLocation::LEFT));
72 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::lane::ContactLocation::LEFT));
73 : :
74 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::lane::ContactLocation::RIGHT), "::ad::map::lane::ContactLocation::RIGHT");
- + - - -
- - - ]
75 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::lane::ContactLocation::RIGHT));
76 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::lane::ContactLocation::RIGHT));
77 : :
78 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::lane::ContactLocation::SUCCESSOR), "::ad::map::lane::ContactLocation::SUCCESSOR");
- + - - -
- - - ]
79 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::lane::ContactLocation::SUCCESSOR));
80 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::lane::ContactLocation::SUCCESSOR));
81 : :
82 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::lane::ContactLocation::PREDECESSOR), "::ad::map::lane::ContactLocation::PREDECESSOR");
- + - - -
- - - ]
83 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::lane::ContactLocation::PREDECESSOR));
84 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::lane::ContactLocation::PREDECESSOR));
85 : :
86 [ + - + - : 2 : ASSERT_EQ(toString(::ad::map::lane::ContactLocation::OVERLAP), "::ad::map::lane::ContactLocation::OVERLAP");
- + - - -
- - - ]
87 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::map::lane::ContactLocation::OVERLAP));
88 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::map::lane::ContactLocation::OVERLAP));
89 : :
90 [ + - + - : 2 : ASSERT_EQ(toString(static_cast<::ad::map::lane::ContactLocation>(minValue - 1)), "UNKNOWN ENUM VALUE");
- + - - -
- - - ]
91 [ + - + - : 2 : ASSERT_EQ(toString(static_cast<::ad::map::lane::ContactLocation>(maxValue + 1)), "UNKNOWN ENUM VALUE");
- + - - -
- - - ]
92 : : }
93 : :
94 : 2 : TEST(ContactLocationTests, ostreamOperatorTest)
95 : : {
96 [ + - ]: 1 : std::stringstream stream;
97 : 1 : ::ad::map::lane::ContactLocation value(::ad::map::lane::ContactLocation::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
|