Branch data Line data Source code
1 : : /* 2 : : * ----------------- BEGIN LICENSE BLOCK --------------------------------- 3 : : * 4 : : * Copyright (C) 2018-2022 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/world/LateralRssAccelerationValuesValidInputRange.hpp" 20 : : 21 : 4 : TEST(LateralRssAccelerationValuesValidInputRangeTests, testValidInputRange) 22 : : { 23 : 1 : ::ad::rss::world::LateralRssAccelerationValues value; 24 : 1 : ::ad::physics::Acceleration valueAccel_max(-1e2); 25 : 1 : valueAccel_max = ::ad::physics::Acceleration(0.); // set to valid value within struct 26 : 1 : value.accel_max = valueAccel_max; 27 : 1 : ::ad::physics::Acceleration valueBrake_min(-1e2); 28 : 1 : value.brake_min = valueBrake_min; 29 [ + - - + : 1 : ASSERT_TRUE(withinValidInputRange(value)); - - - - - - - - + - ] 30 : : } 31 : : 32 : 4 : TEST(LateralRssAccelerationValuesValidInputRangeTests, testValidInputRangeAccel_maxTooSmall) 33 : : { 34 : 1 : ::ad::rss::world::LateralRssAccelerationValues value; 35 : 1 : ::ad::physics::Acceleration valueAccel_max(-1e2); 36 : 1 : valueAccel_max = ::ad::physics::Acceleration(0.); // set to valid value within struct 37 : 1 : value.accel_max = valueAccel_max; 38 : 1 : ::ad::physics::Acceleration valueBrake_min(-1e2); 39 : 1 : value.brake_min = valueBrake_min; 40 : : 41 : : // override member with data type value below input range minimum 42 : 1 : ::ad::physics::Acceleration invalidInitializedMember(-1e2 * 1.1); 43 : 1 : value.accel_max = invalidInitializedMember; 44 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - + - ] 45 : : 46 : : // override member with value below struct member input range minimum 47 : 2 : invalidInitializedMember = ::ad::physics::Acceleration( 48 : 1 : 0. - ::ad::physics::Acceleration::cPrecisionValue); // set to invalid value within struct 49 : 1 : value.accel_max = invalidInitializedMember; 50 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - + - ] 51 : : } 52 : : 53 : 4 : TEST(LateralRssAccelerationValuesValidInputRangeTests, testValidInputRangeAccel_maxTooBig) 54 : : { 55 : 1 : ::ad::rss::world::LateralRssAccelerationValues value; 56 : 1 : ::ad::physics::Acceleration valueAccel_max(-1e2); 57 : 1 : valueAccel_max = ::ad::physics::Acceleration(0.); // set to valid value within struct 58 : 1 : value.accel_max = valueAccel_max; 59 : 1 : ::ad::physics::Acceleration valueBrake_min(-1e2); 60 : 1 : value.brake_min = valueBrake_min; 61 : : 62 : : // override member with data type value above input range maximum 63 : 1 : ::ad::physics::Acceleration invalidInitializedMember(1e2 * 1.1); 64 : 1 : value.accel_max = invalidInitializedMember; 65 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - + - ] 66 : : } 67 : : 68 : 4 : TEST(LateralRssAccelerationValuesValidInputRangeTests, testValidInputRangeaccel_maxDefault) 69 : : { 70 : 1 : ::ad::rss::world::LateralRssAccelerationValues value; 71 : 1 : ::ad::physics::Acceleration valueDefault; 72 : 1 : value.accel_max = valueDefault; 73 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - + - ] 74 : : } 75 : : 76 : 4 : TEST(LateralRssAccelerationValuesValidInputRangeTests, testValidInputRangeBrake_minTooSmall) 77 : : { 78 : 1 : ::ad::rss::world::LateralRssAccelerationValues value; 79 : 1 : ::ad::physics::Acceleration valueAccel_max(-1e2); 80 : 1 : valueAccel_max = ::ad::physics::Acceleration(0.); // set to valid value within struct 81 : 1 : value.accel_max = valueAccel_max; 82 : 1 : ::ad::physics::Acceleration valueBrake_min(-1e2); 83 : 1 : value.brake_min = valueBrake_min; 84 : : 85 : : // override member with data type value below input range minimum 86 : 1 : ::ad::physics::Acceleration invalidInitializedMember(-1e2 * 1.1); 87 : 1 : value.brake_min = invalidInitializedMember; 88 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - + - ] 89 : : } 90 : : 91 : 4 : TEST(LateralRssAccelerationValuesValidInputRangeTests, testValidInputRangeBrake_minTooBig) 92 : : { 93 : 1 : ::ad::rss::world::LateralRssAccelerationValues value; 94 : 1 : ::ad::physics::Acceleration valueAccel_max(-1e2); 95 : 1 : valueAccel_max = ::ad::physics::Acceleration(0.); // set to valid value within struct 96 : 1 : value.accel_max = valueAccel_max; 97 : 1 : ::ad::physics::Acceleration valueBrake_min(-1e2); 98 : 1 : value.brake_min = valueBrake_min; 99 : : 100 : : // override member with data type value above input range maximum 101 : 1 : ::ad::physics::Acceleration invalidInitializedMember(1e2 * 1.1); 102 : 1 : value.brake_min = invalidInitializedMember; 103 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - + - ] 104 : : 105 : : // override member with value above struct member input range maximum 106 : 1 : invalidInitializedMember = ::ad::physics::Acceleration(0.); // set to valid value within struct 107 : 1 : value.brake_min = invalidInitializedMember; 108 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - + - ] 109 : : } 110 : : 111 : 4 : TEST(LateralRssAccelerationValuesValidInputRangeTests, testValidInputRangebrake_minDefault) 112 : : { 113 : 1 : ::ad::rss::world::LateralRssAccelerationValues value; 114 : 1 : ::ad::physics::Acceleration valueDefault; 115 : 1 : value.brake_min = valueDefault; 116 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - + - ] 117 : : }