|
|
|
|
@ -48,7 +48,9 @@ class VectorTest: public Corrade::TestSuite::Tester {
|
|
|
|
|
void sum(); |
|
|
|
|
void product(); |
|
|
|
|
void min(); |
|
|
|
|
void minAbs(); |
|
|
|
|
void max(); |
|
|
|
|
void maxAbs(); |
|
|
|
|
|
|
|
|
|
void projected(); |
|
|
|
|
void angle(); |
|
|
|
|
@ -85,7 +87,9 @@ VectorTest::VectorTest() {
|
|
|
|
|
&VectorTest::sum, |
|
|
|
|
&VectorTest::product, |
|
|
|
|
&VectorTest::min, |
|
|
|
|
&VectorTest::minAbs, |
|
|
|
|
&VectorTest::max, |
|
|
|
|
&VectorTest::maxAbs, |
|
|
|
|
|
|
|
|
|
&VectorTest::projected, |
|
|
|
|
&VectorTest::angle, |
|
|
|
|
@ -217,11 +221,23 @@ void VectorTest::min() {
|
|
|
|
|
CORRADE_COMPARE(Vector3(1.0f, -2.0f, 3.0f).min(), -2.0f); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void VectorTest::minAbs() { |
|
|
|
|
/* Check that initial value is absolute and also all others */ |
|
|
|
|
CORRADE_COMPARE(Vector3(-2.0f, 1.0f, 3.0f).minAbs(), 1.0f); |
|
|
|
|
CORRADE_COMPARE(Vector3(1.0f, -2.0f, 3.0f).minAbs(), 1.0f); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void VectorTest::max() { |
|
|
|
|
/* Check also that initial value isn't initialized to 0 */ |
|
|
|
|
CORRADE_COMPARE(Vector3(-1.0f, -2.0f, -3.0f).max(), -1.0f); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void VectorTest::maxAbs() { |
|
|
|
|
/* Check that initial value is absolute and also all others */ |
|
|
|
|
CORRADE_COMPARE(Vector3(-5.0f, 1.0f, 3.0f).maxAbs(), 5.0f); |
|
|
|
|
CORRADE_COMPARE(Vector3(1.0f, -5.0f, 3.0f).maxAbs(), 5.0f); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void VectorTest::projected() { |
|
|
|
|
Vector3 line(1.0f, -1.0f, 0.5f); |
|
|
|
|
Vector3 projected = Vector3(1.0f, 2.0f, 3.0f).projected(line); |
|
|
|
|
|