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

554 lines
15 KiB
C++

/*
AUTOMATICALLY GENERATED FILE - DO NOT EDIT!
Please change MatrixNxN.py and re-run it
*/
/* Generated with ./VectorN.py n = 4, TYPE = 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_Vec4iAdd();
static const char* testSST_Math_Vec4iAddLocal();
static const char* testSST_Math_Vec4iSubtract();
static const char* testSST_Math_Vec4iSubtractLocal();
static const char* testSST_Math_Vec4iMultiply();
static const char* testSST_Math_Vec4iMultiplyLocal();
static const char* testSST_Math_Vec4iScale();
static const char* testSST_Math_Vec4iScaleLocal();
static const char* testSST_Math_Vec4iDivide();
static const char* testSST_Math_Vec4iDivideLocal();
static const char* testSST_Math_Vec4iAbs();
static const char* testSST_Math_Vec4iAbsLocal();
static const char* testSST_Math_Vec4iNegate();
static const char* testSST_Math_Vec4iNegateLocal();
static const char* testSST_Math_Vec4iBias();
static const char* testSST_Math_Vec4iBiasLocal();
static const char* testSST_Math_Vec4iMagnitudeSquared();
static const char* testSST_Math_Vec4iDot();
// List of unit tests
ZUnitTest SST_Math_Vec4iUnitTests[] =
{
{ "testSST_Math_Vec4iAdd " , testSST_Math_Vec4iAdd },
{ "testSST_Math_Vec4iAddLocal " , testSST_Math_Vec4iAddLocal },
{ "testSST_Math_Vec4iSubtract " , testSST_Math_Vec4iSubtract },
{ "testSST_Math_Vec4iSubtractLocal " , testSST_Math_Vec4iSubtractLocal },
{ "testSST_Math_Vec4iMultiply " , testSST_Math_Vec4iMultiply },
{ "testSST_Math_Vec4iMultiplyLocal " , testSST_Math_Vec4iMultiplyLocal },
{ "testSST_Math_Vec4iScale " , testSST_Math_Vec4iScale },
{ "testSST_Math_Vec4iScaleLocal " , testSST_Math_Vec4iScaleLocal },
{ "testSST_Math_Vec4iDivide " , testSST_Math_Vec4iDivide },
{ "testSST_Math_Vec4iDivideLocal " , testSST_Math_Vec4iDivideLocal },
{ "testSST_Math_Vec4iAbs " , testSST_Math_Vec4iAbs },
{ "testSST_Math_Vec4iAbsLocal " , testSST_Math_Vec4iAbsLocal },
{ "testSST_Math_Vec4iNegate " , testSST_Math_Vec4iNegate },
{ "testSST_Math_Vec4iNegateLocal " , testSST_Math_Vec4iNegateLocal },
{ "testSST_Math_Vec4iBias " , testSST_Math_Vec4iBias },
{ "testSST_Math_Vec4iBiasLocal " , testSST_Math_Vec4iBiasLocal },
{ "testSST_Math_Vec4iMagnitudeSquared " , testSST_Math_Vec4iMagnitudeSquared },
{ "testSST_Math_Vec4iDot " , testSST_Math_Vec4iDot }
};
DECLARE_ZTESTBLOCK(SST_Math_Vec4i)
/******************************************************************************/
static const char* testSST_Math_Vec4iAdd()
{
SST_Vec4i x; /* 4 vector */
SST_Vec4i y; /* 4 vector */
SST_Vec4i w; /* 4 vector */
/* Resetting test vectors */
x.v[0] = -18;
x.v[1] = -17;
x.v[2] = 14;
x.v[3] = -11;
y.v[0] = 11;
y.v[1] = -16;
y.v[2] = -12;
y.v[3] = 12;
w.v[0] = 0;
w.v[1] = 0;
w.v[2] = 0;
w.v[3] = 0;
/*
[-18 -17 14 -11]
[ 11 -16 -12 12]
[ -7 -33 2 1]
*/
SST_Math_Vec4iAdd(&x,&y,&w);
TASSERT((w.v[0])==(-7),"Entry _x failed!");
TASSERT((w.v[1])==(-33),"Entry _y failed!");
TASSERT((w.v[2])==(2),"Entry _z failed!");
TASSERT((w.v[3])==(1),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iAddLocal()
{
SST_Vec4i x; /* 4 vector */
SST_Vec4i y; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 19;
x.v[1] = -9;
x.v[2] = -4;
x.v[3] = -20;
y.v[0] = -5;
y.v[1] = 19;
y.v[2] = -8;
y.v[3] = 12;
/*
[ 19 -9 -4 -20]
[-5 19 -8 12]
[ 14 10 -12 -8]
*/
SST_Math_Vec4iAddLocal(&x,&y); /* for accuracy */
TASSERT((x.v[0])==(14),"Entry _x failed!");
TASSERT((x.v[1])==(10),"Entry _y failed!");
TASSERT((x.v[2])==(-12),"Entry _z failed!");
TASSERT((x.v[3])==(-8),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iSubtract()
{
SST_Vec4i x; /* 4 vector */
SST_Vec4i y; /* 4 vector */
SST_Vec4i w; /* 4 vector */
/* Resetting test vectors */
x.v[0] = -15;
x.v[1] = -11;
x.v[2] = 0;
x.v[3] = -10;
y.v[0] = -19;
y.v[1] = -9;
y.v[2] = -11;
y.v[3] = 7;
w.v[0] = 0;
w.v[1] = 0;
w.v[2] = 0;
w.v[3] = 0;
/*
[-15 -11 0 -10]
[-19 -9 -11 7]
[ 4 -2 11 -17]
*/
SST_Math_Vec4iSubtract(&x,&y,&w);
TASSERT((w.v[0])==(4),"Entry _x failed!");
TASSERT((w.v[1])==(-2),"Entry _y failed!");
TASSERT((w.v[2])==(11),"Entry _z failed!");
TASSERT((w.v[3])==(-17),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iSubtractLocal()
{
SST_Vec4i x; /* 4 vector */
SST_Vec4i y; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 3;
x.v[1] = 8;
x.v[2] = 17;
x.v[3] = 1;
y.v[0] = 11;
y.v[1] = 6;
y.v[2] = -2;
y.v[3] = 19;
/*
[ 3 8 17 1]
[11 6 -2 19]
[ -8 2 19 -18]
*/
SST_Math_Vec4iSubtractLocal(&x,&y); /* for accuracy */
TASSERT((x.v[0])==(-8),"Entry _x failed!");
TASSERT((x.v[1])==(2),"Entry _y failed!");
TASSERT((x.v[2])==(19),"Entry _z failed!");
TASSERT((x.v[3])==(-18),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iMultiply()
{
SST_Vec4i x; /* 4 vector */
SST_Vec4i y; /* 4 vector */
SST_Vec4i w; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 0;
x.v[1] = 9;
x.v[2] = -18;
x.v[3] = 9;
y.v[0] = -17;
y.v[1] = 0;
y.v[2] = 8;
y.v[3] = -12;
w.v[0] = 0;
w.v[1] = 0;
w.v[2] = 0;
w.v[3] = 0;
/*
[ 0 9 -18 9]
[-17 0 8 -12]
[ 0 0 -144 -108]
*/
SST_Math_Vec4iMultiply(&x,&y,&w);
TASSERT((w.v[0])==(0),"Entry _x failed!");
TASSERT((w.v[1])==(0),"Entry _y failed!");
TASSERT((w.v[2])==(-144),"Entry _z failed!");
TASSERT((w.v[3])==(-108),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iMultiplyLocal()
{
SST_Vec4i x; /* 4 vector */
SST_Vec4i y; /* 4 vector */
/* Resetting test vectors */
x.v[0] = -9;
x.v[1] = 10;
x.v[2] = -6;
x.v[3] = -2;
y.v[0] = 10;
y.v[1] = 11;
y.v[2] = -19;
y.v[3] = 12;
/*
[-9 10 -6 -2]
[ 10 11 -19 12]
[-90 110 114 -24]
*/
SST_Math_Vec4iMultiplyLocal(&x,&y); /* for accuracy */
TASSERT((x.v[0])==(-90),"Entry _x failed!");
TASSERT((x.v[1])==(110),"Entry _y failed!");
TASSERT((x.v[2])==(114),"Entry _z failed!");
TASSERT((x.v[3])==(-24),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iDivide()
{
SST_Vec4i x; /* 4 vector */
SST_Vec4i y; /* 4 vector */
SST_Vec4i w; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 28;
x.v[1] = 34;
x.v[2] = 37;
x.v[3] = 21;
y.v[0] = 39;
y.v[1] = 16;
y.v[2] = 22;
y.v[3] = 26;
w.v[0] = 0;
w.v[1] = 0;
w.v[2] = 0;
w.v[3] = 0;
/*
[28 34 37 21]
[39 16 22 26]
[0 2 1 0]
*/
SST_Math_Vec4iDivide(&x,&y,&w);
TASSERT((w.v[0])==(0),"Entry _x failed!");
TASSERT((w.v[1])==(2),"Entry _y failed!");
TASSERT((w.v[2])==(1),"Entry _z failed!");
TASSERT((w.v[3])==(0),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iDivideLocal()
{
SST_Vec4i x; /* 4 vector */
SST_Vec4i y; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 12;
x.v[1] = 36;
x.v[2] = 30;
x.v[3] = 7;
y.v[0] = 38;
y.v[1] = 16;
y.v[2] = 28;
y.v[3] = 3;
/*
[12 36 30 7]
[38 16 28 3]
[0 2 1 2]
*/
SST_Math_Vec4iDivideLocal(&x,&y); /* for accuracy */
TASSERT((x.v[0])==(0),"Entry _x failed!");
TASSERT((x.v[1])==(2),"Entry _y failed!");
TASSERT((x.v[2])==(1),"Entry _z failed!");
TASSERT((x.v[3])==(2),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iScale()
{
SST_Vec4i x; /* 4 vector */
SST_Vec4i w; /* 4 vector */
int a; /* scalar */
/* Resetting test vectors */
x.v[0] = -2;
x.v[1] = -16;
x.v[2] = 6;
x.v[3] = 19;
w.v[0] = 0;
w.v[1] = 0;
w.v[2] = 0;
w.v[3] = 0;
a = 2;
/*
[ -2 -16 6 19]
[ -4 -32 12 38]
*/
SST_Math_Vec4iScale(&x,a,&w);
TASSERT((w.v[0])==(-4),"Entry _x failed!");
TASSERT((w.v[1])==(-32),"Entry _y failed!");
TASSERT((w.v[2])==(12),"Entry _z failed!");
TASSERT((w.v[3])==(38),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iScaleLocal()
{
SST_Vec4i x; /* 4 vector */
int a; /* scalar */
/* Resetting test vectors */
x.v[0] = -1;
x.v[1] = 16;
x.v[2] = -20;
x.v[3] = -6;
a = 2;
/*
[ -1 16 -20 -6]
[ -2 32 -40 -12]
*/
SST_Math_Vec4iScaleLocal(&x,a); /* for accuracy */
TASSERT((x.v[0])==(-2),"Entry _x failed!");
TASSERT((x.v[1])==(32),"Entry _y failed!");
TASSERT((x.v[2])==(-40),"Entry _z failed!");
TASSERT((x.v[3])==(-12),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iAbs()
{
SST_Vec4i x; /* 4 vector */
SST_Vec4i w; /* 4 vector */
/* Resetting test vectors */
x.v[0] = -5;
x.v[1] = 7;
x.v[2] = -2;
x.v[3] = -6;
w.v[0] = 0;
w.v[1] = 0;
w.v[2] = 0;
w.v[3] = 0;
/*
[-5 7 -2 -6]
[5 7 2 6]
*/
SST_Math_Vec4iAbs(&x,&w);
TASSERT((w.v[0])==(5),"Entry _x failed!");
TASSERT((w.v[1])==(7),"Entry _y failed!");
TASSERT((w.v[2])==(2),"Entry _z failed!");
TASSERT((w.v[3])==(6),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iAbsLocal()
{
SST_Vec4i x; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 6;
x.v[1] = 2;
x.v[2] = -20;
x.v[3] = -8;
/*
[ 6 2 -20 -8]
[ 6 2 20 8]
*/
SST_Math_Vec4iAbsLocal(&x); /* for accuracy */
TASSERT((x.v[0])==(6),"Entry _x failed!");
TASSERT((x.v[1])==(2),"Entry _y failed!");
TASSERT((x.v[2])==(20),"Entry _z failed!");
TASSERT((x.v[3])==(8),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iBias()
{
SST_Vec4i x; /* 4 vector */
SST_Vec4i w; /* 4 vector */
int a; /* scalar */
/* Resetting test vectors */
x.v[0] = -15;
x.v[1] = 10;
x.v[2] = 0;
x.v[3] = 5;
w.v[0] = 0;
w.v[1] = 0;
w.v[2] = 0;
w.v[3] = 0;
a = -12;
/*
[-15 10 0 5]
[-30 20 0 10]
*/
SST_Math_Vec4iBias(&x,a,&w);
TASSERT((w.v[0])==(-27),"Entry _x failed!");
TASSERT((w.v[1])==(-2),"Entry _y failed!");
TASSERT((w.v[2])==(-12),"Entry _z failed!");
TASSERT((w.v[3])==(-7),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iBiasLocal()
{
SST_Vec4i x; /* 4 vector */
int a; /* scalar */
/* Resetting test vectors */
x.v[0] = 14;
x.v[1] = 17;
x.v[2] = -5;
x.v[3] = -2;
a = 17;
/*
[14 17 -5 -2]
[ 28 34 -10 -4]
*/
SST_Math_Vec4iBiasLocal(&x,a); /* for accuracy */
TASSERT((x.v[0])==(31),"Entry _x failed!");
TASSERT((x.v[1])==(34),"Entry _y failed!");
TASSERT((x.v[2])==(12),"Entry _z failed!");
TASSERT((x.v[3])==(15),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iNegate()
{
SST_Vec4i x; /* 4 vector */
SST_Vec4i w; /* 4 vector */
/* Resetting test vectors */
x.v[0] = -7;
x.v[1] = 5;
x.v[2] = 12;
x.v[3] = -15;
w.v[0] = 0;
w.v[1] = 0;
w.v[2] = 0;
w.v[3] = 0;
/*
[ -7 5 12 -15]
[ 7 -5 -12 15]
*/
SST_Math_Vec4iNegate(&x,&w);
TASSERT((w.v[0])==(7),"Entry _x failed!");
TASSERT((w.v[1])==(-5),"Entry _y failed!");
TASSERT((w.v[2])==(-12),"Entry _z failed!");
TASSERT((w.v[3])==(15),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iNegateLocal()
{
SST_Vec4i x; /* 4 vector */
/* Resetting test vectors */
x.v[0] = 3;
x.v[1] = -8;
x.v[2] = -7;
x.v[3] = 14;
/*
[ 3 -8 -7 14]
[ -3 8 7 -14]
*/
SST_Math_Vec4iNegateLocal(&x); /* for accuracy */
TASSERT((x.v[0])==(-3),"Entry _x failed!");
TASSERT((x.v[1])==(8),"Entry _y failed!");
TASSERT((x.v[2])==(7),"Entry _z failed!");
TASSERT((x.v[3])==(-14),"Entry _w failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iMagnitudeSquared()
{
SST_Vec4i x; /* 4 vector */
int a; /* scalar */
/* Resetting test vectors */
x.v[0] = 12;
x.v[1] = 12;
x.v[2] = -15;
x.v[3] = 11;
/*
[ 12 12 -15 11]
634
*/
a = SST_Math_Vec4iMagnitudeSquared(&x);
TASSERT((a)==(634),"MagnitudeSquared failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/
static const char* testSST_Math_Vec4iDot()
{
SST_Vec4i x; /* 4 vector */
SST_Vec4i y; /* 4 vector */
int a; /* scalar */
/* Resetting test vectors */
x.v[0] = 1;
x.v[1] = 1;
x.v[2] = 1;
x.v[3] = 8;
y.v[0] = 7;
y.v[1] = 12;
y.v[2] = -18;
y.v[3] = -11;
/*
[1 1 1 8]
-87
*/
a = SST_Math_Vec4iDot(&x,&y);
TASSERT((a)==(-87),"Dot failed!");
return ZTEST_SUCCESS;
}
/******************************************************************************/