mirror of https://github.com/mosra/magnum.git
Browse Source
Added tests for Matrix3, Vector2 just to be sure that debug output works also there.vectorfields
22 changed files with 293 additions and 0 deletions
@ -1,8 +1,17 @@
|
||||
corrade_add_test(VectorTest VectorTest.h VectorTest.cpp) |
||||
target_link_libraries(VectorTest ${CORRADE_UTILITY_LIBRARY}) |
||||
corrade_add_test(Vector2Test Vector2Test.h Vector2Test.cpp) |
||||
target_link_libraries(Vector2Test ${CORRADE_UTILITY_LIBRARY}) |
||||
corrade_add_test(Vector3Test Vector3Test.h Vector3Test.cpp) |
||||
target_link_libraries(Vector3Test ${CORRADE_UTILITY_LIBRARY}) |
||||
corrade_add_test(Vector4Test Vector4Test.h Vector4Test.cpp) |
||||
target_link_libraries(Vector4Test ${CORRADE_UTILITY_LIBRARY}) |
||||
|
||||
corrade_add_test(MatrixTest MatrixTest.h MatrixTest.cpp) |
||||
target_link_libraries(MatrixTest ${CORRADE_UTILITY_LIBRARY}) |
||||
corrade_add_test(Matrix3Test Matrix3Test.h Matrix3Test.cpp) |
||||
target_link_libraries(Matrix3Test ${CORRADE_UTILITY_LIBRARY}) |
||||
corrade_add_test(Matrix4Test Matrix4Test.h Matrix4Test.cpp) |
||||
target_link_libraries(Matrix4Test ${CORRADE_UTILITY_LIBRARY}) |
||||
|
||||
corrade_add_test(GeometryUtilsTest GeometryUtilsTest.h GeometryUtilsTest.cpp) |
||||
|
||||
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright © 2010, 2011 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
This file is part of Magnum. |
||||
|
||||
Magnum is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU Lesser General Public License version 3 |
||||
only, as published by the Free Software Foundation. |
||||
|
||||
Magnum is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU Lesser General Public License version 3 for more details. |
||||
*/ |
||||
|
||||
#include "Matrix3Test.h" |
||||
|
||||
#include <sstream> |
||||
#include <QtTest/QTest> |
||||
|
||||
#include "Matrix3.h" |
||||
|
||||
QTEST_APPLESS_MAIN(Magnum::Math::Test::Matrix3Test) |
||||
|
||||
using namespace std; |
||||
using namespace Corrade::Utility; |
||||
|
||||
namespace Magnum { namespace Math { namespace Test { |
||||
|
||||
typedef Math::Matrix3<float> Matrix3; |
||||
|
||||
void Matrix3Test::debug() { |
||||
float m[] = { |
||||
3, 5, 8, |
||||
4, 4, 7, |
||||
7, -1, 8, |
||||
}; |
||||
|
||||
ostringstream o; |
||||
Debug(&o) << Matrix3(m); |
||||
QCOMPARE(QString::fromStdString(o.str()), QString("Matrix(3, 4, 7,\n" |
||||
" 5, 4, -1,\n" |
||||
" 8, 7, 8)\n")); |
||||
} |
||||
|
||||
}}} |
||||
@ -0,0 +1,31 @@
|
||||
#ifndef Magnum_Math_Test_Matrix3Test_h |
||||
#define Magnum_Math_Test_Matrix3Test_h |
||||
/*
|
||||
Copyright © 2010, 2011 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
This file is part of Magnum. |
||||
|
||||
Magnum is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU Lesser General Public License version 3 |
||||
only, as published by the Free Software Foundation. |
||||
|
||||
Magnum is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU Lesser General Public License version 3 for more details. |
||||
*/ |
||||
|
||||
#include <QtCore/QObject> |
||||
|
||||
namespace Magnum { namespace Math { namespace Test { |
||||
|
||||
class Matrix3Test: public QObject { |
||||
Q_OBJECT |
||||
|
||||
private slots: |
||||
void debug(); |
||||
}; |
||||
|
||||
}}} |
||||
|
||||
#endif |
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright © 2010, 2011 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
This file is part of Magnum. |
||||
|
||||
Magnum is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU Lesser General Public License version 3 |
||||
only, as published by the Free Software Foundation. |
||||
|
||||
Magnum is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU Lesser General Public License version 3 for more details. |
||||
*/ |
||||
|
||||
#include "Vector2Test.h" |
||||
|
||||
#include <sstream> |
||||
#include <QtTest/QTest> |
||||
|
||||
#include "Vector2.h" |
||||
|
||||
QTEST_APPLESS_MAIN(Magnum::Math::Test::Vector2Test) |
||||
|
||||
using namespace std; |
||||
using namespace Corrade::Utility; |
||||
|
||||
namespace Magnum { namespace Math { namespace Test { |
||||
|
||||
typedef Math::Vector2<float> Vector2; |
||||
|
||||
void Vector2Test::debug() { |
||||
ostringstream o; |
||||
Debug(&o) << Vector2(0.5f, 15.0f); |
||||
QCOMPARE(QString::fromStdString(o.str()), QString("Vector(0.5, 15)\n")); |
||||
} |
||||
|
||||
}}} |
||||
@ -0,0 +1,31 @@
|
||||
#ifndef Magnum_Math_Test_Vector2Test_h |
||||
#define Magnum_Math_Test_Vector2Test_h |
||||
/*
|
||||
Copyright © 2010, 2011 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
This file is part of Magnum. |
||||
|
||||
Magnum is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU Lesser General Public License version 3 |
||||
only, as published by the Free Software Foundation. |
||||
|
||||
Magnum is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU Lesser General Public License version 3 for more details. |
||||
*/ |
||||
|
||||
#include <QtCore/QObject> |
||||
|
||||
namespace Magnum { namespace Math { namespace Test { |
||||
|
||||
class Vector2Test: public QObject { |
||||
Q_OBJECT |
||||
|
||||
private slots: |
||||
void debug(); |
||||
}; |
||||
|
||||
}}} |
||||
|
||||
#endif |
||||
Loading…
Reference in new issue