|
|
|
@ -27,6 +27,7 @@ class QuaternionTest: public Corrade::TestSuite::Tester { |
|
|
|
explicit QuaternionTest(); |
|
|
|
explicit QuaternionTest(); |
|
|
|
|
|
|
|
|
|
|
|
void construct(); |
|
|
|
void construct(); |
|
|
|
|
|
|
|
void addSubtract(); |
|
|
|
void negated(); |
|
|
|
void negated(); |
|
|
|
void multiplyDivideScalar(); |
|
|
|
void multiplyDivideScalar(); |
|
|
|
void multiply(); |
|
|
|
void multiply(); |
|
|
|
@ -46,6 +47,7 @@ typedef Math::Vector3<float> Vector3; |
|
|
|
|
|
|
|
|
|
|
|
QuaternionTest::QuaternionTest() { |
|
|
|
QuaternionTest::QuaternionTest() { |
|
|
|
addTests(&QuaternionTest::construct, |
|
|
|
addTests(&QuaternionTest::construct, |
|
|
|
|
|
|
|
&QuaternionTest::addSubtract, |
|
|
|
&QuaternionTest::negated, |
|
|
|
&QuaternionTest::negated, |
|
|
|
&QuaternionTest::multiplyDivideScalar, |
|
|
|
&QuaternionTest::multiplyDivideScalar, |
|
|
|
&QuaternionTest::multiply, |
|
|
|
&QuaternionTest::multiply, |
|
|
|
@ -67,6 +69,15 @@ void QuaternionTest::construct() { |
|
|
|
CORRADE_COMPARE(Quaternion(), Quaternion({0.0f, 0.0f, 0.0f}, {1.0f})); |
|
|
|
CORRADE_COMPARE(Quaternion(), Quaternion({0.0f, 0.0f, 0.0f}, {1.0f})); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QuaternionTest::addSubtract() { |
|
|
|
|
|
|
|
Quaternion a({1.0f, 3.0f, -2.0f}, -4.0f); |
|
|
|
|
|
|
|
Quaternion b({-0.5f, 1.4f, 3.0f}, 12.0f); |
|
|
|
|
|
|
|
Quaternion c({0.5f, 4.4f, 1.0f}, 8.0f); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CORRADE_COMPARE(a+b, c); |
|
|
|
|
|
|
|
CORRADE_COMPARE(c-b, a); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QuaternionTest::negated() { |
|
|
|
void QuaternionTest::negated() { |
|
|
|
CORRADE_COMPARE(-Quaternion({1.0f, 2.0f, -3.0f}, -4.0f), Quaternion({-1.0f, -2.0f, 3.0f}, 4.0f)); |
|
|
|
CORRADE_COMPARE(-Quaternion({1.0f, 2.0f, -3.0f}, -4.0f), Quaternion({-1.0f, -2.0f, 3.0f}, 4.0f)); |
|
|
|
} |
|
|
|
} |
|
|
|
|