Модульные тесты для Vector2, Vector3, Quaternion и Versor: is unit, is zero, is identity
This commit is contained in:
parent
47ba771b68
commit
2d8240265c
74 changed files with 999 additions and 348 deletions
|
@ -17,35 +17,35 @@ static const int _TEST_FP32_CLOSE_VERSOR_PAIR_AMOUNT = 10;
|
|||
static const _TestVersorPairFP32 _TEST_FP32_CLOSE_VERSOR_PAIR_LIST[] = {
|
||||
{
|
||||
{ 1.0f, 0.0f, 0.0f, 0.0f },
|
||||
{ 1.0f + BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
|
||||
{ 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
|
||||
},
|
||||
{
|
||||
{ 1.0f, 0.0f, 0.0f, 0.0f },
|
||||
{ 1.0f - BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
|
||||
{ 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
|
||||
},
|
||||
{
|
||||
{ 0.0f, 1.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 1.0f + BGC_EPSYLON_FP32, 0.0f, 0.0f }
|
||||
{ 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f }
|
||||
},
|
||||
{
|
||||
{ 0.0f, 1.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 1.0f - BGC_EPSYLON_FP32, 0.0f, 0.0f }
|
||||
{ 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f }
|
||||
},
|
||||
{
|
||||
{ 0.0f, 0.0f, 1.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f + BGC_EPSYLON_FP32, 0.0f }
|
||||
{ 0.0f, 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f }
|
||||
},
|
||||
{
|
||||
{ 0.0f, 0.0f, 1.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f - BGC_EPSYLON_FP32, 0.0f }
|
||||
{ 0.0f, 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f }
|
||||
},
|
||||
{
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f + BGC_EPSYLON_FP32 }
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32 }
|
||||
},
|
||||
{
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f - BGC_EPSYLON_FP32 }
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32 }
|
||||
},
|
||||
{
|
||||
{ 0.70710678f, 0.0f, 0.70710675f, 0.0f },
|
||||
|
@ -62,35 +62,35 @@ static const int _TEST_FP32_DIFFERENT_VERSOR_PAIR_AMOUNT = 10;
|
|||
static const _TestVersorPairFP32 _TEST_FP32_DIFFERENT_VERSOR_PAIR_LIST[] = {
|
||||
{
|
||||
{ 1.0f, 0.0f, 0.0f, 0.0f },
|
||||
{ 1.0f + 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
|
||||
{ 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
|
||||
},
|
||||
{
|
||||
{ 1.0f, 0.0f, 0.0f, 0.0f },
|
||||
{ 1.0f - 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
|
||||
{ 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
|
||||
},
|
||||
{
|
||||
{ 0.0f, 1.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 1.0f + 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f }
|
||||
{ 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }
|
||||
},
|
||||
{
|
||||
{ 0.0f, 1.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 1.0f - 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f }
|
||||
{ 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }
|
||||
},
|
||||
{
|
||||
{ 0.0f, 0.0f, 1.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f + 1.5f * BGC_EPSYLON_FP32, 0.0f }
|
||||
{ 0.0f, 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f }
|
||||
},
|
||||
{
|
||||
{ 0.0f, 0.0f, 1.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f - 1.5f * BGC_EPSYLON_FP32, 0.0f }
|
||||
{ 0.0f, 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f }
|
||||
},
|
||||
{
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f + 1.5f * BGC_EPSYLON_FP32 }
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32 }
|
||||
},
|
||||
{
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f - 1.5f * BGC_EPSYLON_FP32 }
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32 }
|
||||
},
|
||||
{
|
||||
{ 0.707106f, 0.0f, 0.707107f, 0.0f },
|
||||
|
@ -102,7 +102,7 @@ static const _TestVersorPairFP32 _TEST_FP32_DIFFERENT_VERSOR_PAIR_LIST[] = {
|
|||
}
|
||||
};
|
||||
|
||||
int test_bgc_versor_are_close_fp32()
|
||||
int test_versor_are_close_fp32()
|
||||
{
|
||||
print_testing_name("bgc_versor_are_close_fp32");
|
||||
|
||||
|
@ -135,35 +135,35 @@ static const int _TEST_FP64_CLOSE_VERSOR_PAIR_AMOUNT = 10;
|
|||
static const _TestVersorPairFP64 _TEST_FP64_CLOSE_VERSOR_PAIR_LIST[] = {
|
||||
{
|
||||
{ 1.0, 0.0, 0.0, 0.0 },
|
||||
{ 1.0 + BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
|
||||
{ 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
|
||||
},
|
||||
{
|
||||
{ 1.0, 0.0, 0.0, 0.0 },
|
||||
{ 1.0 - BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
|
||||
{ 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
|
||||
},
|
||||
{
|
||||
{ 0.0, 1.0, 0.0, 0.0 },
|
||||
{ 0.0, 1.0 + BGC_EPSYLON_FP64, 0.0, 0.0 }
|
||||
{ 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 }
|
||||
},
|
||||
{
|
||||
{ 0.0, 1.0, 0.0, 0.0 },
|
||||
{ 0.0, 1.0 - BGC_EPSYLON_FP64, 0.0, 0.0 }
|
||||
{ 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 }
|
||||
},
|
||||
{
|
||||
{ 0.0, 0.0, 1.0, 0.0 },
|
||||
{ 0.0, 0.0, 1.0 + BGC_EPSYLON_FP64, 0.0 }
|
||||
{ 0.0, 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0 }
|
||||
},
|
||||
{
|
||||
{ 0.0, 0.0, 1.0, 0.0 },
|
||||
{ 0.0, 0.0, 1.0 - BGC_EPSYLON_FP64, 0.0 }
|
||||
{ 0.0, 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0 }
|
||||
},
|
||||
{
|
||||
{ 0.0, 0.0, 0.0, 1.0 },
|
||||
{ 0.0, 0.0, 0.0, 1.0 + BGC_EPSYLON_FP64 }
|
||||
{ 0.0, 0.0, 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64 }
|
||||
},
|
||||
{
|
||||
{ 0.0, 0.0, 0.0, 1.0 },
|
||||
{ 0.0, 0.0, 0.0, 1.0 - BGC_EPSYLON_FP64 }
|
||||
{ 0.0, 0.0, 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64 }
|
||||
},
|
||||
{
|
||||
{ 0.7071067811865475244, 0.0, 0.7071067811865465244, 0.0 },
|
||||
|
@ -180,35 +180,35 @@ static const int _TEST_FP64_DIFFERENT_VERSOR_PAIR_AMOUNT = 10;
|
|||
static const _TestVersorPairFP64 _TEST_FP64_DIFFERENT_VERSOR_PAIR_LIST[] = {
|
||||
{
|
||||
{ 1.0, 0.0, 0.0, 0.0 },
|
||||
{ 1.0 + 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
|
||||
{ 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
|
||||
},
|
||||
{
|
||||
{ 1.0, 0.0, 0.0, 0.0 },
|
||||
{ 1.0 - 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
|
||||
{ 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
|
||||
},
|
||||
{
|
||||
{ 0.0, 1.0, 0.0, 0.0 },
|
||||
{ 0.0, 1.0 + 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0 }
|
||||
{ 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }
|
||||
},
|
||||
{
|
||||
{ 0.0, 1.0, 0.0, 0.0 },
|
||||
{ 0.0, 1.0 - 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0 }
|
||||
{ 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }
|
||||
},
|
||||
{
|
||||
{ 0.0, 0.0, 1.0, 0.0 },
|
||||
{ 0.0, 0.0, 1.0 + 1.5 * BGC_EPSYLON_FP64, 0.0 }
|
||||
{ 0.0, 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0 }
|
||||
},
|
||||
{
|
||||
{ 0.0, 0.0, 1.0, 0.0 },
|
||||
{ 0.0, 0.0, 1.0 - 1.5 * BGC_EPSYLON_FP64, 0.0 }
|
||||
{ 0.0, 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0 }
|
||||
},
|
||||
{
|
||||
{ 0.0, 0.0, 0.0, 1.0 },
|
||||
{ 0.0, 0.0, 0.0, 1.0 + 1.5 * BGC_EPSYLON_FP64 }
|
||||
{ 0.0, 0.0, 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64 }
|
||||
},
|
||||
{
|
||||
{ 0.0, 0.0, 0.0, 1.0 },
|
||||
{ 0.0, 0.0, 0.0, 1.0 - 1.5 * BGC_EPSYLON_FP64 }
|
||||
{ 0.0, 0.0, 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64 }
|
||||
},
|
||||
{
|
||||
{ 0.7071067811866, 0.0, 0.7071067811865, 0.0 },
|
||||
|
@ -220,7 +220,7 @@ static const _TestVersorPairFP64 _TEST_FP64_DIFFERENT_VERSOR_PAIR_LIST[] = {
|
|||
}
|
||||
};
|
||||
|
||||
int test_bgc_versor_are_close_fp64()
|
||||
int test_versor_are_close_fp64()
|
||||
{
|
||||
print_testing_name("bgc_versor_are_close_fp64");
|
||||
|
||||
|
@ -245,13 +245,13 @@ int test_bgc_versor_are_close_fp64()
|
|||
return TEST_SUCCES;
|
||||
}
|
||||
|
||||
int test_bgc_versor_are_close()
|
||||
int test_versor_are_close()
|
||||
{
|
||||
if (test_bgc_versor_are_close_fp32() != TEST_SUCCES) {
|
||||
if (test_versor_are_close_fp32() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_bgc_versor_are_close_fp64() != TEST_SUCCES) {
|
||||
if (test_versor_are_close_fp64() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _TEST_VERSOR_ARE_CLOSE_H_
|
||||
#define _TEST_VERSOR_ARE_CLOSE_H_
|
||||
|
||||
int test_bgc_versor_are_close_fp32();
|
||||
int test_versor_are_close_fp32();
|
||||
|
||||
int test_bgc_versor_are_close_fp64();
|
||||
int test_versor_are_close_fp64();
|
||||
|
||||
int test_bgc_versor_are_close();
|
||||
int test_versor_are_close();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -44,7 +44,7 @@ static const _TestVersorTripletFP32 _TEST_FP32_VERSOR_TRIPLET_LIST[] = {
|
|||
}
|
||||
};
|
||||
|
||||
int test_bgc_versor_combine_fp32()
|
||||
int test_versor_combine_fp32()
|
||||
{
|
||||
BgcVersorFP32 versor;
|
||||
|
||||
|
@ -96,7 +96,7 @@ static const _TestVersorTripletFP64 _TEST_FP64_VERSOR_TRIPLET_LIST[] = {
|
|||
}
|
||||
};
|
||||
|
||||
int test_bgc_versor_combine_fp64()
|
||||
int test_versor_combine_fp64()
|
||||
{
|
||||
BgcVersorFP64 versor;
|
||||
|
||||
|
@ -116,13 +116,13 @@ int test_bgc_versor_combine_fp64()
|
|||
return TEST_SUCCES;
|
||||
}
|
||||
|
||||
int test_bgc_versor_combine()
|
||||
int test_versor_combine()
|
||||
{
|
||||
if (test_bgc_versor_combine_fp32() != TEST_SUCCES) {
|
||||
if (test_versor_combine_fp32() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_bgc_versor_combine_fp64() != TEST_SUCCES) {
|
||||
if (test_versor_combine_fp64() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _TEST_VERSOR_COMBINE_H_
|
||||
#define _TEST_VERSOR_COMBINE_H_
|
||||
|
||||
int test_bgc_versor_combine_fp32();
|
||||
int test_versor_combine_fp32();
|
||||
|
||||
int test_bgc_versor_combine_fp64();
|
||||
int test_versor_combine_fp64();
|
||||
|
||||
int test_bgc_versor_combine();
|
||||
int test_versor_combine();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -18,7 +18,7 @@ static const BgcVersorFP32 _TEST_FP32_VERSOR_LIST[] = {
|
|||
{ 0.7071067812f, 0.0f, 0.0f, -0.7071067812f }
|
||||
};
|
||||
|
||||
int test_bgc_versor_copy_fp32()
|
||||
int test_versor_copy_fp32()
|
||||
{
|
||||
BgcVersorFP32 versor;
|
||||
|
||||
|
@ -56,7 +56,7 @@ static const BgcVersorFP64 _TEST_FP64_VERSOR_LIST[] = {
|
|||
{ 0.7071067811865475, 0.0, 0.0, -0.7071067811865475 }
|
||||
};
|
||||
|
||||
int test_bgc_versor_copy_fp64()
|
||||
int test_versor_copy_fp64()
|
||||
{
|
||||
BgcVersorFP64 versor;
|
||||
|
||||
|
@ -80,13 +80,13 @@ int test_bgc_versor_copy_fp64()
|
|||
return TEST_SUCCES;
|
||||
}
|
||||
|
||||
int test_bgc_versor_copy()
|
||||
int test_versor_copy()
|
||||
{
|
||||
if (test_bgc_versor_copy_fp32() != TEST_SUCCES) {
|
||||
if (test_versor_copy_fp32() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_bgc_versor_copy_fp64() != TEST_SUCCES) {
|
||||
if (test_versor_copy_fp64() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _TEST_VERSOR_COPY_H_
|
||||
#define _TEST_VERSOR_COPY_H_
|
||||
|
||||
int test_bgc_versor_copy_fp32();
|
||||
int test_versor_copy_fp32();
|
||||
|
||||
int test_bgc_versor_copy_fp64();
|
||||
int test_versor_copy_fp64();
|
||||
|
||||
int test_bgc_versor_copy();
|
||||
int test_versor_copy();
|
||||
|
||||
#endif
|
||||
|
|
116
basic-geometry-test/tests/versor/versor_is_identity.c
Normal file
116
basic-geometry-test/tests/versor/versor_is_identity.c
Normal file
|
@ -0,0 +1,116 @@
|
|||
#include "./versor_is_identity.h"
|
||||
|
||||
#include "./../../helpers.h"
|
||||
|
||||
// ==================== FP32 ==================== //
|
||||
|
||||
static const int _TEST_FP32_IDENTIYTY_VERSOR_AMOUNT = 9;
|
||||
static const int _TEST_FP32_NON_IDENTIYTY_VERSOR_AMOUNT = 5;
|
||||
|
||||
static const BgcVersorFP32 _TEST_FP32_IDENTIYTY_VERSOR_LIST[] = {
|
||||
{ 1.0f, 0.0f, 0.0f, 0.0f },
|
||||
{ 1.0f + BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
|
||||
{ 1.0f - BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
|
||||
{ 1.0f, BGC_EPSYLON_FP32, 0.0f, 0.0f },
|
||||
{ 1.0f, -BGC_EPSYLON_FP32, 0.0f, 0.0f },
|
||||
{ 1.0f, 0.0f, BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 1.0f, 0.0f, -BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 1.0f, 0.0f, 0.0f, BGC_EPSYLON_FP32 },
|
||||
{ 1.0f, 0.0f, 0.0f, -BGC_EPSYLON_FP32 }
|
||||
};
|
||||
|
||||
static const BgcVersorFP32 _TEST_FP32_NON_IDENTIYTY_VERSOR_LIST[] = {
|
||||
{ 0.0f, 1.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f },
|
||||
{ 0.5f, 0.5f, 0.5f, 0.5f },
|
||||
{ 1.0f - 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
|
||||
};
|
||||
|
||||
int test_versor_is_identity_fp32()
|
||||
{
|
||||
print_testing_name("bgc_versor_is_identity_fp32");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP32_IDENTIYTY_VERSOR_AMOUNT; i++) {
|
||||
if (!bgc_versor_is_identity_fp32(&_TEST_FP32_IDENTIYTY_VERSOR_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP32_NON_IDENTIYTY_VERSOR_AMOUNT; i++) {
|
||||
if (bgc_versor_is_identity_fp32(&_TEST_FP32_NON_IDENTIYTY_VERSOR_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
print_testing_success();
|
||||
|
||||
return TEST_SUCCES;
|
||||
}
|
||||
|
||||
// ==================== FP64 ==================== //
|
||||
|
||||
static const int _TEST_FP64_IDENTIYTY_VERSOR_AMOUNT = 9;
|
||||
static const int _TEST_FP64_NON_IDENTIYTY_VERSOR_AMOUNT = 5;
|
||||
|
||||
static const BgcVersorFP64 _TEST_FP64_IDENTIYTY_VERSOR_LIST[] = {
|
||||
{ 1.0, 0.0, 0.0, 0.0 },
|
||||
{ 1.0 + BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
|
||||
{ 1.0 - BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
|
||||
{ 1.0, -BGC_EPSYLON_FP64, 0.0, 0.0 },
|
||||
{ 1.0, BGC_EPSYLON_FP64, 0.0, 0.0 },
|
||||
{ 1.0, 0.0, BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 1.0, 0.0, -BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 1.0, 0.0, 0.0, BGC_EPSYLON_FP64 },
|
||||
{ 1.0, 0.0, 0.0, -BGC_EPSYLON_FP64 }
|
||||
};
|
||||
|
||||
static const BgcVersorFP64 _TEST_FP64_NON_IDENTIYTY_VERSOR_LIST[] = {
|
||||
{ 0.0, 1.0, 0.0, 0.0 },
|
||||
{ 0.0, 0.0, 1.0, 0.0 },
|
||||
{ 0.0, 0.0, 0.0, 1.0 },
|
||||
{ 0.5, 0.5, 0.5, 0.5 },
|
||||
{ 1.0 - 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
|
||||
};
|
||||
|
||||
int test_versor_is_identity_fp64()
|
||||
{
|
||||
print_testing_name("bgc_versor_is_identity_fp64");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP64_IDENTIYTY_VERSOR_AMOUNT; i++) {
|
||||
if (!bgc_versor_is_identity_fp64(&_TEST_FP64_IDENTIYTY_VERSOR_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP64_NON_IDENTIYTY_VERSOR_AMOUNT; i++) {
|
||||
if (bgc_versor_is_identity_fp64(&_TEST_FP64_NON_IDENTIYTY_VERSOR_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
print_testing_success();
|
||||
|
||||
return TEST_SUCCES;
|
||||
}
|
||||
|
||||
int test_versor_is_identity()
|
||||
{
|
||||
if (test_versor_is_identity_fp32() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_versor_is_identity_fp64() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
return TEST_SUCCES;
|
||||
}
|
10
basic-geometry-test/tests/versor/versor_is_identity.h
Normal file
10
basic-geometry-test/tests/versor/versor_is_identity.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef _TEST_VERSOR_IS_IDENTITY_H_
|
||||
#define _TEST_VERSOR_IS_IDENTITY_H_
|
||||
|
||||
int test_versor_is_identity_fp32();
|
||||
|
||||
int test_versor_is_identity_fp64();
|
||||
|
||||
int test_versor_is_identity();
|
||||
|
||||
#endif
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "./../../helpers.h"
|
||||
|
||||
int test_bgc_versor_reset_fp32()
|
||||
int test_versor_reset_fp32()
|
||||
{
|
||||
BgcVersorFP32 versor;
|
||||
|
||||
|
@ -20,7 +20,7 @@ int test_bgc_versor_reset_fp32()
|
|||
return TEST_SUCCES;
|
||||
}
|
||||
|
||||
int test_bgc_versor_reset_fp64()
|
||||
int test_versor_reset_fp64()
|
||||
{
|
||||
BgcVersorFP64 versor;
|
||||
|
||||
|
@ -38,13 +38,13 @@ int test_bgc_versor_reset_fp64()
|
|||
return TEST_SUCCES;
|
||||
}
|
||||
|
||||
int test_bgc_versor_reset()
|
||||
int test_versor_reset()
|
||||
{
|
||||
if (test_bgc_versor_reset_fp32() != TEST_SUCCES) {
|
||||
if (test_versor_reset_fp32() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_bgc_versor_reset_fp64() != TEST_SUCCES) {
|
||||
if (test_versor_reset_fp64() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _TEST_VERSOR_RESET_H_
|
||||
#define _TEST_VERSOR_RESET_H_
|
||||
|
||||
int test_bgc_versor_reset_fp32();
|
||||
int test_versor_reset_fp32();
|
||||
|
||||
int test_bgc_versor_reset_fp64();
|
||||
int test_versor_reset_fp64();
|
||||
|
||||
int test_bgc_versor_reset();
|
||||
int test_versor_reset();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,7 @@ static const _TestVersorComponentsFP32 _TEST_FP32_VERSOR_DATA_LIST[] = {
|
|||
{ 1.0f, 0.0f, 1.0f, 0.0f }
|
||||
};
|
||||
|
||||
int test_bgc_versor_set_values_fp32()
|
||||
int test_versor_set_values_fp32()
|
||||
{
|
||||
float versor_module, ratio;
|
||||
BgcVersorFP32 versor;
|
||||
|
@ -86,7 +86,7 @@ static const _TestVersorComponentsFP64 _TEST_FP64_VERSOR_DATA_LIST[] = {
|
|||
{ 1.0, 0.0, 1.0, 0.0 }
|
||||
};
|
||||
|
||||
int test_bgc_versor_set_values_fp64()
|
||||
int test_versor_set_values_fp64()
|
||||
{
|
||||
double versor_module, ratio;
|
||||
BgcVersorFP64 versor;
|
||||
|
@ -140,13 +140,13 @@ int test_bgc_versor_set_values_fp64()
|
|||
return TEST_SUCCES;
|
||||
}
|
||||
|
||||
int test_bgc_versor_set_values()
|
||||
int test_versor_set_values()
|
||||
{
|
||||
if (test_bgc_versor_set_values_fp32() != TEST_SUCCES) {
|
||||
if (test_versor_set_values_fp32() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_bgc_versor_set_values_fp64() != TEST_SUCCES) {
|
||||
if (test_versor_set_values_fp64() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _TEST_VERSOR_SET_VALUES_H_
|
||||
#define _TEST_VERSOR_SET_VALUES_H_
|
||||
|
||||
int test_bgc_versor_set_values_fp32();
|
||||
int test_versor_set_values_fp32();
|
||||
|
||||
int test_bgc_versor_set_values_fp64();
|
||||
int test_versor_set_values_fp64();
|
||||
|
||||
int test_bgc_versor_set_values();
|
||||
int test_versor_set_values();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,7 +28,7 @@ static const _TestVersorDataFP32 _TEST_FP32_VERSOR_LIST2[] = {
|
|||
{ 4.0f, 3.0f, 2.0f, 1.0f }
|
||||
};
|
||||
|
||||
int test_bgc_versor_swap_fp32()
|
||||
int test_versor_swap_fp32()
|
||||
{
|
||||
BgcVersorFP32 versor1a, versor2a, versor1b, versor2b;
|
||||
|
||||
|
@ -70,7 +70,7 @@ int test_bgc_versor_swap_fp32()
|
|||
|
||||
// ==================== FP64 ==================== //
|
||||
|
||||
int test_bgc_versor_swap_fp64()
|
||||
int test_versor_swap_fp64()
|
||||
{
|
||||
BgcVersorFP64 versor1a, versor2a, versor1b, versor2b;
|
||||
|
||||
|
@ -110,13 +110,13 @@ int test_bgc_versor_swap_fp64()
|
|||
return TEST_SUCCES;
|
||||
}
|
||||
|
||||
int test_bgc_versor_swap()
|
||||
int test_versor_swap()
|
||||
{
|
||||
if (test_bgc_versor_swap_fp32() != TEST_SUCCES) {
|
||||
if (test_versor_swap_fp32() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_bgc_versor_swap_fp64() != TEST_SUCCES) {
|
||||
if (test_versor_swap_fp64() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _TEST_VERSOR_SWAP_H_
|
||||
#define _TEST_VERSOR_SWAP_H_
|
||||
|
||||
int test_bgc_versor_swap_fp32();
|
||||
int test_versor_swap_fp32();
|
||||
|
||||
int test_bgc_versor_swap_fp64();
|
||||
int test_versor_swap_fp64();
|
||||
|
||||
int test_bgc_versor_swap();
|
||||
int test_versor_swap();
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue