Branch data Line data Source code
1 : : /*
2 : : * ----------------- BEGIN LICENSE BLOCK ---------------------------------
3 : : *
4 : : * Copyright (C) 2018-2021 Intel Corporation
5 : : *
6 : : * SPDX-License-Identifier: LGPL-2.1-only
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/rss/state/LongitudinalResponse.hpp"
23 : :
24 : 2 : TEST(LongitudinalResponseTests, testFromString)
25 : : {
26 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::rss::state::LongitudinalResponse>("None"), ::ad::rss::state::LongitudinalResponse::None);
+ - - + -
- - - -
- ]
27 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::rss::state::LongitudinalResponse>("::ad::rss::state::LongitudinalResponse::None"),
+ - - + -
- - - -
- ]
28 : : ::ad::rss::state::LongitudinalResponse::None);
29 : :
30 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::rss::state::LongitudinalResponse>("BrakeMinCorrect"),
+ - - + -
- - - -
- ]
31 : : ::ad::rss::state::LongitudinalResponse::BrakeMinCorrect);
32 [ + - + - : 1 : ASSERT_EQ(
+ - - + -
- - - -
- ]
33 : : fromString<::ad::rss::state::LongitudinalResponse>("::ad::rss::state::LongitudinalResponse::BrakeMinCorrect"),
34 : : ::ad::rss::state::LongitudinalResponse::BrakeMinCorrect);
35 : :
36 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::rss::state::LongitudinalResponse>("BrakeMin"),
+ - - + -
- - - -
- ]
37 : : ::ad::rss::state::LongitudinalResponse::BrakeMin);
38 [ + - + - : 1 : ASSERT_EQ(fromString<::ad::rss::state::LongitudinalResponse>("::ad::rss::state::LongitudinalResponse::BrakeMin"),
+ - - + -
- - - -
- ]
39 : : ::ad::rss::state::LongitudinalResponse::BrakeMin);
40 : :
41 [ + - + - : 4 : EXPECT_ANY_THROW({ fromString<::ad::rss::state::LongitudinalResponse>("NOT A VALID ENUM LITERAL"); });
+ - + - -
+ - + - -
- - ]
42 : : }
43 : :
44 : 2 : TEST(LongitudinalResponseTests, 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::rss::state::LongitudinalResponse::None), "::ad::rss::state::LongitudinalResponse::None");
- + - - -
- - - ]
50 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::rss::state::LongitudinalResponse::None));
51 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::rss::state::LongitudinalResponse::None));
52 : :
53 [ + - + - : 2 : ASSERT_EQ(toString(::ad::rss::state::LongitudinalResponse::BrakeMinCorrect),
- + - - -
- - - ]
54 : : "::ad::rss::state::LongitudinalResponse::BrakeMinCorrect");
55 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::rss::state::LongitudinalResponse::BrakeMinCorrect));
56 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::rss::state::LongitudinalResponse::BrakeMinCorrect));
57 : :
58 [ + - + - : 2 : ASSERT_EQ(toString(::ad::rss::state::LongitudinalResponse::BrakeMin),
- + - - -
- - - ]
59 : : "::ad::rss::state::LongitudinalResponse::BrakeMin");
60 : 1 : minValue = std::min(minValue, static_cast<int32_t>(::ad::rss::state::LongitudinalResponse::BrakeMin));
61 : 1 : maxValue = std::max(maxValue, static_cast<int32_t>(::ad::rss::state::LongitudinalResponse::BrakeMin));
62 : :
63 [ + - + - : 2 : ASSERT_EQ(toString(static_cast<::ad::rss::state::LongitudinalResponse>(minValue - 1)), "UNKNOWN ENUM VALUE");
- + - - -
- - - ]
64 [ + - + - : 2 : ASSERT_EQ(toString(static_cast<::ad::rss::state::LongitudinalResponse>(maxValue + 1)), "UNKNOWN ENUM VALUE");
- + - - -
- - - ]
65 : : }
66 : :
67 : 2 : TEST(LongitudinalResponseTests, ostreamOperatorTest)
68 : : {
69 [ + - ]: 1 : std::stringstream stream;
70 : 1 : ::ad::rss::state::LongitudinalResponse value(::ad::rss::state::LongitudinalResponse::None);
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
|