fix bug in sign comparision

This commit is contained in:
Marc Wäckerlin
2017-01-09 16:07:47 +00:00
parent c3e2f8251c
commit 1e4898d396
5 changed files with 68 additions and 83 deletions

View File

@@ -114,10 +114,15 @@ class TemplateMatrixTest: public CppUnit::TestFixture {
5, 6, 7, 8);
Matrix<T,2,4> m5(1, 2, 0, 4,
5, 6, 7, 8);
Matrix<T,2,4> m6(-m1);
Matrix<T,2,4> m7(-1, -2, -3, -4,
-5, -6, -7, -8);
CPPUNIT_ASSERT_EQUAL(m7, m6);
CPPUNIT_ASSERT(m1==m2);
CPPUNIT_ASSERT(m1!=m3);
CPPUNIT_ASSERT(m1!=m4);
CPPUNIT_ASSERT(m1!=m5);
CPPUNIT_ASSERT(m1!=m6);
}
template<typename T>
void operator_plus() {
@@ -290,7 +295,7 @@ class TemplateMatrixTest: public CppUnit::TestFixture {
-1, 1, 0, 2,
0, 0, 2, 4,
2, -2, 0, 1);
const Matrix<T,4,4> res((T)-1/3, (T)13/15, (T)-2/3, 0.6,
const Matrix<T,4,4> res((T)1/3, (T)13/15, (T)-2/3, 0.6,
(T)1/3, (T)16/15, (T)-2/3, 0.2,
0, -0.8, 0.5, -0.4,
0, 0.4, 0, 0.2);
@@ -521,9 +526,15 @@ class VariableMatrixTest: public CppUnit::TestFixture {
Matrix<T> m4(2, 4,
9, 2, 3, 4,
5, 6, 7, 8);
Matrix<T> m5(-m1);
Matrix<T> m6(2, 4,
-1, -2, -3, -4,
-5, -6, -7, -8);
CPPUNIT_ASSERT_EQUAL(m6, m5);
CPPUNIT_ASSERT(m1==m2);
CPPUNIT_ASSERT(m1!=m3);
CPPUNIT_ASSERT(m1!=m4);
CPPUNIT_ASSERT(m1!=m5);
}
template<typename T>
void operator_plus() {
@@ -712,7 +723,7 @@ class VariableMatrixTest: public CppUnit::TestFixture {
0, 0, 2, 4,
2, -2, 0, 1);
const Matrix<T> res(4, 4,
(T)-1/3, (T)13/15, (T)-2/3, 0.6,
(T)1/3, (T)13/15, (T)-2/3, 0.6,
(T)1/3, (T)16/15, (T)-2/3, 0.2,
0, -0.8, 0.5, -0.4,
0, 0.4, 0, 0.2);