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 : : #include <gtest/gtest.h> 16 : : 17 : : #include <limits> 18 : : 19 : : #include "ad/map/config/MapEntryValidInputRange.hpp" 20 : : 21 : 2 : TEST(MapEntryValidInputRangeTests, testValidInputRange) 22 : : { 23 : 1 : ::ad::map::config::MapEntry value; 24 [ + - ]: 1 : std::string valueFilename{"min"}; 25 [ + - ]: 1 : value.filename = valueFilename; 26 : 1 : ::ad::physics::Distance valueOpenDriveOverlapMargin(-1e9); 27 : 1 : value.openDriveOverlapMargin = valueOpenDriveOverlapMargin; 28 : 1 : ::ad::map::intersection::IntersectionType valueOpenDriveDefaultIntersectionType( 29 : : ::ad::map::intersection::IntersectionType::Unknown); 30 : 1 : value.openDriveDefaultIntersectionType = valueOpenDriveDefaultIntersectionType; 31 : 1 : ::ad::map::landmark::TrafficLightType valueOpenDriveDefaultTrafficLightType( 32 : : ::ad::map::landmark::TrafficLightType::INVALID); 33 : 1 : value.openDriveDefaultTrafficLightType = valueOpenDriveDefaultTrafficLightType; 34 [ + - - + : 1 : ASSERT_TRUE(withinValidInputRange(value)); - - - - - - - - ] 35 : : } 36 : : 37 : 2 : TEST(MapEntryValidInputRangeTests, testValidInputRangeOpenDriveOverlapMarginTooSmall) 38 : : { 39 : 1 : ::ad::map::config::MapEntry value; 40 [ + - ]: 1 : std::string valueFilename{"min"}; 41 [ + - ]: 1 : value.filename = valueFilename; 42 : 1 : ::ad::physics::Distance valueOpenDriveOverlapMargin(-1e9); 43 : 1 : value.openDriveOverlapMargin = valueOpenDriveOverlapMargin; 44 : 1 : ::ad::map::intersection::IntersectionType valueOpenDriveDefaultIntersectionType( 45 : : ::ad::map::intersection::IntersectionType::Unknown); 46 : 1 : value.openDriveDefaultIntersectionType = valueOpenDriveDefaultIntersectionType; 47 : 1 : ::ad::map::landmark::TrafficLightType valueOpenDriveDefaultTrafficLightType( 48 : : ::ad::map::landmark::TrafficLightType::INVALID); 49 : 1 : value.openDriveDefaultTrafficLightType = valueOpenDriveDefaultTrafficLightType; 50 : : 51 : : // override member with data type value below input range minimum 52 : 1 : ::ad::physics::Distance invalidInitializedMember(-1e9 * 1.1); 53 : 1 : value.openDriveOverlapMargin = invalidInitializedMember; 54 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 55 : : } 56 : : 57 : 2 : TEST(MapEntryValidInputRangeTests, testValidInputRangeOpenDriveOverlapMarginTooBig) 58 : : { 59 : 1 : ::ad::map::config::MapEntry value; 60 [ + - ]: 1 : std::string valueFilename{"min"}; 61 [ + - ]: 1 : value.filename = valueFilename; 62 : 1 : ::ad::physics::Distance valueOpenDriveOverlapMargin(-1e9); 63 : 1 : value.openDriveOverlapMargin = valueOpenDriveOverlapMargin; 64 : 1 : ::ad::map::intersection::IntersectionType valueOpenDriveDefaultIntersectionType( 65 : : ::ad::map::intersection::IntersectionType::Unknown); 66 : 1 : value.openDriveDefaultIntersectionType = valueOpenDriveDefaultIntersectionType; 67 : 1 : ::ad::map::landmark::TrafficLightType valueOpenDriveDefaultTrafficLightType( 68 : : ::ad::map::landmark::TrafficLightType::INVALID); 69 : 1 : value.openDriveDefaultTrafficLightType = valueOpenDriveDefaultTrafficLightType; 70 : : 71 : : // override member with data type value above input range maximum 72 : 1 : ::ad::physics::Distance invalidInitializedMember(1e9 * 1.1); 73 : 1 : value.openDriveOverlapMargin = invalidInitializedMember; 74 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 75 : : } 76 : : 77 : 2 : TEST(MapEntryValidInputRangeTests, testValidInputRangeopenDriveOverlapMarginDefault) 78 : : { 79 : 1 : ::ad::map::config::MapEntry value; 80 : 1 : ::ad::physics::Distance valueDefault; 81 : 1 : value.openDriveOverlapMargin = valueDefault; 82 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 83 : : } 84 : : 85 : 2 : TEST(MapEntryValidInputRangeTests, testValidInputRangeOpenDriveDefaultIntersectionTypeTooSmall) 86 : : { 87 : 1 : ::ad::map::config::MapEntry value; 88 [ + - ]: 1 : std::string valueFilename{"min"}; 89 [ + - ]: 1 : value.filename = valueFilename; 90 : 1 : ::ad::physics::Distance valueOpenDriveOverlapMargin(-1e9); 91 : 1 : value.openDriveOverlapMargin = valueOpenDriveOverlapMargin; 92 : 1 : ::ad::map::intersection::IntersectionType valueOpenDriveDefaultIntersectionType( 93 : : ::ad::map::intersection::IntersectionType::Unknown); 94 : 1 : value.openDriveDefaultIntersectionType = valueOpenDriveDefaultIntersectionType; 95 : 1 : ::ad::map::landmark::TrafficLightType valueOpenDriveDefaultTrafficLightType( 96 : : ::ad::map::landmark::TrafficLightType::INVALID); 97 : 1 : value.openDriveDefaultTrafficLightType = valueOpenDriveDefaultTrafficLightType; 98 : : 99 : : // override member with data type value below input range minimum 100 : 1 : ::ad::map::intersection::IntersectionType invalidInitializedMember( 101 : : static_cast<::ad::map::intersection::IntersectionType>(-1)); 102 : 1 : value.openDriveDefaultIntersectionType = invalidInitializedMember; 103 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 104 : : } 105 : : 106 : 2 : TEST(MapEntryValidInputRangeTests, testValidInputRangeOpenDriveDefaultIntersectionTypeTooBig) 107 : : { 108 : 1 : ::ad::map::config::MapEntry value; 109 [ + - ]: 1 : std::string valueFilename{"min"}; 110 [ + - ]: 1 : value.filename = valueFilename; 111 : 1 : ::ad::physics::Distance valueOpenDriveOverlapMargin(-1e9); 112 : 1 : value.openDriveOverlapMargin = valueOpenDriveOverlapMargin; 113 : 1 : ::ad::map::intersection::IntersectionType valueOpenDriveDefaultIntersectionType( 114 : : ::ad::map::intersection::IntersectionType::Unknown); 115 : 1 : value.openDriveDefaultIntersectionType = valueOpenDriveDefaultIntersectionType; 116 : 1 : ::ad::map::landmark::TrafficLightType valueOpenDriveDefaultTrafficLightType( 117 : : ::ad::map::landmark::TrafficLightType::INVALID); 118 : 1 : value.openDriveDefaultTrafficLightType = valueOpenDriveDefaultTrafficLightType; 119 : : 120 : : // override member with data type value above input range maximum 121 : 1 : ::ad::map::intersection::IntersectionType invalidInitializedMember( 122 : : static_cast<::ad::map::intersection::IntersectionType>(-1)); 123 : 1 : value.openDriveDefaultIntersectionType = invalidInitializedMember; 124 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 125 : : } 126 : : 127 : 2 : TEST(MapEntryValidInputRangeTests, testValidInputRangeOpenDriveDefaultTrafficLightTypeTooSmall) 128 : : { 129 : 1 : ::ad::map::config::MapEntry value; 130 [ + - ]: 1 : std::string valueFilename{"min"}; 131 [ + - ]: 1 : value.filename = valueFilename; 132 : 1 : ::ad::physics::Distance valueOpenDriveOverlapMargin(-1e9); 133 : 1 : value.openDriveOverlapMargin = valueOpenDriveOverlapMargin; 134 : 1 : ::ad::map::intersection::IntersectionType valueOpenDriveDefaultIntersectionType( 135 : : ::ad::map::intersection::IntersectionType::Unknown); 136 : 1 : value.openDriveDefaultIntersectionType = valueOpenDriveDefaultIntersectionType; 137 : 1 : ::ad::map::landmark::TrafficLightType valueOpenDriveDefaultTrafficLightType( 138 : : ::ad::map::landmark::TrafficLightType::INVALID); 139 : 1 : value.openDriveDefaultTrafficLightType = valueOpenDriveDefaultTrafficLightType; 140 : : 141 : : // override member with data type value below input range minimum 142 : 1 : ::ad::map::landmark::TrafficLightType invalidInitializedMember( 143 : : static_cast<::ad::map::landmark::TrafficLightType>(-1)); 144 : 1 : value.openDriveDefaultTrafficLightType = invalidInitializedMember; 145 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 146 : : } 147 : : 148 : 2 : TEST(MapEntryValidInputRangeTests, testValidInputRangeOpenDriveDefaultTrafficLightTypeTooBig) 149 : : { 150 : 1 : ::ad::map::config::MapEntry value; 151 [ + - ]: 1 : std::string valueFilename{"min"}; 152 [ + - ]: 1 : value.filename = valueFilename; 153 : 1 : ::ad::physics::Distance valueOpenDriveOverlapMargin(-1e9); 154 : 1 : value.openDriveOverlapMargin = valueOpenDriveOverlapMargin; 155 : 1 : ::ad::map::intersection::IntersectionType valueOpenDriveDefaultIntersectionType( 156 : : ::ad::map::intersection::IntersectionType::Unknown); 157 : 1 : value.openDriveDefaultIntersectionType = valueOpenDriveDefaultIntersectionType; 158 : 1 : ::ad::map::landmark::TrafficLightType valueOpenDriveDefaultTrafficLightType( 159 : : ::ad::map::landmark::TrafficLightType::INVALID); 160 : 1 : value.openDriveDefaultTrafficLightType = valueOpenDriveDefaultTrafficLightType; 161 : : 162 : : // override member with data type value above input range maximum 163 : 1 : ::ad::map::landmark::TrafficLightType invalidInitializedMember( 164 : : static_cast<::ad::map::landmark::TrafficLightType>(-1)); 165 : 1 : value.openDriveDefaultTrafficLightType = invalidInitializedMember; 166 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 167 : : }