Compare commits

33 Commits

Author SHA1 Message Date
3ebb0d3fe0 Merge branch 'tests' of https://git.shs.tools/SHS/pip into tests 2020-09-15 10:13:54 +03:00
Шишов Максим Денисович
c7ebbe30c1 bug fixes 2020-09-10 18:39:37 +03:00
Шишов Максим Денисович
2fa852a050 bug fixes 2020-09-10 18:39:37 +03:00
Шишов Максим Денисович
36fe9135db indentation in strings 2020-09-10 18:38:44 +03:00
Шишов Максим Денисович
05e935f552 overall PIMathMatrix tests correction 2020-09-10 18:38:32 +03:00
Шишов Максим Денисович
6b7594cc90 testing another operations 2020-09-10 18:38:15 +03:00
Шишов Максим Денисович
9e52a78022 final tab correction 2020-09-10 18:37:49 +03:00
Шишов Максим Денисович
7a8ab669d6 tab correction 2020-09-10 18:37:49 +03:00
Шишов Максим Денисович
d59d60b1a7 doc correction 2020-09-10 18:37:48 +03:00
42793522a4 Fix code formatting & grammar mistakes 2020-09-10 18:36:35 +03:00
Шишов Максим Денисович
8163a68e03 space correction 2020-09-10 18:35:14 +03:00
Шишов Максим Денисович
3a038ef50b Rotation remake 2020-09-10 18:32:46 +03:00
Шишов Максим Денисович
8b6a356349 PIMathMatrix document 2020-09-10 18:30:14 +03:00
Шишов Максим Денисович
604aa44e57 PIMathMatrix doc 2020-09-10 18:30:14 +03:00
Шишов Максим Денисович
d0e703751a bug fixes 2020-09-10 18:27:58 +03:00
Шишов Максим Денисович
8b5f80d6dc bug fixes 2020-09-10 18:27:58 +03:00
Шишов Максим Денисович
9f6fa4cb8e indentation in strings 2020-09-10 18:27:58 +03:00
Шишов Максим Денисович
2b2ad436f0 overall PIMathMatrix tests correction 2020-09-10 18:27:58 +03:00
Федоренко Дмитрий Витальевич
88a147e0a1 string tests 2020-09-10 18:27:58 +03:00
Шишов Максим Денисович
eab3317ae6 testing another operations 2020-09-10 18:27:58 +03:00
Шишов Максим Денисович
ee6b026c61 PIMathMatrix new tests version 2020-09-10 18:27:58 +03:00
Шишов Максим Денисович
7a94de5af8 tests correction 2020-09-10 18:27:58 +03:00
Шишов Максим Денисович
d003a2e7d8 final tab correction 2020-09-10 18:27:58 +03:00
Шишов Максим Денисович
2471231943 tab correction 2020-09-10 18:27:58 +03:00
Шишов Максим Денисович
012981baf7 doc correction 2020-09-10 18:27:58 +03:00
a0c53bf689 Fix code formatting & grammar mistakes 2020-09-10 18:27:58 +03:00
Шишов Максим Денисович
14a8c11a71 space correction 2020-09-10 18:26:42 +03:00
Шишов Максим Денисович
97a17a892d Rotation remake 2020-09-10 18:25:44 +03:00
Шишов Максим Денисович
781a1e75e2 PIMathMatrix document 2020-09-10 18:25:44 +03:00
Шишов Максим Денисович
608e09c9a0 PIMathMatrix doc 2020-09-10 18:25:44 +03:00
Шишов Максим Денисович
6ba17c1122 add CMakeLists.txt.user to .gitignore 2020-09-10 18:22:54 +03:00
9a6fab980c varsion 2020-09-10 17:33:33 +03:00
cb2ef7113a mising exports in PIString 2020-09-10 17:33:09 +03:00
5 changed files with 81 additions and 4 deletions

View File

@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
project(pip)
set(pip_MAJOR 2)
set(pip_MINOR 5)
set(pip_MINOR 6)
set(pip_REVISION 0)
set(pip_SUFFIX _beta)
set(pip_COMPANY SHS)

