355 lines
9.2 KiB
C++
355 lines
9.2 KiB
C++
/*
|
|
AUTOMATICALLY GENERATED FILE - DO NOT EDIT!
|
|
Please change MatrixNxN.py and re-run it
|
|
*/
|
|
/* Generated with ./VectorN.py n = 3, TYPE = unsigned int */
|
|
|
|
#include "ZUnitTest.hpp"
|
|
#include <float.h>
|
|
#include <math.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <SST/SST_Vec3.h>
|
|
|
|
|
|
|
|
|
|
static const char* testSST_Math_Vec3uAdd();
|
|
static const char* testSST_Math_Vec3uAddLocal();
|
|
static const char* testSST_Math_Vec3uSubtract();
|
|
static const char* testSST_Math_Vec3uSubtractLocal();
|
|
static const char* testSST_Math_Vec3uMultiply();
|
|
static const char* testSST_Math_Vec3uMultiplyLocal();
|
|
static const char* testSST_Math_Vec3uScale();
|
|
static const char* testSST_Math_Vec3uScaleLocal();
|
|
static const char* testSST_Math_Vec3uDivide();
|
|
static const char* testSST_Math_Vec3uDivideLocal();
|
|
static const char* testSST_Math_Vec3uMagnitudeSquared();
|
|
static const char* testSST_Math_Vec3uDot();
|
|
// List of unit tests
|
|
ZUnitTest SST_Math_Vec3uUnitTests[] =
|
|
{
|
|
{ "testSST_Math_Vec3uAdd " , testSST_Math_Vec3uAdd },
|
|
{ "testSST_Math_Vec3uAddLocal " , testSST_Math_Vec3uAddLocal },
|
|
{ "testSST_Math_Vec3uSubtract " , testSST_Math_Vec3uSubtract },
|
|
{ "testSST_Math_Vec3uSubtractLocal " , testSST_Math_Vec3uSubtractLocal },
|
|
{ "testSST_Math_Vec3uMultiply " , testSST_Math_Vec3uMultiply },
|
|
{ "testSST_Math_Vec3uMultiplyLocal " , testSST_Math_Vec3uMultiplyLocal },
|
|
{ "testSST_Math_Vec3uScale " , testSST_Math_Vec3uScale },
|
|
{ "testSST_Math_Vec3uScaleLocal " , testSST_Math_Vec3uScaleLocal },
|
|
{ "testSST_Math_Vec3uDivide " , testSST_Math_Vec3uDivide },
|
|
{ "testSST_Math_Vec3uDivideLocal " , testSST_Math_Vec3uDivideLocal },
|
|
{ "testSST_Math_Vec3uMagnitudeSquared " , testSST_Math_Vec3uMagnitudeSquared },
|
|
{ "testSST_Math_Vec3uDot " , testSST_Math_Vec3uDot }
|
|
};
|
|
DECLARE_ZTESTBLOCK(SST_Math_Vec3u)
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3uAdd()
|
|
{
|
|
SST_Vec3u x; /* 3 vector */
|
|
SST_Vec3u y; /* 3 vector */
|
|
SST_Vec3u w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 24;
|
|
x.v[1] = 38;
|
|
x.v[2] = 8;
|
|
y.v[0] = 37;
|
|
y.v[1] = 3;
|
|
y.v[2] = 25;
|
|
w.v[0] = 0;
|
|
w.v[1] = 0;
|
|
w.v[2] = 0;
|
|
/*
|
|
[24 38 8]
|
|
[37 3 25]
|
|
[61 41 33]
|
|
*/
|
|
SST_Math_Vec3uAdd(&x,&y,&w);
|
|
TASSERT((w.v[0])==(61),"Entry _x failed!");
|
|
TASSERT((w.v[1])==(41),"Entry _y failed!");
|
|
TASSERT((w.v[2])==(33),"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3uAddLocal()
|
|
{
|
|
SST_Vec3u x; /* 3 vector */
|
|
SST_Vec3u y; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 24;
|
|
x.v[1] = 8;
|
|
x.v[2] = 24;
|
|
y.v[0] = 33;
|
|
y.v[1] = 28;
|
|
y.v[2] = 25;
|
|
/*
|
|
[24 8 24]
|
|
[33 28 25]
|
|
[57 36 49]
|
|
*/
|
|
SST_Math_Vec3uAddLocal(&x,&y); /* for accuracy */
|
|
TASSERT((x.v[0])==(57),"Entry _x failed!");
|
|
TASSERT((x.v[1])==(36),"Entry _y failed!");
|
|
TASSERT((x.v[2])==(49),"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3uSubtract()
|
|
{
|
|
SST_Vec3u x; /* 3 vector */
|
|
SST_Vec3u y; /* 3 vector */
|
|
SST_Vec3u w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 18;
|
|
x.v[1] = 29;
|
|
x.v[2] = 32;
|
|
y.v[0] = 38;
|
|
y.v[1] = 30;
|
|
y.v[2] = 6;
|
|
w.v[0] = 0;
|
|
w.v[1] = 0;
|
|
w.v[2] = 0;
|
|
/*
|
|
[18 29 32]
|
|
[38 30 6]
|
|
[4294967276 4294967295 26]
|
|
*/
|
|
SST_Math_Vec3uSubtract(&x,&y,&w);
|
|
TASSERT((w.v[0])==(4294967276),"Entry _x failed!");
|
|
TASSERT((w.v[1])==(4294967295),"Entry _y failed!");
|
|
TASSERT((w.v[2])==(26),"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3uSubtractLocal()
|
|
{
|
|
SST_Vec3u x; /* 3 vector */
|
|
SST_Vec3u y; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 5;
|
|
x.v[1] = 15;
|
|
x.v[2] = 11;
|
|
y.v[0] = 13;
|
|
y.v[1] = 7;
|
|
y.v[2] = 24;
|
|
/*
|
|
[ 5 15 11]
|
|
[13 7 24]
|
|
[4294967288 8 4294967283]
|
|
*/
|
|
SST_Math_Vec3uSubtractLocal(&x,&y); /* for accuracy */
|
|
TASSERT((x.v[0])==(4294967288),"Entry _x failed!");
|
|
TASSERT((x.v[1])==(8),"Entry _y failed!");
|
|
TASSERT((x.v[2])==(4294967283),"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3uMultiply()
|
|
{
|
|
SST_Vec3u x; /* 3 vector */
|
|
SST_Vec3u y; /* 3 vector */
|
|
SST_Vec3u w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 22;
|
|
x.v[1] = 9;
|
|
x.v[2] = 9;
|
|
y.v[0] = 29;
|
|
y.v[1] = 16;
|
|
y.v[2] = 24;
|
|
w.v[0] = 0;
|
|
w.v[1] = 0;
|
|
w.v[2] = 0;
|
|
/*
|
|
[22 9 9]
|
|
[29 16 24]
|
|
[638 144 216]
|
|
*/
|
|
SST_Math_Vec3uMultiply(&x,&y,&w);
|
|
TASSERT((w.v[0])==(638),"Entry _x failed!");
|
|
TASSERT((w.v[1])==(144),"Entry _y failed!");
|
|
TASSERT((w.v[2])==(216),"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3uMultiplyLocal()
|
|
{
|
|
SST_Vec3u x; /* 3 vector */
|
|
SST_Vec3u y; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 32;
|
|
x.v[1] = 27;
|
|
x.v[2] = 34;
|
|
y.v[0] = 33;
|
|
y.v[1] = 16;
|
|
y.v[2] = 36;
|
|
/*
|
|
[32 27 34]
|
|
[33 16 36]
|
|
[1056 432 1224]
|
|
*/
|
|
SST_Math_Vec3uMultiplyLocal(&x,&y); /* for accuracy */
|
|
TASSERT((x.v[0])==(1056),"Entry _x failed!");
|
|
TASSERT((x.v[1])==(432),"Entry _y failed!");
|
|
TASSERT((x.v[2])==(1224),"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3uDivide()
|
|
{
|
|
SST_Vec3u x; /* 3 vector */
|
|
SST_Vec3u y; /* 3 vector */
|
|
SST_Vec3u w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 36;
|
|
x.v[1] = 14;
|
|
x.v[2] = 10;
|
|
y.v[0] = 30;
|
|
y.v[1] = 35;
|
|
y.v[2] = 27;
|
|
w.v[0] = 0;
|
|
w.v[1] = 0;
|
|
w.v[2] = 0;
|
|
/*
|
|
[36 14 10]
|
|
[30 35 27]
|
|
[1 0 0]
|
|
*/
|
|
SST_Math_Vec3uDivide(&x,&y,&w);
|
|
TASSERT((w.v[0])==(1),"Entry _x failed!");
|
|
TASSERT((w.v[1])==(0),"Entry _y failed!");
|
|
TASSERT((w.v[2])==(0),"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3uDivideLocal()
|
|
{
|
|
SST_Vec3u x; /* 3 vector */
|
|
SST_Vec3u y; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 21;
|
|
x.v[1] = 5;
|
|
x.v[2] = 36;
|
|
y.v[0] = 14;
|
|
y.v[1] = 13;
|
|
y.v[2] = 6;
|
|
/*
|
|
[21 5 36]
|
|
[14 13 6]
|
|
[1 0 6]
|
|
*/
|
|
SST_Math_Vec3uDivideLocal(&x,&y); /* for accuracy */
|
|
TASSERT((x.v[0])==(1),"Entry _x failed!");
|
|
TASSERT((x.v[1])==(0),"Entry _y failed!");
|
|
TASSERT((x.v[2])==(6),"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3uScale()
|
|
{
|
|
SST_Vec3u x; /* 3 vector */
|
|
SST_Vec3u w; /* 3 vector */
|
|
unsigned int a; /* scalar */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 30;
|
|
x.v[1] = 18;
|
|
x.v[2] = 37;
|
|
w.v[0] = 0;
|
|
w.v[1] = 0;
|
|
w.v[2] = 0;
|
|
a = 2;
|
|
/*
|
|
[30 18 37]
|
|
[60 36 74]
|
|
*/
|
|
SST_Math_Vec3uScale(&x,a,&w);
|
|
TASSERT((w.v[0])==(60),"Entry _x failed!");
|
|
TASSERT((w.v[1])==(36),"Entry _y failed!");
|
|
TASSERT((w.v[2])==(74),"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3uScaleLocal()
|
|
{
|
|
SST_Vec3u x; /* 3 vector */
|
|
unsigned int a; /* scalar */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 26;
|
|
x.v[1] = 26;
|
|
x.v[2] = 28;
|
|
a = 2;
|
|
/*
|
|
[26 26 28]
|
|
[52 52 56]
|
|
*/
|
|
SST_Math_Vec3uScaleLocal(&x,a); /* for accuracy */
|
|
TASSERT((x.v[0])==(52),"Entry _x failed!");
|
|
TASSERT((x.v[1])==(52),"Entry _y failed!");
|
|
TASSERT((x.v[2])==(56),"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3uMagnitudeSquared()
|
|
{
|
|
SST_Vec3u x; /* 3 vector */
|
|
unsigned int a; /* scalar */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 28;
|
|
x.v[1] = 36;
|
|
x.v[2] = 39;
|
|
/*
|
|
[28 36 39]
|
|
3601
|
|
*/
|
|
a = SST_Math_Vec3uMagnitudeSquared(&x);
|
|
TASSERT((a)==(3601),"MagnitudeSquared failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3uDot()
|
|
{
|
|
SST_Vec3u x; /* 3 vector */
|
|
SST_Vec3u y; /* 3 vector */
|
|
unsigned int a; /* scalar */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 0;
|
|
x.v[1] = 26;
|
|
x.v[2] = 4;
|
|
y.v[0] = 16;
|
|
y.v[1] = 24;
|
|
y.v[2] = 31;
|
|
/*
|
|
[ 0 26 4]
|
|
748
|
|
*/
|
|
a = SST_Math_Vec3uDot(&x,&y);
|
|
TASSERT((a)==(748),"Dot failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|