644 lines
18 KiB
C++
644 lines
18 KiB
C++
/*
|
|
AUTOMATICALLY GENERATED FILE - DO NOT EDIT!
|
|
Please change MatrixNxN.py and re-run it
|
|
*/
|
|
/* Generated with ./MatrixNxN.py n = 3, TYPE = unsigned int */
|
|
|
|
#include "ZUnitTest.hpp"
|
|
#include <float.h>
|
|
#include <math.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <SST/SST_Mat33.h>
|
|
#include <SST/SST_Vec3.h>
|
|
|
|
|
|
|
|
|
|
static const char* testSST_Math_Mat33uAdd();
|
|
static const char* testSST_Math_Mat33uAddLocal();
|
|
static const char* testSST_Math_Mat33uSubtract();
|
|
static const char* testSST_Math_Mat33uSubtractLocal();
|
|
static const char* testSST_Math_Mat33uMultiplyElementwise();
|
|
static const char* testSST_Math_Mat33uMultiplyElementwiseLocal();
|
|
static const char* testSST_Math_Mat33uMultiplyScalar();
|
|
static const char* testSST_Math_Mat33uMultiplyScalarLocal();
|
|
static const char* testSST_Math_Mat33uMultiplyMatrix();
|
|
static const char* testSST_Math_Mat33uMultiplyMatrixLocal();
|
|
static const char* testSST_Math_Mat33uMultiplyVector();
|
|
static const char* testSST_Math_Mat33uMultiplyVectorLocal();
|
|
static const char* testSST_Math_Mat33uTranspose();
|
|
static const char* testSST_Math_Mat33uTransposeLocal();
|
|
// List of unit tests
|
|
ZUnitTest SST_Math_Mat33uUnitTests[] =
|
|
{
|
|
{ "testSST_Math_Mat33uAdd " , testSST_Math_Mat33uAdd },
|
|
{ "testSST_Math_Mat33uAddLocal " , testSST_Math_Mat33uAddLocal },
|
|
{ "testSST_Math_Mat33uSubtract " , testSST_Math_Mat33uSubtract },
|
|
{ "testSST_Math_Mat33uSubtractLocal " , testSST_Math_Mat33uSubtractLocal },
|
|
{ "testSST_Math_Mat33uMultiplyElementwise " , testSST_Math_Mat33uMultiplyElementwise },
|
|
{ "testSST_Math_Mat33uMultiplyElementwiseLocal " , testSST_Math_Mat33uMultiplyElementwiseLocal },
|
|
{ "testSST_Math_Mat33uMultiplyScalar " , testSST_Math_Mat33uMultiplyScalar },
|
|
{ "testSST_Math_Mat33uMultiplyScalarLocal " , testSST_Math_Mat33uMultiplyScalarLocal },
|
|
{ "testSST_Math_Mat33uMultiplyMatrix " , testSST_Math_Mat33uMultiplyMatrix },
|
|
{ "testSST_Math_Mat33uMultiplyMatrixLocal " , testSST_Math_Mat33uMultiplyMatrixLocal },
|
|
{ "testSST_Math_Mat33uMultiplyVector " , testSST_Math_Mat33uMultiplyVector },
|
|
{ "testSST_Math_Mat33uMultiplyVectorLocal " , testSST_Math_Mat33uMultiplyVectorLocal },
|
|
{ "testSST_Math_Mat33uTranspose " , testSST_Math_Mat33uTranspose },
|
|
{ "testSST_Math_Mat33uTransposeLocal " , testSST_Math_Mat33uTransposeLocal }
|
|
};
|
|
DECLARE_ZTESTBLOCK(SST_Math_Mat33u)
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Mat33uAdd(){
|
|
SST_Mat33u X; /* 3 x 3 matrix */
|
|
SST_Mat33u Y; /* 3 x 3 matrix */
|
|
SST_Mat33u A; /* 3 x 3 matrix */
|
|
/* Resetting test vectors / mats */
|
|
X.v[0] = 35;
|
|
X.v[1] = 11;
|
|
X.v[2] = 6;
|
|
X.v[3] = 32;
|
|
X.v[4] = 1;
|
|
X.v[5] = 19;
|
|
X.v[6] = 34;
|
|
X.v[7] = 1;
|
|
X.v[8] = 12;
|
|
Y.v[0] = 9;
|
|
Y.v[1] = 27;
|
|
Y.v[2] = 33;
|
|
Y.v[3] = 11;
|
|
Y.v[4] = 12;
|
|
Y.v[5] = 6;
|
|
Y.v[6] = 8;
|
|
Y.v[7] = 22;
|
|
Y.v[8] = 11;
|
|
/*
|
|
[[35 32 34]
|
|
[11 1 1]
|
|
[ 6 19 12]]
|
|
[[ 9 11 8]
|
|
[27 12 22]
|
|
[33 6 11]]
|
|
[[44 43 42]
|
|
[38 13 23]
|
|
[39 25 23]]
|
|
*/
|
|
SST_Math_Mat33uAdd(&X,&Y,&A);
|
|
TASSERT((A.v[0])==(44),"Entry _a11 failed!");
|
|
TASSERT((A.v[3])==(43),"Entry _a12 failed!");
|
|
TASSERT((A.v[6])==(42),"Entry _a13 failed!");
|
|
TASSERT((A.v[1])==(38),"Entry _a21 failed!");
|
|
TASSERT((A.v[4])==(13),"Entry _a22 failed!");
|
|
TASSERT((A.v[7])==(23),"Entry _a23 failed!");
|
|
TASSERT((A.v[2])==(39),"Entry _a31 failed!");
|
|
TASSERT((A.v[5])==(25),"Entry _a32 failed!");
|
|
TASSERT((A.v[8])==(23),"Entry _a33 failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Mat33uAddLocal(){
|
|
SST_Mat33u X; /* 3 x 3 matrix */
|
|
SST_Mat33u Y; /* 3 x 3 matrix */
|
|
/* Resetting test vectors / mats */
|
|
X.v[0] = 25;
|
|
X.v[1] = 11;
|
|
X.v[2] = 26;
|
|
X.v[3] = 39;
|
|
X.v[4] = 33;
|
|
X.v[5] = 33;
|
|
X.v[6] = 1;
|
|
X.v[7] = 15;
|
|
X.v[8] = 31;
|
|
Y.v[0] = 12;
|
|
Y.v[1] = 38;
|
|
Y.v[2] = 35;
|
|
Y.v[3] = 12;
|
|
Y.v[4] = 11;
|
|
Y.v[5] = 15;
|
|
Y.v[6] = 8;
|
|
Y.v[7] = 0;
|
|
Y.v[8] = 25;
|
|
/*
|
|
[[25 39 1]
|
|
[11 33 15]
|
|
[26 33 31]]
|
|
[[12 12 8]
|
|
[38 11 0]
|
|
[35 15 25]]
|
|
[[37 51 9]
|
|
[49 44 15]
|
|
[61 48 56]]
|
|
*/
|
|
SST_Math_Mat33uAddLocal(&X,&Y); /* for accuracy */
|
|
TASSERT((X.v[0])==(37),"Entry _a11 failed!");
|
|
TASSERT((X.v[3])==(51),"Entry _a12 failed!");
|
|
TASSERT((X.v[6])==(9),"Entry _a13 failed!");
|
|
TASSERT((X.v[1])==(49),"Entry _a21 failed!");
|
|
TASSERT((X.v[4])==(44),"Entry _a22 failed!");
|
|
TASSERT((X.v[7])==(15),"Entry _a23 failed!");
|
|
TASSERT((X.v[2])==(61),"Entry _a31 failed!");
|
|
TASSERT((X.v[5])==(48),"Entry _a32 failed!");
|
|
TASSERT((X.v[8])==(56),"Entry _a33 failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Mat33uSubtract(){
|
|
SST_Mat33u X; /* 3 x 3 matrix */
|
|
SST_Mat33u Y; /* 3 x 3 matrix */
|
|
SST_Mat33u A; /* 3 x 3 matrix */
|
|
/* Resetting test vectors / mats */
|
|
X.v[0] = 33;
|
|
X.v[1] = 15;
|
|
X.v[2] = 17;
|
|
X.v[3] = 4;
|
|
X.v[4] = 1;
|
|
X.v[5] = 30;
|
|
X.v[6] = 29;
|
|
X.v[7] = 18;
|
|
X.v[8] = 31;
|
|
Y.v[0] = 0;
|
|
Y.v[1] = 19;
|
|
Y.v[2] = 12;
|
|
Y.v[3] = 37;
|
|
Y.v[4] = 35;
|
|
Y.v[5] = 2;
|
|
Y.v[6] = 6;
|
|
Y.v[7] = 15;
|
|
Y.v[8] = 1;
|
|
/*
|
|
[[33 4 29]
|
|
[15 1 18]
|
|
[17 30 31]]
|
|
[[ 0 37 6]
|
|
[19 35 15]
|
|
[12 2 1]]
|
|
[[ 33 4294967263 23]
|
|
[4294967292 4294967262 3]
|
|
[ 5 28 30]]
|
|
*/
|
|
SST_Math_Mat33uSubtract(&X,&Y,&A);
|
|
TASSERT((A.v[0])==(33),"Entry _a11 failed!");
|
|
TASSERT((A.v[3])==(4294967263),"Entry _a12 failed!");
|
|
TASSERT((A.v[6])==(23),"Entry _a13 failed!");
|
|
TASSERT((A.v[1])==(4294967292),"Entry _a21 failed!");
|
|
TASSERT((A.v[4])==(4294967262),"Entry _a22 failed!");
|
|
TASSERT((A.v[7])==(3),"Entry _a23 failed!");
|
|
TASSERT((A.v[2])==(5),"Entry _a31 failed!");
|
|
TASSERT((A.v[5])==(28),"Entry _a32 failed!");
|
|
TASSERT((A.v[8])==(30),"Entry _a33 failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Mat33uSubtractLocal(){
|
|
SST_Mat33u X; /* 3 x 3 matrix */
|
|
SST_Mat33u Y; /* 3 x 3 matrix */
|
|
/* Resetting test vectors / mats */
|
|
X.v[0] = 4;
|
|
X.v[1] = 1;
|
|
X.v[2] = 17;
|
|
X.v[3] = 16;
|
|
X.v[4] = 33;
|
|
X.v[5] = 38;
|
|
X.v[6] = 20;
|
|
X.v[7] = 33;
|
|
X.v[8] = 33;
|
|
Y.v[0] = 22;
|
|
Y.v[1] = 8;
|
|
Y.v[2] = 15;
|
|
Y.v[3] = 11;
|
|
Y.v[4] = 8;
|
|
Y.v[5] = 28;
|
|
Y.v[6] = 29;
|
|
Y.v[7] = 22;
|
|
Y.v[8] = 19;
|
|
/*
|
|
[[ 4 16 20]
|
|
[ 1 33 33]
|
|
[17 38 33]]
|
|
[[22 11 29]
|
|
[ 8 8 22]
|
|
[15 28 19]]
|
|
[[4294967278 5 4294967287]
|
|
[4294967289 25 11]
|
|
[ 2 10 14]]
|
|
*/
|
|
SST_Math_Mat33uSubtractLocal(&X,&Y); /* for accuracy */
|
|
TASSERT((X.v[0])==(4294967278),"Entry _a11 failed!");
|
|
TASSERT((X.v[3])==(5),"Entry _a12 failed!");
|
|
TASSERT((X.v[6])==(4294967287),"Entry _a13 failed!");
|
|
TASSERT((X.v[1])==(4294967289),"Entry _a21 failed!");
|
|
TASSERT((X.v[4])==(25),"Entry _a22 failed!");
|
|
TASSERT((X.v[7])==(11),"Entry _a23 failed!");
|
|
TASSERT((X.v[2])==(2),"Entry _a31 failed!");
|
|
TASSERT((X.v[5])==(10),"Entry _a32 failed!");
|
|
TASSERT((X.v[8])==(14),"Entry _a33 failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Mat33uMultiplyElementwise(){
|
|
SST_Mat33u X; /* 3 x 3 matrix */
|
|
SST_Mat33u Y; /* 3 x 3 matrix */
|
|
SST_Mat33u A; /* 3 x 3 matrix */
|
|
/* Resetting test vectors / mats */
|
|
X.v[0] = 19;
|
|
X.v[1] = 5;
|
|
X.v[2] = 16;
|
|
X.v[3] = 27;
|
|
X.v[4] = 15;
|
|
X.v[5] = 28;
|
|
X.v[6] = 1;
|
|
X.v[7] = 12;
|
|
X.v[8] = 28;
|
|
Y.v[0] = 13;
|
|
Y.v[1] = 5;
|
|
Y.v[2] = 30;
|
|
Y.v[3] = 6;
|
|
Y.v[4] = 39;
|
|
Y.v[5] = 38;
|
|
Y.v[6] = 30;
|
|
Y.v[7] = 12;
|
|
Y.v[8] = 35;
|
|
/*
|
|
[[19 27 1]
|
|
[ 5 15 12]
|
|
[16 28 28]]
|
|
[[13 6 30]
|
|
[ 5 39 12]
|
|
[30 38 35]]
|
|
[[ 247 162 30]
|
|
[ 25 585 144]
|
|
[ 480 1064 980]]
|
|
*/
|
|
SST_Math_Mat33uMultiplyElementwise(&X, &Y, &A);
|
|
TASSERT((A.v[0])==(247),"Entry _a11 failed!");
|
|
TASSERT((A.v[3])==(162),"Entry _a12 failed!");
|
|
TASSERT((A.v[6])==(30),"Entry _a13 failed!");
|
|
TASSERT((A.v[1])==(25),"Entry _a21 failed!");
|
|
TASSERT((A.v[4])==(585),"Entry _a22 failed!");
|
|
TASSERT((A.v[7])==(144),"Entry _a23 failed!");
|
|
TASSERT((A.v[2])==(480),"Entry _a31 failed!");
|
|
TASSERT((A.v[5])==(1064),"Entry _a32 failed!");
|
|
TASSERT((A.v[8])==(980),"Entry _a33 failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Mat33uMultiplyElementwiseLocal(){
|
|
SST_Mat33u X; /* 3 x 3 matrix */
|
|
SST_Mat33u Y; /* 3 x 3 matrix */
|
|
/* Resetting test vectors / mats */
|
|
X.v[0] = 27;
|
|
X.v[1] = 10;
|
|
X.v[2] = 15;
|
|
X.v[3] = 38;
|
|
X.v[4] = 0;
|
|
X.v[5] = 3;
|
|
X.v[6] = 10;
|
|
X.v[7] = 5;
|
|
X.v[8] = 13;
|
|
Y.v[0] = 35;
|
|
Y.v[1] = 25;
|
|
Y.v[2] = 12;
|
|
Y.v[3] = 12;
|
|
Y.v[4] = 23;
|
|
Y.v[5] = 35;
|
|
Y.v[6] = 5;
|
|
Y.v[7] = 38;
|
|
Y.v[8] = 26;
|
|
/*
|
|
[[27 38 10]
|
|
[10 0 5]
|
|
[15 3 13]]
|
|
[[35 12 5]
|
|
[25 23 38]
|
|
[12 35 26]]
|
|
[[945 456 50]
|
|
[250 0 190]
|
|
[180 105 338]]
|
|
*/
|
|
SST_Math_Mat33uMultiplyElementwiseLocal(&X,&Y);
|
|
TASSERT((X.v[0])==(945),"Entry _a11 failed!");
|
|
TASSERT((X.v[3])==(456),"Entry _a12 failed!");
|
|
TASSERT((X.v[6])==(50),"Entry _a13 failed!");
|
|
TASSERT((X.v[1])==(250),"Entry _a21 failed!");
|
|
TASSERT((X.v[4])==(0),"Entry _a22 failed!");
|
|
TASSERT((X.v[7])==(190),"Entry _a23 failed!");
|
|
TASSERT((X.v[2])==(180),"Entry _a31 failed!");
|
|
TASSERT((X.v[5])==(105),"Entry _a32 failed!");
|
|
TASSERT((X.v[8])==(338),"Entry _a33 failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Mat33uMultiplyScalar(){
|
|
SST_Mat33u X; /* 3 x 3 matrix */
|
|
SST_Mat33u A; /* 3 x 3 matrix */
|
|
/* Resetting test vectors / mats */
|
|
X.v[0] = 24;
|
|
X.v[1] = 11;
|
|
X.v[2] = 1;
|
|
X.v[3] = 22;
|
|
X.v[4] = 0;
|
|
X.v[5] = 17;
|
|
X.v[6] = 22;
|
|
X.v[7] = 36;
|
|
X.v[8] = 27;
|
|
/*
|
|
[[24 22 22]
|
|
[11 0 36]
|
|
[ 1 17 27]]
|
|
[[48 44 44]
|
|
[22 0 72]
|
|
[ 2 34 54]]
|
|
*/
|
|
SST_Math_Mat33uMultiplyScalar(&X,2,&A);
|
|
TASSERT((A.v[0])==(48),"Entry _a11 failed!");
|
|
TASSERT((A.v[3])==(44),"Entry _a12 failed!");
|
|
TASSERT((A.v[6])==(44),"Entry _a13 failed!");
|
|
TASSERT((A.v[1])==(22),"Entry _a21 failed!");
|
|
TASSERT((A.v[4])==(0),"Entry _a22 failed!");
|
|
TASSERT((A.v[7])==(72),"Entry _a23 failed!");
|
|
TASSERT((A.v[2])==(2),"Entry _a31 failed!");
|
|
TASSERT((A.v[5])==(34),"Entry _a32 failed!");
|
|
TASSERT((A.v[8])==(54),"Entry _a33 failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Mat33uMultiplyScalarLocal(){
|
|
SST_Mat33u X; /* 3 x 3 matrix */
|
|
/* Resetting test vectors / mats */
|
|
X.v[0] = 12;
|
|
X.v[1] = 19;
|
|
X.v[2] = 9;
|
|
X.v[3] = 30;
|
|
X.v[4] = 31;
|
|
X.v[5] = 2;
|
|
X.v[6] = 38;
|
|
X.v[7] = 7;
|
|
X.v[8] = 0;
|
|
/*
|
|
[[12 30 38]
|
|
[19 31 7]
|
|
[ 9 2 0]]
|
|
[[24 60 76]
|
|
[38 62 14]
|
|
[18 4 0]]
|
|
*/
|
|
SST_Math_Mat33uMultiplyScalarLocal(&X,2);
|
|
TASSERT((X.v[0])==(24),"Entry _a11 failed!");
|
|
TASSERT((X.v[3])==(60),"Entry _a12 failed!");
|
|
TASSERT((X.v[6])==(76),"Entry _a13 failed!");
|
|
TASSERT((X.v[1])==(38),"Entry _a21 failed!");
|
|
TASSERT((X.v[4])==(62),"Entry _a22 failed!");
|
|
TASSERT((X.v[7])==(14),"Entry _a23 failed!");
|
|
TASSERT((X.v[2])==(18),"Entry _a31 failed!");
|
|
TASSERT((X.v[5])==(4),"Entry _a32 failed!");
|
|
TASSERT((X.v[8])==(0),"Entry _a33 failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Mat33uMultiplyMatrix(){
|
|
SST_Mat33u X; /* 3 x 3 matrix */
|
|
SST_Mat33u Y; /* 3 x 3 matrix */
|
|
SST_Mat33u A; /* 3 x 3 matrix */
|
|
/* Resetting test vectors / mats */
|
|
X.v[0] = 1;
|
|
X.v[1] = 26;
|
|
X.v[2] = 39;
|
|
X.v[3] = 24;
|
|
X.v[4] = 30;
|
|
X.v[5] = 23;
|
|
X.v[6] = 27;
|
|
X.v[7] = 11;
|
|
X.v[8] = 27;
|
|
Y.v[0] = 26;
|
|
Y.v[1] = 21;
|
|
Y.v[2] = 4;
|
|
Y.v[3] = 32;
|
|
Y.v[4] = 32;
|
|
Y.v[5] = 37;
|
|
Y.v[6] = 25;
|
|
Y.v[7] = 10;
|
|
Y.v[8] = 32;
|
|
/*
|
|
X
|
|
[[ 1 24 27]
|
|
[26 30 11]
|
|
[39 23 27]]
|
|
Y
|
|
[[26 32 25]
|
|
[21 32 10]
|
|
[ 4 37 32]]
|
|
[[ 638 1799 1129]
|
|
[1350 2199 1302]
|
|
[1605 2983 2069]]
|
|
*/
|
|
SST_Math_Mat33uMultiplyMatrix(&X,&Y,&A);
|
|
TASSERT((A.v[0])==(638),"Entry _a11 failed!");
|
|
TASSERT((A.v[3])==(1799),"Entry _a12 failed!");
|
|
TASSERT((A.v[6])==(1129),"Entry _a13 failed!");
|
|
TASSERT((A.v[1])==(1350),"Entry _a21 failed!");
|
|
TASSERT((A.v[4])==(2199),"Entry _a22 failed!");
|
|
TASSERT((A.v[7])==(1302),"Entry _a23 failed!");
|
|
TASSERT((A.v[2])==(1605),"Entry _a31 failed!");
|
|
TASSERT((A.v[5])==(2983),"Entry _a32 failed!");
|
|
TASSERT((A.v[8])==(2069),"Entry _a33 failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Mat33uMultiplyMatrixLocal(){
|
|
SST_Mat33u X; /* 3 x 3 matrix */
|
|
SST_Mat33u Y; /* 3 x 3 matrix */
|
|
/* Resetting test vectors / mats */
|
|
X.v[0] = 12;
|
|
X.v[1] = 31;
|
|
X.v[2] = 4;
|
|
X.v[3] = 25;
|
|
X.v[4] = 35;
|
|
X.v[5] = 0;
|
|
X.v[6] = 11;
|
|
X.v[7] = 9;
|
|
X.v[8] = 37;
|
|
Y.v[0] = 16;
|
|
Y.v[1] = 5;
|
|
Y.v[2] = 12;
|
|
Y.v[3] = 3;
|
|
Y.v[4] = 8;
|
|
Y.v[5] = 33;
|
|
Y.v[6] = 30;
|
|
Y.v[7] = 5;
|
|
Y.v[8] = 11;
|
|
/*
|
|
X
|
|
[[12 25 11]
|
|
[31 35 9]
|
|
[ 4 0 37]]
|
|
Y
|
|
[[16 3 30]
|
|
[ 5 8 5]
|
|
[12 33 11]]
|
|
X
|
|
[[ 449 599 606]
|
|
[ 779 670 1204]
|
|
[ 508 1233 527]]
|
|
*/
|
|
SST_Math_Mat33uMultiplyMatrixLocal(&X,&Y);
|
|
TASSERT((X.v[0])==(449),"Entry _a11 failed!");
|
|
TASSERT((X.v[3])==(599),"Entry _a12 failed!");
|
|
TASSERT((X.v[6])==(606),"Entry _a13 failed!");
|
|
TASSERT((X.v[1])==(779),"Entry _a21 failed!");
|
|
TASSERT((X.v[4])==(670),"Entry _a22 failed!");
|
|
TASSERT((X.v[7])==(1204),"Entry _a23 failed!");
|
|
TASSERT((X.v[2])==(508),"Entry _a31 failed!");
|
|
TASSERT((X.v[5])==(1233),"Entry _a32 failed!");
|
|
TASSERT((X.v[8])==(527),"Entry _a33 failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Mat33uMultiplyVector(){
|
|
SST_Mat33u X; /* 3 x 3 matrix */
|
|
SST_Vec3u v; /* 3 vector */
|
|
SST_Vec3u w; /* 3 vector */
|
|
/* Resetting test vectors / mats */
|
|
v.v[0] = 34;
|
|
v.v[1] = 0;
|
|
v.v[2] = 26;
|
|
X.v[0] = 19;
|
|
X.v[1] = 33;
|
|
X.v[2] = 4;
|
|
X.v[3] = 21;
|
|
X.v[4] = 12;
|
|
X.v[5] = 32;
|
|
X.v[6] = 10;
|
|
X.v[7] = 24;
|
|
X.v[8] = 21;
|
|
/*
|
|
X
|
|
[[19 21 10]
|
|
[33 12 24]
|
|
[ 4 32 21]]
|
|
v
|
|
[34 0 26]
|
|
w
|
|
[ 906 1746 682]
|
|
*/
|
|
SST_Math_Mat33uMultiplyVector(&X,&v,&w);
|
|
TASSERT((w.v[0])==(906),"Entry .v[0] failed!");
|
|
TASSERT((w.v[1])==(1746),"Entry .v[1] failed!");
|
|
TASSERT((w.v[2])==(682),"Entry .v[2] failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Mat33uMultiplyVectorLocal(){
|
|
SST_Mat33u X; /* 3 x 3 matrix */
|
|
SST_Vec3u v; /* 3 vector */
|
|
/* Resetting test vectors / mats */
|
|
v.v[0] = 16;
|
|
v.v[1] = 36;
|
|
v.v[2] = 13;
|
|
X.v[0] = 37;
|
|
X.v[1] = 27;
|
|
X.v[2] = 8;
|
|
X.v[3] = 25;
|
|
X.v[4] = 12;
|
|
X.v[5] = 19;
|
|
X.v[6] = 24;
|
|
X.v[7] = 17;
|
|
X.v[8] = 19;
|
|
/*
|
|
X
|
|
[[37 25 24]
|
|
[27 12 17]
|
|
[ 8 19 19]]
|
|
v
|
|
[16 36 13]
|
|
v
|
|
[1804 1085 1059]
|
|
*/
|
|
SST_Math_Mat33uMultiplyVectorLocal(&X,&v);
|
|
TASSERT((v.v[0])==(1804),"Entry .v[0] failed!");
|
|
TASSERT((v.v[1])==(1085),"Entry .v[1] failed!");
|
|
TASSERT((v.v[2])==(1059),"Entry .v[2] failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Mat33uTranspose(){
|
|
SST_Mat33u X; /* 3 x 3 matrix */
|
|
SST_Mat33u A; /* 3 x 3 matrix */
|
|
/* Resetting test vectors / mats */
|
|
X.v[0] = 13;
|
|
X.v[1] = 16;
|
|
X.v[2] = 26;
|
|
X.v[3] = 24;
|
|
X.v[4] = 39;
|
|
X.v[5] = 24;
|
|
X.v[6] = 16;
|
|
X.v[7] = 12;
|
|
X.v[8] = 13;
|
|
SST_Math_Mat33uTranspose(&X,&A);
|
|
TASSERT((A.v[0])==(13),"Entry _a11 failed!");
|
|
TASSERT((A.v[3])==(16),"Entry _a12 failed!");
|
|
TASSERT((A.v[6])==(26),"Entry _a13 failed!");
|
|
TASSERT((A.v[1])==(24),"Entry _a21 failed!");
|
|
TASSERT((A.v[4])==(39),"Entry _a22 failed!");
|
|
TASSERT((A.v[7])==(24),"Entry _a23 failed!");
|
|
TASSERT((A.v[2])==(16),"Entry _a31 failed!");
|
|
TASSERT((A.v[5])==(12),"Entry _a32 failed!");
|
|
TASSERT((A.v[8])==(13),"Entry _a33 failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Mat33uTransposeLocal(){
|
|
SST_Mat33u X; /* 3 x 3 matrix */
|
|
/* Resetting test vectors / mats */
|
|
X.v[0] = 35;
|
|
X.v[1] = 15;
|
|
X.v[2] = 2;
|
|
X.v[3] = 17;
|
|
X.v[4] = 31;
|
|
X.v[5] = 13;
|
|
X.v[6] = 22;
|
|
X.v[7] = 14;
|
|
X.v[8] = 21;
|
|
SST_Math_Mat33uTransposeLocal(&X);
|
|
TASSERT((X.v[0])==(35),"Entry _a11 failed!");
|
|
TASSERT((X.v[3])==(15),"Entry _a12 failed!");
|
|
TASSERT((X.v[6])==(2),"Entry _a13 failed!");
|
|
TASSERT((X.v[1])==(17),"Entry _a21 failed!");
|
|
TASSERT((X.v[4])==(31),"Entry _a22 failed!");
|
|
TASSERT((X.v[7])==(13),"Entry _a23 failed!");
|
|
TASSERT((X.v[2])==(22),"Entry _a31 failed!");
|
|
TASSERT((X.v[5])==(14),"Entry _a32 failed!");
|
|
TASSERT((X.v[8])==(21),"Entry _a33 failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|