Browse Source

Math: use typedefs from Magnum.h in all tests.

For some reason a lot of these got forgotten in
b2c353bf21. Also adding a comment
explaining the difference, because it's likely to stop being obvious few
months from now.
pull/168/head
Vladimír Vondruš 2 years ago
parent
commit
8c7679c7b1
  1. 2
      src/Magnum/Math/Test/BezierTest.cpp
  2. 2
      src/Magnum/Math/Test/DualComplexTest.cpp
  3. 2
      src/Magnum/Math/Test/DualQuaternionTest.cpp
  4. 2
      src/Magnum/Math/Test/DualTest.cpp
  5. 6
      src/Magnum/Math/Test/FunctionsBenchmark.cpp
  6. 6
      src/Magnum/Math/Test/InterpolationBenchmark.cpp
  7. 16
      src/Magnum/Math/Test/IntersectionBenchmark.cpp
  8. 2
      src/Magnum/Math/Test/Matrix3Test.cpp
  9. 2
      src/Magnum/Math/Test/Matrix4Test.cpp
  10. 10
      src/Magnum/Math/Test/MatrixBenchmark.cpp
  11. 3
      src/Magnum/Math/Test/MatrixTest.cpp
  12. 19
      src/Magnum/Math/Test/RectangularMatrixTest.cpp
  13. 1
      src/Magnum/Math/Test/SwizzleTest.cpp
  14. 2
      src/Magnum/Math/Test/UnitTest.cpp
  15. 6
      src/Magnum/Math/Test/VectorBenchmark.cpp
  16. 7
      src/Magnum/Math/Test/VectorTest.cpp

2
src/Magnum/Math/Test/BezierTest.cpp

