Updated unit test to make sure it won't happen again.
@ -29,6 +29,10 @@ namespace Magnum { namespace Math { namespace Test {
typedef Math::Vector2<float> Vector2;
void Vector2Test::construct() {
QVERIFY((Vector2(1, 2) == Vector<float, 2>(1.0f, 2.0f)));
}
void Vector2Test::debug() {
ostringstream o;
Debug(&o) << Vector2(0.5f, 15.0f);
@ -23,6 +23,7 @@ class Vector2Test: public QObject {
Q_OBJECT
private slots:
void construct();
void debug();
};
@ -29,6 +29,11 @@ namespace Magnum { namespace Math { namespace Test {
typedef Math::Vector3<float> Vector3;
void Vector3Test::construct() {
QVERIFY((Vector3(1, 2, 3) == Vector<float, 3>(1.0f, 2.0f, 3.0f)));
QVERIFY((Vector3(Vector<float, 2>(1.0f, 2.0f), 3) == Vector<float, 3>(1.0f, 2.0f, 3.0f)));
void Vector3Test::cross() {
Vector3 a(1, -1, 1);
Vector3 b(4, 3, 7);
@ -23,6 +23,7 @@ class Vector3Test: public QObject {
void cross();
@ -32,6 +32,8 @@ typedef Math::Vector3<float> Vector3;
void Vector4Test::construct() {
QVERIFY(Vector4() == Vector4(0.0f, 0.0f, 0.0f, 1.0f));
QVERIFY((Vector4(1, 2, 3, 4) == Vector<float, 4>(1.0f, 2.0f, 3.0f, 4.0f)));
QVERIFY((Vector4(Vector<float, 3>(1.0f, 2.0f, 3.0f), 4) == Vector<float, 4>(1.0f, 2.0f, 3.0f, 4.0f)));
void Vector4Test::threeComponent() {
@ -64,7 +64,7 @@ template<class T> class Vector3: public Vector<T, 3> {
* @param other Two component vector
* @param z Z / B value
*/
inline Vector3(const Vector<T, 2>& other, T z = T(0)): Vector<T, 3>(other[0], other[1], other[2]) {}
inline Vector3(const Vector<T, 2>& other, T z = T(0)): Vector<T, 3>(other[0], other[1], z) {}
inline T x() const { return Vector<T, 3>::at(0); } /**< @brief X component */
inline T y() const { return Vector<T, 3>::at(1); } /**< @brief Y component */