Browse Source

Math: test "implicitness" of value constructors.

pull/277/head
Vladimír Vondruš 13 years ago
parent
commit
7427292173
  1. 6
      src/Math/Test/Matrix3Test.cpp
  2. 8
      src/Math/Test/Matrix4Test.cpp
  3. 9
      src/Math/Test/MatrixTest.cpp
  4. 6
      src/Math/Test/RectangularMatrixTest.cpp
  5. 2
      src/Math/Test/Vector2Test.cpp
  6. 2
      src/Math/Test/Vector3Test.cpp
  7. 2
      src/Math/Test/Vector4Test.cpp
  8. 2
      src/Math/Test/VectorTest.cpp

6
src/Math/Test/Matrix3Test.cpp

@ -122,9 +122,9 @@ Matrix3Test::Matrix3Test() {
} }
void Matrix3Test::construct() { void Matrix3Test::construct() {
constexpr Matrix3 a({3.0f, 5.0f, 8.0f}, constexpr Matrix3 a = {{3.0f, 5.0f, 8.0f},
{4.5f, 4.0f, 7.0f}, {4.5f, 4.0f, 7.0f},
{7.9f, -1.0f, 8.0f}); {7.9f, -1.0f, 8.0f}};
CORRADE_COMPARE(a, Matrix3({3.0f, 5.0f, 8.0f}, CORRADE_COMPARE(a, Matrix3({3.0f, 5.0f, 8.0f},
{4.5f, 4.0f, 7.0f}, {4.5f, 4.0f, 7.0f},
{7.9f, -1.0f, 8.0f})); {7.9f, -1.0f, 8.0f}));

8
src/Math/Test/Matrix4Test.cpp

@ -134,10 +134,10 @@ Matrix4Test::Matrix4Test() {
} }
void Matrix4Test::construct() { void Matrix4Test::construct() {
constexpr Matrix4 a({3.0f, 5.0f, 8.0f, -3.0f}, constexpr Matrix4 a = {{3.0f, 5.0f, 8.0f, -3.0f},
{4.5f, 4.0f, 7.0f, 2.0f}, {4.5f, 4.0f, 7.0f, 2.0f},
{1.0f, 2.0f, 3.0f, -1.0f}, {1.0f, 2.0f, 3.0f, -1.0f},
{7.9f, -1.0f, 8.0f, -1.5f}); {7.9f, -1.0f, 8.0f, -1.5f}};
CORRADE_COMPARE(a, Matrix4({3.0f, 5.0f, 8.0f, -3.0f}, CORRADE_COMPARE(a, Matrix4({3.0f, 5.0f, 8.0f, -3.0f},
{4.5f, 4.0f, 7.0f, 2.0f}, {4.5f, 4.0f, 7.0f, 2.0f},
{1.0f, 2.0f, 3.0f, -1.0f}, {1.0f, 2.0f, 3.0f, -1.0f},

9
src/Math/Test/MatrixTest.cpp

@ -108,11 +108,10 @@ MatrixTest::MatrixTest() {
} }
void MatrixTest::construct() { void MatrixTest::construct() {
/* Value constructor */ constexpr Matrix4 a = {Vector4(3.0f, 5.0f, 8.0f, -3.0f),
constexpr Matrix4 a(Vector4(3.0f, 5.0f, 8.0f, -3.0f), Vector4(4.5f, 4.0f, 7.0f, 2.0f),
Vector4(4.5f, 4.0f, 7.0f, 2.0f), Vector4(1.0f, 2.0f, 3.0f, -1.0f),
Vector4(1.0f, 2.0f, 3.0f, -1.0f), Vector4(7.9f, -1.0f, 8.0f, -1.5f)};
Vector4(7.9f, -1.0f, 8.0f, -1.5f));
CORRADE_COMPARE(a, Matrix4(Vector4(3.0f, 5.0f, 8.0f, -3.0f), CORRADE_COMPARE(a, Matrix4(Vector4(3.0f, 5.0f, 8.0f, -3.0f),
Vector4(4.5f, 4.0f, 7.0f, 2.0f), Vector4(4.5f, 4.0f, 7.0f, 2.0f),
Vector4(1.0f, 2.0f, 3.0f, -1.0f), Vector4(1.0f, 2.0f, 3.0f, -1.0f),

6
src/Math/Test/RectangularMatrixTest.cpp

@ -122,9 +122,9 @@ RectangularMatrixTest::RectangularMatrixTest() {
} }
void RectangularMatrixTest::construct() { void RectangularMatrixTest::construct() {
constexpr Matrix3x4 a(Vector4(1.0f, 2.0f, 3.0f, 4.0f), constexpr Matrix3x4 a = {Vector4(1.0f, 2.0f, 3.0f, 4.0f),
Vector4(5.0f, 6.0f, 7.0f, 8.0f), Vector4(5.0f, 6.0f, 7.0f, 8.0f),
Vector4(9.0f, 10.0f, 11.0f, 12.0f)); Vector4(9.0f, 10.0f, 11.0f, 12.0f)};
CORRADE_COMPARE(a, Matrix3x4(Vector4(1.0f, 2.0f, 3.0f, 4.0f), CORRADE_COMPARE(a, Matrix3x4(Vector4(1.0f, 2.0f, 3.0f, 4.0f),
Vector4(5.0f, 6.0f, 7.0f, 8.0f), Vector4(5.0f, 6.0f, 7.0f, 8.0f),
Vector4(9.0f, 10.0f, 11.0f, 12.0f))); Vector4(9.0f, 10.0f, 11.0f, 12.0f)));

2
src/Math/Test/Vector2Test.cpp

@ -96,7 +96,7 @@ Vector2Test::Vector2Test() {
} }
void Vector2Test::construct() { void Vector2Test::construct() {
constexpr Vector2 a(1.5f, 2.5f); constexpr Vector2 a = {1.5f, 2.5f};
CORRADE_COMPARE(a, (Vector<2, Float>(1.5f, 2.5f))); CORRADE_COMPARE(a, (Vector<2, Float>(1.5f, 2.5f)));
} }

2
src/Math/Test/Vector3Test.cpp

@ -98,7 +98,7 @@ Vector3Test::Vector3Test() {
} }
void Vector3Test::construct() { void Vector3Test::construct() {
constexpr Vector3 a(1.0f, 2.5f, -3.0f); constexpr Vector3 a = {1.0f, 2.5f, -3.0f};
CORRADE_COMPARE(a, (Vector<3, Float>(1.0f, 2.5f, -3.0f))); CORRADE_COMPARE(a, (Vector<3, Float>(1.0f, 2.5f, -3.0f)));
} }

2
src/Math/Test/Vector4Test.cpp

@ -95,7 +95,7 @@ Vector4Test::Vector4Test() {
} }
void Vector4Test::construct() { void Vector4Test::construct() {
constexpr Vector4 a(1.0f, -2.5f, 3.0f, 4.1f); constexpr Vector4 a = {1.0f, -2.5f, 3.0f, 4.1f};
CORRADE_COMPARE(a, (Vector<4, Float>(1.0f, -2.5f, 3.0f, 4.1f))); CORRADE_COMPARE(a, (Vector<4, Float>(1.0f, -2.5f, 3.0f, 4.1f)));
} }

2
src/Math/Test/VectorTest.cpp

@ -143,7 +143,7 @@ VectorTest::VectorTest() {
} }
void VectorTest::construct() { void VectorTest::construct() {
constexpr Vector4 a(1.0f, 2.0f, -3.0f, 4.5f); constexpr Vector4 a = {1.0f, 2.0f, -3.0f, 4.5f};
CORRADE_COMPARE(a, Vector4(1.0f, 2.0f, -3.0f, 4.5f)); CORRADE_COMPARE(a, Vector4(1.0f, 2.0f, -3.0f, 4.5f));
} }

Loading…
Cancel
Save