Browse Source

Math: fixed matrix tests (spotted by Clang).

Either GCC 4.8 poorly implements C++11 or it already has support for
some proposed C++14 feature, which allows to elide successive
initializer braces.
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
a4a962f686
  1. 12
      src/Math/Test/Matrix3Test.cpp
  2. 16
      src/Math/Test/Matrix4Test.cpp
  3. 12
      src/Math/Test/MatrixTest.cpp
  4. 8
      src/Math/Test/RectangularMatrixTest.cpp

12
src/Math/Test/Matrix3Test.cpp

@ -45,9 +45,9 @@ template<> struct RectangularMatrixConverter<3, 3, float, Mat3> {
}
inline constexpr static Mat3 to(const RectangularMatrix<3, 3, Float>& other) {
return Mat3{other[0][0], other[0][1], other[0][2],
other[1][0], other[1][1], other[1][2],
other[2][0], other[2][1], other[2][2]};
return Mat3{{other[0][0], other[0][1], other[0][2],
other[1][0], other[1][1], other[1][2],
other[2][0], other[2][1], other[2][2]}};
}
};
@ -181,9 +181,9 @@ void Matrix3Test::constructCopy() {
}
void Matrix3Test::convert() {
constexpr Mat3 a{1.5f, 2.0f, -3.5f,
2.0f, -3.1f, 0.4f,
9.5f, -1.5f, 0.1f};
constexpr Mat3 a{{1.5f, 2.0f, -3.5f,
2.0f, -3.1f, 0.4f,
9.5f, -1.5f, 0.1f}};
constexpr Matrix3 b(Vector3(1.5f, 2.0f, -3.5f),
Vector3(2.0f, -3.1f, 0.4f),
Vector3(9.5f, -1.5f, 0.1f));

16
src/Math/Test/Matrix4Test.cpp

@ -46,10 +46,10 @@ template<> struct RectangularMatrixConverter<4, 4, float, Mat4> {
}
inline constexpr static Mat4 to(const RectangularMatrix<4, 4, Float>& other) {
return Mat4{other[0][0], other[0][1], other[0][2], other[0][3],
other[1][0], other[1][1], other[1][2], other[1][3],
other[2][0], other[2][1], other[2][2], other[2][3],
other[3][0], other[3][1], other[3][2], other[3][3]};
return Mat4{{other[0][0], other[0][1], other[0][2], other[0][3],
other[1][0], other[1][1], other[1][2], other[1][3],
other[2][0], other[2][1], other[2][2], other[2][3],
other[3][0], other[3][1], other[3][2], other[3][3]}};
}
};
@ -203,10 +203,10 @@ void Matrix4Test::constructCopy() {
}
void Matrix4Test::convert() {
constexpr Mat4 a{3.0f, 5.0f, 8.0f, -3.0f,
4.5f, 4.0f, 7.0f, 2.0f,
1.0f, 2.0f, 3.0f, -1.0f,
7.9f, -1.0f, 8.0f, -1.5f};
constexpr Mat4 a{{3.0f, 5.0f, 8.0f, -3.0f,
4.5f, 4.0f, 7.0f, 2.0f,
1.0f, 2.0f, 3.0f, -1.0f,
7.9f, -1.0f, 8.0f, -1.5f}};
constexpr Matrix4 b({3.0f, 5.0f, 8.0f, -3.0f},
{4.5f, 4.0f, 7.0f, 2.0f},
{1.0f, 2.0f, 3.0f, -1.0f},

12
src/Math/Test/MatrixTest.cpp

@ -45,9 +45,9 @@ template<> struct RectangularMatrixConverter<3, 3, float, Mat3> {
}
inline constexpr static Mat3 to(const RectangularMatrix<3, 3, Float>& other) {
return Mat3{other[0][0], other[0][1], other[0][2],
other[1][0], other[1][1], other[1][2],
other[2][0], other[2][1], other[2][2]};
return Mat3{{other[0][0], other[0][1], other[0][2],
other[1][0], other[1][1], other[1][2],
other[2][0], other[2][1], other[2][2]}};
}
};
@ -179,9 +179,9 @@ void MatrixTest::constructCopy() {
}
void MatrixTest::convert() {
constexpr Mat3 a{1.5f, 2.0f, -3.5f,
2.0f, -3.1f, 0.4f,
9.5f, -1.5f, 0.1f};
constexpr Mat3 a{{1.5f, 2.0f, -3.5f,
2.0f, -3.1f, 0.4f,
9.5f, -1.5f, 0.1f}};
constexpr Matrix3 b(Vector3(1.5f, 2.0f, -3.5f),
Vector3(2.0f, -3.1f, 0.4f),
Vector3(9.5f, -1.5f, 0.1f));

8
src/Math/Test/RectangularMatrixTest.cpp

@ -44,8 +44,8 @@ template<> struct RectangularMatrixConverter<2, 3, float, Mat2x3> {
}
inline constexpr static Mat2x3 to(const RectangularMatrix<2, 3, Float>& other) {
return Mat2x3{other[0][0], other[0][1], other[0][2],
other[1][0], other[1][1], other[1][2]};
return Mat2x3{{other[0][0], other[0][1], other[0][2],
other[1][0], other[1][1], other[1][2]}};
}
};
@ -195,8 +195,8 @@ 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 Mat2x3 a{{1.5f, 2.0f, -3.5f,
2.0f, -3.1f, 0.4f}};
constexpr Matrix2x3 b(Vector3(1.5f, 2.0f, -3.5f),
Vector3(2.0f, -3.1f, 0.4f));

Loading…
Cancel
Save