new tests fo PIMathVector.h and tab correction
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
#include "pimathvector.h"
|
#include "pimathvector.h"
|
||||||
|
|
||||||
const uint SIZE = 3u;
|
const uint SIZE = 3u;
|
||||||
|
const double angle45DegInRad = 0.78539816339744830961566084581988;
|
||||||
|
|
||||||
bool cmpVectorWithValue(PIMathVector<double> vector, double val, int num) {
|
bool cmpVectorWithValue(PIMathVector<double> vector, double val, int num) {
|
||||||
bool b = true;
|
bool b = true;
|
||||||
@@ -32,7 +33,7 @@ TEST(PIMathVector_Test, resized) {
|
|||||||
double a = 5.0;
|
double a = 5.0;
|
||||||
PIMathVector<double> vector;
|
PIMathVector<double> vector;
|
||||||
auto vect = vector.resized(newSize, a);
|
auto vect = vector.resized(newSize, a);
|
||||||
ASSERT_TRUE(cmpVectorWithValue(vect, a, vect.size()) && vect.size() == newSize);
|
ASSERT_TRUE(cmpVectorWithValue(vect, a, vect.size()));
|
||||||
ASSERT_TRUE(vect.size() == newSize);
|
ASSERT_TRUE(vect.size() == newSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,6 +63,19 @@ TEST(PIMathVector_Test, moveVec) {
|
|||||||
ASSERT_TRUE(cmpVectorWithValue(vector, a + b, SIZE));
|
ASSERT_TRUE(cmpVectorWithValue(vector, a + b, SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, moveVecSizeNotEq) {
|
||||||
|
double a = 5.0;
|
||||||
|
double b = 7.0;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector(SIZE);
|
||||||
|
PIMathVector<double> vec(SIZE + bias);
|
||||||
|
vector.fill(a);
|
||||||
|
vec.fill(b);
|
||||||
|
vector.move(vec);
|
||||||
|
ASSERT_TRUE(cmpVectorWithValue(vector, a, SIZE));
|
||||||
|
ASSERT_TRUE(vector.size() == SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, swap) {
|
TEST(PIMathVector_Test, swap) {
|
||||||
double b = 5.12;
|
double b = 5.12;
|
||||||
double c = 3.32;
|
double c = 3.32;
|
||||||
@@ -103,46 +117,87 @@ TEST(PIMathVector_Test, manhattanLength) {
|
|||||||
|
|
||||||
TEST(PIMathVector_Test, angleCos) {
|
TEST(PIMathVector_Test, angleCos) {
|
||||||
double a = 3.32;
|
double a = 3.32;
|
||||||
double angle = 0.78539816339744830961566084581988;
|
|
||||||
PIMathVector<double> vector(SIZE);
|
PIMathVector<double> vector(SIZE);
|
||||||
PIMathVector<double> vec(SIZE);
|
PIMathVector<double> vec(SIZE);
|
||||||
vector[0] = a;
|
vector[0] = a;
|
||||||
vector[1] = a;
|
vector[1] = a;
|
||||||
vec[1] = a;
|
vec[1] = a;
|
||||||
ASSERT_DOUBLE_EQ(cos(angle), vector.angleCos(vec));
|
ASSERT_DOUBLE_EQ(cos(angle45DegInRad), vector.angleCos(vec));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, angleCosSizeNotEq) {
|
||||||
|
double a = 3.32;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector(SIZE);
|
||||||
|
PIMathVector<double> vec(SIZE + bias);
|
||||||
|
vector[0] = a;
|
||||||
|
vector[1] = a;
|
||||||
|
vec[1] = a;
|
||||||
|
ASSERT_FALSE(vector.angleCos(vec));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, angleSin) {
|
TEST(PIMathVector_Test, angleSin) {
|
||||||
double a = 3.32;
|
double a = 3.32;
|
||||||
double angle = 0.78539816339744830961566084581988;
|
|
||||||
PIMathVector<double> vector(SIZE);
|
PIMathVector<double> vector(SIZE);
|
||||||
PIMathVector<double> vec(SIZE);
|
PIMathVector<double> vec(SIZE);
|
||||||
vector[0] = a;
|
vector[0] = a;
|
||||||
vector[1] = a;
|
vector[1] = a;
|
||||||
vec[1] = a;
|
vec[1] = a;
|
||||||
ASSERT_DOUBLE_EQ(sin(angle), vector.angleSin(vec));
|
ASSERT_DOUBLE_EQ(sin(angle45DegInRad), vector.angleSin(vec));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, angleSinSizeNotEq) {
|
||||||
|
double a = 3.32;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector(SIZE);
|
||||||
|
PIMathVector<double> vec(SIZE + bias);
|
||||||
|
vector[0] = a;
|
||||||
|
vector[1] = a;
|
||||||
|
vec[1] = a;
|
||||||
|
ASSERT_FALSE(vector.angleSin(vec));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, angleRad) {
|
TEST(PIMathVector_Test, angleRad) {
|
||||||
double a = 3.32;
|
double a = 3.32;
|
||||||
double angle = 0.78539816339744830961566084581988;
|
|
||||||
PIMathVector<double> vector(SIZE);
|
PIMathVector<double> vector(SIZE);
|
||||||
PIMathVector<double> vec(SIZE);
|
PIMathVector<double> vec(SIZE);
|
||||||
vector[0] = a;
|
vector[0] = a;
|
||||||
vector[1] = a;
|
vector[1] = a;
|
||||||
vec[1] = a;
|
vec[1] = a;
|
||||||
ASSERT_DOUBLE_EQ(angle, vector.angleRad(vec));
|
ASSERT_DOUBLE_EQ(angle45DegInRad, vector.angleRad(vec));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, angleRadSizeNotEq) {
|
||||||
|
double a = 3.32;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector(SIZE);
|
||||||
|
PIMathVector<double> vec(SIZE + bias);
|
||||||
|
vector[0] = a;
|
||||||
|
vector[1] = a;
|
||||||
|
vec[1] = a;
|
||||||
|
ASSERT_FALSE(vector.angleRad(vec));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, angleDeg) {
|
TEST(PIMathVector_Test, angleDeg) {
|
||||||
double a = 3.32;
|
double a = 3.32;
|
||||||
double angle = 45.0;
|
double angle45Deg = 45.0;
|
||||||
PIMathVector<double> vector(SIZE);
|
PIMathVector<double> vector(SIZE);
|
||||||
PIMathVector<double> vec(SIZE);
|
PIMathVector<double> vec(SIZE);
|
||||||
vector[0] = a;
|
vector[0] = a;
|
||||||
vector[1] = a;
|
vector[1] = a;
|
||||||
vec[1] = a;
|
vec[1] = a;
|
||||||
ASSERT_DOUBLE_EQ(angle, vector.angleDeg(vec));
|
ASSERT_DOUBLE_EQ(angle45Deg, vector.angleDeg(vec));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, angleDegSizeNotEq) {
|
||||||
|
double a = 3.32;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector(SIZE);
|
||||||
|
PIMathVector<double> vec(SIZE + bias);
|
||||||
|
vector[0] = a;
|
||||||
|
vector[1] = a;
|
||||||
|
vec[1] = a;
|
||||||
|
ASSERT_FALSE(vector.angleDeg(vec));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, projection) {
|
TEST(PIMathVector_Test, projection) {
|
||||||
@@ -162,6 +217,23 @@ TEST(PIMathVector_Test, projection) {
|
|||||||
ASSERT_DOUBLE_EQ(res, vecProj[2]);
|
ASSERT_DOUBLE_EQ(res, vecProj[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, projectionSizeNotEq) {
|
||||||
|
double a = 2.0;
|
||||||
|
double b = 2.0;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector(SIZE);
|
||||||
|
PIMathVector<double> vec(SIZE + bias);
|
||||||
|
vec[0] = a;
|
||||||
|
vec[2] = b;
|
||||||
|
vector[0] = a;
|
||||||
|
vector[1] = b;
|
||||||
|
vector[2] = a;
|
||||||
|
auto vecProj = vector.projection(vec);
|
||||||
|
ASSERT_DOUBLE_EQ(a, vecProj[0]);
|
||||||
|
ASSERT_DOUBLE_EQ(b, vecProj[1]);
|
||||||
|
ASSERT_DOUBLE_EQ(a, vecProj[2]);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, normalize) {
|
TEST(PIMathVector_Test, normalize) {
|
||||||
double a = 5.0;
|
double a = 5.0;
|
||||||
PIMathVector<double> vector(SIZE);
|
PIMathVector<double> vector(SIZE);
|
||||||
@@ -251,6 +323,18 @@ TEST(PIMathVector_Test, operator_AssignmentVector) {
|
|||||||
ASSERT_TRUE(cmpVectorWithValue(vector, a, SIZE));
|
ASSERT_TRUE(cmpVectorWithValue(vector, a, SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, operator_AssignmentVectorSizeNotEq) {
|
||||||
|
double a = 5.5;
|
||||||
|
double b = 1.43;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector(SIZE);
|
||||||
|
PIMathVector<double> vec(SIZE + bias);
|
||||||
|
vector = b;
|
||||||
|
vec = a;
|
||||||
|
vector = vec;
|
||||||
|
ASSERT_TRUE(cmpVectorWithValue(vector, b, SIZE));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, operator_EqualTrue) {
|
TEST(PIMathVector_Test, operator_EqualTrue) {
|
||||||
double a = 5.12;
|
double a = 5.12;
|
||||||
double b = 7.34;
|
double b = 7.34;
|
||||||
@@ -305,7 +389,7 @@ TEST(PIMathVector_Test, operator_Not_EqualFalse) {
|
|||||||
ASSERT_FALSE(vec != vector);
|
ASSERT_FALSE(vec != vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, operator_Addition_Aassignment) {
|
TEST(PIMathVector_Test, operator_Addition_Assignment) {
|
||||||
double a = 6.0;
|
double a = 6.0;
|
||||||
double b = 1.72;
|
double b = 1.72;
|
||||||
PIMathVector<double> vector1(SIZE);
|
PIMathVector<double> vector1(SIZE);
|
||||||
@@ -316,6 +400,18 @@ TEST(PIMathVector_Test, operator_Addition_Aassignment) {
|
|||||||
ASSERT_TRUE(cmpVectorWithValue(vector1, a + b, SIZE));
|
ASSERT_TRUE(cmpVectorWithValue(vector1, a + b, SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, operator_Addition_Assignment_sizeNotEq) {
|
||||||
|
double a = 6.0;
|
||||||
|
double b = 1.72;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector1(SIZE);
|
||||||
|
PIMathVector<double> vector2(SIZE + bias);
|
||||||
|
vector1.fill(a);
|
||||||
|
vector2.fill(b);
|
||||||
|
vector1 += vector2;
|
||||||
|
ASSERT_TRUE(cmpVectorWithValue(vector1, a, SIZE));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, operator_Subtraction_Assignment) {
|
TEST(PIMathVector_Test, operator_Subtraction_Assignment) {
|
||||||
double a = 6.0;
|
double a = 6.0;
|
||||||
double b = 1.72;
|
double b = 1.72;
|
||||||
@@ -327,6 +423,18 @@ TEST(PIMathVector_Test, operator_Subtraction_Assignment) {
|
|||||||
ASSERT_TRUE(cmpVectorWithValue(vector1, a - b, SIZE));
|
ASSERT_TRUE(cmpVectorWithValue(vector1, a - b, SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, operator_Subtraction_Assignment_sizeNotEq) {
|
||||||
|
double a = 6.0;
|
||||||
|
double b = 1.72;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector1(SIZE);
|
||||||
|
PIMathVector<double> vector2(SIZE + bias);
|
||||||
|
vector1.fill(a);
|
||||||
|
vector2.fill(b);
|
||||||
|
vector1 -= vector2;
|
||||||
|
ASSERT_TRUE(cmpVectorWithValue(vector1, a, SIZE));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, operator_Multiplication_AssignmentValue) {
|
TEST(PIMathVector_Test, operator_Multiplication_AssignmentValue) {
|
||||||
double a = 6.0;
|
double a = 6.0;
|
||||||
double b = 4.0;
|
double b = 4.0;
|
||||||
@@ -347,6 +455,18 @@ TEST(PIMathVector_Test, operator_Multiplication_AssignmentVector) {
|
|||||||
ASSERT_TRUE(cmpVectorWithValue(vector1, a * b, SIZE));
|
ASSERT_TRUE(cmpVectorWithValue(vector1, a * b, SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, operator_Multiplication_AssignmentVector_sizeNotEq) {
|
||||||
|
double a = 6.0;
|
||||||
|
double b = 1.72;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector1(SIZE);
|
||||||
|
PIMathVector<double> vector2(SIZE + bias);
|
||||||
|
vector1.fill(a);
|
||||||
|
vector2.fill(b);
|
||||||
|
vector1 *= vector2;
|
||||||
|
ASSERT_TRUE(cmpVectorWithValue(vector1, a, SIZE));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, operator_Division_AssignmentValue) {
|
TEST(PIMathVector_Test, operator_Division_AssignmentValue) {
|
||||||
double a = 6.0;
|
double a = 6.0;
|
||||||
double b = 4.0;
|
double b = 4.0;
|
||||||
@@ -367,6 +487,18 @@ TEST(PIMathVector_Test, operator_Division_AssignmentVector) {
|
|||||||
ASSERT_TRUE(cmpVectorWithValue(vector1, a / b, SIZE));
|
ASSERT_TRUE(cmpVectorWithValue(vector1, a / b, SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, operator_Division_AssignmentVector_sizeNotEq) {
|
||||||
|
double a = 6.0;
|
||||||
|
double b = 1.72;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector1(SIZE);
|
||||||
|
PIMathVector<double> vector2(SIZE + bias);
|
||||||
|
vector1.fill(a);
|
||||||
|
vector2.fill(b);
|
||||||
|
vector1 /= vector2;
|
||||||
|
ASSERT_TRUE(cmpVectorWithValue(vector1, a, SIZE));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, operator_Addition) {
|
TEST(PIMathVector_Test, operator_Addition) {
|
||||||
double a = 6.0;
|
double a = 6.0;
|
||||||
double b = 1.72;
|
double b = 1.72;
|
||||||
@@ -377,6 +509,17 @@ TEST(PIMathVector_Test, operator_Addition) {
|
|||||||
ASSERT_TRUE(cmpVectorWithValue(vector1 + vector2, a + b, SIZE));
|
ASSERT_TRUE(cmpVectorWithValue(vector1 + vector2, a + b, SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, operator_AdditionSizeNotEq) {
|
||||||
|
double a = 6.0;
|
||||||
|
double b = 1.72;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector1(SIZE);
|
||||||
|
PIMathVector<double> vector2(SIZE + bias);
|
||||||
|
vector1.fill(a);
|
||||||
|
vector2.fill(b);
|
||||||
|
ASSERT_TRUE(cmpVectorWithValue(vector1 + vector2, a, SIZE));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, operator_Subtraction) {
|
TEST(PIMathVector_Test, operator_Subtraction) {
|
||||||
double a = 6.0;
|
double a = 6.0;
|
||||||
double b = 1.72;
|
double b = 1.72;
|
||||||
@@ -387,6 +530,17 @@ TEST(PIMathVector_Test, operator_Subtraction) {
|
|||||||
ASSERT_TRUE(cmpVectorWithValue(vector1 - vector2, a - b, SIZE));
|
ASSERT_TRUE(cmpVectorWithValue(vector1 - vector2, a - b, SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, operator_SubtractionSizeNotEq) {
|
||||||
|
double a = 6.0;
|
||||||
|
double b = 1.72;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector1(SIZE);
|
||||||
|
PIMathVector<double> vector2(SIZE + bias);
|
||||||
|
vector1.fill(a);
|
||||||
|
vector2.fill(b);
|
||||||
|
ASSERT_TRUE(cmpVectorWithValue(vector1 - vector2, a, SIZE));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, operator_MultiplicationValue) {
|
TEST(PIMathVector_Test, operator_MultiplicationValue) {
|
||||||
double a = 6.0;
|
double a = 6.0;
|
||||||
double b = 4.0;
|
double b = 4.0;
|
||||||
@@ -436,6 +590,17 @@ TEST(PIMathVector_Test, operator_MultiplVect) {
|
|||||||
ASSERT_TRUE(cmpVectorWithValue(vector1 & vector2, a * b, SIZE));
|
ASSERT_TRUE(cmpVectorWithValue(vector1 & vector2, a * b, SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, operator_MultiplVectSizeNotEq) {
|
||||||
|
double a = 6.0;
|
||||||
|
double b = 5.0;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector1(SIZE);
|
||||||
|
PIMathVector<double> vector2(SIZE + bias);
|
||||||
|
vector1.fill(a);
|
||||||
|
vector2.fill(b);
|
||||||
|
ASSERT_TRUE(cmpVectorWithValue(vector1 & vector2, a , SIZE));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(PIMathVector_Test, operator_DotProduct) {
|
TEST(PIMathVector_Test, operator_DotProduct) {
|
||||||
double a = 6.0;
|
double a = 6.0;
|
||||||
double b = 5.0;
|
double b = 5.0;
|
||||||
@@ -445,3 +610,14 @@ TEST(PIMathVector_Test, operator_DotProduct) {
|
|||||||
vector2.fill(b);
|
vector2.fill(b);
|
||||||
ASSERT_TRUE(SIZE * a * b == (vector1 ^ vector2));
|
ASSERT_TRUE(SIZE * a * b == (vector1 ^ vector2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(PIMathVector_Test, operator_DotProductSizeNotEq) {
|
||||||
|
double a = 6.0;
|
||||||
|
double b = 5.0;
|
||||||
|
uint bias = 2u;
|
||||||
|
PIMathVector<double> vector1(SIZE);
|
||||||
|
PIMathVector<double> vector2(SIZE + bias);
|
||||||
|
vector1.fill(a);
|
||||||
|
vector2.fill(b);
|
||||||
|
ASSERT_FALSE(vector1 ^ vector2);
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "pimathmatrix.h"
|
#include "pimathmatrix.h"
|
||||||
|
|
||||||
const uint SIZE = 3u;
|
const uint SIZE = 3u;
|
||||||
|
const double angle45DegInRad = 0.78539816339744830961566084581988;
|
||||||
|
|
||||||
bool cmpVectorWithValue(PIMathVectorT<SIZE, double> vector, double val, int num) {
|
bool cmpVectorWithValue(PIMathVectorT<SIZE, double> vector, double val, int num) {
|
||||||
bool b = true;
|
bool b = true;
|
||||||
@@ -70,57 +71,54 @@ TEST(PIMathVectorT_Test, manhattanLength) {
|
|||||||
|
|
||||||
TEST(PIMathVectorT_Test, angleCos) {
|
TEST(PIMathVectorT_Test, angleCos) {
|
||||||
double a = 1.0;
|
double a = 1.0;
|
||||||
double angle = 0.78539816339744830961566084581988;
|
|
||||||
PIMathVectorT<SIZE, double> vector;
|
PIMathVectorT<SIZE, double> vector;
|
||||||
PIMathVectorT<SIZE, double> vec;
|
PIMathVectorT<SIZE, double> vec;
|
||||||
vector[0] = a;
|
vector[0] = a;
|
||||||
vector[1] = a;
|
vector[1] = a;
|
||||||
vec[1] = a;
|
vec[1] = a;
|
||||||
ASSERT_DOUBLE_EQ(cos(angle), vector.angleCos(vec));
|
ASSERT_DOUBLE_EQ(cos(angle45DegInRad), vector.angleCos(vec));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathVectorT_Test, angleSin) {
|
TEST(PIMathVectorT_Test, angleSin) {
|
||||||
double a = 1.0;
|
double a = 1.0;
|
||||||
double angle = 0.78539816339744830961566084581988;
|
|
||||||
PIMathVectorT<SIZE, double> vector;
|
PIMathVectorT<SIZE, double> vector;
|
||||||
PIMathVectorT<SIZE, double> vec;
|
PIMathVectorT<SIZE, double> vec;
|
||||||
vector[0] = a;
|
vector[0] = a;
|
||||||
vector[1] = a;
|
vector[1] = a;
|
||||||
vec[1] = a;
|
vec[1] = a;
|
||||||
ASSERT_DOUBLE_EQ(sin(angle), vector.angleSin(vec));
|
ASSERT_DOUBLE_EQ(sin(angle45DegInRad), vector.angleSin(vec));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathVectorT_Test, angleRad) {
|
TEST(PIMathVectorT_Test, angleRad) {
|
||||||
double a = 1.0;
|
double a = 1.0;
|
||||||
double angle = 0.78539816339744830961566084581988;
|
|
||||||
PIMathVectorT<SIZE, double> vector;
|
PIMathVectorT<SIZE, double> vector;
|
||||||
PIMathVectorT<SIZE, double> vec;
|
PIMathVectorT<SIZE, double> vec;
|
||||||
vector[0] = a;
|
vector[0] = a;
|
||||||
vector[1] = a;
|
vector[1] = a;
|
||||||
vec[1] = a;
|
vec[1] = a;
|
||||||
ASSERT_DOUBLE_EQ(angle, vector.angleRad(vec));
|
ASSERT_DOUBLE_EQ(angle45DegInRad, vector.angleRad(vec));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathVectorT_Test, angleDeg) {
|
TEST(PIMathVectorT_Test, angleDeg) {
|
||||||
double a = 1.0;
|
double a = 1.0;
|
||||||
double angle = 45.0;
|
double angle45inDeg = 45.0;
|
||||||
PIMathVectorT<SIZE, double> vector;
|
PIMathVectorT<SIZE, double> vector;
|
||||||
PIMathVectorT<SIZE, double> vec;
|
PIMathVectorT<SIZE, double> vec;
|
||||||
vector[0] = a;
|
vector[0] = a;
|
||||||
vector[1] = a;
|
vector[1] = a;
|
||||||
vec[1] = a;
|
vec[1] = a;
|
||||||
ASSERT_DOUBLE_EQ(angle, vector.angleDeg(vec));
|
ASSERT_DOUBLE_EQ(angle45inDeg, vector.angleDeg(vec));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathVectorT_Test, angleElevation) {
|
TEST(PIMathVectorT_Test, angleElevation) {
|
||||||
double a = 1.0;
|
double a = 1.0;
|
||||||
double angle = 45.0;
|
double angle45inDeg = 45.0;
|
||||||
PIMathVectorT<SIZE, double> vector;
|
PIMathVectorT<SIZE, double> vector;
|
||||||
PIMathVectorT<SIZE, double> vec;
|
PIMathVectorT<SIZE, double> vec;
|
||||||
vector[0] = a;
|
vector[0] = a;
|
||||||
vector[1] = a;
|
vector[1] = a;
|
||||||
vec[1] = a;
|
vec[1] = a;
|
||||||
ASSERT_DOUBLE_EQ(-angle, vector.angleElevation(vec));
|
ASSERT_DOUBLE_EQ(-angle45inDeg, vector.angleElevation(vec));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathVectorT_Test, projection) {
|
TEST(PIMathVectorT_Test, projection) {
|
||||||
@@ -301,7 +299,7 @@ TEST(PIMathVectorT_Test, operator_Not_EqualFalse) {
|
|||||||
ASSERT_FALSE(vec != vector);
|
ASSERT_FALSE(vec != vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathVectorT_Test, operator_Addition_Aassignment) {
|
TEST(PIMathVectorT_Test, operator_Addition_Assignment) {
|
||||||
double a = 6.0;
|
double a = 6.0;
|
||||||
double b = 1.72;
|
double b = 1.72;
|
||||||
PIMathVectorT<SIZE, double> vector1;
|
PIMathVectorT<SIZE, double> vector1;
|
||||||
|
|||||||
Reference in New Issue
Block a user