Browse Source

MSVC 2013 compatibility: some explicit typing needed.

Vladimír Vondruš 11 years ago
parent
commit
1dbb4b8856
  1. 6
      src/Magnum/Math/Test/ComplexTest.cpp
  2. 6
      src/Magnum/Math/Test/QuaternionTest.cpp
  3. 9
      src/Magnum/Math/Test/VectorTest.cpp

6
src/Magnum/Math/Test/ComplexTest.cpp

@ -245,11 +245,13 @@ void ComplexTest::invertedNormalized() {
void ComplexTest::angle() {
std::ostringstream o;
Error::setOutput(&o);
Math::angle(Complex(1.5f, -2.0f).normalized(), {-4.0f, 3.5f});
/* MSVC 2013 needs explicit type for both */
Math::angle(Complex(1.5f, -2.0f).normalized(), Complex{-4.0f, 3.5f});
CORRADE_COMPARE(o.str(), "Math::angle(): complex numbers must be normalized\n");
o.str({});
Math::angle({1.5f, -2.0f}, Complex(-4.0f, 3.5f).normalized());
/* MSVC 2013 needs explicit type for both */
Math::angle(Complex{1.5f, -2.0f}, Complex(-4.0f, 3.5f).normalized());
CORRADE_COMPARE(o.str(), "Math::angle(): complex numbers must be normalized\n");
/* Verify also that the angle is the same as angle between 2D vectors */

6
src/Magnum/Math/Test/QuaternionTest.cpp

@ -260,11 +260,13 @@ void QuaternionTest::rotation() {
void QuaternionTest::angle() {
std::ostringstream o;
Error::setOutput(&o);
Math::angle(Quaternion({1.0f, 2.0f, -3.0f}, -4.0f).normalized(), {{4.0f, -3.0f, 2.0f}, -1.0f});
/* MSVC 2013 needs explicit type for both */
Math::angle(Quaternion({1.0f, 2.0f, -3.0f}, -4.0f).normalized(), Quaternion{{4.0f, -3.0f, 2.0f}, -1.0f});
CORRADE_COMPARE(o.str(), "Math::angle(): quaternions must be normalized\n");
o.str({});
Math::angle({{1.0f, 2.0f, -3.0f}, -4.0f}, Quaternion({4.0f, -3.0f, 2.0f}, -1.0f).normalized());
/* MSVC 2013 needs explicit type for both */
Math::angle(Quaternion{{1.0f, 2.0f, -3.0f}, -4.0f}, Quaternion({4.0f, -3.0f, 2.0f}, -1.0f).normalized());
CORRADE_COMPARE(o.str(), "Math::angle(): quaternions must be normalized\n");
/* Verify also that the angle is the same as angle between 4D vectors */

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

@ -381,7 +381,8 @@ void VectorTest::bitwise() {
}
void VectorTest::dot() {
CORRADE_COMPARE(Math::dot(Vector4{1.0f, 0.5f, 0.75f, 1.5f}, {2.0f, 4.0f, 1.0f, 7.0f}), 15.25f);
/* MSVC 2013 needs explicit type for both */
CORRADE_COMPARE(Math::dot(Vector4{1.0f, 0.5f, 0.75f, 1.5f}, Vector4{2.0f, 4.0f, 1.0f, 7.0f}), 15.25f);
}
void VectorTest::dotSelf() {
@ -452,11 +453,13 @@ void VectorTest::projectedOntoNormalized() {
void VectorTest::angle() {
std::ostringstream o;
Error::setOutput(&o);
Math::angle(Vector3(2.0f, 3.0f, 4.0f).normalized(), {1.0f, -2.0f, 3.0f});
/* MSVC 2013 needs explicit type for both */
Math::angle(Vector3(2.0f, 3.0f, 4.0f).normalized(), Vector3{1.0f, -2.0f, 3.0f});
CORRADE_COMPARE(o.str(), "Math::angle(): vectors must be normalized\n");
o.str({});
Math::angle({2.0f, 3.0f, 4.0f}, Vector3(1.0f, -2.0f, 3.0f).normalized());
/* MSVC 2013 needs explicit type for both */
Math::angle(Vector3{2.0f, 3.0f, 4.0f}, Vector3(1.0f, -2.0f, 3.0f).normalized());
CORRADE_COMPARE(o.str(), "Math::angle(): vectors must be normalized\n");
CORRADE_COMPARE(Math::angle(Vector3(2.0f, 3.0f, 4.0f).normalized(),

Loading…
Cancel
Save