/* AUTOMATICALLY GENERATED FILE - DO NOT EDIT! Please change MatrixNxN.py and re-run it */ /* Generated with ./VectorN.py n = 2, TYPE = float */ #include "ZUnitTest.hpp" #include #include #include #include #include static const char* testSST_Math_Vec2fAdd(); static const char* testSST_Math_Vec2fAddLocal(); static const char* testSST_Math_Vec2fSubtract(); static const char* testSST_Math_Vec2fSubtractLocal(); static const char* testSST_Math_Vec2fMultiply(); static const char* testSST_Math_Vec2fMultiplyLocal(); static const char* testSST_Math_Vec2fScale(); static const char* testSST_Math_Vec2fScaleLocal(); static const char* testSST_Math_Vec2fDivide(); static const char* testSST_Math_Vec2fDivideLocal(); static const char* testSST_Math_Vec2fAbs(); static const char* testSST_Math_Vec2fAbsLocal(); static const char* testSST_Math_Vec2fNegate(); static const char* testSST_Math_Vec2fNegateLocal(); static const char* testSST_Math_Vec2fBias(); static const char* testSST_Math_Vec2fBiasLocal(); static const char* testSST_Math_Vec2fRecip(); static const char* testSST_Math_Vec2fRecipLocal(); static const char* testSST_Math_Vec2fRecipSqrt(); static const char* testSST_Math_Vec2fRecipSqrtLocal(); static const char* testSST_Math_Vec2fSqrt(); static const char* testSST_Math_Vec2fSqrtLocal(); static const char* testSST_Math_Vec2fSqrt(); static const char* testSST_Math_Vec2fSqrtLocal(); static const char* testSST_Math_Vec2fCross(); static const char* testSST_Math_Vec2fCrossLocal(); static const char* testSST_Math_Vec2fProject(); static const char* testSST_Math_Vec2fProjectLocal(); static const char* testSST_Math_Vec2fMagnitude(); static const char* testSST_Math_Vec2fNormalize(); static const char* testSST_Math_Vec2fNormalizeLocal(); static const char* testSST_Math_Vec2fMagnitudeSquared(); static const char* testSST_Math_Vec2fDot(); // List of unit tests ZUnitTest SST_Math_Vec2fUnitTests[] = { { "testSST_Math_Vec2fAdd " , testSST_Math_Vec2fAdd }, { "testSST_Math_Vec2fAddLocal " , testSST_Math_Vec2fAddLocal }, { "testSST_Math_Vec2fSubtract " , testSST_Math_Vec2fSubtract }, { "testSST_Math_Vec2fSubtractLocal " , testSST_Math_Vec2fSubtractLocal }, { "testSST_Math_Vec2fMultiply " , testSST_Math_Vec2fMultiply }, { "testSST_Math_Vec2fMultiplyLocal " , testSST_Math_Vec2fMultiplyLocal }, { "testSST_Math_Vec2fScale " , testSST_Math_Vec2fScale }, { "testSST_Math_Vec2fScaleLocal " , testSST_Math_Vec2fScaleLocal }, { "testSST_Math_Vec2fDivide " , testSST_Math_Vec2fDivide }, { "testSST_Math_Vec2fDivideLocal " , testSST_Math_Vec2fDivideLocal }, { "testSST_Math_Vec2fAbs " , testSST_Math_Vec2fAbs }, { "testSST_Math_Vec2fAbsLocal " , testSST_Math_Vec2fAbsLocal }, { "testSST_Math_Vec2fNegate " , testSST_Math_Vec2fNegate }, { "testSST_Math_Vec2fNegateLocal " , testSST_Math_Vec2fNegateLocal }, { "testSST_Math_Vec2fBias " , testSST_Math_Vec2fBias }, { "testSST_Math_Vec2fBiasLocal " , testSST_Math_Vec2fBiasLocal }, { "testSST_Math_Vec2fRecip " , testSST_Math_Vec2fRecip }, { "testSST_Math_Vec2fRecipLocal " , testSST_Math_Vec2fRecipLocal }, { "testSST_Math_Vec2fRecipSqrt " , testSST_Math_Vec2fRecipSqrt }, { "testSST_Math_Vec2fRecipSqrtLocal " , testSST_Math_Vec2fRecipSqrtLocal }, { "testSST_Math_Vec2fSqrt " , testSST_Math_Vec2fSqrt }, { "testSST_Math_Vec2fSqrtLocal " , testSST_Math_Vec2fSqrtLocal }, { "testSST_Math_Vec2fSqrt " , testSST_Math_Vec2fSqrt }, { "testSST_Math_Vec2fSqrtLocal " , testSST_Math_Vec2fSqrtLocal }, { "testSST_Math_Vec2fMagnitude " , testSST_Math_Vec2fMagnitude }, { "testSST_Math_Vec2fNormalize " , testSST_Math_Vec2fNormalize }, { "testSST_Math_Vec2fNormalizeLocal " , testSST_Math_Vec2fNormalizeLocal }, { "testSST_Math_Vec2fCross " , testSST_Math_Vec2fCross }, { "testSST_Math_Vec2fCrossLocal " , testSST_Math_Vec2fCrossLocal }, { "testSST_Math_Vec2fProject " , testSST_Math_Vec2fProject }, { "testSST_Math_Vec2fProjectLocal " , testSST_Math_Vec2fProjectLocal }, { "testSST_Math_Vec2fMagnitudeSquared " , testSST_Math_Vec2fMagnitudeSquared }, { "testSST_Math_Vec2fDot " , testSST_Math_Vec2fDot } }; DECLARE_ZTESTBLOCK(SST_Math_Vec2f) /******************************************************************************/ static const char* testSST_Math_Vec2fAdd() { SST_Vec2f x; /* 2 vector */ SST_Vec2f y; /* 2 vector */ SST_Vec2f w; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 0.000000f; x.v[1] = 4.000000f; y.v[0] = -12.000000f; y.v[1] = -14.000000f; w.v[0] = 0.000000f; w.v[1] = 0.000000f; /* [ 0. 4.] [-12. -14.] [-12. -10.] */ SST_Math_Vec2fAdd(&x,&y,&w); TASSERT(fabsf((w.v[0])-(-12.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((w.v[1])-(-10.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fAddLocal() { SST_Vec2f x; /* 2 vector */ SST_Vec2f y; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 2.000000f; x.v[1] = 2.000000f; y.v[0] = 14.000000f; y.v[1] = -6.000000f; /* [ 2. 2.] [ 14. -6.] [ 16. -4.] */ SST_Math_Vec2fAddLocal(&x,&y); /* for accuracy */ TASSERT(fabsf((x.v[0])-(16.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((x.v[1])-(-4.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fSubtract() { SST_Vec2f x; /* 2 vector */ SST_Vec2f y; /* 2 vector */ SST_Vec2f w; /* 2 vector */ /* Resetting test vectors */ x.v[0] = -3.000000f; x.v[1] = 8.000000f; y.v[0] = -5.000000f; y.v[1] = -17.000000f; w.v[0] = 0.000000f; w.v[1] = 0.000000f; /* [-3. 8.] [ -5. -17.] [ 2. 25.] */ SST_Math_Vec2fSubtract(&x,&y,&w); TASSERT(fabsf((w.v[0])-(2.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((w.v[1])-(25.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fSubtractLocal() { SST_Vec2f x; /* 2 vector */ SST_Vec2f y; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 8.000000f; x.v[1] = 13.000000f; y.v[0] = -17.000000f; y.v[1] = 10.000000f; /* [ 8. 13.] [-17. 10.] [ 25. 3.] */ SST_Math_Vec2fSubtractLocal(&x,&y); /* for accuracy */ TASSERT(fabsf((x.v[0])-(25.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((x.v[1])-(3.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fMultiply() { SST_Vec2f x; /* 2 vector */ SST_Vec2f y; /* 2 vector */ SST_Vec2f w; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 16.000000f; x.v[1] = 7.000000f; y.v[0] = 6.000000f; y.v[1] = -12.000000f; w.v[0] = 0.000000f; w.v[1] = 0.000000f; /* [ 16. 7.] [ 6. -12.] [ 96. -84.] */ SST_Math_Vec2fMultiply(&x,&y,&w); TASSERT(fabsf((w.v[0])-(96.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((w.v[1])-(-84.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fMultiplyLocal() { SST_Vec2f x; /* 2 vector */ SST_Vec2f y; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 3.000000f; x.v[1] = 7.000000f; y.v[0] = 5.000000f; y.v[1] = 14.000000f; /* [ 3. 7.] [ 5. 14.] [ 15. 98.] */ SST_Math_Vec2fMultiplyLocal(&x,&y); /* for accuracy */ TASSERT(fabsf((x.v[0])-(15.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((x.v[1])-(98.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fDivide() { SST_Vec2f x; /* 2 vector */ SST_Vec2f y; /* 2 vector */ SST_Vec2f w; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 14.000000f; x.v[1] = 18.000000f; y.v[0] = 39.000000f; y.v[1] = 26.000000f; w.v[0] = 0.000000f; w.v[1] = 0.000000f; /* [ 14. 18.] [ 39. 26.] [ 0.35897437 0.69230771] */ SST_Math_Vec2fDivide(&x,&y,&w); TASSERT(fabsf((w.v[0])-(0.358974f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((w.v[1])-(0.692308f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fDivideLocal() { SST_Vec2f x; /* 2 vector */ SST_Vec2f y; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 4.000000f; x.v[1] = 31.000000f; y.v[0] = 31.000000f; y.v[1] = 18.000000f; /* [ 4. 31.] [ 31. 18.] [ 0.12903225 1.72222221] */ SST_Math_Vec2fDivideLocal(&x,&y); /* for accuracy */ TASSERT(fabsf((x.v[0])-(0.129032f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((x.v[1])-(1.722222f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fScale() { SST_Vec2f x; /* 2 vector */ SST_Vec2f w; /* 2 vector */ float a; /* scalar */ /* Resetting test vectors */ x.v[0] = -18.000000f; x.v[1] = 18.000000f; w.v[0] = 0.000000f; w.v[1] = 0.000000f; a = 2.000000f; /* [-18. 18.] [-36. 36.] */ SST_Math_Vec2fScale(&x,a,&w); TASSERT(fabsf((w.v[0])-(-36.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((w.v[1])-(36.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fScaleLocal() { SST_Vec2f x; /* 2 vector */ float a; /* scalar */ /* Resetting test vectors */ x.v[0] = 2.000000f; x.v[1] = -3.000000f; a = 2.000000f; /* [ 2. -3.] [ 4. -6.] */ SST_Math_Vec2fScaleLocal(&x,a); /* for accuracy */ TASSERT(fabsf((x.v[0])-(4.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((x.v[1])-(-6.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fAbs() { SST_Vec2f x; /* 2 vector */ SST_Vec2f w; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 13.000000f; x.v[1] = 14.000000f; w.v[0] = 0.000000f; w.v[1] = 0.000000f; /* [ 13. 14.] [ 13. 14.] */ SST_Math_Vec2fAbs(&x,&w); TASSERT(fabsf((w.v[0])-(13.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((w.v[1])-(14.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fAbsLocal() { SST_Vec2f x; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 12.000000f; x.v[1] = -4.000000f; /* [ 12. -4.] [ 12. 4.] */ SST_Math_Vec2fAbsLocal(&x); /* for accuracy */ TASSERT(fabsf((x.v[0])-(12.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((x.v[1])-(4.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fBias() { SST_Vec2f x; /* 2 vector */ SST_Vec2f w; /* 2 vector */ float a; /* scalar */ /* Resetting test vectors */ x.v[0] = -2.000000f; x.v[1] = -20.000000f; w.v[0] = 0.000000f; w.v[1] = 0.000000f; a = 9.000000f; /* [ -2. -20.] [ -4. -40.] */ SST_Math_Vec2fBias(&x,a,&w); TASSERT(fabsf((w.v[0])-(7.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((w.v[1])-(-11.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fBiasLocal() { SST_Vec2f x; /* 2 vector */ float a; /* scalar */ /* Resetting test vectors */ x.v[0] = -9.000000f; x.v[1] = -2.000000f; a = 5.000000f; /* [-9. -2.] [-18. -4.] */ SST_Math_Vec2fBiasLocal(&x,a); /* for accuracy */ TASSERT(fabsf((x.v[0])-(-4.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((x.v[1])-(3.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fNegate() { SST_Vec2f x; /* 2 vector */ SST_Vec2f w; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 11.000000f; x.v[1] = 9.000000f; w.v[0] = 0.000000f; w.v[1] = 0.000000f; /* [ 11. 9.] [-11. -9.] */ SST_Math_Vec2fNegate(&x,&w); TASSERT(fabsf((w.v[0])-(-11.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((w.v[1])-(-9.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fNegateLocal() { SST_Vec2f x; /* 2 vector */ /* Resetting test vectors */ x.v[0] = -15.000000f; x.v[1] = 11.000000f; /* [-15. 11.] [ 15. -11.] */ SST_Math_Vec2fNegateLocal(&x); /* for accuracy */ TASSERT(fabsf((x.v[0])-(15.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((x.v[1])-(-11.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fSqrt() { SST_Vec2f x; /* 2 vector */ SST_Vec2f w; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 27.000000f; x.v[1] = 9.000000f; w.v[0] = 0.000000f; w.v[1] = 0.000000f; /* [ 27. 9.] [ 5.19615221 3. ] */ SST_Math_Vec2fSqrt(&x,&w); TASSERT(fabsf((w.v[0])-(5.196152f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((w.v[1])-(3.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fSqrtLocal() { SST_Vec2f x; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 30.000000f; x.v[1] = 36.000000f; /* [ 30. 36.] [ 5.47722578 6. ] */ SST_Math_Vec2fSqrtLocal(&x); /* for accuracy */ TASSERT(fabsf((x.v[0])-(5.477226f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((x.v[1])-(6.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fRecipSqrt() { SST_Vec2f x; /* 2 vector */ SST_Vec2f w; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 6.000000f; x.v[1] = 38.000000f; w.v[0] = 0.000000f; w.v[1] = 0.000000f; /* [ 6. 38.] [ 0.40824828 0.16222142] */ SST_Math_Vec2fRecipSqrt(&x,&w); TASSERT(fabsf((w.v[0])-(0.408248f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((w.v[1])-(0.162221f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fRecipSqrtLocal() { SST_Vec2f x; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 28.000000f; x.v[1] = 31.000000f; /* [ 28. 31.] [ 0.18898225 0.17960531] */ SST_Math_Vec2fRecipSqrtLocal(&x); /* for accuracy */ TASSERT(fabsf((x.v[0])-(0.188982f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((x.v[1])-(0.179605f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fRecip() { SST_Vec2f x; /* 2 vector */ SST_Vec2f w; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 1.000000f; x.v[1] = 22.000000f; w.v[0] = 0.000000f; w.v[1] = 0.000000f; /* [ 1. 22.] [ 1. 0.04545455] */ SST_Math_Vec2fRecip(&x,&w); TASSERT(fabsf((w.v[0])-(1.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((w.v[1])-(0.045455f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fRecipLocal() { SST_Vec2f x; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 12.000000f; x.v[1] = 1.000000f; /* [ 12. 1.] [ 0.28867513 1. ] */ SST_Math_Vec2fRecipLocal(&x); /* for accuracy */ TASSERT(fabsf((x.v[0])-(0.083333f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((x.v[1])-(1.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fNormalize() { SST_Vec2f x; /* 2 vector */ SST_Vec2f w; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 11.000000f; x.v[1] = -11.000000f; w.v[0] = 0.000000f; w.v[1] = 0.000000f; /* [ 11. -11.] [ 0.70710677 -0.70710677] */ SST_Math_Vec2fNormalize(&x,&w); TASSERT(fabsf((w.v[0])-(0.707107f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((w.v[1])-(-0.707107f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fNormalizeLocal() { SST_Vec2f x; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 11.000000f; x.v[1] = 16.000000f; /* [ 11. 16.] [ 0.5665288 0.8240419] */ SST_Math_Vec2fNormalizeLocal(&x); /* for accuracy */ TASSERT(fabsf((x.v[0])-(0.566529f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((x.v[1])-(0.824042f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fProject() { SST_Vec2f x; /* 2 vector */ SST_Vec2f y; /* 2 vector */ SST_Vec2f w; /* 2 vector */ /* Resetting test vectors */ x.v[0] = -4.000000f; x.v[1] = -13.000000f; y.v[0] = 5.000000f; y.v[1] = -4.000000f; w.v[0] = 0.000000f; w.v[1] = 0.000000f; /* [ -4. -13.] [ 5. -4.] [ 3.90243888 -3.1219511 ] */ SST_Math_Vec2fProject(&x,&y,&w); TASSERT(fabsf((w.v[0])-(3.902439f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((w.v[1])-(-3.121951f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fProjectLocal() { SST_Vec2f x; /* 2 vector */ SST_Vec2f y; /* 2 vector */ /* Resetting test vectors */ x.v[0] = -7.000000f; x.v[1] = 3.000000f; y.v[0] = 4.000000f; y.v[1] = 18.000000f; /* [-7. 3.] [ 4. 18.] [ 0.30588236 1.37647069] */ SST_Math_Vec2fProjectLocal(&x,&y); /* for accuracy */ TASSERT(fabsf((x.v[0])-(0.305882f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((x.v[1])-(1.376471f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fCross() { SST_Vec2f x; /* 2 vector */ SST_Vec2f y; /* 2 vector */ SST_Vec2f w; /* 2 vector */ /* Resetting test vectors */ x.v[0] = -3.000000f; x.v[1] = 2.000000f; y.v[0] = -4.000000f; y.v[1] = -20.000000f; w.v[0] = 0.000000f; w.v[1] = 0.000000f; /* [-3. 2.] [ -4. -20.] 68.0 */ SST_Math_Vec2fCross(&x,&y,&w); TASSERT(fabsf((w.v[0])-(68.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((w.v[1])-(68.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fCrossLocal() { SST_Vec2f x; /* 2 vector */ SST_Vec2f y; /* 2 vector */ /* Resetting test vectors */ x.v[0] = 3.000000f; x.v[1] = -4.000000f; y.v[0] = 17.000000f; y.v[1] = 19.000000f; /* [ 3. -4.] [ 17. 19.] 125.0 */ SST_Math_Vec2fCrossLocal(&x,&y); /* for accuracy */ TASSERT(fabsf((x.v[0])-(125.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _x failed!"); TASSERT(fabsf((x.v[1])-(125.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _y failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fMagnitude() { SST_Vec2f x; /* 2 vector */ float a; /* scalar */ /* Resetting test vectors */ x.v[0] = -4.000000f; x.v[1] = -3.000000f; /* [-4. -3.] 5.0 */ a = SST_Math_Vec2fMagnitude(&x); TASSERT(fabsf((a)-(5.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Magnitude failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fMagnitudeSquared() { SST_Vec2f x; /* 2 vector */ float a; /* scalar */ /* Resetting test vectors */ x.v[0] = -2.000000f; x.v[1] = 7.000000f; /* [-2. 7.] 53.0 */ a = SST_Math_Vec2fMagnitudeSquared(&x); TASSERT(fabsf((a)-(53.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"MagnitudeSquared failed!"); return ZTEST_SUCCESS; } /******************************************************************************/ static const char* testSST_Math_Vec2fDot() { SST_Vec2f x; /* 2 vector */ SST_Vec2f y; /* 2 vector */ float a; /* scalar */ /* Resetting test vectors */ x.v[0] = -7.000000f; x.v[1] = -1.000000f; y.v[0] = 13.000000f; y.v[1] = -16.000000f; /* [-7. -1.] -75.0 */ a = SST_Math_Vec2fDot(&x,&y); TASSERT(fabsf((a)-(-75.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Dot failed!"); return ZTEST_SUCCESS; } /******************************************************************************/