Преглед на файлове

Solve SonarLint findings

Patrick-Christopher Mattulat преди 11 месеца
родител
ревизия
636c734878
променени са 3 файла, в които са добавени 4 реда и са изтрити 10 реда
  1. 1 1
      include/ls_math/vector/Vector2.hpp
  2. 1 1
      source/ls_math/vector/Vector2.cpp
  3. 2 8
      test/cases/vector/Vector2Test.cpp

+ 1 - 1
include/ls_math/vector/Vector2.hpp

@@ -40,7 +40,7 @@ namespace ls::math::vector
 
       [[nodiscard]] static ls::math::vector::Vector2 add(const ls::math::vector::Vector2 &_leftAddend, const ls::math::vector::Vector2 &_rightAddend);
       [[nodiscard]] static ls::math::core::type::vector_scalar dot(const ls::math::vector::Vector2 &_leftAddend, const ls::math::vector::Vector2 &_rightAddend);
-      [[nodiscard]] ls::math::core::type::vector2_components getComponents();
+      [[nodiscard]] ls::math::core::type::vector2_components getComponents() const;
       [[nodiscard]] double getLength();
       [[nodiscard]] ls::math::core::type::vector2_component getX();
       [[nodiscard]] ls::math::core::type::vector2_component getY();

+ 1 - 1
source/ls_math/vector/Vector2.cpp

@@ -67,7 +67,7 @@ vector_scalar Vector2::dot(const Vector2 &_leftAddend, const Vector2 &_rightAdde
   return Vector2::_dot(_leftAddend, _rightAddend);
 }
 
-vector2_components Vector2::getComponents()
+vector2_components Vector2::getComponents() const
 {
   return this->components;
 }

+ 2 - 8
test/cases/vector/Vector2Test.cpp

@@ -20,16 +20,10 @@ namespace
 {
   class Vector2Test : public Test
   {
-    protected:
+    public:
 
       Vector2Test() = default;
       ~Vector2Test() override = default;
-
-      void SetUp() override
-      {}
-
-      void TearDown() override
-      {}
   };
 
   TEST_F(Vector2Test, operator_addition)
@@ -64,7 +58,7 @@ namespace
 
   TEST_F(Vector2Test, operator_divisor)
   {
-    Vector2 c = Vector2(150.0f, -25.0f);
+    auto c = Vector2(150.0f, -25.0f);
     Vector2 n = c / 152.4f;
 
     // round by two decimals