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

391 lines
10 KiB
C++

/*
AUTOMATICALLY GENERATED FILE - DO NOT EDIT!
Please change MatrixNxN.py and re-run it
*/
/* Generated with ./VectorN.py n = 4, TYPE = unsigned int */
#include "ZUnitTest.hpp"
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <SST/SST_Vec4.h>
static const char* testSST_Math_Vec4uAdd();
static const char* testSST_Math_Vec4uAddLocal();
static const char* testSST_Math_Vec4uSubtract();
static const char* testSST_Math_Vec4uSubtractLocal();
static const char* testSST_Math_Vec4uMultiply();
static const char* testSST_Math_Vec4uMultiplyLocal();
static const char* testSST_Math_Vec4uScale();
static const char* testSST_Math_Vec4uScaleLocal();
static const char* testSST_Math_Vec4uDivide();
static const char* testSST_Math_Vec4uDivideLocal();
static const char* testSST_Math_Vec4uMagnitudeSquared();
static const char* testSST_Math_Vec4uDot();
// List of unit tests
ZUnitTest SST_Math_Vec4uUnitTests[] =
{
{ "testSST_Math_Vec4uAdd " , testSST_Math_Vec4uAdd },
{ "testSST_Math_Vec4uAddLocal " , testSST_Math_Vec4uAddLocal },
{ "testSST_Math_Vec4uSubtract " , testSST_Math_Vec4uSubtract },
{ "testSST_Math_Vec4uSubtractLocal " , testSST_Math_Vec4uSubtractLocal },
{ "testSST_Math_Vec4uMultiply " , testSST_Math_Vec4uMultiply },
{ "testSST_Math_Vec4uMultiplyLocal " , testSST_Math_Vec4uMultiplyLocal },
{ "testSST_Math_Vec4uScale " , testSST_Math_Vec4uScale },
{ "testSST_Math_Vec4uScaleLocal " , testSST_Math_Vec4uScaleLocal },
{ "testSST_Math_Vec4uDivide " , testSST_Math_Vec4uDivide },
{ "testSST_Math_Vec4uDivideLocal " , testSST_Math_Vec4uDivideLocal },
{ "testSST_Math_Vec4uMagnitudeSquared " , testSST_Math_Vec4uMagnitudeSquared },
{ "testSST_Math_Vec4uDot " , testSST_Math_Vec4uDot }
};
DECLARE_ZTESTBLOCK(SST_Math_Vec4u)
/******************************************************************************/
static const char* testSST_Math_Vec4uAdd()
{
SST_Vec4u x; /* 4 vector */
SST_Vec4u y; /* 4 vector */
SST_Vec4u w; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 15;
x.v[1] = 34;
x.v[2] = 18;
x.v[3] = 33;
y.v[0] = 31;
y.v[1] = 5;
y.v[2] = 22;
y.v[3] = 22;
w.v[0] = 0;
w.v[1] = 0;
w.v[2] = 0;
w.v[3] = 0;
/*
[15 34 18 33]
[31 5 22 22]
[46 39 40 55]
*/
SST_Math_Vec4uAdd(&x,&y,&w);
TASSERT((w.v[0])==(46),"Entry _x failed!");
TASSERT((w.v[1])==(39),"Entry _y failed!");
TASSERT((w.v[2])==(40),"Entry _z failed!");
TASSERT((w.v[3])==(55),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4uAddLocal()
{
SST_Vec4u x; /* 4 vector */
SST_Vec4u y; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 23;
x.v[1] = 7;
x.v[2] = 20;
x.v[3] = 39;
y.v[0] = 29;
y.v[1] = 24;
y.v[2] = 33;
y.v[3] = 20;
/*
[23 7 20 39]
[29 24 33 20]
[52 31 53 59]
*/
SST_Math_Vec4uAddLocal(&x,&y); /* for accuracy */
TASSERT((x.v[0])==(52),"Entry _x failed!");
TASSERT((x.v[1])==(31),"Entry _y failed!");
TASSERT((x.v[2])==(53),"Entry _z failed!");
TASSERT((x.v[3])==(59),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4uSubtract()
{
SST_Vec4u x; /* 4 vector */
SST_Vec4u y; /* 4 vector */
SST_Vec4u w; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 28;
x.v[1] = 35;
x.v[2] = 2;
x.v[3] = 0;
y.v[0] = 25;
y.v[1] = 4;
y.v[2] = 2;
y.v[3] = 30;
w.v[0] = 0;
w.v[1] = 0;
w.v[2] = 0;
w.v[3] = 0;
/*
[28 35 2 0]
[25 4 2 30]
[ 3 31 0 4294967266]
*/
SST_Math_Vec4uSubtract(&x,&y,&w);
TASSERT((w.v[0])==(3),"Entry _x failed!");
TASSERT((w.v[1])==(31),"Entry _y failed!");
TASSERT((w.v[2])==(0),"Entry _z failed!");
TASSERT((w.v[3])==(4294967266),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4uSubtractLocal()
{
SST_Vec4u x; /* 4 vector */
SST_Vec4u y; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 10;
x.v[1] = 6;
x.v[2] = 29;
x.v[3] = 10;
y.v[0] = 27;
y.v[1] = 37;
y.v[2] = 26;
y.v[3] = 27;
/*
[10 6 29 10]
[27 37 26 27]
[4294967279 4294967265 3 4294967279]
*/
SST_Math_Vec4uSubtractLocal(&x,&y); /* for accuracy */
TASSERT((x.v[0])==(4294967279),"Entry _x failed!");
TASSERT((x.v[1])==(4294967265),"Entry _y failed!");
TASSERT((x.v[2])==(3),"Entry _z failed!");
TASSERT((x.v[3])==(4294967279),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4uMultiply()
{
SST_Vec4u x; /* 4 vector */
SST_Vec4u y; /* 4 vector */
SST_Vec4u w; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 23;
x.v[1] = 8;
x.v[2] = 8;
x.v[3] = 1;
y.v[0] = 13;
y.v[1] = 29;
y.v[2] = 2;
y.v[3] = 12;
w.v[0] = 0;
w.v[1] = 0;
w.v[2] = 0;
w.v[3] = 0;
/*
[23 8 8 1]
[13 29 2 12]
[299 232 16 12]
*/
SST_Math_Vec4uMultiply(&x,&y,&w);
TASSERT((w.v[0])==(299),"Entry _x failed!");
TASSERT((w.v[1])==(232),"Entry _y failed!");
TASSERT((w.v[2])==(16),"Entry _z failed!");
TASSERT((w.v[3])==(12),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4uMultiplyLocal()
{
SST_Vec4u x; /* 4 vector */
SST_Vec4u y; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 6;
x.v[1] = 37;
x.v[2] = 35;
x.v[3] = 22;
y.v[0] = 13;
y.v[1] = 11;
y.v[2] = 12;
y.v[3] = 20;
/*
[ 6 37 35 22]
[13 11 12 20]
[ 78 407 420 440]
*/
SST_Math_Vec4uMultiplyLocal(&x,&y); /* for accuracy */
TASSERT((x.v[0])==(78),"Entry _x failed!");
TASSERT((x.v[1])==(407),"Entry _y failed!");
TASSERT((x.v[2])==(420),"Entry _z failed!");
TASSERT((x.v[3])==(440),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4uDivide()
{
SST_Vec4u x; /* 4 vector */
SST_Vec4u y; /* 4 vector */
SST_Vec4u w; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 10;
x.v[1] = 3;
x.v[2] = 32;
x.v[3] = 2;
y.v[0] = 13;
y.v[1] = 15;
y.v[2] = 14;
y.v[3] = 10;
w.v[0] = 0;
w.v[1] = 0;
w.v[2] = 0;
w.v[3] = 0;
/*
[10 3 32 2]
[13 15 14 10]
[0 0 2 0]
*/
SST_Math_Vec4uDivide(&x,&y,&w);
TASSERT((w.v[0])==(0),"Entry _x failed!");
TASSERT((w.v[1])==(0),"Entry _y failed!");
TASSERT((w.v[2])==(2),"Entry _z failed!");
TASSERT((w.v[3])==(0),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4uDivideLocal()
{
SST_Vec4u x; /* 4 vector */
SST_Vec4u y; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 7;
x.v[1] = 6;
x.v[2] = 8;
x.v[3] = 5;
y.v[0] = 10;
y.v[1] = 32;
y.v[2] = 32;
y.v[3] = 36;
/*
[7 6 8 5]
[10 32 32 36]
[0 0 0 0]
*/
SST_Math_Vec4uDivideLocal(&x,&y); /* for accuracy */
TASSERT((x.v[0])==(0),"Entry _x failed!");
TASSERT((x.v[1])==(0),"Entry _y failed!");
TASSERT((x.v[2])==(0),"Entry _z failed!");
TASSERT((x.v[3])==(0),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4uScale()
{
SST_Vec4u x; /* 4 vector */
SST_Vec4u w; /* 4 vector */
unsigned int a; /* scalar */
/* Resetting test vectors */
x.v[0] = 23;
x.v[1] = 36;
x.v[2] = 14;
x.v[3] = 6;
w.v[0] = 0;
w.v[1] = 0;
w.v[2] = 0;
w.v[3] = 0;
a = 2;
/*
[23 36 14 6]
[46 72 28 12]
*/
SST_Math_Vec4uScale(&x,a,&w);
TASSERT((w.v[0])==(46),"Entry _x failed!");
TASSERT((w.v[1])==(72),"Entry _y failed!");
TASSERT((w.v[2])==(28),"Entry _z failed!");
TASSERT((w.v[3])==(12),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4uScaleLocal()
{
SST_Vec4u x; /* 4 vector */
unsigned int a; /* scalar */
/* Resetting test vectors */
x.v[0] = 29;
x.v[1] = 5;
x.v[2] = 28;
x.v[3] = 38;
a = 2;
/*
[29 5 28 38]
[58 10 56 76]
*/
SST_Math_Vec4uScaleLocal(&x,a); /* for accuracy */
TASSERT((x.v[0])==(58),"Entry _x failed!");
TASSERT((x.v[1])==(10),"Entry _y failed!");
TASSERT((x.v[2])==(56),"Entry _z failed!");
TASSERT((x.v[3])==(76),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4uMagnitudeSquared()
{
SST_Vec4u x; /* 4 vector */
unsigned int a; /* scalar */
/* Resetting test vectors */
x.v[0] = 38;
x.v[1] = 24;
x.v[2] = 18;
x.v[3] = 38;
/*
[38 24 18 38]
3788
*/
a = SST_Math_Vec4uMagnitudeSquared(&x);
TASSERT((a)==(3788),"MagnitudeSquared failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4uDot()
{
SST_Vec4u x; /* 4 vector */
SST_Vec4u y; /* 4 vector */
unsigned int a; /* scalar */
/* Resetting test vectors */
x.v[0] = 29;
x.v[1] = 21;
x.v[2] = 23;
x.v[3] = 13;
y.v[0] = 11;
y.v[1] = 38;
y.v[2] = 30;
y.v[3] = 26;
/*
[29 21 23 13]
2145
*/
a = SST_Math_Vec4uDot(&x,&y);
TASSERT((a)==(2145),"Dot failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/