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