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 : : #include <gtest/gtest.h> 16 : : 17 : : #include <limits> 18 : : 19 : : #include "ad/rss/state/LateralRssStateValidInputRange.hpp" 20 : : 21 : 2 : TEST(LateralRssStateValidInputRangeTests, testValidInputRange) 22 : : { 23 : 1 : ::ad::rss::state::LateralRssState value; 24 : 1 : bool valueIsSafe{true}; 25 : 1 : value.isSafe = valueIsSafe; 26 : 1 : ::ad::rss::state::LateralResponse valueResponse(::ad::rss::state::LateralResponse::None); 27 : 1 : value.response = valueResponse; 28 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueAlphaLat; 29 : 1 : ::ad::physics::Acceleration valueAlphaLatAccelMax(-1e2); 30 : 1 : valueAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 31 : 1 : valueAlphaLat.accelMax = valueAlphaLatAccelMax; 32 : 1 : ::ad::physics::Acceleration valueAlphaLatBrakeMin(-1e2); 33 : 1 : valueAlphaLat.brakeMin = valueAlphaLatBrakeMin; 34 : 1 : value.alphaLat = valueAlphaLat; 35 : 1 : ::ad::rss::state::RssStateInformation valueRssStateInformation; 36 : 1 : ::ad::physics::Distance valueRssStateInformationSafeDistance(-1e9); 37 : 1 : valueRssStateInformation.safeDistance = valueRssStateInformationSafeDistance; 38 : 1 : ::ad::physics::Distance valueRssStateInformationCurrentDistance(-1e9); 39 : 1 : valueRssStateInformation.currentDistance = valueRssStateInformationCurrentDistance; 40 : 1 : ::ad::rss::state::RssStateEvaluator valueRssStateInformationEvaluator(::ad::rss::state::RssStateEvaluator::None); 41 : 1 : valueRssStateInformation.evaluator = valueRssStateInformationEvaluator; 42 : 1 : value.rssStateInformation = valueRssStateInformation; 43 [ + - - + : 1 : ASSERT_TRUE(withinValidInputRange(value)); - - - - - - - - ] 44 : : } 45 : : 46 : 2 : TEST(LateralRssStateValidInputRangeTests, testValidInputRangeResponseTooSmall) 47 : : { 48 : 1 : ::ad::rss::state::LateralRssState value; 49 : 1 : bool valueIsSafe{true}; 50 : 1 : value.isSafe = valueIsSafe; 51 : 1 : ::ad::rss::state::LateralResponse valueResponse(::ad::rss::state::LateralResponse::None); 52 : 1 : value.response = valueResponse; 53 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueAlphaLat; 54 : 1 : ::ad::physics::Acceleration valueAlphaLatAccelMax(-1e2); 55 : 1 : valueAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 56 : 1 : valueAlphaLat.accelMax = valueAlphaLatAccelMax; 57 : 1 : ::ad::physics::Acceleration valueAlphaLatBrakeMin(-1e2); 58 : 1 : valueAlphaLat.brakeMin = valueAlphaLatBrakeMin; 59 : 1 : value.alphaLat = valueAlphaLat; 60 : 1 : ::ad::rss::state::RssStateInformation valueRssStateInformation; 61 : 1 : ::ad::physics::Distance valueRssStateInformationSafeDistance(-1e9); 62 : 1 : valueRssStateInformation.safeDistance = valueRssStateInformationSafeDistance; 63 : 1 : ::ad::physics::Distance valueRssStateInformationCurrentDistance(-1e9); 64 : 1 : valueRssStateInformation.currentDistance = valueRssStateInformationCurrentDistance; 65 : 1 : ::ad::rss::state::RssStateEvaluator valueRssStateInformationEvaluator(::ad::rss::state::RssStateEvaluator::None); 66 : 1 : valueRssStateInformation.evaluator = valueRssStateInformationEvaluator; 67 : 1 : value.rssStateInformation = valueRssStateInformation; 68 : : 69 : : // override member with data type value below input range minimum 70 : 1 : ::ad::rss::state::LateralResponse invalidInitializedMember(static_cast<::ad::rss::state::LateralResponse>(-1)); 71 : 1 : value.response = invalidInitializedMember; 72 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 73 : : } 74 : : 75 : 2 : TEST(LateralRssStateValidInputRangeTests, testValidInputRangeResponseTooBig) 76 : : { 77 : 1 : ::ad::rss::state::LateralRssState value; 78 : 1 : bool valueIsSafe{true}; 79 : 1 : value.isSafe = valueIsSafe; 80 : 1 : ::ad::rss::state::LateralResponse valueResponse(::ad::rss::state::LateralResponse::None); 81 : 1 : value.response = valueResponse; 82 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueAlphaLat; 83 : 1 : ::ad::physics::Acceleration valueAlphaLatAccelMax(-1e2); 84 : 1 : valueAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 85 : 1 : valueAlphaLat.accelMax = valueAlphaLatAccelMax; 86 : 1 : ::ad::physics::Acceleration valueAlphaLatBrakeMin(-1e2); 87 : 1 : valueAlphaLat.brakeMin = valueAlphaLatBrakeMin; 88 : 1 : value.alphaLat = valueAlphaLat; 89 : 1 : ::ad::rss::state::RssStateInformation valueRssStateInformation; 90 : 1 : ::ad::physics::Distance valueRssStateInformationSafeDistance(-1e9); 91 : 1 : valueRssStateInformation.safeDistance = valueRssStateInformationSafeDistance; 92 : 1 : ::ad::physics::Distance valueRssStateInformationCurrentDistance(-1e9); 93 : 1 : valueRssStateInformation.currentDistance = valueRssStateInformationCurrentDistance; 94 : 1 : ::ad::rss::state::RssStateEvaluator valueRssStateInformationEvaluator(::ad::rss::state::RssStateEvaluator::None); 95 : 1 : valueRssStateInformation.evaluator = valueRssStateInformationEvaluator; 96 : 1 : value.rssStateInformation = valueRssStateInformation; 97 : : 98 : : // override member with data type value above input range maximum 99 : 1 : ::ad::rss::state::LateralResponse invalidInitializedMember(static_cast<::ad::rss::state::LateralResponse>(-1)); 100 : 1 : value.response = invalidInitializedMember; 101 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 102 : : } 103 : : 104 : 2 : TEST(LateralRssStateValidInputRangeTests, testValidInputRangeAlphaLatTooSmall) 105 : : { 106 : 1 : ::ad::rss::state::LateralRssState value; 107 : 1 : bool valueIsSafe{true}; 108 : 1 : value.isSafe = valueIsSafe; 109 : 1 : ::ad::rss::state::LateralResponse valueResponse(::ad::rss::state::LateralResponse::None); 110 : 1 : value.response = valueResponse; 111 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueAlphaLat; 112 : 1 : ::ad::physics::Acceleration valueAlphaLatAccelMax(-1e2); 113 : 1 : valueAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 114 : 1 : valueAlphaLat.accelMax = valueAlphaLatAccelMax; 115 : 1 : ::ad::physics::Acceleration valueAlphaLatBrakeMin(-1e2); 116 : 1 : valueAlphaLat.brakeMin = valueAlphaLatBrakeMin; 117 : 1 : value.alphaLat = valueAlphaLat; 118 : 1 : ::ad::rss::state::RssStateInformation valueRssStateInformation; 119 : 1 : ::ad::physics::Distance valueRssStateInformationSafeDistance(-1e9); 120 : 1 : valueRssStateInformation.safeDistance = valueRssStateInformationSafeDistance; 121 : 1 : ::ad::physics::Distance valueRssStateInformationCurrentDistance(-1e9); 122 : 1 : valueRssStateInformation.currentDistance = valueRssStateInformationCurrentDistance; 123 : 1 : ::ad::rss::state::RssStateEvaluator valueRssStateInformationEvaluator(::ad::rss::state::RssStateEvaluator::None); 124 : 1 : valueRssStateInformation.evaluator = valueRssStateInformationEvaluator; 125 : 1 : value.rssStateInformation = valueRssStateInformation; 126 : : 127 : : // override member with data type value below input range minimum 128 : 1 : ::ad::rss::world::LateralRssAccelerationValues invalidInitializedMember; 129 : 1 : ::ad::physics::Acceleration invalidInitializedMemberAccelMax(-1e2 * 1.1); 130 : 1 : invalidInitializedMember.accelMax = invalidInitializedMemberAccelMax; 131 : 1 : value.alphaLat = invalidInitializedMember; 132 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 133 : : } 134 : : 135 : 2 : TEST(LateralRssStateValidInputRangeTests, testValidInputRangeAlphaLatTooBig) 136 : : { 137 : 1 : ::ad::rss::state::LateralRssState value; 138 : 1 : bool valueIsSafe{true}; 139 : 1 : value.isSafe = valueIsSafe; 140 : 1 : ::ad::rss::state::LateralResponse valueResponse(::ad::rss::state::LateralResponse::None); 141 : 1 : value.response = valueResponse; 142 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueAlphaLat; 143 : 1 : ::ad::physics::Acceleration valueAlphaLatAccelMax(-1e2); 144 : 1 : valueAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 145 : 1 : valueAlphaLat.accelMax = valueAlphaLatAccelMax; 146 : 1 : ::ad::physics::Acceleration valueAlphaLatBrakeMin(-1e2); 147 : 1 : valueAlphaLat.brakeMin = valueAlphaLatBrakeMin; 148 : 1 : value.alphaLat = valueAlphaLat; 149 : 1 : ::ad::rss::state::RssStateInformation valueRssStateInformation; 150 : 1 : ::ad::physics::Distance valueRssStateInformationSafeDistance(-1e9); 151 : 1 : valueRssStateInformation.safeDistance = valueRssStateInformationSafeDistance; 152 : 1 : ::ad::physics::Distance valueRssStateInformationCurrentDistance(-1e9); 153 : 1 : valueRssStateInformation.currentDistance = valueRssStateInformationCurrentDistance; 154 : 1 : ::ad::rss::state::RssStateEvaluator valueRssStateInformationEvaluator(::ad::rss::state::RssStateEvaluator::None); 155 : 1 : valueRssStateInformation.evaluator = valueRssStateInformationEvaluator; 156 : 1 : value.rssStateInformation = valueRssStateInformation; 157 : : 158 : : // override member with data type value above input range maximum 159 : 1 : ::ad::rss::world::LateralRssAccelerationValues invalidInitializedMember; 160 : 1 : ::ad::physics::Acceleration invalidInitializedMemberAccelMax(1e2 * 1.1); 161 : 1 : invalidInitializedMember.accelMax = invalidInitializedMemberAccelMax; 162 : 1 : value.alphaLat = invalidInitializedMember; 163 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 164 : : } 165 : : 166 : 2 : TEST(LateralRssStateValidInputRangeTests, testValidInputRangeRssStateInformationTooSmall) 167 : : { 168 : 1 : ::ad::rss::state::LateralRssState value; 169 : 1 : bool valueIsSafe{true}; 170 : 1 : value.isSafe = valueIsSafe; 171 : 1 : ::ad::rss::state::LateralResponse valueResponse(::ad::rss::state::LateralResponse::None); 172 : 1 : value.response = valueResponse; 173 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueAlphaLat; 174 : 1 : ::ad::physics::Acceleration valueAlphaLatAccelMax(-1e2); 175 : 1 : valueAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 176 : 1 : valueAlphaLat.accelMax = valueAlphaLatAccelMax; 177 : 1 : ::ad::physics::Acceleration valueAlphaLatBrakeMin(-1e2); 178 : 1 : valueAlphaLat.brakeMin = valueAlphaLatBrakeMin; 179 : 1 : value.alphaLat = valueAlphaLat; 180 : 1 : ::ad::rss::state::RssStateInformation valueRssStateInformation; 181 : 1 : ::ad::physics::Distance valueRssStateInformationSafeDistance(-1e9); 182 : 1 : valueRssStateInformation.safeDistance = valueRssStateInformationSafeDistance; 183 : 1 : ::ad::physics::Distance valueRssStateInformationCurrentDistance(-1e9); 184 : 1 : valueRssStateInformation.currentDistance = valueRssStateInformationCurrentDistance; 185 : 1 : ::ad::rss::state::RssStateEvaluator valueRssStateInformationEvaluator(::ad::rss::state::RssStateEvaluator::None); 186 : 1 : valueRssStateInformation.evaluator = valueRssStateInformationEvaluator; 187 : 1 : value.rssStateInformation = valueRssStateInformation; 188 : : 189 : : // override member with data type value below input range minimum 190 : 1 : ::ad::rss::state::RssStateInformation invalidInitializedMember; 191 : 1 : ::ad::physics::Distance invalidInitializedMemberSafeDistance(-1e9 * 1.1); 192 : 1 : invalidInitializedMember.safeDistance = invalidInitializedMemberSafeDistance; 193 : 1 : value.rssStateInformation = invalidInitializedMember; 194 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 195 : : } 196 : : 197 : 2 : TEST(LateralRssStateValidInputRangeTests, testValidInputRangeRssStateInformationTooBig) 198 : : { 199 : 1 : ::ad::rss::state::LateralRssState value; 200 : 1 : bool valueIsSafe{true}; 201 : 1 : value.isSafe = valueIsSafe; 202 : 1 : ::ad::rss::state::LateralResponse valueResponse(::ad::rss::state::LateralResponse::None); 203 : 1 : value.response = valueResponse; 204 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueAlphaLat; 205 : 1 : ::ad::physics::Acceleration valueAlphaLatAccelMax(-1e2); 206 : 1 : valueAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 207 : 1 : valueAlphaLat.accelMax = valueAlphaLatAccelMax; 208 : 1 : ::ad::physics::Acceleration valueAlphaLatBrakeMin(-1e2); 209 : 1 : valueAlphaLat.brakeMin = valueAlphaLatBrakeMin; 210 : 1 : value.alphaLat = valueAlphaLat; 211 : 1 : ::ad::rss::state::RssStateInformation valueRssStateInformation; 212 : 1 : ::ad::physics::Distance valueRssStateInformationSafeDistance(-1e9); 213 : 1 : valueRssStateInformation.safeDistance = valueRssStateInformationSafeDistance; 214 : 1 : ::ad::physics::Distance valueRssStateInformationCurrentDistance(-1e9); 215 : 1 : valueRssStateInformation.currentDistance = valueRssStateInformationCurrentDistance; 216 : 1 : ::ad::rss::state::RssStateEvaluator valueRssStateInformationEvaluator(::ad::rss::state::RssStateEvaluator::None); 217 : 1 : valueRssStateInformation.evaluator = valueRssStateInformationEvaluator; 218 : 1 : value.rssStateInformation = valueRssStateInformation; 219 : : 220 : : // override member with data type value above input range maximum 221 : 1 : ::ad::rss::state::RssStateInformation invalidInitializedMember; 222 : 1 : ::ad::physics::Distance invalidInitializedMemberSafeDistance(1e9 * 1.1); 223 : 1 : invalidInitializedMember.safeDistance = invalidInitializedMemberSafeDistance; 224 : 1 : value.rssStateInformation = invalidInitializedMember; 225 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 226 : : }