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 : : #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/map/point/BoundingSphere.hpp" 23 : : 24 : : class BoundingSphereTests : public testing::Test 25 : : { 26 : : protected: 27 : 8 : virtual void SetUp() override 28 : : { 29 : : // valid initialization 30 : 8 : ::ad::map::point::BoundingSphere value; 31 : 8 : ::ad::map::point::ECEFPoint valueCenter; 32 : 8 : ::ad::map::point::ECEFCoordinate valueCenterX(-6400000); 33 : 8 : valueCenter.x = valueCenterX; 34 : 8 : ::ad::map::point::ECEFCoordinate valueCenterY(-6400000); 35 : 8 : valueCenter.y = valueCenterY; 36 : 8 : ::ad::map::point::ECEFCoordinate valueCenterZ(-6400000); 37 : 8 : valueCenter.z = valueCenterZ; 38 : 8 : value.center = valueCenter; 39 : 8 : ::ad::physics::Distance valueRadius(-1e9); 40 : 8 : value.radius = valueRadius; 41 : 8 : mValue = value; 42 : 8 : } 43 : : 44 : : ::ad::map::point::BoundingSphere mValue; 45 : : }; 46 : : 47 : 2 : TEST_F(BoundingSphereTests, copyConstruction) 48 : : { 49 : 1 : ::ad::map::point::BoundingSphere value(mValue); 50 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 51 : 1 : } 52 : : 53 : 2 : TEST_F(BoundingSphereTests, moveConstruction) 54 : : { 55 : 1 : ::ad::map::point::BoundingSphere tmpValue(mValue); 56 : 1 : ::ad::map::point::BoundingSphere value(std::move(tmpValue)); 57 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 58 : 1 : } 59 : : 60 : 2 : TEST_F(BoundingSphereTests, copyAssignment) 61 : : { 62 : 1 : ::ad::map::point::BoundingSphere value; 63 : 1 : value = mValue; 64 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 65 : 1 : } 66 : : 67 : 2 : TEST_F(BoundingSphereTests, moveAssignment) 68 : : { 69 : 1 : ::ad::map::point::BoundingSphere tmpValue(mValue); 70 : 1 : ::ad::map::point::BoundingSphere value; 71 : 1 : value = std::move(tmpValue); 72 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 73 : 1 : } 74 : : 75 : 2 : TEST_F(BoundingSphereTests, comparisonOperatorEqual) 76 : : { 77 : 1 : ::ad::map::point::BoundingSphere valueA = mValue; 78 : 1 : ::ad::map::point::BoundingSphere valueB = mValue; 79 : : 80 [ + - - + : 1 : EXPECT_TRUE(valueA == valueB); - - - - - - - - ] 81 [ + - - + : 1 : EXPECT_FALSE(valueA != valueB); - - - - - - - - ] 82 : 1 : } 83 : : 84 : 2 : TEST_F(BoundingSphereTests, stringConversionTest) 85 : : { 86 [ + - ]: 1 : std::stringstream stream; 87 [ + - ]: 1 : stream << mValue; 88 [ + - ]: 1 : std::string ostreamStr = stream.str(); 89 [ + - ]: 1 : std::string toStr = std::to_string(mValue); 90 [ + - - + : 1 : ASSERT_EQ(ostreamStr, toStr); - - - - - - ] 91 : : } 92 : : 93 : 2 : TEST_F(BoundingSphereTests, comparisonOperatorCenterDiffers) 94 : : { 95 : 1 : ::ad::map::point::BoundingSphere valueA = mValue; 96 : 1 : ::ad::map::point::ECEFPoint center; 97 : 1 : ::ad::map::point::ECEFCoordinate centerX(6400000); 98 : 1 : center.x = centerX; 99 : 1 : ::ad::map::point::ECEFCoordinate centerY(6400000); 100 : 1 : center.y = centerY; 101 : 1 : ::ad::map::point::ECEFCoordinate centerZ(6400000); 102 : 1 : center.z = centerZ; 103 : 1 : valueA.center = center; 104 : 1 : ::ad::map::point::BoundingSphere valueB = mValue; 105 : : 106 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 107 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 108 : 1 : } 109 : : 110 : 2 : TEST_F(BoundingSphereTests, comparisonOperatorRadiusDiffers) 111 : : { 112 : 1 : ::ad::map::point::BoundingSphere valueA = mValue; 113 : 1 : ::ad::physics::Distance radius(1e9); 114 : 1 : valueA.radius = radius; 115 : 1 : ::ad::map::point::BoundingSphere valueB = mValue; 116 : : 117 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 118 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 119 : 1 : } 120 : : 121 : : #if defined(__clang__) && (__clang_major__ >= 7) 122 : : #pragma GCC diagnostic pop 123 : : #endif