mirror of
https://github.com/orange-cpp/omath.git
synced 2026-08-07 21:42:05 +00:00
improvement
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user