Files
libsst/ZTestSuite/Test-SST_Mat22u.cpp
2026-04-03 00:22:39 -05:00

440 lines
12 KiB
C++

/*
AUTOMATICALLY GENERATED FILE - DO NOT EDIT!
Please change MatrixNxN.py and re-run it
*/
/* Generated with ./MatrixNxN.py n = 2, TYPE = unsigned int */
#include "ZUnitTest.hpp"
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <SST/SST_Mat22.h>
#include <SST/SST_Vec2.h>
static const char* testSST_Math_Mat22uAdd();
static const char* testSST_Math_Mat22uAddLocal();
static const char* testSST_Math_Mat22uSubtract();
static const char* testSST_Math_Mat22uSubtractLocal();
static const char* testSST_Math_Mat22uMultiplyElementwise();
static const char* testSST_Math_Mat22uMultiplyElementwiseLocal();
static const char* testSST_Math_Mat22uMultiplyScalar();
static const char* testSST_Math_Mat22uMultiplyScalarLocal();
static const char* testSST_Math_Mat22uMultiplyMatrix();
static const char* testSST_Math_Mat22uMultiplyMatrixLocal();
static const char* testSST_Math_Mat22uMultiplyVector();
static const char* testSST_Math_Mat22uMultiplyVectorLocal();
static const char* testSST_Math_Mat22uTranspose();
static const char* testSST_Math_Mat22uTransposeLocal();
// List of unit tests
ZUnitTest SST_Math_Mat22uUnitTests[] =
{
{ "testSST_Math_Mat22uAdd " , testSST_Math_Mat22uAdd },
{ "testSST_Math_Mat22uAddLocal " , testSST_Math_Mat22uAddLocal },
{ "testSST_Math_Mat22uSubtract " , testSST_Math_Mat22uSubtract },
{ "testSST_Math_Mat22uSubtractLocal " , testSST_Math_Mat22uSubtractLocal },
{ "testSST_Math_Mat22uMultiplyElementwise " , testSST_Math_Mat22uMultiplyElementwise },
{ "testSST_Math_Mat22uMultiplyElementwiseLocal " , testSST_Math_Mat22uMultiplyElementwiseLocal },
{ "testSST_Math_Mat22uMultiplyScalar " , testSST_Math_Mat22uMultiplyScalar },
{ "testSST_Math_Mat22uMultiplyScalarLocal " , testSST_Math_Mat22uMultiplyScalarLocal },
{ "testSST_Math_Mat22uMultiplyMatrix " , testSST_Math_Mat22uMultiplyMatrix },
{ "testSST_Math_Mat22uMultiplyMatrixLocal " , testSST_Math_Mat22uMultiplyMatrixLocal },
{ "testSST_Math_Mat22uMultiplyVector " , testSST_Math_Mat22uMultiplyVector },
{ "testSST_Math_Mat22uMultiplyVectorLocal " , testSST_Math_Mat22uMultiplyVectorLocal },
{ "testSST_Math_Mat22uTranspose " , testSST_Math_Mat22uTranspose },
{ "testSST_Math_Mat22uTransposeLocal " , testSST_Math_Mat22uTransposeLocal }
};
DECLARE_ZTESTBLOCK(SST_Math_Mat22u)
/******************************************************************************/
static const char* testSST_Math_Mat22uAdd(){
SST_Mat22u X; /* 2 x 2 matrix */
SST_Mat22u Y; /* 2 x 2 matrix */
SST_Mat22u A; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
X.v[0] = 36;
X.v[1] = 5;
X.v[2] = 15;
X.v[3] = 7;
Y.v[0] = 36;
Y.v[1] = 7;
Y.v[2] = 31;
Y.v[3] = 33;
/*
[[36 15]
[ 5 7]]
[[36 31]
[ 7 33]]
[[72 46]
[12 40]]
*/
SST_Math_Mat22uAdd(&X,&Y,&A);
TASSERT((A.v[0])==(72),"Entry _a11 failed!");
TASSERT((A.v[2])==(46),"Entry _a12 failed!");
TASSERT((A.v[1])==(12),"Entry _a21 failed!");
TASSERT((A.v[3])==(40),"Entry _a22 failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Mat22uAddLocal(){
SST_Mat22u X; /* 2 x 2 matrix */
SST_Mat22u Y; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
X.v[0] = 23;
X.v[1] = 38;
X.v[2] = 10;
X.v[3] = 27;
Y.v[0] = 16;
Y.v[1] = 5;
Y.v[2] = 21;
Y.v[3] = 11;
/*
[[23 10]
[38 27]]
[[16 21]
[ 5 11]]
[[39 31]
[43 38]]
*/
SST_Math_Mat22uAddLocal(&X,&Y); /* for accuracy */
TASSERT((X.v[0])==(39),"Entry _a11 failed!");
TASSERT((X.v[2])==(31),"Entry _a12 failed!");
TASSERT((X.v[1])==(43),"Entry _a21 failed!");
TASSERT((X.v[3])==(38),"Entry _a22 failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Mat22uSubtract(){
SST_Mat22u X; /* 2 x 2 matrix */
SST_Mat22u Y; /* 2 x 2 matrix */
SST_Mat22u A; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
X.v[0] = 16;
X.v[1] = 26;
X.v[2] = 12;
X.v[3] = 28;
Y.v[0] = 0;
Y.v[1] = 23;
Y.v[2] = 19;
Y.v[3] = 36;
/*
[[16 12]
[26 28]]
[[ 0 19]
[23 36]]
[[ 16 4294967289]
[ 3 4294967288]]
*/
SST_Math_Mat22uSubtract(&X,&Y,&A);
TASSERT((A.v[0])==(16),"Entry _a11 failed!");
TASSERT((A.v[2])==(4294967289),"Entry _a12 failed!");
TASSERT((A.v[1])==(3),"Entry _a21 failed!");
TASSERT((A.v[3])==(4294967288),"Entry _a22 failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Mat22uSubtractLocal(){
SST_Mat22u X; /* 2 x 2 matrix */
SST_Mat22u Y; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
X.v[0] = 10;
X.v[1] = 13;
X.v[2] = 29;
X.v[3] = 24;
Y.v[0] = 21;
Y.v[1] = 30;
Y.v[2] = 18;
Y.v[3] = 7;
/*
[[10 29]
[13 24]]
[[21 18]
[30 7]]
[[4294967285 11]
[4294967279 17]]
*/
SST_Math_Mat22uSubtractLocal(&X,&Y); /* for accuracy */
TASSERT((X.v[0])==(4294967285),"Entry _a11 failed!");
TASSERT((X.v[2])==(11),"Entry _a12 failed!");
TASSERT((X.v[1])==(4294967279),"Entry _a21 failed!");
TASSERT((X.v[3])==(17),"Entry _a22 failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Mat22uMultiplyElementwise(){
SST_Mat22u X; /* 2 x 2 matrix */
SST_Mat22u Y; /* 2 x 2 matrix */
SST_Mat22u A; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
X.v[0] = 6;
X.v[1] = 9;
X.v[2] = 36;
X.v[3] = 17;
Y.v[0] = 0;
Y.v[1] = 19;
Y.v[2] = 38;
Y.v[3] = 19;
/*
[[ 6 36]
[ 9 17]]
[[ 0 38]
[19 19]]
[[ 0 1368]
[ 171 323]]
*/
SST_Math_Mat22uMultiplyElementwise(&X, &Y, &A);
TASSERT((A.v[0])==(0),"Entry _a11 failed!");
TASSERT((A.v[2])==(1368),"Entry _a12 failed!");
TASSERT((A.v[1])==(171),"Entry _a21 failed!");
TASSERT((A.v[3])==(323),"Entry _a22 failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Mat22uMultiplyElementwiseLocal(){
SST_Mat22u X; /* 2 x 2 matrix */
SST_Mat22u Y; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
X.v[0] = 24;
X.v[1] = 20;
X.v[2] = 28;
X.v[3] = 37;
Y.v[0] = 25;
Y.v[1] = 9;
Y.v[2] = 21;
Y.v[3] = 38;
/*
[[24 28]
[20 37]]
[[25 21]
[ 9 38]]
[[ 600 588]
[ 180 1406]]
*/
SST_Math_Mat22uMultiplyElementwiseLocal(&X,&Y);
TASSERT((X.v[0])==(600),"Entry _a11 failed!");
TASSERT((X.v[2])==(588),"Entry _a12 failed!");
TASSERT((X.v[1])==(180),"Entry _a21 failed!");
TASSERT((X.v[3])==(1406),"Entry _a22 failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Mat22uMultiplyScalar(){
SST_Mat22u X; /* 2 x 2 matrix */
SST_Mat22u A; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
X.v[0] = 33;
X.v[1] = 2;
X.v[2] = 24;
X.v[3] = 39;
/*
[[33 24]
[ 2 39]]
[[66 48]
[ 4 78]]
*/
SST_Math_Mat22uMultiplyScalar(&X,2,&A);
TASSERT((A.v[0])==(66),"Entry _a11 failed!");
TASSERT((A.v[2])==(48),"Entry _a12 failed!");
TASSERT((A.v[1])==(4),"Entry _a21 failed!");
TASSERT((A.v[3])==(78),"Entry _a22 failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Mat22uMultiplyScalarLocal(){
SST_Mat22u X; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
X.v[0] = 11;
X.v[1] = 22;
X.v[2] = 3;
X.v[3] = 13;
/*
[[11 3]
[22 13]]
[[22 6]
[44 26]]
*/
SST_Math_Mat22uMultiplyScalarLocal(&X,2);
TASSERT((X.v[0])==(22),"Entry _a11 failed!");
TASSERT((X.v[2])==(6),"Entry _a12 failed!");
TASSERT((X.v[1])==(44),"Entry _a21 failed!");
TASSERT((X.v[3])==(26),"Entry _a22 failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Mat22uMultiplyMatrix(){
SST_Mat22u X; /* 2 x 2 matrix */
SST_Mat22u Y; /* 2 x 2 matrix */
SST_Mat22u A; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
X.v[0] = 36;
X.v[1] = 18;
X.v[2] = 29;
X.v[3] = 14;
Y.v[0] = 6;
Y.v[1] = 17;
Y.v[2] = 31;
Y.v[3] = 8;
/*
X
[[36 29]
[18 14]]
Y
[[ 6 31]
[17 8]]
[[ 709 1348]
[ 346 670]]
*/
SST_Math_Mat22uMultiplyMatrix(&X,&Y,&A);
TASSERT((A.v[0])==(709),"Entry _a11 failed!");
TASSERT((A.v[2])==(1348),"Entry _a12 failed!");
TASSERT((A.v[1])==(346),"Entry _a21 failed!");
TASSERT((A.v[3])==(670),"Entry _a22 failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Mat22uMultiplyMatrixLocal(){
SST_Mat22u X; /* 2 x 2 matrix */
SST_Mat22u Y; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
X.v[0] = 30;
X.v[1] = 6;
X.v[2] = 13;
X.v[3] = 33;
Y.v[0] = 20;
Y.v[1] = 24;
Y.v[2] = 2;
Y.v[3] = 2;
/*
X
[[30 13]
[ 6 33]]
Y
[[20 2]
[24 2]]
X
[[912 86]
[912 78]]
*/
SST_Math_Mat22uMultiplyMatrixLocal(&X,&Y);
TASSERT((X.v[0])==(912),"Entry _a11 failed!");
TASSERT((X.v[2])==(86),"Entry _a12 failed!");
TASSERT((X.v[1])==(912),"Entry _a21 failed!");
TASSERT((X.v[3])==(78),"Entry _a22 failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Mat22uMultiplyVector(){
SST_Mat22u X; /* 2 x 2 matrix */
SST_Vec2u v; /* 2 vector */
SST_Vec2u w; /* 2 vector */
/* Resetting test vectors / mats */
v.v[0] = 21;
v.v[1] = 34;
X.v[0] = 34;
X.v[1] = 39;
X.v[2] = 28;
X.v[3] = 7;
/*
X
[[34 28]
[39 7]]
v
[21 34]
w
[1666 1057]
*/
SST_Math_Mat22uMultiplyVector(&X,&v,&w);
TASSERT((w.v[0])==(1666),"Entry .v[0] failed!");
TASSERT((w.v[1])==(1057),"Entry .v[1] failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Mat22uMultiplyVectorLocal(){
SST_Mat22u X; /* 2 x 2 matrix */
SST_Vec2u v; /* 2 vector */
/* Resetting test vectors / mats */
v.v[0] = 9;
v.v[1] = 29;
X.v[0] = 35;
X.v[1] = 4;
X.v[2] = 30;
X.v[3] = 22;
/*
X
[[35 30]
[ 4 22]]
v
[ 9 29]
v
[1185 674]
*/
SST_Math_Mat22uMultiplyVectorLocal(&X,&v);
TASSERT((v.v[0])==(1185),"Entry .v[0] failed!");
TASSERT((v.v[1])==(674),"Entry .v[1] failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Mat22uTranspose(){
SST_Mat22u X; /* 2 x 2 matrix */
SST_Mat22u A; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
X.v[0] = 19;
X.v[1] = 39;
X.v[2] = 14;
X.v[3] = 38;
SST_Math_Mat22uTranspose(&X,&A);
TASSERT((A.v[0])==(19),"Entry _a11 failed!");
TASSERT((A.v[2])==(39),"Entry _a12 failed!");
TASSERT((A.v[1])==(14),"Entry _a21 failed!");
TASSERT((A.v[3])==(38),"Entry _a22 failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Mat22uTransposeLocal(){
SST_Mat22u X; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
X.v[0] = 34;
X.v[1] = 36;
X.v[2] = 12;
X.v[3] = 8;
SST_Math_Mat22uTransposeLocal(&X);
TASSERT((X.v[0])==(34),"Entry _a11 failed!");
TASSERT((X.v[2])==(36),"Entry _a12 failed!");
TASSERT((X.v[1])==(12),"Entry _a21 failed!");
TASSERT((X.v[3])==(8),"Entry _a22 failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/