Browse Source

Math: fix/workaround constexpr test compilation on MSVC 2015.

pull/162/merge
Vladimír Vondruš 10 years ago
parent
commit
bf393fad59
  1. 14
      src/Magnum/Math/Test/RectangularMatrixTest.cpp
  2. 5
      src/Magnum/Math/Test/VectorTest.cpp

14
src/Magnum/Math/Test/RectangularMatrixTest.cpp

@ -600,12 +600,18 @@ void RectangularMatrixTest::subclass() {
CORRADE_COMPARE(i*j, (BasicMat<1, Float>(6.0f)));
/* Functions */
constexpr Mat2x2 flippedCols = Mat2x2{Vector2{-1.0f, 5.0f},
Vector2{ 7.0f, -2.0f}}.flippedCols();
#ifndef CORRADE_MSVC2015_COMPATIBILITY /* Probably because copy is not constexpr */
constexpr
#endif
Mat2x2 flippedCols = Mat2x2{Vector2{-1.0f, 5.0f},
Vector2{ 7.0f, -2.0f}}.flippedCols();
CORRADE_COMPARE(flippedCols, (Mat2x2{Vector2{ 7.0f, -2.0f},
Vector2{-1.0f, 5.0f}}));
constexpr Mat2x2 flippedRows = Mat2x2{Vector2{-1.0f, 5.0f},
Vector2{ 7.0f, -2.0f}}.flippedRows();
#ifndef CORRADE_MSVC2015_COMPATIBILITY /* Probably because copy is not constexpr */
constexpr
#endif
Mat2x2 flippedRows = Mat2x2{Vector2{-1.0f, 5.0f},
Vector2{ 7.0f, -2.0f}}.flippedRows();
CORRADE_COMPARE(flippedRows, (Mat2x2{Vector2{ 5.0f, -1.0f},
Vector2{-2.0f, 7.0f}}));
}

5
src/Magnum/Math/Test/VectorTest.cpp

@ -649,7 +649,10 @@ void VectorTest::subclass() {
CORRADE_COMPARE(Vec2(3.0f, 0.0f).resized(6.0f), Vec2(6.0f, 0.0f));
CORRADE_COMPARE(Vec2(1.0f, 1.0f).projected({0.0f, 2.0f}), Vec2(0.0f, 1.0f));
CORRADE_COMPARE(Vec2(1.0f, 1.0f).projectedOntoNormalized({0.0f, 1.0f}), Vec2(0.0f, 1.0f));
constexpr Vec2 flipped = Vec2{1.0f, 0.4f}.flipped();
#ifndef CORRADE_MSVC2015_COMPATIBILITY /* Probably because copy is not constexpr */
constexpr
#endif
Vec2 flipped = Vec2{1.0f, 0.4f}.flipped();
CORRADE_COMPARE(flipped, (Vec2{0.4f, 1.0f}));
}

Loading…
Cancel
Save