View File

@@ -785,9 +785,9 @@ inline PIString operator +(const char c, const PIString & f) {return PIChar(c) +
inline PIString operator +(const PIString & f, const char c) {return f + PIChar(c);}
int versionCompare(const PIString & v0, const PIString & v1, int components = 6);
int PIP_EXPORT versionCompare(const PIString & v0, const PIString & v1, int components = 6);
PIString versionNormalize(const PIString & v);
PIString PIP_EXPORT versionNormalize(const PIString & v);

View File

@@ -1,6 +1,7 @@
#include "pip.h"
int main() {
versionCompare("","");
PICloudServer s("127.0.0.1:10101");
s.startThreadedRead();
piSleep(10);

View File

@@ -52,6 +52,25 @@ TEST(PIMathMatrixT_Test, element) {
ASSERT_TRUE(true);
}
TEST(PIMathMatrixT_Test, element) {
auto matrix = PIMathMatrix<double>::identity(3, 3);
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
if(i != j){
if(matrix[i][j] != 0.0){
ASSERT_TRUE(false);
}
}
else {
if(matrix.element(i,i) != 1.0) {
ASSERT_TRUE(false);
}
}
}
}
ASSERT_TRUE(true);
}
TEST(PIMathMatrix_Test, matrixRow) {
PIMathVector<double> vector;
vector.resize(3, 3.0);
@@ -554,3 +573,58 @@ TEST(PIMathMatrix_Test, hermitian) {
}
ASSERT_TRUE(true);
}
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(PIMathMatrix_Test, matrixAndVectorMultiplication) {
PIMathMatrix<double> matrix1(2, 2, 1.5);
PIMathVector<double> vector;
vector.resize(2, 2.5);
for(uint i = 0; i < 2; i++) {
if((matrix1 * vector)[i] != 7.5) {
ASSERT_TRUE(false);
}
}
ASSERT_TRUE(true);
}
TEST(PIMathMatrix_Test, vectorAndMatrixMultiplication) {
PIMathMatrix<double> matrix1(2, 2, 1.5);
PIMathVector<double> vector;
vector.resize(2, 2.5);
for(uint i = 0; i < 2; i++) {
if((vector * matrix1)[i] != 7.5) {
ASSERT_TRUE(false);
}
}
ASSERT_TRUE(true);
}
TEST(PIMathMatrix_Test, valAndMatrixMultiplication) {
PIMathMatrix<double> matrix1(3, 3, 1.5);
ASSERT_TRUE(cmpSquareMatrixWithValue(25.0*matrix1, 37.5, 3));
}
TEST(PIMathMatrix_Test, hermitian) {
complex<double> val;
complex<double> res;
val.imag(1.0);
val.real(1.0);
PIMathMatrix<complex<double>> matrix(3, 3, val);
res.imag(-1.0);
res.real(1.0);
auto matr = hermitian(matrix);
for(uint i = 0; i < 3; i++) {
for(uint j = 0; j < 3; j++) {
if(matr.element(i, j) != res) {
ASSERT_TRUE(false);
}
}
}
ASSERT_TRUE(true);
}

View File

@@ -33,6 +33,7 @@ TEST(PIMathMatrixT_Test, identity) {
}
}
}
>>>>>>> 05a32cc... doc correction
ASSERT_TRUE(true);
}
@@ -297,7 +298,8 @@ TEST(PIMathMatrixT_Test, operator_Addition_Assignment) {
auto matrix1 = PIMathMatrixT<rows, cols, double>::filled(6.72) ;
auto matrix2 = PIMathMatrixT<rows, cols, double>::filled(1.0) ;
matrix1 += matrix2;
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1, 7.72, rows));
b = cmpSquareMatrixWithValue(matrix1, 7.72, rows);
ASSERT_TRUE(b);
}
TEST(PIMathMatrixT_Test, operator_Subtraction_Assignment) {