diff --git a/include/omath/trigonometry/angle.hpp b/include/omath/trigonometry/angle.hpp index 9d8f9cc..22902b8 100644 --- a/include/omath/trigonometry/angle.hpp +++ b/include/omath/trigonometry/angle.hpp @@ -125,7 +125,7 @@ namespace omath } [[nodiscard]] - constexpr Angle operator+(const Angle& other) noexcept + constexpr Angle operator+(const Angle& other) const noexcept { if constexpr (flags == AngleFlags::Normalized) return Angle{angles::wrap_angle(m_angle + other.m_angle, min, max)}; @@ -140,7 +140,7 @@ namespace omath } [[nodiscard]] - constexpr Angle operator-(const Angle& other) noexcept + constexpr Angle operator-(const Angle& other) const noexcept { return operator+(-other); } diff --git a/tests/general/unit_test_angle.cpp b/tests/general/unit_test_angle.cpp index 89cc88c..edbe361 100644 --- a/tests/general/unit_test_angle.cpp +++ b/tests/general/unit_test_angle.cpp @@ -183,7 +183,7 @@ TEST(UnitTestAngle, Formatter_PrintsDegreesWithSuffix) TEST(UnitTestAngle, BinaryPlus_ReturnsWrappedSum) { - Angle<> a = Deg::from_degrees(350.0f); + const Angle<> a = Deg::from_degrees(350.0f); const Deg b = Deg::from_degrees(20.0f); const Deg c = a + b; // expect 10° EXPECT_FLOAT_EQ(c.as_degrees(), 10.0f); @@ -191,7 +191,7 @@ TEST(UnitTestAngle, BinaryPlus_ReturnsWrappedSum) TEST(UnitTestAngle, BinaryMinus_ReturnsWrappedDiff) { - Angle<> a = Deg::from_degrees(10.0f); + const Angle<> a = Deg::from_degrees(10.0f); const Deg b = Deg::from_degrees(30.0f); const Deg c = a - b; // expect 340° EXPECT_FLOAT_EQ(c.as_degrees(), 340.0f);