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/PointOfInterestValidInputRange.hpp" 20 : : 21 : 2 : TEST(PointOfInterestValidInputRangeTests, testValidInputRange) 22 : : { 23 : 1 : ::ad::map::config::PointOfInterest value; 24 : 1 : ::ad::map::point::GeoPoint valueGeoPoint; 25 : 1 : ::ad::map::point::Longitude valueGeoPointLongitude(-180); 26 : 1 : valueGeoPoint.longitude = valueGeoPointLongitude; 27 : 1 : ::ad::map::point::Latitude valueGeoPointLatitude(-90); 28 : 1 : valueGeoPoint.latitude = valueGeoPointLatitude; 29 : 1 : ::ad::map::point::Altitude valueGeoPointAltitude(-11000); 30 : 1 : valueGeoPoint.altitude = valueGeoPointAltitude; 31 : 1 : value.geoPoint = valueGeoPoint; 32 [ + - ]: 1 : std::string valueName{"min"}; 33 [ + - ]: 1 : value.name = valueName; 34 [ + - - + : 1 : ASSERT_TRUE(withinValidInputRange(value)); - - - - - - - - ] 35 : : } 36 : : 37 : 2 : TEST(PointOfInterestValidInputRangeTests, testValidInputRangeGeoPointTooSmall) 38 : : { 39 : 1 : ::ad::map::config::PointOfInterest value; 40 : 1 : ::ad::map::point::GeoPoint valueGeoPoint; 41 : 1 : ::ad::map::point::Longitude valueGeoPointLongitude(-180); 42 : 1 : valueGeoPoint.longitude = valueGeoPointLongitude; 43 : 1 : ::ad::map::point::Latitude valueGeoPointLatitude(-90); 44 : 1 : valueGeoPoint.latitude = valueGeoPointLatitude; 45 : 1 : ::ad::map::point::Altitude valueGeoPointAltitude(-11000); 46 : 1 : valueGeoPoint.altitude = valueGeoPointAltitude; 47 : 1 : value.geoPoint = valueGeoPoint; 48 [ + - ]: 1 : std::string valueName{"min"}; 49 [ + - ]: 1 : value.name = valueName; 50 : : 51 : : // override member with data type value below input range minimum 52 : 1 : ::ad::map::point::GeoPoint invalidInitializedMember; 53 : 1 : ::ad::map::point::Longitude invalidInitializedMemberLongitude(-180 * 1.1); 54 : 1 : invalidInitializedMember.longitude = invalidInitializedMemberLongitude; 55 : 1 : value.geoPoint = invalidInitializedMember; 56 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 57 : : } 58 : : 59 : 2 : TEST(PointOfInterestValidInputRangeTests, testValidInputRangeGeoPointTooBig) 60 : : { 61 : 1 : ::ad::map::config::PointOfInterest value; 62 : 1 : ::ad::map::point::GeoPoint valueGeoPoint; 63 : 1 : ::ad::map::point::Longitude valueGeoPointLongitude(-180); 64 : 1 : valueGeoPoint.longitude = valueGeoPointLongitude; 65 : 1 : ::ad::map::point::Latitude valueGeoPointLatitude(-90); 66 : 1 : valueGeoPoint.latitude = valueGeoPointLatitude; 67 : 1 : ::ad::map::point::Altitude valueGeoPointAltitude(-11000); 68 : 1 : valueGeoPoint.altitude = valueGeoPointAltitude; 69 : 1 : value.geoPoint = valueGeoPoint; 70 [ + - ]: 1 : std::string valueName{"min"}; 71 [ + - ]: 1 : value.name = valueName; 72 : : 73 : : // override member with data type value above input range maximum 74 : 1 : ::ad::map::point::GeoPoint invalidInitializedMember; 75 : 1 : ::ad::map::point::Longitude invalidInitializedMemberLongitude(180 * 1.1); 76 : 1 : invalidInitializedMember.longitude = invalidInitializedMemberLongitude; 77 : 1 : value.geoPoint = invalidInitializedMember; 78 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 79 : : }