Skip to content

Commit

Permalink
just add constexpr to the same unit in Vector{2,3}
Browse files Browse the repository at this point in the history
  • Loading branch information
sthalik committed Oct 10, 2022
1 parent e7afdb1 commit 03b11cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/Magnum/Math/Test/Vector2Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void Vector2Test::convert() {
}

void Vector2Test::access() {
Vector2 vec(1.0f, -2.0f);
MAGNUM_CONSTEXPR14 Vector2 vec(1.0f, -2.0f);
CORRADE_COMPARE(vec.x(), 1.0f);
CORRADE_COMPARE(vec.y(), -2.0f);

Expand All @@ -209,8 +209,8 @@ void Vector2Test::access() {
}

void Vector2Test::cross() {
Vector2i a(1, -1);
Vector2i b(4, 3);
MAGNUM_CONSTEXPR14 Vector2i a(1, -1);
MAGNUM_CONSTEXPR14 Vector2i b(4, 3);

CORRADE_COMPARE(Math::cross(a, b), 7);
CORRADE_COMPARE(Math::cross<Int>({a, 0}, {b, 0}), Vector3i(0, 0, Math::cross(a, b)));
Expand Down
14 changes: 7 additions & 7 deletions src/Magnum/Math/Test/Vector3Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void Vector3Test::convert() {
}

void Vector3Test::access() {
Vector3 vec(1.0f, -2.0f, 5.0f);
MAGNUM_CONSTEXPR14 Vector3 vec(1.0f, -2.0f, 5.0f);
CORRADE_COMPARE(vec.x(), 1.0f);
CORRADE_COMPARE(vec.r(), 1.0f);
CORRADE_COMPARE(vec.y(), -2.0f);
Expand All @@ -230,8 +230,8 @@ void Vector3Test::access() {
}

void Vector3Test::cross() {
Vector3i a(1, -1, 1);
Vector3i b(4, 3, 7);
MAGNUM_CONSTEXPR14 Vector3i a(1, -1, 1);
MAGNUM_CONSTEXPR14 Vector3i b(4, 3, 7);

CORRADE_COMPARE(Math::cross(a, b), Vector3i(-10, -3, 7));
}
Expand All @@ -255,7 +255,7 @@ void Vector3Test::scales() {
}

void Vector3Test::twoComponent() {
Vector3 a(1.0f, 2.0f, 3.0f);
MAGNUM_CONSTEXPR14 Vector3 a(1.0f, 2.0f, 3.0f);
CORRADE_COMPARE(a.xy(), Vector2(1.0f, 2.0f));

constexpr Vector3 b(1.0f, 2.0f, 3.0f);
Expand All @@ -267,9 +267,9 @@ void Vector3Test::twoComponent() {

void Vector3Test::strictWeakOrdering() {
StrictWeakOrdering o;
const Vector3 v3a{1.0f, 2.0f, 3.0f};
const Vector3 v3b{2.0f, 3.0f, 4.0f};
const Vector3 v3c{1.0f, 2.0f, 4.0f};
MAGNUM_CONSTEXPR14 const Vector3 v3a{1.0f, 2.0f, 3.0f};
MAGNUM_CONSTEXPR14 const Vector3 v3b{2.0f, 3.0f, 4.0f};
MAGNUM_CONSTEXPR14 const Vector3 v3c{1.0f, 2.0f, 4.0f};

CORRADE_VERIFY( o(v3a, v3b));
CORRADE_VERIFY(!o(v3b, v3a));
Expand Down

0 comments on commit 03b11cb

Please sign in to comment.