overall PIMathMatrix tests correction

This commit is contained in:
Шишов Максим Денисович
2020-09-10 16:56:04 +03:00
committed by Gama
parent 88a147e0a1
commit 2b2ad436f0
2 changed files with 206 additions and 422 deletions

View File

@@ -470,7 +470,6 @@ TEST(PIMathMatrix_Test, toUpperTriangular)
TEST(PIMathMatrix_Test, invert)
{
double d1, d2;
bool b;
PIMathMatrix<double> matrix1(3, 3, 0.0);
PIMathMatrix<double> matrix2(3, 3, 0.0);
PIMathMatrix<double> matrix3(3, 3, 0.0);
@@ -494,21 +493,12 @@ TEST(PIMathMatrix_Test, invert)
matrix2.invert();
d2 = matrix2.determinant();
matrix4.invert();
if((matrix3 == matrix4) && (round((1/d1)*10000)/10000 == round(d2*10000)/10000))
{
b = true;
}
else
{
b = false;
}
ASSERT_TRUE(b);
ASSERT_TRUE((matrix3 == matrix4) && (round((1/d1)*10000)/10000 == round(d2*10000)/10000));
}
TEST(PIMathMatrix_Test, inverted)
{
double d1, d2;
bool b;
PIMathMatrix<double> matrix1(3, 3, 0.0);
PIMathMatrix<double> matrix2(3, 3, 0.0);
PIMathMatrix<double> matrix3(3, 3, 0.0);
@@ -532,22 +522,13 @@ TEST(PIMathMatrix_Test, inverted)
matrix1 = matrix2.invert();
d2 = matrix1.determinant();
matrix3 = matrix4.invert();
if((matrix3 == matrix4) && (round((1/d1)*10000)/10000 == round(d2*10000)/10000))
{
b = true;
}
else
{
b = false;
}
ASSERT_TRUE(b);
ASSERT_TRUE((matrix3 == matrix4) && (round((1/d1)*10000)/10000 == round(d2*10000)/10000));
}
TEST(PIMathMatrix_Test, transposed)
{
PIMathMatrix<double> origMatr;
double d1, d2;
bool b;
PIMathMatrix<double> matrix1;
PIMathMatrix<double> matrix2;
PIMathMatrix<double> matrix3;
@@ -570,25 +551,17 @@ TEST(PIMathMatrix_Test, transposed)
matrix2 = matrix1.transposed();
d2 = matrix2.determinant();
matrix3 = matrix2.transposed();
if((d1 == d2) && (matrix1 == matrix3))
{
b = true;
}
else
{
b = false;
}
ASSERT_TRUE(b);
ASSERT_TRUE((d1 == d2) && (matrix1 == matrix3));
}
TEST(PIMathMatrixT_Test, matrixMultiplication)
TEST(PIMathMatrix_Test, matrixMultiplication)
{
PIMathMatrix<double> matrix1(2, 2, 1.5);
PIMathMatrix<double> matrix2(2, 2, 2.5);
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1 * matrix2, 7.5, 2));
}
TEST(PIMathMatrixT_Test, matrixAndVectorMultiplication)
TEST(PIMathMatrix_Test, matrixAndVectorMultiplication)
{
PIMathMatrix<double> matrix1(2, 2, 1.5);
PIMathVector<double> vector;
@@ -601,7 +574,7 @@ TEST(PIMathMatrixT_Test, matrixAndVectorMultiplication)
ASSERT_TRUE(true);
}
TEST(PIMathMatrixT_Test, vectorAndMatrixMultiplication)
TEST(PIMathMatrix_Test, vectorAndMatrixMultiplication)
{
PIMathMatrix<double> matrix1(2, 2, 1.5);
PIMathVector<double> vector;
@@ -614,13 +587,13 @@ TEST(PIMathMatrixT_Test, vectorAndMatrixMultiplication)
ASSERT_TRUE(true);
}
TEST(PIMathMatrixT_Test, valAndMatrixMultiplication)
TEST(PIMathMatrix_Test, valAndMatrixMultiplication)
{
PIMathMatrix<double> matrix1(3, 3, 1.5);
ASSERT_TRUE(cmpSquareMatrixWithValue(25.0*matrix1, 37.5, 3));
}
TEST(PIMathMatrixT_Test, hermitian)
TEST(PIMathMatrix_Test, hermitian)
{
complex<double> val;
complex<double> res;
@@ -639,4 +612,3 @@ TEST(PIMathMatrixT_Test, hermitian)
}
ASSERT_TRUE(true);
}