PIMathVector Tests bug fix

This commit is contained in:
2020-10-08 11:16:05 +03:00
parent d6637047b2
commit 9b02325ba1
3 changed files with 10 additions and 10 deletions

View File

@@ -18,8 +18,8 @@ bool cmpSquareMatrixWithValue(PIMathMatrixT<rows, cols, double> matrix, double v
TEST(PIMathMatrixT_Test, identity) {
auto matrix = PIMathMatrixT<rows, cols, double>::identity();
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
for(int i = 0; i < rows; i++){
for(int j = 0; j < cols; j++){
if(i != j){
if(matrix[i][j] != 0.0){
ASSERT_TRUE(false);

View File

@@ -16,7 +16,7 @@ bool cmpVectorWithValue(PIMathVector<double> vector, double val, int num) {
TEST(PIMathVector_Test, size) {
auto vector = PIMathVector<double>(SIZE);
ASSERT_TRUE(vector.size() == SIZE);
ASSERT_EQ(vector.size(), SIZE);
}
TEST(PIMathVector_Test, resize) {
@@ -24,8 +24,8 @@ TEST(PIMathVector_Test, resize) {
double a = 5.0;
PIMathVector<double> vector;
vector.resize(newSize, a);
ASSERT_EQ(vector.size(), newSize);
ASSERT_TRUE(cmpVectorWithValue(vector, a, vector.size()));
ASSERT_TRUE(vector.size() == newSize);
}
TEST(PIMathVector_Test, resized) {
@@ -33,8 +33,8 @@ TEST(PIMathVector_Test, resized) {
double a = 5.0;
PIMathVector<double> vector;
auto vect = vector.resized(newSize, a);
ASSERT_EQ(vect.size(), newSize);
ASSERT_TRUE(cmpVectorWithValue(vect, a, vect.size()));
ASSERT_TRUE(vect.size() == newSize);
}
TEST(PIMathVector_Test, fill) {
@@ -73,7 +73,7 @@ TEST(PIMathVector_Test, moveVecSizeNotEq) {
vec.fill(b);
vector.move(vec);
ASSERT_TRUE(cmpVectorWithValue(vector, a, SIZE));
ASSERT_TRUE(vector.size() == SIZE);
ASSERT_EQ(vector.size(), SIZE);
}
TEST(PIMathVector_Test, swap) {
@@ -304,7 +304,6 @@ TEST(PIMathVector_Test, at) {
ASSERT_TRUE(false);
}
}
ASSERT_TRUE(true);
}
TEST(PIMathVector_Test, operator_AssignmentValue) {

View File

@@ -230,7 +230,6 @@ TEST(PIMathVectorT_Test, at) {
ASSERT_TRUE(false);
}
}
ASSERT_TRUE(true);
}
TEST(PIMathVectorT_Test, operator_AssignmentValue) {
@@ -406,7 +405,10 @@ TEST(PIMathVectorT_Test, operator_MultiplicationVector2) {
PIMathVectorT<SIZE,double> vector2;
vector1[0] = a;
vector2[1] = a;
ASSERT_TRUE(((vector1 * vector2)[0] < double(1E-200)) && ((vector1 * vector2)[1] < double(1E-200)) && ((vector1 * vector2)[2] - a < double(1E-200)));
auto vect = vector1 * vector2;
ASSERT_TRUE(vect[0] < double(1E-200));
ASSERT_TRUE(vect[1] < double(1E-200));
ASSERT_TRUE(vect[2] - a < double(1E-200));
}
TEST(PIMathVectorT_Test, operator_DivisionVal) {
@@ -458,7 +460,6 @@ TEST(PIMathVectorT_Test, transposed) {
ASSERT_TRUE(false);
}
}
ASSERT_TRUE(true);
}
TEST(PIMathVectorT_Test, filled) {