Initial commit
This commit is contained in:
318
ZTestSuite/Test-SST_Vec2u.cpp
Normal file
318
ZTestSuite/Test-SST_Vec2u.cpp
Normal file
@@ -0,0 +1,318 @@
|
||||
/*
|
||||
AUTOMATICALLY GENERATED FILE - DO NOT EDIT!
|
||||
Please change MatrixNxN.py and re-run it
|
||||
*/
|
||||
/* Generated with ./VectorN.py n = 2, TYPE = unsigned int */
|
||||
|
||||
#include "ZUnitTest.hpp"
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <SST/SST_Vec2.h>
|
||||
|
||||
|
||||
|
||||
|
||||
static const char* testSST_Math_Vec2uAdd();
|
||||
static const char* testSST_Math_Vec2uAddLocal();
|
||||
static const char* testSST_Math_Vec2uSubtract();
|
||||
static const char* testSST_Math_Vec2uSubtractLocal();
|
||||
static const char* testSST_Math_Vec2uMultiply();
|
||||
static const char* testSST_Math_Vec2uMultiplyLocal();
|
||||
static const char* testSST_Math_Vec2uScale();
|
||||
static const char* testSST_Math_Vec2uScaleLocal();
|
||||
static const char* testSST_Math_Vec2uDivide();
|
||||
static const char* testSST_Math_Vec2uDivideLocal();
|
||||
static const char* testSST_Math_Vec2uMagnitudeSquared();
|
||||
static const char* testSST_Math_Vec2uDot();
|
||||
// List of unit tests
|
||||
ZUnitTest SST_Math_Vec2uUnitTests[] =
|
||||
{
|
||||
{ "testSST_Math_Vec2uAdd " , testSST_Math_Vec2uAdd },
|
||||
{ "testSST_Math_Vec2uAddLocal " , testSST_Math_Vec2uAddLocal },
|
||||
{ "testSST_Math_Vec2uSubtract " , testSST_Math_Vec2uSubtract },
|
||||
{ "testSST_Math_Vec2uSubtractLocal " , testSST_Math_Vec2uSubtractLocal },
|
||||
{ "testSST_Math_Vec2uMultiply " , testSST_Math_Vec2uMultiply },
|
||||
{ "testSST_Math_Vec2uMultiplyLocal " , testSST_Math_Vec2uMultiplyLocal },
|
||||
{ "testSST_Math_Vec2uScale " , testSST_Math_Vec2uScale },
|
||||
{ "testSST_Math_Vec2uScaleLocal " , testSST_Math_Vec2uScaleLocal },
|
||||
{ "testSST_Math_Vec2uDivide " , testSST_Math_Vec2uDivide },
|
||||
{ "testSST_Math_Vec2uDivideLocal " , testSST_Math_Vec2uDivideLocal },
|
||||
{ "testSST_Math_Vec2uMagnitudeSquared " , testSST_Math_Vec2uMagnitudeSquared },
|
||||
{ "testSST_Math_Vec2uDot " , testSST_Math_Vec2uDot }
|
||||
};
|
||||
DECLARE_ZTESTBLOCK(SST_Math_Vec2u)
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static const char* testSST_Math_Vec2uAdd()
|
||||
{
|
||||
SST_Vec2u x; /* 2 vector */
|
||||
SST_Vec2u y; /* 2 vector */
|
||||
SST_Vec2u w; /* 2 vector */
|
||||
/* Resetting test vectors */
|
||||
x.v[0] = 35;
|
||||
x.v[1] = 32;
|
||||
y.v[0] = 4;
|
||||
y.v[1] = 17;
|
||||
w.v[0] = 0;
|
||||
w.v[1] = 0;
|
||||
/*
|
||||
[35 32]
|
||||
[ 4 17]
|
||||
[39 49]
|
||||
*/
|
||||
SST_Math_Vec2uAdd(&x,&y,&w);
|
||||
TASSERT((w.v[0])==(39),"Entry _x failed!");
|
||||
TASSERT((w.v[1])==(49),"Entry _y failed!");
|
||||
return ZTEST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static const char* testSST_Math_Vec2uAddLocal()
|
||||
{
|
||||
SST_Vec2u x; /* 2 vector */
|
||||
SST_Vec2u y; /* 2 vector */
|
||||
/* Resetting test vectors */
|
||||
x.v[0] = 10;
|
||||
x.v[1] = 35;
|
||||
y.v[0] = 6;
|
||||
y.v[1] = 39;
|
||||
/*
|
||||
[10 35]
|
||||
[ 6 39]
|
||||
[16 74]
|
||||
*/
|
||||
SST_Math_Vec2uAddLocal(&x,&y); /* for accuracy */
|
||||
TASSERT((x.v[0])==(16),"Entry _x failed!");
|
||||
TASSERT((x.v[1])==(74),"Entry _y failed!");
|
||||
return ZTEST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static const char* testSST_Math_Vec2uSubtract()
|
||||
{
|
||||
SST_Vec2u x; /* 2 vector */
|
||||
SST_Vec2u y; /* 2 vector */
|
||||
SST_Vec2u w; /* 2 vector */
|
||||
/* Resetting test vectors */
|
||||
x.v[0] = 36;
|
||||
x.v[1] = 37;
|
||||
y.v[0] = 39;
|
||||
y.v[1] = 33;
|
||||
w.v[0] = 0;
|
||||
w.v[1] = 0;
|
||||
/*
|
||||
[36 37]
|
||||
[39 33]
|
||||
[4294967293 4]
|
||||
*/
|
||||
SST_Math_Vec2uSubtract(&x,&y,&w);
|
||||
TASSERT((w.v[0])==(4294967293),"Entry _x failed!");
|
||||
TASSERT((w.v[1])==(4),"Entry _y failed!");
|
||||
return ZTEST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static const char* testSST_Math_Vec2uSubtractLocal()
|
||||
{
|
||||
SST_Vec2u x; /* 2 vector */
|
||||
SST_Vec2u y; /* 2 vector */
|
||||
/* Resetting test vectors */
|
||||
x.v[0] = 16;
|
||||
x.v[1] = 26;
|
||||
y.v[0] = 29;
|
||||
y.v[1] = 29;
|
||||
/*
|
||||
[16 26]
|
||||
[29 29]
|
||||
[4294967283 4294967293]
|
||||
*/
|
||||
SST_Math_Vec2uSubtractLocal(&x,&y); /* for accuracy */
|
||||
TASSERT((x.v[0])==(4294967283),"Entry _x failed!");
|
||||
TASSERT((x.v[1])==(4294967293),"Entry _y failed!");
|
||||
return ZTEST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static const char* testSST_Math_Vec2uMultiply()
|
||||
{
|
||||
SST_Vec2u x; /* 2 vector */
|
||||
SST_Vec2u y; /* 2 vector */
|
||||
SST_Vec2u w; /* 2 vector */
|
||||
/* Resetting test vectors */
|
||||
x.v[0] = 25;
|
||||
x.v[1] = 37;
|
||||
y.v[0] = 26;
|
||||
y.v[1] = 17;
|
||||
w.v[0] = 0;
|
||||
w.v[1] = 0;
|
||||
/*
|
||||
[25 37]
|
||||
[26 17]
|
||||
[650 629]
|
||||
*/
|
||||
SST_Math_Vec2uMultiply(&x,&y,&w);
|
||||
TASSERT((w.v[0])==(650),"Entry _x failed!");
|
||||
TASSERT((w.v[1])==(629),"Entry _y failed!");
|
||||
return ZTEST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static const char* testSST_Math_Vec2uMultiplyLocal()
|
||||
{
|
||||
SST_Vec2u x; /* 2 vector */
|
||||
SST_Vec2u y; /* 2 vector */
|
||||
/* Resetting test vectors */
|
||||
x.v[0] = 38;
|
||||
x.v[1] = 39;
|
||||
y.v[0] = 10;
|
||||
y.v[1] = 10;
|
||||
/*
|
||||
[38 39]
|
||||
[10 10]
|
||||
[380 390]
|
||||
*/
|
||||
SST_Math_Vec2uMultiplyLocal(&x,&y); /* for accuracy */
|
||||
TASSERT((x.v[0])==(380),"Entry _x failed!");
|
||||
TASSERT((x.v[1])==(390),"Entry _y failed!");
|
||||
return ZTEST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static const char* testSST_Math_Vec2uDivide()
|
||||
{
|
||||
SST_Vec2u x; /* 2 vector */
|
||||
SST_Vec2u y; /* 2 vector */
|
||||
SST_Vec2u w; /* 2 vector */
|
||||
/* Resetting test vectors */
|
||||
x.v[0] = 13;
|
||||
x.v[1] = 12;
|
||||
y.v[0] = 34;
|
||||
y.v[1] = 8;
|
||||
w.v[0] = 0;
|
||||
w.v[1] = 0;
|
||||
/*
|
||||
[13 12]
|
||||
[34 8]
|
||||
[0 1]
|
||||
*/
|
||||
SST_Math_Vec2uDivide(&x,&y,&w);
|
||||
TASSERT((w.v[0])==(0),"Entry _x failed!");
|
||||
TASSERT((w.v[1])==(1),"Entry _y failed!");
|
||||
return ZTEST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static const char* testSST_Math_Vec2uDivideLocal()
|
||||
{
|
||||
SST_Vec2u x; /* 2 vector */
|
||||
SST_Vec2u y; /* 2 vector */
|
||||
/* Resetting test vectors */
|
||||
x.v[0] = 12;
|
||||
x.v[1] = 11;
|
||||
y.v[0] = 24;
|
||||
y.v[1] = 22;
|
||||
/*
|
||||
[12 11]
|
||||
[24 22]
|
||||
[0 0]
|
||||
*/
|
||||
SST_Math_Vec2uDivideLocal(&x,&y); /* for accuracy */
|
||||
TASSERT((x.v[0])==(0),"Entry _x failed!");
|
||||
TASSERT((x.v[1])==(0),"Entry _y failed!");
|
||||
return ZTEST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static const char* testSST_Math_Vec2uScale()
|
||||
{
|
||||
SST_Vec2u x; /* 2 vector */
|
||||
SST_Vec2u w; /* 2 vector */
|
||||
unsigned int a; /* scalar */
|
||||
/* Resetting test vectors */
|
||||
x.v[0] = 7;
|
||||
x.v[1] = 31;
|
||||
w.v[0] = 0;
|
||||
w.v[1] = 0;
|
||||
a = 2;
|
||||
/*
|
||||
[ 7 31]
|
||||
[14 62]
|
||||
*/
|
||||
SST_Math_Vec2uScale(&x,a,&w);
|
||||
TASSERT((w.v[0])==(14),"Entry _x failed!");
|
||||
TASSERT((w.v[1])==(62),"Entry _y failed!");
|
||||
return ZTEST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static const char* testSST_Math_Vec2uScaleLocal()
|
||||
{
|
||||
SST_Vec2u x; /* 2 vector */
|
||||
unsigned int a; /* scalar */
|
||||
/* Resetting test vectors */
|
||||
x.v[0] = 15;
|
||||
x.v[1] = 39;
|
||||
a = 2;
|
||||
/*
|
||||
[15 39]
|
||||
[30 78]
|
||||
*/
|
||||
SST_Math_Vec2uScaleLocal(&x,a); /* for accuracy */
|
||||
TASSERT((x.v[0])==(30),"Entry _x failed!");
|
||||
TASSERT((x.v[1])==(78),"Entry _y failed!");
|
||||
return ZTEST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static const char* testSST_Math_Vec2uMagnitudeSquared()
|
||||
{
|
||||
SST_Vec2u x; /* 2 vector */
|
||||
unsigned int a; /* scalar */
|
||||
/* Resetting test vectors */
|
||||
x.v[0] = 37;
|
||||
x.v[1] = 27;
|
||||
/*
|
||||
[37 27]
|
||||
2098
|
||||
*/
|
||||
a = SST_Math_Vec2uMagnitudeSquared(&x);
|
||||
TASSERT((a)==(2098),"MagnitudeSquared failed!");
|
||||
return ZTEST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static const char* testSST_Math_Vec2uDot()
|
||||
{
|
||||
SST_Vec2u x; /* 2 vector */
|
||||
SST_Vec2u y; /* 2 vector */
|
||||
unsigned int a; /* scalar */
|
||||
/* Resetting test vectors */
|
||||
x.v[0] = 10;
|
||||
x.v[1] = 5;
|
||||
y.v[0] = 2;
|
||||
y.v[1] = 11;
|
||||
/*
|
||||
[10 5]
|
||||
75
|
||||
*/
|
||||
a = SST_Math_Vec2uDot(&x,&y);
|
||||
TASSERT((a)==(75),"Dot failed!");
|
||||
return ZTEST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user