@ -56,6 +56,8 @@ template<> struct BezierConverter<2, 2, Float, QBezier2D> {
namespace Test { namespace {
/* What's a typedef and not a using differs from the typedefs in root Magnum
namespace, or is not present there at all */
using Magnum::Vector2;
typedef Math::Bezier<1, 2, Float> LinearBezier2D;
using Magnum::QuadraticBezier2D;

2
src/Magnum/Math/Test/DualComplexTest.cpp

@ -103,6 +103,8 @@ struct DualComplexTest: TestSuite::Tester {
using namespace Math::Literals;
/* What's a typedef and not a using differs from the typedefs in root Magnum
namespace, or is not present there at all */
using Magnum::Deg;
using Magnum::Rad;
using Magnum::Complex;

2
src/Magnum/Math/Test/DualQuaternionTest.cpp

@ -110,6 +110,8 @@ struct DualQuaternionTest: TestSuite::Tester {
void debug();
};
/* What's a typedef and not a using differs from the typedefs in root Magnum
namespace, or is not present there at all */
using Magnum::Deg;
using Magnum::Rad;
typedef Math::Dual<Float> Dual;

2
src/Magnum/Math/Test/DualTest.cpp

@ -68,6 +68,8 @@ struct DualTest: TestSuite::Tester {
void debug();
};
/* What's a typedef and not a using differs from the typedefs in root Magnum
namespace, or is not present there at all */
typedef Math::Dual<Float> Dual;
using Magnum::Vector2;
typedef Math::Dual<Vector2> DualVector2;

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

@ -68,9 +68,9 @@ FunctionsBenchmark::FunctionsBenchmark() {
&FunctionsBenchmark::sinCosCombined}, 100);
}
typedef Math::Constants<Float> Constants;
typedef Math::Deg<Float> Deg;
typedef Math::Rad<Float> Rad;
using Magnum::Constants;
using Magnum::Deg;
using Magnum::Rad;
enum: std::size_t { Repeats = 100000 };

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

@ -47,9 +47,9 @@ struct InterpolationBenchmark: TestSuite::Tester {
using namespace Math::Literals;
typedef Math::Quaternion<Float> Quaternion;
typedef Math::DualQuaternion<Float> DualQuaternion;
typedef Math::Vector3<Float> Vector3;
using Magnum::Quaternion;
using Magnum::DualQuaternion;
using Magnum::Vector3;
InterpolationBenchmark::InterpolationBenchmark() {
addBenchmarks({&InterpolationBenchmark::baseline,

16
src/Magnum/Math/Test/IntersectionBenchmark.cpp

@ -87,14 +87,14 @@ Math::Matrix4<T> coneViewFromCone(const Math::Vector3<T>& origin, const Math::Ve
return Math::Matrix4<T>::lookAt(origin, origin + normal, Math::Vector3<T>::yAxis()).inverted();
}
typedef Math::Vector2<Float> Vector2;
typedef Math::Vector3<Float> Vector3;
typedef Math::Vector4<Float> Vector4;
typedef Math::Matrix4<Float> Matrix4;
typedef Math::Frustum<Float> Frustum;
typedef Math::Range3D<Float> Range3D;
typedef Math::Deg<Float> Deg;
typedef Math::Rad<Float> Rad;
using Magnum::Vector2;
using Magnum::Vector3;
using Magnum::Vector4;
using Magnum::Matrix4;
using Magnum::Frustum;
using Magnum::Range3D;
using Magnum::Deg;
using Magnum::Rad;
struct IntersectionBenchmark: TestSuite::Tester {
explicit IntersectionBenchmark();

2
src/Magnum/Math/Test/Matrix3Test.cpp

@ -104,6 +104,8 @@ struct Matrix3Test: TestSuite::Tester {
void debug();
};
/* What's a typedef and not a using differs from the typedefs in root Magnum
namespace, or is not present there at all */
using Magnum::Deg;
using Magnum::Matrix2x2;
using Magnum::Matrix2x4;

2
src/Magnum/Math/Test/Matrix4Test.cpp

@ -124,6 +124,8 @@ struct Matrix4Test: TestSuite::Tester {
void debug();
};
/* What's a typedef and not a using differs from the typedefs in root Magnum
namespace, or is not present there at all */
using Magnum::Deg;
using Magnum::Rad;
using Magnum::Matrix2x2;

10
src/Magnum/Math/Test/MatrixBenchmark.cpp

@ -75,11 +75,11 @@ MatrixBenchmark::MatrixBenchmark() {
&MatrixBenchmark::transformPoint4}, 1000);
}
typedef Math::Vector2<Float> Vector2;
typedef Math::Vector3<Float> Vector3;
typedef Math::Vector4<Float> Vector4;
typedef Math::Matrix4<Float> Matrix4;
typedef Math::Matrix3<Float> Matrix3;
using Magnum::Vector2;
using Magnum::Vector3;
using Magnum::Vector4;
using Magnum::Matrix4;
using Magnum::Matrix3;
enum: std::size_t { Repeats = 10000 };

3
src/Magnum/Math/Test/MatrixTest.cpp

@ -89,6 +89,9 @@ struct MatrixTest: TestSuite::Tester {
void debug();
};
/* What's a typedef and not a using differs from the typedefs in root Magnum
namespace, or is not present there at all */
using Magnum::Matrix2x2;
using Magnum::Matrix2x3;
using Magnum::Matrix3x3;

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

@ -99,18 +99,21 @@ struct RectangularMatrixTest: TestSuite::Tester {
void debugPacked();
};
typedef RectangularMatrix<4, 3, Float> Matrix4x3;
typedef RectangularMatrix<4, 2, Float> Matrix4x2;
typedef RectangularMatrix<3, 4, Float> Matrix3x4;
/* What's a typedef and not a using differs from the typedefs in root Magnum
namespace, or is not present there at all */
using Magnum::Matrix4x3;
using Magnum::Matrix4x2;
using Magnum::Matrix3x4;
typedef RectangularMatrix<3, 3, Float> Matrix3x3;
typedef RectangularMatrix<3, 2, Float> Matrix3x2;
using Magnum::Matrix3x2;
typedef RectangularMatrix<2, 2, Float> Matrix2x2;
typedef RectangularMatrix<2, 3, Float> Matrix2x3;
typedef RectangularMatrix<2, 4, Float> Matrix2x4;
using Magnum::Matrix2x3;
using Magnum::Matrix2x4;
typedef RectangularMatrix<2, 2, Int> Matrix2x2i;
typedef Vector<4, Float> Vector4;
typedef Vector<3, Float> Vector3;
typedef Vector<2, Float> Vector2;
using Magnum::BitVector3;
typedef RectangularMatrix<4, 3, Int> Matrix4x3i;
typedef RectangularMatrix<3, 4, Int> Matrix3x4i;
@ -380,7 +383,6 @@ void RectangularMatrixTest::constructCopy() {
}
void RectangularMatrixTest::convert() {
typedef RectangularMatrix<2, 3, Float> Matrix2x3;
constexpr Mat2x3 a{{1.5f, 2.0f, -3.5f,
2.0f, -3.1f, 0.4f}};
constexpr Matrix2x3 b(Vector3(1.5f, 2.0f, -3.5f),
@ -474,7 +476,6 @@ void RectangularMatrixTest::compare() {
}
void RectangularMatrixTest::compareComponentWise() {
typedef BitVector<3> BitVector3;
typedef RectangularMatrix<3, 1, Float> Matrix3x1;
CORRADE_COMPARE(Matrix3x1(1.0f, -1.0f, 5.0f) < Matrix3x1(1.1f, -1.0f, 3.0f), BitVector3(0x1));
CORRADE_COMPARE(Matrix3x1(1.0f, -1.0f, 5.0f) <= Matrix3x1(1.1f, -1.0f, 3.0f), BitVector3(0x3));
@ -637,8 +638,6 @@ void RectangularMatrixTest::diagonal() {
}
void RectangularMatrixTest::vector() {
typedef Vector<3, Int> Vector3i;
typedef RectangularMatrix<4, 3, Int> Matrix4x3i;
typedef Vector<12, Int> Vector12i;
Matrix4x3i a(Vector3i(0, 1, 2),

1
src/Magnum/Math/Test/SwizzleTest.cpp

@ -44,6 +44,7 @@ struct SwizzleTest: TestSuite::Tester {
void scatterFarComponents();
};
/* These differ from the typedefs in root Magnum namespace */
typedef Vector<2, Int> Vector2i;
typedef Vector<3, Int> Vector3i;
typedef Vector<4, Int> Vector4i;

2
src/Magnum/Math/Test/UnitTest.cpp

@ -64,6 +64,8 @@ UnitTest::UnitTest() {
&UnitTest::multiplyDivide});
}
/* What's a typedef and not a using differs from the typedefs in root Magnum
namespace, or is not present there at all */
template<class> struct Sec_;
typedef Unit<Sec_, Float> Sec;
typedef Unit<Sec_, Int> Seci;

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

@ -67,9 +67,9 @@ VectorBenchmark::VectorBenchmark() {
}, 500);
}
typedef Math::Constants<Float> Constants;
typedef Math::Vector2<Float> Vector2;
typedef Math::Vector3<Float> Vector3;
using Magnum::Constants;
using Magnum::Vector2;
using Magnum::Vector3;
enum: std::size_t { Repeats = 100000 };

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

@ -120,6 +120,8 @@ struct VectorTest: TestSuite::Tester {
void debugPacked();
};
/* What's a typedef and not a using differs from the typedefs in root Magnum
namespace */
using Magnum::Constants;
using Magnum::Rad;
typedef Vector<2, Float> Vector2;
@ -128,6 +130,7 @@ typedef Vector<3, Float> Vector3;
typedef Vector<4, Float> Vector4;
typedef Vector<4, Half> Vector4h;
typedef Vector<4, Int> Vector4i;
typedef Vector<2, Int> Vector2i;
using namespace Literals;
@ -459,8 +462,6 @@ void VectorTest::multiplyDivideComponentWiseIntegral() {
}
void VectorTest::modulo() {
typedef Math::Vector<2, Int> Vector2i;
const Vector2i a(4, 13);
const Vector2i b(2, 5);
CORRADE_COMPARE(a % 2, Vector2i(0, 1));
@ -468,8 +469,6 @@ void VectorTest::modulo() {
}
void VectorTest::bitwise() {
typedef Math::Vector<2, Int> Vector2i;
const Vector2i a(85, 240);
const Vector2i b(170, 85);
CORRADE_COMPARE(~a, Vector2i(-86, -241));

Loading…
Cancel
Save