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