Переход на версию 0.3: изменение подхода к именованию сущностей, добавление, изменение и удаление ряда функций
This commit is contained in:
parent
d33daf4e2d
commit
f7e41645fe
87 changed files with 4580 additions and 4051 deletions
|
|
@ -25,19 +25,19 @@ typedef struct {
|
|||
// =================== Versor =================== //
|
||||
|
||||
typedef struct {
|
||||
BgcVersorFP32 first, second;
|
||||
BGC_FP32_Versor first, second;
|
||||
} TestVersorPairFP32;
|
||||
|
||||
typedef struct {
|
||||
BgcVersorFP64 first, second;
|
||||
BGC_FP64_Versor first, second;
|
||||
} TestVersorPairFP64;
|
||||
|
||||
typedef struct {
|
||||
BgcVersorFP32 first, second, result;
|
||||
BGC_FP32_Versor first, second, result;
|
||||
} TestVersorTripletFP32;
|
||||
|
||||
typedef struct {
|
||||
BgcVersorFP64 first, second, result;
|
||||
BGC_FP64_Versor first, second, result;
|
||||
} TestVersorTripletFP64;
|
||||
|
||||
// ================= Functions ================== //
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
// ==================== FP32 ==================== //
|
||||
|
||||
static const int _TEST_FP32_COMPLEX_AMOUNT = 4;
|
||||
static const BgcComplexFP32 _TEST_FP32_COMPLEX_LIST[] = {
|
||||
static const BGC_FP32_Complex _TEST_FP32_COMPLEX_LIST[] = {
|
||||
{ 1.0f, 2.0f },
|
||||
{ -4.0f, -3.0f },
|
||||
{ -0.001f, 100.0f },
|
||||
|
|
@ -16,13 +16,13 @@ static const BgcComplexFP32 _TEST_FP32_COMPLEX_LIST[] = {
|
|||
|
||||
void test_complex_copy_fp32()
|
||||
{
|
||||
BgcComplexFP32 vector;
|
||||
BGC_FP32_Complex vector;
|
||||
|
||||
print_testing_name("bgc_complex_copy_fp32");
|
||||
print_testing_name("bgc_fp32_complex_copy");
|
||||
|
||||
for (int i = 0; i < _TEST_FP32_COMPLEX_AMOUNT; i++) {
|
||||
|
||||
bgc_complex_copy_fp32(&_TEST_FP32_COMPLEX_LIST[i], &vector);
|
||||
bgc_fp32_complex_copy(&_TEST_FP32_COMPLEX_LIST[i], &vector);
|
||||
|
||||
if (vector.real != _TEST_FP32_COMPLEX_LIST[i].real ||
|
||||
vector.imaginary != _TEST_FP32_COMPLEX_LIST[i].imaginary) {
|
||||
|
|
@ -37,7 +37,7 @@ void test_complex_copy_fp32()
|
|||
// ==================== FP64 ==================== //
|
||||
|
||||
static const int _TEST_FP64_COMPLEX_AMOUNT = 4;
|
||||
static const BgcComplexFP64 _TEST_FP64_COMPLEX_LIST[] = {
|
||||
static const BGC_FP64_Complex _TEST_FP64_COMPLEX_LIST[] = {
|
||||
{ 1.0, 2.0 },
|
||||
{ -4.0, -3.0 },
|
||||
{ -0.001, 100.0 },
|
||||
|
|
@ -46,13 +46,13 @@ static const BgcComplexFP64 _TEST_FP64_COMPLEX_LIST[] = {
|
|||
|
||||
void test_complex_copy_fp64()
|
||||
{
|
||||
BgcComplexFP64 vector;
|
||||
BGC_FP64_Complex vector;
|
||||
|
||||
print_testing_name("bgc_complex_copy_fp64");
|
||||
print_testing_name("bgc_fp64_complex_copy");
|
||||
|
||||
for (int i = 0; i < _TEST_FP64_COMPLEX_AMOUNT; i++) {
|
||||
|
||||
bgc_complex_copy_fp64(&_TEST_FP64_COMPLEX_LIST[i], &vector);
|
||||
bgc_fp64_complex_copy(&_TEST_FP64_COMPLEX_LIST[i], &vector);
|
||||
|
||||
if (vector.real != _TEST_FP64_COMPLEX_LIST[i].real ||
|
||||
vector.imaginary != _TEST_FP64_COMPLEX_LIST[i].imaginary) {
|
||||
|
|
|
|||
|
|
@ -7,35 +7,35 @@
|
|||
static const int _TEST_FP32_UNIT_COMPLEX_AMOUNT = 10;
|
||||
static const int _TEST_FP32_NONUNIT_COMPLEX_AMOUNT = 6;
|
||||
|
||||
static const BgcComplexFP32 _TEST_FP32_UNIT_COMPLEX_LIST[] = {
|
||||
static const BGC_FP32_Complex _TEST_FP32_UNIT_COMPLEX_LIST[] = {
|
||||
{ 1.0f, 0.0f },
|
||||
{ -1.0f, 0.0f },
|
||||
{ 0.6f, -0.8f },
|
||||
{ 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32 },
|
||||
{ 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32 },
|
||||
{ 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON },
|
||||
{ 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON },
|
||||
{ 0.7071067812f, 0.7071067812f },
|
||||
{ 0.7071067812f + 0.75f * BGC_EPSYLON_FP32, 0.7071067812f },
|
||||
{ 0.7071067812f, 0.7071067812f - 0.75f * BGC_EPSYLON_FP32 }
|
||||
{ 0.7071067812f + 0.75f * BGC_FP32_EPSYLON, 0.7071067812f },
|
||||
{ 0.7071067812f, 0.7071067812f - 0.75f * BGC_FP32_EPSYLON }
|
||||
};
|
||||
|
||||
static const BgcComplexFP32 _TEST_FP32_NONUNIT_QUATERION_LIST[] = {
|
||||
{ 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32 },
|
||||
{ 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32 },
|
||||
{ 0.7071067812f + 1.25f * BGC_EPSYLON_FP32, 0.7071067812f + 1.25f * BGC_EPSYLON_FP32 },
|
||||
{ 0.7071067812f - 1.25f * BGC_EPSYLON_FP32, 0.7071067812f - 1.25f * BGC_EPSYLON_FP32 }
|
||||
static const BGC_FP32_Complex _TEST_FP32_NONUNIT_QUATERION_LIST[] = {
|
||||
{ 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON },
|
||||
{ 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON },
|
||||
{ 0.7071067812f + 1.25f * BGC_FP32_EPSYLON, 0.7071067812f + 1.25f * BGC_FP32_EPSYLON },
|
||||
{ 0.7071067812f - 1.25f * BGC_FP32_EPSYLON, 0.7071067812f - 1.25f * BGC_FP32_EPSYLON }
|
||||
};
|
||||
|
||||
void test_complex_is_unit_fp32()
|
||||
{
|
||||
print_testing_name("bgc_complex_is_unit_fp32");
|
||||
print_testing_name("bgc_fp32_complex_is_unit");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP32_UNIT_COMPLEX_AMOUNT; i++) {
|
||||
if (!bgc_complex_is_unit_fp32(&_TEST_FP32_UNIT_COMPLEX_LIST[i])) {
|
||||
if (!bgc_fp32_complex_is_unit(&_TEST_FP32_UNIT_COMPLEX_LIST[i])) {
|
||||
print_testing_error("A unit complex number was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ void test_complex_is_unit_fp32()
|
|||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP32_NONUNIT_COMPLEX_AMOUNT; i++) {
|
||||
if (bgc_complex_is_unit_fp32(&_TEST_FP32_NONUNIT_QUATERION_LIST[i])) {
|
||||
if (bgc_fp32_complex_is_unit(&_TEST_FP32_NONUNIT_QUATERION_LIST[i])) {
|
||||
print_testing_error("A non-unit complex number was recognized a unit complex number");
|
||||
return;
|
||||
}
|
||||
|
|
@ -57,35 +57,35 @@ void test_complex_is_unit_fp32()
|
|||
static const int _TEST_FP64_UNIT_COMPLEX_AMOUNT = 10;
|
||||
static const int _TEST_FP64_NONUNIT_COMPLEX_AMOUNT = 6;
|
||||
|
||||
static const BgcComplexFP64 _TEST_FP64_UNIT_COMPLEX_LIST[] = {
|
||||
static const BGC_FP64_Complex _TEST_FP64_UNIT_COMPLEX_LIST[] = {
|
||||
{ 1.0, 0.0 },
|
||||
{ -1.0, 0.0 },
|
||||
{ -0.6, 0.8 },
|
||||
{ 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64 },
|
||||
{ 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64 },
|
||||
{ 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON },
|
||||
{ 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON },
|
||||
{ 0.7071067811865475244, 0.7071067811865475244 },
|
||||
{ 0.7071067811865475244 + 0.75 * BGC_EPSYLON_FP64, 0.7071067811865475244 },
|
||||
{ 0.7071067811865475244, 0.7071067811865475244 - 0.75 * BGC_EPSYLON_FP64 }
|
||||
{ 0.7071067811865475244 + 0.75 * BGC_FP64_EPSYLON, 0.7071067811865475244 },
|
||||
{ 0.7071067811865475244, 0.7071067811865475244 - 0.75 * BGC_FP64_EPSYLON }
|
||||
};
|
||||
|
||||
static const BgcComplexFP64 _TEST_FP64_NONUNIT_QUATERION_LIST[] = {
|
||||
{ 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64 },
|
||||
{ 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64 },
|
||||
{ 0.7071067811865475244 + 1.25 * BGC_EPSYLON_FP64, 0.7071067811865475244 + 1.25 * BGC_EPSYLON_FP64 },
|
||||
{ 0.7071067811865475244 - 1.25 * BGC_EPSYLON_FP64, 0.7071067811865475244 - 1.25 * BGC_EPSYLON_FP64 }
|
||||
static const BGC_FP64_Complex _TEST_FP64_NONUNIT_QUATERION_LIST[] = {
|
||||
{ 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON },
|
||||
{ 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON },
|
||||
{ 0.7071067811865475244 + 1.25 * BGC_FP64_EPSYLON, 0.7071067811865475244 + 1.25 * BGC_FP64_EPSYLON },
|
||||
{ 0.7071067811865475244 - 1.25 * BGC_FP64_EPSYLON, 0.7071067811865475244 - 1.25 * BGC_FP64_EPSYLON }
|
||||
};
|
||||
|
||||
void test_complex_is_unit_fp64()
|
||||
{
|
||||
print_testing_name("bgc_complex_is_unit_fp64");
|
||||
print_testing_name("bgc_fp64_complex_is_unit");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP64_UNIT_COMPLEX_AMOUNT; i++) {
|
||||
if (!bgc_complex_is_unit_fp64(&_TEST_FP64_UNIT_COMPLEX_LIST[i])) {
|
||||
if (!bgc_fp64_complex_is_unit(&_TEST_FP64_UNIT_COMPLEX_LIST[i])) {
|
||||
print_testing_error("A unit complex number was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ void test_complex_is_unit_fp64()
|
|||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP64_NONUNIT_COMPLEX_AMOUNT; i++) {
|
||||
if (bgc_complex_is_unit_fp64(&_TEST_FP64_NONUNIT_QUATERION_LIST[i])) {
|
||||
if (bgc_fp64_complex_is_unit(&_TEST_FP64_NONUNIT_QUATERION_LIST[i])) {
|
||||
print_testing_error("A non-unit complex number was recognized a unit complex number");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,31 +7,31 @@
|
|||
static const int _TEST_FP32_ZERO_COMPLEX_AMOUNT = 4;
|
||||
static const int _TEST_FP32_NONZERO_COMPLEX_AMOUNT = 7;
|
||||
|
||||
static const BgcComplexFP32 _TEST_FP32_ZERO_COMPLEX_LIST[] = {
|
||||
static const BGC_FP32_Complex _TEST_FP32_ZERO_COMPLEX_LIST[] = {
|
||||
{ 0.0f, 0.0f },
|
||||
{ 0.75f * BGC_EPSYLON_FP32, 0.0f },
|
||||
{ -0.75f * BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 0.0f, 0.75f * BGC_EPSYLON_FP32 },
|
||||
{ 0.0f, -0.75f * BGC_EPSYLON_FP32 }
|
||||
{ 0.75f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ -0.75f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 0.0f, 0.75f * BGC_FP32_EPSYLON },
|
||||
{ 0.0f, -0.75f * BGC_FP32_EPSYLON }
|
||||
};
|
||||
|
||||
static const BgcComplexFP32 _TEST_FP32_NONZERO_QUATERION_LIST[] = {
|
||||
static const BGC_FP32_Complex _TEST_FP32_NONZERO_QUATERION_LIST[] = {
|
||||
{ 0.0f, 1.0f },
|
||||
{ 1.25f * BGC_EPSYLON_FP32 },
|
||||
{ -1.25f * BGC_EPSYLON_FP32 },
|
||||
{ 0.0f, 1.25f * BGC_EPSYLON_FP32 },
|
||||
{ 0.0f, -1.25f * BGC_EPSYLON_FP32 },
|
||||
{ 1.25f * BGC_EPSYLON_FP32, 1.25f * BGC_EPSYLON_FP32 },
|
||||
{ -1.25f * BGC_EPSYLON_FP32, -1.25f * BGC_EPSYLON_FP32 }
|
||||
{ 1.25f * BGC_FP32_EPSYLON },
|
||||
{ -1.25f * BGC_FP32_EPSYLON },
|
||||
{ 0.0f, 1.25f * BGC_FP32_EPSYLON },
|
||||
{ 0.0f, -1.25f * BGC_FP32_EPSYLON },
|
||||
{ 1.25f * BGC_FP32_EPSYLON, 1.25f * BGC_FP32_EPSYLON },
|
||||
{ -1.25f * BGC_FP32_EPSYLON, -1.25f * BGC_FP32_EPSYLON }
|
||||
};
|
||||
|
||||
void test_complex_is_zero_fp32()
|
||||
{
|
||||
print_testing_name("bgc_complex_is_zero_fp32");
|
||||
print_testing_name("bgc_fp32_complex_is_zero");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP32_ZERO_COMPLEX_AMOUNT; i++) {
|
||||
if (!bgc_complex_is_zero_fp32(&_TEST_FP32_ZERO_COMPLEX_LIST[i])) {
|
||||
if (!bgc_fp32_complex_is_zero(&_TEST_FP32_ZERO_COMPLEX_LIST[i])) {
|
||||
print_testing_error("A zero complex number was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ void test_complex_is_zero_fp32()
|
|||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP32_NONZERO_COMPLEX_AMOUNT; i++) {
|
||||
if (bgc_complex_is_zero_fp32(&_TEST_FP32_NONZERO_QUATERION_LIST[i])) {
|
||||
if (bgc_fp32_complex_is_zero(&_TEST_FP32_NONZERO_QUATERION_LIST[i])) {
|
||||
print_testing_error("A non-zero complex number was recognized as a zero complex number");
|
||||
return;
|
||||
}
|
||||
|
|
@ -53,31 +53,31 @@ void test_complex_is_zero_fp32()
|
|||
static const int _TEST_FP64_ZERO_COMPLEX_AMOUNT = 4;
|
||||
static const int _TEST_FP64_NONZERO_COMPLEX_AMOUNT = 7;
|
||||
|
||||
static const BgcComplexFP64 _TEST_FP64_ZERO_COMPLEX_LIST[] = {
|
||||
static const BGC_FP64_Complex _TEST_FP64_ZERO_COMPLEX_LIST[] = {
|
||||
{ 0.0, 0.0 },
|
||||
{ 0.75 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ -0.75 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 0.0, 0.75 * BGC_EPSYLON_FP64 },
|
||||
{ 0.0, -0.75 * BGC_EPSYLON_FP64 }
|
||||
{ 0.75 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ -0.75 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 0.0, 0.75 * BGC_FP64_EPSYLON },
|
||||
{ 0.0, -0.75 * BGC_FP64_EPSYLON }
|
||||
};
|
||||
|
||||
static const BgcComplexFP64 _TEST_FP64_NONZERO_QUATERION_LIST[] = {
|
||||
static const BGC_FP64_Complex _TEST_FP64_NONZERO_QUATERION_LIST[] = {
|
||||
{ 0.0, 1.0 },
|
||||
{ 1.25 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ -1.25 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 0.0, 1.25 * BGC_EPSYLON_FP64 },
|
||||
{ 0.0, -1.25 * BGC_EPSYLON_FP64 },
|
||||
{ 1.25 * BGC_EPSYLON_FP64, 1.25 * BGC_EPSYLON_FP64 },
|
||||
{ -1.25 * BGC_EPSYLON_FP64, -1.25 * BGC_EPSYLON_FP64 }
|
||||
{ 1.25 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ -1.25 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 0.0, 1.25 * BGC_FP64_EPSYLON },
|
||||
{ 0.0, -1.25 * BGC_FP64_EPSYLON },
|
||||
{ 1.25 * BGC_FP64_EPSYLON, 1.25 * BGC_FP64_EPSYLON },
|
||||
{ -1.25 * BGC_FP64_EPSYLON, -1.25 * BGC_FP64_EPSYLON }
|
||||
};
|
||||
|
||||
void test_complex_is_zero_fp64()
|
||||
{
|
||||
print_testing_name("bgc_complex_is_zero_fp64");
|
||||
print_testing_name("bgc_fp64_complex_is_zero");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP64_ZERO_COMPLEX_AMOUNT; i++) {
|
||||
if (!bgc_complex_is_zero_fp64(&_TEST_FP64_ZERO_COMPLEX_LIST[i])) {
|
||||
if (!bgc_fp64_complex_is_zero(&_TEST_FP64_ZERO_COMPLEX_LIST[i])) {
|
||||
print_testing_error("A zero complex number was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -85,7 +85,7 @@ void test_complex_is_zero_fp64()
|
|||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP64_NONZERO_COMPLEX_AMOUNT; i++) {
|
||||
if (bgc_complex_is_zero_fp64(&_TEST_FP64_NONZERO_QUATERION_LIST[i])) {
|
||||
if (bgc_fp64_complex_is_zero(&_TEST_FP64_NONZERO_QUATERION_LIST[i])) {
|
||||
print_testing_error("A non-zero complex number was recognized as a zero complex number");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
static const int _TEST_FP32_COMPLEX_AMOUNT = 4;
|
||||
|
||||
static const BgcComplexFP32 _TEST_FP32_COMPLEX_LIST[] = {
|
||||
static const BGC_FP32_Complex _TEST_FP32_COMPLEX_LIST[] = {
|
||||
{ 4.0f, 3.0f },
|
||||
{ -1.0f, 1.0f },
|
||||
{ 100.0f, -100.0f },
|
||||
|
|
@ -29,10 +29,10 @@ static const float _TEST_FP32_MODULUS_LIST[] = {
|
|||
|
||||
void test_complex_square_modulus_fp32()
|
||||
{
|
||||
print_testing_name("bgc_complex_get_square_modulus_fp32");
|
||||
print_testing_name("bgc_fp32_complex_get_square_modulus");
|
||||
|
||||
for (int i = 0; i < _TEST_FP32_COMPLEX_AMOUNT; i++) {
|
||||
if (!bgc_are_close_fp32(bgc_complex_get_square_modulus_fp32(&_TEST_FP32_COMPLEX_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) {
|
||||
if (!bgc_fp32_are_close(bgc_fp32_complex_get_square_modulus(&_TEST_FP32_COMPLEX_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return;
|
||||
}
|
||||
|
|
@ -43,10 +43,10 @@ void test_complex_square_modulus_fp32()
|
|||
|
||||
void test_complex_modulus_fp32()
|
||||
{
|
||||
print_testing_name("bgc_complex_get_modulus_fp32");
|
||||
print_testing_name("bgc_fp32_complex_get_modulus");
|
||||
|
||||
for (int i = 0; i < _TEST_FP32_COMPLEX_AMOUNT; i++) {
|
||||
if (!bgc_are_close_fp32(bgc_complex_get_modulus_fp32(&_TEST_FP32_COMPLEX_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) {
|
||||
if (!bgc_fp32_are_close(bgc_fp32_complex_get_modulus(&_TEST_FP32_COMPLEX_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return;
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ void test_complex_modulus_fp32()
|
|||
|
||||
static const int _TEST_FP64_COMPLEX_AMOUNT = 4;
|
||||
|
||||
static const BgcComplexFP64 _TEST_FP64_COMPLEX_LIST[] = {
|
||||
static const BGC_FP64_Complex _TEST_FP64_COMPLEX_LIST[] = {
|
||||
{ 4.0, 3.0 },
|
||||
{ -1.0, -1.0 },
|
||||
{ -100.0, 100.0 },
|
||||
|
|
@ -82,10 +82,10 @@ static const double _TEST_FP64_MODULUS_LIST[] = {
|
|||
|
||||
void test_complex_square_modulus_fp64()
|
||||
{
|
||||
print_testing_name("bgc_complex_get_square_modulus_fp64");
|
||||
print_testing_name("bgc_fp64_complex_get_square_modulus");
|
||||
|
||||
for (int i = 0; i < _TEST_FP64_COMPLEX_AMOUNT; i++) {
|
||||
if (!bgc_are_close_fp64(bgc_complex_get_square_modulus_fp64(&_TEST_FP64_COMPLEX_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) {
|
||||
if (!bgc_fp64_are_close(bgc_fp64_complex_get_square_modulus(&_TEST_FP64_COMPLEX_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return;
|
||||
}
|
||||
|
|
@ -96,10 +96,10 @@ void test_complex_square_modulus_fp64()
|
|||
|
||||
void test_complex_modulus_fp64()
|
||||
{
|
||||
print_testing_name("bgc_complex_get_modulus_fp64");
|
||||
print_testing_name("bgc_fp64_complex_get_modulus");
|
||||
|
||||
for (int i = 0; i < _TEST_FP64_COMPLEX_AMOUNT; i++) {
|
||||
if (!bgc_are_close_fp64(bgc_complex_get_modulus_fp64(&_TEST_FP64_COMPLEX_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) {
|
||||
if (!bgc_fp64_are_close(bgc_fp64_complex_get_modulus(&_TEST_FP64_COMPLEX_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
void test_complex_reset_fp32()
|
||||
{
|
||||
BgcComplexFP32 vector;
|
||||
BGC_FP32_Complex vector;
|
||||
|
||||
print_testing_name("bgc_complex_reset_fp32");
|
||||
print_testing_name("bgc_fp32_complex_reset");
|
||||
|
||||
bgc_complex_reset_fp32(&vector);
|
||||
bgc_fp32_complex_reset(&vector);
|
||||
|
||||
if (vector.real != 0.0f || vector.imaginary != 0.0f) {
|
||||
print_testing_failed();
|
||||
|
|
@ -20,11 +20,11 @@ void test_complex_reset_fp32()
|
|||
|
||||
void test_complex_reset_fp64()
|
||||
{
|
||||
BgcComplexFP64 vector;
|
||||
BGC_FP64_Complex vector;
|
||||
|
||||
print_testing_name("bgc_complex_reset_fp64");
|
||||
print_testing_name("bgc_fp64_complex_reset");
|
||||
|
||||
bgc_complex_reset_fp64(&vector);
|
||||
bgc_fp64_complex_reset(&vector);
|
||||
|
||||
if (vector.real != 0.0 || vector.imaginary != 0.0) {
|
||||
print_testing_failed();
|
||||
|
|
|
|||
|
|
@ -8,25 +8,25 @@
|
|||
|
||||
void test_complex_set_values_fp32()
|
||||
{
|
||||
BgcComplexFP32 vector;
|
||||
BGC_FP32_Complex vector;
|
||||
|
||||
print_testing_name("bgc_complex_set_values_fp32");
|
||||
print_testing_name("bgc_fp32_complex_make");
|
||||
|
||||
bgc_complex_set_values_fp32(1.0f, 2.0f, &vector);
|
||||
bgc_fp32_complex_make(1.0f, 2.0f, &vector);
|
||||
|
||||
if (vector.real != 1.0f || vector.imaginary != 2.0f) {
|
||||
print_testing_error("First step failed");
|
||||
return;
|
||||
}
|
||||
|
||||
bgc_complex_set_values_fp32(-1.0f, -3.0f, &vector);
|
||||
bgc_fp32_complex_make(-1.0f, -3.0f, &vector);
|
||||
|
||||
if (vector.real != -1.0f || vector.imaginary != -3.0f) {
|
||||
print_testing_error("Second step failed");
|
||||
return;
|
||||
}
|
||||
|
||||
bgc_complex_set_values_fp32(-8.0f, -2.0f, &vector);
|
||||
bgc_fp32_complex_make(-8.0f, -2.0f, &vector);
|
||||
|
||||
if (vector.real != -8.0f || vector.imaginary != -2.0f) {
|
||||
print_testing_error("Third step failed");
|
||||
|
|
@ -40,25 +40,25 @@ void test_complex_set_values_fp32()
|
|||
|
||||
void test_complex_set_values_fp64()
|
||||
{
|
||||
BgcComplexFP64 vector;
|
||||
BGC_FP64_Complex vector;
|
||||
|
||||
print_testing_name("bgc_complex_set_values_fp64");
|
||||
print_testing_name("bgc_fp64_complex_make");
|
||||
|
||||
bgc_complex_set_values_fp64(1.0, 2.0, &vector);
|
||||
bgc_fp64_complex_make(1.0, 2.0, &vector);
|
||||
|
||||
if (vector.real != 1.0 || vector.imaginary != 2.0) {
|
||||
print_testing_error("First step failed");
|
||||
return;
|
||||
}
|
||||
|
||||
bgc_complex_set_values_fp64(-1.0, -3.0, &vector);
|
||||
bgc_fp64_complex_make(-1.0, -3.0, &vector);
|
||||
|
||||
if (vector.real != -1.0 || vector.imaginary != -3.0) {
|
||||
print_testing_error("Second step failed");
|
||||
return;
|
||||
}
|
||||
|
||||
bgc_complex_set_values_fp64(-8.0, -2.0, &vector);
|
||||
bgc_fp64_complex_make(-8.0, -2.0, &vector);
|
||||
|
||||
if (vector.real != -8.0 || vector.imaginary != -2.0) {
|
||||
print_testing_error("Third step failed");
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@
|
|||
|
||||
static const int _TEST_FP32_COMPLEX_AMOUNT = 4;
|
||||
|
||||
static const BgcComplexFP32 _TEST_FP32_COMPLEX_LIST1[] = {
|
||||
static const BGC_FP32_Complex _TEST_FP32_COMPLEX_LIST1[] = {
|
||||
{ 3.0f, 4.0f },
|
||||
{ -2.0f, -1.0f },
|
||||
{ -244.8f, 100.0f },
|
||||
{ 1000.32f, -100.1f }
|
||||
};
|
||||
|
||||
static const BgcComplexFP32 _TEST_FP32_COMPLEX_LIST2[] = {
|
||||
static const BGC_FP32_Complex _TEST_FP32_COMPLEX_LIST2[] = {
|
||||
{ 5.3f, 1003.28f },
|
||||
{ -0.0032f, 891.3f },
|
||||
{ 5.322f, 0.9275f },
|
||||
|
|
@ -24,15 +24,15 @@ static const BgcComplexFP32 _TEST_FP32_COMPLEX_LIST2[] = {
|
|||
|
||||
void test_complex_swap_fp32()
|
||||
{
|
||||
BgcComplexFP32 compleimaginary, complex2;
|
||||
BGC_FP32_Complex compleimaginary, complex2;
|
||||
|
||||
print_testing_name("bgc_complex_swap_fp32");
|
||||
print_testing_name("bgc_fp32_complex_swap");
|
||||
|
||||
for (int i = 0; i < _TEST_FP32_COMPLEX_AMOUNT; i++) {
|
||||
bgc_complex_copy_fp32(&_TEST_FP32_COMPLEX_LIST1[i], &compleimaginary);
|
||||
bgc_complex_copy_fp32(&_TEST_FP32_COMPLEX_LIST2[i], &complex2);
|
||||
bgc_fp32_complex_copy(&_TEST_FP32_COMPLEX_LIST1[i], &compleimaginary);
|
||||
bgc_fp32_complex_copy(&_TEST_FP32_COMPLEX_LIST2[i], &complex2);
|
||||
|
||||
bgc_complex_swap_fp32(&compleimaginary, &complex2);
|
||||
bgc_fp32_complex_swap(&compleimaginary, &complex2);
|
||||
|
||||
if (compleimaginary.real != _TEST_FP32_COMPLEX_LIST2[i].real ||
|
||||
compleimaginary.imaginary != _TEST_FP32_COMPLEX_LIST2[i].imaginary ||
|
||||
|
|
@ -50,14 +50,14 @@ void test_complex_swap_fp32()
|
|||
|
||||
static const int _TEST_FP64_COMPLEX_AMOUNT = 4;
|
||||
|
||||
static const BgcComplexFP64 _TEST_FP64_COMPLEX_LIST1[] = {
|
||||
static const BGC_FP64_Complex _TEST_FP64_COMPLEX_LIST1[] = {
|
||||
{ 1.0, 4.0 },
|
||||
{ -4.0, -3.0 },
|
||||
{ -244.8, 344.7 },
|
||||
{ 1000.32, -271.3 }
|
||||
};
|
||||
|
||||
static const BgcComplexFP64 _TEST_FP64_COMPLEX_LIST2[] = {
|
||||
static const BGC_FP64_Complex _TEST_FP64_COMPLEX_LIST2[] = {
|
||||
{ -0.123, 1003.28 },
|
||||
{ 204.07, -781.89 },
|
||||
{ 5.322, 0.9275 },
|
||||
|
|
@ -66,15 +66,15 @@ static const BgcComplexFP64 _TEST_FP64_COMPLEX_LIST2[] = {
|
|||
|
||||
void test_complex_swap_fp64()
|
||||
{
|
||||
BgcComplexFP64 compleimaginary, complex2;
|
||||
BGC_FP64_Complex compleimaginary, complex2;
|
||||
|
||||
print_testing_name("bgc_complex_swap_fp64");
|
||||
print_testing_name("bgc_fp64_complex_swap");
|
||||
|
||||
for (int i = 0; i < _TEST_FP64_COMPLEX_AMOUNT; i++) {
|
||||
bgc_complex_copy_fp64(&_TEST_FP64_COMPLEX_LIST1[i], &compleimaginary);
|
||||
bgc_complex_copy_fp64(&_TEST_FP64_COMPLEX_LIST2[i], &complex2);
|
||||
bgc_fp64_complex_copy(&_TEST_FP64_COMPLEX_LIST1[i], &compleimaginary);
|
||||
bgc_fp64_complex_copy(&_TEST_FP64_COMPLEX_LIST2[i], &complex2);
|
||||
|
||||
bgc_complex_swap_fp64(&compleimaginary, &complex2);
|
||||
bgc_fp64_complex_swap(&compleimaginary, &complex2);
|
||||
|
||||
if (compleimaginary.real != _TEST_FP64_COMPLEX_LIST2[i].real ||
|
||||
compleimaginary.imaginary != _TEST_FP64_COMPLEX_LIST2[i].imaginary ||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
// ==================== FP32 ==================== //
|
||||
|
||||
static const int _TEST_FP32_QUATERNION_AMOUNT = 4;
|
||||
static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST[] = {
|
||||
static const BGC_FP32_Quaternion _TEST_FP32_QUATERNION_LIST[] = {
|
||||
{ 1.0f, 2.0f, 3.0f, 4.0f },
|
||||
{ -4.0f, -3.0f, -2.0f, -1.0f },
|
||||
{ -0.001f, 100.0f, -100.0f, 0.001f },
|
||||
|
|
@ -16,13 +16,13 @@ static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST[] = {
|
|||
|
||||
void test_quaternion_copy_fp32()
|
||||
{
|
||||
BgcQuaternionFP32 vector;
|
||||
BGC_FP32_Quaternion vector;
|
||||
|
||||
print_testing_name("bgc_quaternion_copy_fp32");
|
||||
print_testing_name("bgc_fp32_quaternion_copy");
|
||||
|
||||
for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) {
|
||||
|
||||
bgc_quaternion_copy_fp32(&_TEST_FP32_QUATERNION_LIST[i], &vector);
|
||||
bgc_fp32_quaternion_copy(&_TEST_FP32_QUATERNION_LIST[i], &vector);
|
||||
|
||||
if (vector.s0 != _TEST_FP32_QUATERNION_LIST[i].s0 ||
|
||||
vector.x1 != _TEST_FP32_QUATERNION_LIST[i].x1 ||
|
||||
|
|
@ -39,7 +39,7 @@ void test_quaternion_copy_fp32()
|
|||
// ==================== FP64 ==================== //
|
||||
|
||||
static const int _TEST_FP64_QUATERNION_AMOUNT = 4;
|
||||
static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST[] = {
|
||||
static const BGC_FP64_Quaternion _TEST_FP64_QUATERNION_LIST[] = {
|
||||
{ 1.0, 2.0, 3.0, 4.0 },
|
||||
{ -4.0, -3.0, -2.0, -1.0 },
|
||||
{ -0.001, 100.0, -100.0, 0.001 },
|
||||
|
|
@ -48,13 +48,13 @@ static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST[] = {
|
|||
|
||||
void test_quaternion_copy_fp64()
|
||||
{
|
||||
BgcQuaternionFP64 vector;
|
||||
BGC_FP64_Quaternion vector;
|
||||
|
||||
print_testing_name("bgc_quaternion_copy_fp64");
|
||||
print_testing_name("bgc_fp64_quaternion_copy");
|
||||
|
||||
for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) {
|
||||
|
||||
bgc_quaternion_copy_fp64(&_TEST_FP64_QUATERNION_LIST[i], &vector);
|
||||
bgc_fp64_quaternion_copy(&_TEST_FP64_QUATERNION_LIST[i], &vector);
|
||||
|
||||
if (vector.s0 != _TEST_FP64_QUATERNION_LIST[i].s0 ||
|
||||
vector.x1 != _TEST_FP64_QUATERNION_LIST[i].x1 ||
|
||||
|
|
|
|||
|
|
@ -7,45 +7,45 @@
|
|||
static const int _TEST_FP32_UNIT_QUATERNION_AMOUNT = 16;
|
||||
static const int _TEST_FP32_NONUNIT_QUATERNION_AMOUNT = 10;
|
||||
|
||||
static const BgcQuaternionFP32 _TEST_FP32_UNIT_QUATERNION_LIST[] = {
|
||||
static const BGC_FP32_Quaternion _TEST_FP32_UNIT_QUATERNION_LIST[] = {
|
||||
{ 1.0f, 0.0f, 0.0f, 0.0f },
|
||||
{ -1.0f, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, -0.8f, 0.6f, 0.0f },
|
||||
{ 1.0f + 0.75f * 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.75f * 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.75f * 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.75f * BGC_EPSYLON_FP32 },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32 },
|
||||
{ 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
|
||||
{ 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
|
||||
{ 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON },
|
||||
{ 0.5f, 0.5f, 0.5f, 0.5f },
|
||||
{ 0.5f + 0.75f * BGC_EPSYLON_FP32, 0.5f, 0.5f, 0.5f },
|
||||
{ 0.5f, 0.5f - 0.75f * BGC_EPSYLON_FP32, 0.5f, 0.5f },
|
||||
{ 0.5f, 0.5f, 0.5f + 0.75f * BGC_EPSYLON_FP32, 0.5f },
|
||||
{ 0.5f, 0.5f, 0.5f, 0.5f - 0.75f * BGC_EPSYLON_FP32 }
|
||||
{ 0.5f + 0.75f * BGC_FP32_EPSYLON, 0.5f, 0.5f, 0.5f },
|
||||
{ 0.5f, 0.5f - 0.75f * BGC_FP32_EPSYLON, 0.5f, 0.5f },
|
||||
{ 0.5f, 0.5f, 0.5f + 0.75f * BGC_FP32_EPSYLON, 0.5f },
|
||||
{ 0.5f, 0.5f, 0.5f, 0.5f - 0.75f * BGC_FP32_EPSYLON }
|
||||
};
|
||||
|
||||
static const BgcQuaternionFP32 _TEST_FP32_NONUNIT_QUATERION_LIST[] = {
|
||||
{ 1.0f + 1.25f * 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 + 1.25f * 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 + 1.25f * 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 + 1.25f * BGC_EPSYLON_FP32 },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32 },
|
||||
{ 0.5f + 1.25f * BGC_EPSYLON_FP32, 0.5f + 1.25f * BGC_EPSYLON_FP32, 0.5f, 0.5f },
|
||||
{ 0.5f - 1.25f * BGC_EPSYLON_FP32, 0.5f - 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.5f }
|
||||
static const BGC_FP32_Quaternion _TEST_FP32_NONUNIT_QUATERION_LIST[] = {
|
||||
{ 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
|
||||
{ 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
|
||||
{ 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON },
|
||||
{ 0.5f + 1.25f * BGC_FP32_EPSYLON, 0.5f + 1.25f * BGC_FP32_EPSYLON, 0.5f, 0.5f },
|
||||
{ 0.5f - 1.25f * BGC_FP32_EPSYLON, 0.5f - 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.5f }
|
||||
};
|
||||
|
||||
void test_quaternion_is_unit_fp32()
|
||||
{
|
||||
print_testing_name("bgc_quaternion_is_unit_fp32");
|
||||
print_testing_name("bgc_fp32_quaternion_is_unit");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP32_UNIT_QUATERNION_AMOUNT; i++) {
|
||||
if (!bgc_quaternion_is_unit_fp32(&_TEST_FP32_UNIT_QUATERNION_LIST[i])) {
|
||||
if (!bgc_fp32_quaternion_is_unit(&_TEST_FP32_UNIT_QUATERNION_LIST[i])) {
|
||||
print_testing_error("A unit quaternion was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ void test_quaternion_is_unit_fp32()
|
|||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP32_NONUNIT_QUATERNION_AMOUNT; i++) {
|
||||
if (bgc_quaternion_is_unit_fp32(&_TEST_FP32_NONUNIT_QUATERION_LIST[i])) {
|
||||
if (bgc_fp32_quaternion_is_unit(&_TEST_FP32_NONUNIT_QUATERION_LIST[i])) {
|
||||
print_testing_error("A non-unit quaternion was recognized a unit quaternion");
|
||||
return;
|
||||
}
|
||||
|
|
@ -67,45 +67,45 @@ void test_quaternion_is_unit_fp32()
|
|||
static const int _TEST_FP64_UNIT_QUATERNION_AMOUNT = 16;
|
||||
static const int _TEST_FP64_NONUNIT_QUATERNION_AMOUNT = 10;
|
||||
|
||||
static const BgcQuaternionFP64 _TEST_FP64_UNIT_QUATERNION_LIST[] = {
|
||||
static const BGC_FP64_Quaternion _TEST_FP64_UNIT_QUATERNION_LIST[] = {
|
||||
{ 1.0, 0.0, 0.0, 0.0 },
|
||||
{ -1.0, 0.0, 0.0, 0.0 },
|
||||
{ 0.0, -0.6, 0.8, 0.0 },
|
||||
{ 1.0 + 0.75 * 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.75 * 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.75 * 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.75 * BGC_EPSYLON_FP64 },
|
||||
{ 0.0, 0.0, 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64 },
|
||||
{ 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
|
||||
{ 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
|
||||
{ 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 },
|
||||
{ 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 },
|
||||
{ 0.0, 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 0.0, 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 0.0, 0.0, 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON },
|
||||
{ 0.0, 0.0, 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON },
|
||||
{ 0.5, 0.5, 0.5, 0.5 },
|
||||
{ 0.5 + 0.75 * BGC_EPSYLON_FP64, 0.5, 0.5, 0.5 },
|
||||
{ 0.5, 0.5 - 0.75 * BGC_EPSYLON_FP64, 0.5, 0.5 },
|
||||
{ 0.5, 0.5, 0.5 + 0.75 * BGC_EPSYLON_FP64, 0.5 },
|
||||
{ 0.5, 0.5, 0.5, 0.5 - 0.75 * BGC_EPSYLON_FP64 }
|
||||
{ 0.5 + 0.75 * BGC_FP64_EPSYLON, 0.5, 0.5, 0.5 },
|
||||
{ 0.5, 0.5 - 0.75 * BGC_FP64_EPSYLON, 0.5, 0.5 },
|
||||
{ 0.5, 0.5, 0.5 + 0.75 * BGC_FP64_EPSYLON, 0.5 },
|
||||
{ 0.5, 0.5, 0.5, 0.5 - 0.75 * BGC_FP64_EPSYLON }
|
||||
};
|
||||
|
||||
static const BgcQuaternionFP64 _TEST_FP64_NONUNIT_QUATERION_LIST[] = {
|
||||
{ 1.0 + 1.25 * 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 + 1.25 * 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 + 1.25 * 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 + 1.25 * BGC_EPSYLON_FP64 },
|
||||
{ 0.0, 0.0, 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64 },
|
||||
{ 0.5 + 1.25 * BGC_EPSYLON_FP64, 0.5 + 1.25 * BGC_EPSYLON_FP64, 0.5, 0.5 },
|
||||
{ 0.5 - 1.25 * BGC_EPSYLON_FP64, 0.5 - 1.25 * BGC_EPSYLON_FP64, 0.0, 0.5 }
|
||||
static const BGC_FP64_Quaternion _TEST_FP64_NONUNIT_QUATERION_LIST[] = {
|
||||
{ 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
|
||||
{ 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
|
||||
{ 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
|
||||
{ 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
|
||||
{ 0.0, 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 0.0, 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 0.0, 0.0, 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON },
|
||||
{ 0.0, 0.0, 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON },
|
||||
{ 0.5 + 1.25 * BGC_FP64_EPSYLON, 0.5 + 1.25 * BGC_FP64_EPSYLON, 0.5, 0.5 },
|
||||
{ 0.5 - 1.25 * BGC_FP64_EPSYLON, 0.5 - 1.25 * BGC_FP64_EPSYLON, 0.0, 0.5 }
|
||||
};
|
||||
|
||||
void test_quaternion_is_unit_fp64()
|
||||
{
|
||||
print_testing_name("bgc_quaternion_is_unit_fp64");
|
||||
print_testing_name("bgc_fp64_quaternion_is_unit");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP64_UNIT_QUATERNION_AMOUNT; i++) {
|
||||
if (!bgc_quaternion_is_unit_fp64(&_TEST_FP64_UNIT_QUATERNION_LIST[i])) {
|
||||
if (!bgc_fp64_quaternion_is_unit(&_TEST_FP64_UNIT_QUATERNION_LIST[i])) {
|
||||
print_testing_error("A unit quaternion was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -113,7 +113,7 @@ void test_quaternion_is_unit_fp64()
|
|||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP64_NONUNIT_QUATERNION_AMOUNT; i++) {
|
||||
if (bgc_quaternion_is_unit_fp64(&_TEST_FP64_NONUNIT_QUATERION_LIST[i])) {
|
||||
if (bgc_fp64_quaternion_is_unit(&_TEST_FP64_NONUNIT_QUATERION_LIST[i])) {
|
||||
print_testing_error("A non-unit quaternion was recognized a unit quaternion");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,39 +7,39 @@
|
|||
static const int _TEST_FP32_ZERO_QUATERNION_AMOUNT = 9;
|
||||
static const int _TEST_FP32_NONZERO_QUATERNION_AMOUNT = 11;
|
||||
|
||||
static const BgcQuaternionFP32 _TEST_FP32_ZERO_QUATERNION_LIST[] = {
|
||||
static const BGC_FP32_Quaternion _TEST_FP32_ZERO_QUATERNION_LIST[] = {
|
||||
{ 0.0f, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
|
||||
{ -0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
|
||||
{ 0.0f, -0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.75f * BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 0.0f, 0.0f, -0.75f * BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 0.75f * BGC_EPSYLON_FP32 },
|
||||
{ 0.0f, 0.0f, 0.0f, -0.75f * BGC_EPSYLON_FP32 }
|
||||
{ 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
|
||||
{ -0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
|
||||
{ 0.0f, -0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.75f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 0.0f, 0.0f, -0.75f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 0.75f * BGC_FP32_EPSYLON },
|
||||
{ 0.0f, 0.0f, 0.0f, -0.75f * BGC_FP32_EPSYLON }
|
||||
};
|
||||
|
||||
static const BgcQuaternionFP32 _TEST_FP32_NONZERO_QUATERION_LIST[] = {
|
||||
static const BGC_FP32_Quaternion _TEST_FP32_NONZERO_QUATERION_LIST[] = {
|
||||
{ 0.0f, 1.0f, 0.0f, 0.0f },
|
||||
{ 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
|
||||
{ -1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
|
||||
{ 0.0f, -1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.25f * BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 0.0f, 0.0f, -1.25f * BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.25f * BGC_EPSYLON_FP32 },
|
||||
{ 0.0f, 0.0f, 0.0f, -1.25f * BGC_EPSYLON_FP32 },
|
||||
{ 1.25f * BGC_EPSYLON_FP32, 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
|
||||
{ -1.25f * BGC_EPSYLON_FP32, -1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }
|
||||
{ 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
|
||||
{ -1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
|
||||
{ 0.0f, -1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.25f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 0.0f, 0.0f, -1.25f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.25f * BGC_FP32_EPSYLON },
|
||||
{ 0.0f, 0.0f, 0.0f, -1.25f * BGC_FP32_EPSYLON },
|
||||
{ 1.25f * BGC_FP32_EPSYLON, 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
|
||||
{ -1.25f * BGC_FP32_EPSYLON, -1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f }
|
||||
};
|
||||
|
||||
void test_quaternion_is_zero_fp32()
|
||||
{
|
||||
print_testing_name("bgc_quaternion_is_zero_fp32");
|
||||
print_testing_name("bgc_fp32_quaternion_is_zero");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP32_ZERO_QUATERNION_AMOUNT; i++) {
|
||||
if (!bgc_quaternion_is_zero_fp32(&_TEST_FP32_ZERO_QUATERNION_LIST[i])) {
|
||||
if (!bgc_fp32_quaternion_is_zero(&_TEST_FP32_ZERO_QUATERNION_LIST[i])) {
|
||||
print_testing_error("A zero quaternion was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -47,7 +47,7 @@ void test_quaternion_is_zero_fp32()
|
|||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP32_NONZERO_QUATERNION_AMOUNT; i++) {
|
||||
if (bgc_quaternion_is_zero_fp32(&_TEST_FP32_NONZERO_QUATERION_LIST[i])) {
|
||||
if (bgc_fp32_quaternion_is_zero(&_TEST_FP32_NONZERO_QUATERION_LIST[i])) {
|
||||
print_testing_error("A non-zero quaternion was recognized as a zero quaternion");
|
||||
return;
|
||||
}
|
||||
|
|
@ -61,39 +61,39 @@ void test_quaternion_is_zero_fp32()
|
|||
static const int _TEST_FP64_ZERO_QUATERNION_AMOUNT = 9;
|
||||
static const int _TEST_FP64_NONZERO_QUATERNION_AMOUNT = 11;
|
||||
|
||||
static const BgcQuaternionFP64 _TEST_FP64_ZERO_QUATERNION_LIST[] = {
|
||||
static const BGC_FP64_Quaternion _TEST_FP64_ZERO_QUATERNION_LIST[] = {
|
||||
{ 0.0, 0.0, 0.0, 0.0 },
|
||||
{ 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
|
||||
{ -0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
|
||||
{ 0.0, 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 },
|
||||
{ 0.0, -0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 },
|
||||
{ 0.0, 0.0, 0.75 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 0.0, 0.0, -0.75 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 0.0, 0.0, 0.0, 0.75 * BGC_EPSYLON_FP64 },
|
||||
{ 0.0, 0.0, 0.0, -0.75 * BGC_EPSYLON_FP64 }
|
||||
{ 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
|
||||
{ -0.75 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
|
||||
{ 0.0, 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 },
|
||||
{ 0.0, -0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 },
|
||||
{ 0.0, 0.0, 0.75 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 0.0, 0.0, -0.75 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 0.0, 0.0, 0.0, 0.75 * BGC_FP64_EPSYLON },
|
||||
{ 0.0, 0.0, 0.0, -0.75 * BGC_FP64_EPSYLON }
|
||||
};
|
||||
|
||||
static const BgcQuaternionFP64 _TEST_FP64_NONZERO_QUATERION_LIST[] = {
|
||||
static const BGC_FP64_Quaternion _TEST_FP64_NONZERO_QUATERION_LIST[] = {
|
||||
{ 0.0, 1.0, 0.0, 0.0 },
|
||||
{ 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
|
||||
{ -1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
|
||||
{ 0.0, 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 },
|
||||
{ 0.0, -1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 },
|
||||
{ 0.0, 0.0, 1.25 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 0.0, 0.0, -1.25 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 0.0, 0.0, 0.0, 1.25 * BGC_EPSYLON_FP64 },
|
||||
{ 0.0, 0.0, 0.0, -1.25 * BGC_EPSYLON_FP64 },
|
||||
{ 1.25 * BGC_EPSYLON_FP64, 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 },
|
||||
{ -1.25 * BGC_EPSYLON_FP64, -1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }
|
||||
{ 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
|
||||
{ -1.25 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
|
||||
{ 0.0, 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
|
||||
{ 0.0, -1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
|
||||
{ 0.0, 0.0, 1.25 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 0.0, 0.0, -1.25 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 0.0, 0.0, 0.0, 1.25 * BGC_FP64_EPSYLON },
|
||||
{ 0.0, 0.0, 0.0, -1.25 * BGC_FP64_EPSYLON },
|
||||
{ 1.25 * BGC_FP64_EPSYLON, 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
|
||||
{ -1.25 * BGC_FP64_EPSYLON, -1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 }
|
||||
};
|
||||
|
||||
void test_quaternion_is_zero_fp64()
|
||||
{
|
||||
print_testing_name("bgc_quaternion_is_zero_fp64");
|
||||
print_testing_name("bgc_fp64_quaternion_is_zero");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP64_ZERO_QUATERNION_AMOUNT; i++) {
|
||||
if (!bgc_quaternion_is_zero_fp64(&_TEST_FP64_ZERO_QUATERNION_LIST[i])) {
|
||||
if (!bgc_fp64_quaternion_is_zero(&_TEST_FP64_ZERO_QUATERNION_LIST[i])) {
|
||||
print_testing_error("A zero quaternion was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ void test_quaternion_is_zero_fp64()
|
|||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP64_NONZERO_QUATERNION_AMOUNT; i++) {
|
||||
if (bgc_quaternion_is_zero_fp64(&_TEST_FP64_NONZERO_QUATERION_LIST[i])) {
|
||||
if (bgc_fp64_quaternion_is_zero(&_TEST_FP64_NONZERO_QUATERION_LIST[i])) {
|
||||
print_testing_error("A non-zero quaternion was recognized as a zero quaternion");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
static const int _TEST_FP32_QUATERNION_AMOUNT = 4;
|
||||
|
||||
static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST[] = {
|
||||
static const BGC_FP32_Quaternion _TEST_FP32_QUATERNION_LIST[] = {
|
||||
{ 0.0f, 4.0f, 3.0f, 0.0f },
|
||||
{ -1.0f, 1.0f, -1.0f, 1.0f },
|
||||
{ 100.0f, -100.0f, 0.0f, 100.0f },
|
||||
|
|
@ -29,10 +29,10 @@ static const float _TEST_FP32_MODULUS_LIST[] = {
|
|||
|
||||
void test_quaternion_square_modulus_fp32()
|
||||
{
|
||||
print_testing_name("bgc_quaternion_get_square_modulus_fp32");
|
||||
print_testing_name("bgc_fp32_quaternion_get_square_modulus");
|
||||
|
||||
for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) {
|
||||
if (!bgc_are_close_fp32(bgc_quaternion_get_square_modulus_fp32(&_TEST_FP32_QUATERNION_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) {
|
||||
if (!bgc_fp32_are_close(bgc_fp32_quaternion_get_square_modulus(&_TEST_FP32_QUATERNION_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return;
|
||||
}
|
||||
|
|
@ -43,10 +43,10 @@ void test_quaternion_square_modulus_fp32()
|
|||
|
||||
void test_quaternion_modulus_fp32()
|
||||
{
|
||||
print_testing_name("bgc_quaternion_get_modulus_fp32");
|
||||
print_testing_name("bgc_fp32_quaternion_get_modulus");
|
||||
|
||||
for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) {
|
||||
if (!bgc_are_close_fp32(bgc_quaternion_get_modulus_fp32(&_TEST_FP32_QUATERNION_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) {
|
||||
if (!bgc_fp32_are_close(bgc_fp32_quaternion_get_modulus(&_TEST_FP32_QUATERNION_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return;
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ void test_quaternion_modulus_fp32()
|
|||
|
||||
static const int _TEST_FP64_QUATERNION_AMOUNT = 4;
|
||||
|
||||
static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST[] = {
|
||||
static const BGC_FP64_Quaternion _TEST_FP64_QUATERNION_LIST[] = {
|
||||
{ 0.0, 4.0, 3.0, 0.0 },
|
||||
{ -1.0, 1.0, -1.0, 1.0 },
|
||||
{ 100.0, -100.0, 0.0, 100.0 },
|
||||
|
|
@ -82,10 +82,10 @@ static const double _TEST_FP64_MODULUS_LIST[] = {
|
|||
|
||||
void test_quaternion_square_modulus_fp64()
|
||||
{
|
||||
print_testing_name("bgc_quaternion_get_square_modulus_fp64");
|
||||
print_testing_name("bgc_fp64_quaternion_get_square_modulus");
|
||||
|
||||
for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) {
|
||||
if (!bgc_are_close_fp64(bgc_quaternion_get_square_modulus_fp64(&_TEST_FP64_QUATERNION_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) {
|
||||
if (!bgc_fp64_are_close(bgc_fp64_quaternion_get_square_modulus(&_TEST_FP64_QUATERNION_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return;
|
||||
}
|
||||
|
|
@ -96,10 +96,10 @@ void test_quaternion_square_modulus_fp64()
|
|||
|
||||
void test_quaternion_modulus_fp64()
|
||||
{
|
||||
print_testing_name("bgc_quaternion_get_modulus_fp64");
|
||||
print_testing_name("bgc_fp64_quaternion_get_modulus");
|
||||
|
||||
for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) {
|
||||
if (!bgc_are_close_fp64(bgc_quaternion_get_modulus_fp64(&_TEST_FP64_QUATERNION_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) {
|
||||
if (!bgc_fp64_are_close(bgc_fp64_quaternion_get_modulus(&_TEST_FP64_QUATERNION_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
void test_quaternion_reset_fp32()
|
||||
{
|
||||
BgcQuaternionFP32 vector;
|
||||
BGC_FP32_Quaternion vector;
|
||||
|
||||
print_testing_name("bgc_quaternion_reset_fp32");
|
||||
print_testing_name("bgc_fp32_quaternion_reset");
|
||||
|
||||
bgc_quaternion_reset_fp32(&vector);
|
||||
bgc_fp32_quaternion_reset(&vector);
|
||||
|
||||
if (vector.s0 != 0.0f || vector.x1 != 0.0f || vector.x2 != 0.0f || vector.x3 != 0.0f) {
|
||||
print_testing_failed();
|
||||
|
|
@ -20,11 +20,11 @@ void test_quaternion_reset_fp32()
|
|||
|
||||
void test_quaternion_reset_fp64()
|
||||
{
|
||||
BgcQuaternionFP64 vector;
|
||||
BGC_FP64_Quaternion vector;
|
||||
|
||||
print_testing_name("bgc_quaternion_reset_fp64");
|
||||
print_testing_name("bgc_fp64_quaternion_reset");
|
||||
|
||||
bgc_quaternion_reset_fp64(&vector);
|
||||
bgc_fp64_quaternion_reset(&vector);
|
||||
|
||||
if (vector.s0 != 0.0 || vector.x1 != 0.0 || vector.x2 != 0.0 || vector.x3 != 0.0) {
|
||||
print_testing_failed();
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
#include "./../../helpers.h"
|
||||
|
||||
void test_quaternion_set_to_identity_fp32()
|
||||
void test_quaternion_make_unit_fp32()
|
||||
{
|
||||
BgcQuaternionFP32 vector;
|
||||
BGC_FP32_Quaternion vector;
|
||||
|
||||
print_testing_name("bgc_quaternion_set_to_identity_fp32");
|
||||
print_testing_name("bgc_fp32_quaternion_make_unit");
|
||||
|
||||
bgc_quaternion_make_unit_fp32(&vector);
|
||||
bgc_fp32_quaternion_make_unit(&vector);
|
||||
|
||||
if (vector.s0 != 1.0f || vector.x1 != 0.0f || vector.x2 != 0.0f || vector.x3 != 0.0f) {
|
||||
print_testing_failed();
|
||||
|
|
@ -18,13 +18,13 @@ void test_quaternion_set_to_identity_fp32()
|
|||
print_testing_success();
|
||||
}
|
||||
|
||||
void test_quaternion_set_to_identity_fp64()
|
||||
void test_quaternion_make_unit_fp64()
|
||||
{
|
||||
BgcQuaternionFP64 vector;
|
||||
BGC_FP64_Quaternion vector;
|
||||
|
||||
print_testing_name("bgc_quaternion_set_to_identity_fp64");
|
||||
print_testing_name("bgc_fp64_quaternion_make_unit");
|
||||
|
||||
bgc_quaternion_make_unit_fp64(&vector);
|
||||
bgc_fp64_quaternion_make_unit(&vector);
|
||||
|
||||
if (vector.s0 != 1.0 || vector.x1 != 0.0 || vector.x2 != 0.0 || vector.x3 != 0.0) {
|
||||
print_testing_failed();
|
||||
|
|
@ -36,6 +36,6 @@ void test_quaternion_set_to_identity_fp64()
|
|||
|
||||
void test_quaternion_set_to_identity()
|
||||
{
|
||||
test_quaternion_set_to_identity_fp32();
|
||||
test_quaternion_set_to_identity_fp64();
|
||||
test_quaternion_make_unit_fp32();
|
||||
test_quaternion_make_unit_fp64();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef _TEST_QUATERNION_SET_TO_IDENTITY_H_
|
||||
#define _TEST_QUATERNION_SET_TO_IDENTITY_H_
|
||||
|
||||
void test_quaternion_set_to_identity_fp32();
|
||||
void test_quaternion_make_unit_fp32();
|
||||
|
||||
void test_quaternion_set_to_identity_fp64();
|
||||
void test_quaternion_make_unit_fp64();
|
||||
|
||||
void test_quaternion_set_to_identity();
|
||||
|
||||
|
|
|
|||
|
|
@ -8,25 +8,25 @@
|
|||
|
||||
void test_quaternion_set_values_fp32()
|
||||
{
|
||||
BgcQuaternionFP32 vector;
|
||||
BGC_FP32_Quaternion vector;
|
||||
|
||||
print_testing_name("bgc_quaternion_set_values_fp32");
|
||||
print_testing_name("bgc_fp32_quaternion_make");
|
||||
|
||||
bgc_quaternion_set_values_fp32(1.0f, 2.0f, 3.0f, 4.0f, &vector);
|
||||
bgc_fp32_quaternion_make(1.0f, 2.0f, 3.0f, 4.0f, &vector);
|
||||
|
||||
if (vector.s0 != 1.0f || vector.x1 != 2.0f || vector.x2 != 3.0f || vector.x3 != 4.0f) {
|
||||
print_testing_error("First step failed");
|
||||
return;
|
||||
}
|
||||
|
||||
bgc_quaternion_set_values_fp32(-1.0f, -3.0f, -5.0f, -7.0f, &vector);
|
||||
bgc_fp32_quaternion_make(-1.0f, -3.0f, -5.0f, -7.0f, &vector);
|
||||
|
||||
if (vector.s0 != -1.0f || vector.x1 != -3.0f || vector.x2 != -5.0f || vector.x3 != -7.0f) {
|
||||
print_testing_error("Second step failed");
|
||||
return;
|
||||
}
|
||||
|
||||
bgc_quaternion_set_values_fp32(-8.0f, -2.0f, 2.0f, 4.0f, &vector);
|
||||
bgc_fp32_quaternion_make(-8.0f, -2.0f, 2.0f, 4.0f, &vector);
|
||||
|
||||
if (vector.s0 != -8.0f || vector.x1 != -2.0f || vector.x2 != 2.0f || vector.x3 != 4.0f) {
|
||||
print_testing_error("Third step failed");
|
||||
|
|
@ -40,25 +40,25 @@ void test_quaternion_set_values_fp32()
|
|||
|
||||
void test_quaternion_set_values_fp64()
|
||||
{
|
||||
BgcQuaternionFP64 vector;
|
||||
BGC_FP64_Quaternion vector;
|
||||
|
||||
print_testing_name("bgc_quaternion_set_values_fp64");
|
||||
print_testing_name("bgc_fp64_quaternion_make");
|
||||
|
||||
bgc_quaternion_set_values_fp64(1.0, 2.0, 3.0, 4.0, &vector);
|
||||
bgc_fp64_quaternion_make(1.0, 2.0, 3.0, 4.0, &vector);
|
||||
|
||||
if (vector.s0 != 1.0 || vector.x1 != 2.0 || vector.x2 != 3.0 || vector.x3 != 4.0) {
|
||||
print_testing_error("First step failed");
|
||||
return;
|
||||
}
|
||||
|
||||
bgc_quaternion_set_values_fp64(-1.0, -3.0, -5.0, -7.0, &vector);
|
||||
bgc_fp64_quaternion_make(-1.0, -3.0, -5.0, -7.0, &vector);
|
||||
|
||||
if (vector.s0 != -1.0 || vector.x1 != -3.0 || vector.x2 != -5.0 || vector.x3 != -7.0) {
|
||||
print_testing_error("Second step failed");
|
||||
return;
|
||||
}
|
||||
|
||||
bgc_quaternion_set_values_fp64(-8.0, -2.0, 2.0, 4.0, &vector);
|
||||
bgc_fp64_quaternion_make(-8.0, -2.0, 2.0, 4.0, &vector);
|
||||
|
||||
if (vector.s0 != -8.0 || vector.x1 != -2.0 || vector.x2 != 2.0 || vector.x3 != 4.0) {
|
||||
print_testing_error("Third step failed");
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@
|
|||
|
||||
static const int _TEST_FP32_QUATERNION_AMOUNT = 4;
|
||||
|
||||
static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST1[] = {
|
||||
static const BGC_FP32_Quaternion _TEST_FP32_QUATERNION_LIST1[] = {
|
||||
{ 1.0f, 2.0f, 3.0f, 4.0f },
|
||||
{ -4.0f, -3.0f, -2.0f, -1.0f },
|
||||
{ -244.8f, 100.0f, -100.0f, 344.7f },
|
||||
{ 1000.32f, -100.1f, 100.2f, -271.3f }
|
||||
};
|
||||
|
||||
static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST2[] = {
|
||||
static const BGC_FP32_Quaternion _TEST_FP32_QUATERNION_LIST2[] = {
|
||||
{ 3.6f, -0.123f, 5.3f, 1003.28f },
|
||||
{ 204.07f, -781.89f, -0.0032f, 891.3f },
|
||||
{ -20.02f, -1.0003f, 5.322f, 0.9275f },
|
||||
|
|
@ -24,15 +24,15 @@ static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST2[] = {
|
|||
|
||||
void test_quaternion_swap_fp32()
|
||||
{
|
||||
BgcQuaternionFP32 quaternion1, quaternion2;
|
||||
BGC_FP32_Quaternion quaternion1, quaternion2;
|
||||
|
||||
print_testing_name("bgc_quaternion_swap_fp32");
|
||||
print_testing_name("bgc_fp32_quaternion_swap");
|
||||
|
||||
for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) {
|
||||
bgc_quaternion_copy_fp32(&_TEST_FP32_QUATERNION_LIST1[i], &quaternion1);
|
||||
bgc_quaternion_copy_fp32(&_TEST_FP32_QUATERNION_LIST2[i], &quaternion2);
|
||||
bgc_fp32_quaternion_copy(&_TEST_FP32_QUATERNION_LIST1[i], &quaternion1);
|
||||
bgc_fp32_quaternion_copy(&_TEST_FP32_QUATERNION_LIST2[i], &quaternion2);
|
||||
|
||||
bgc_quaternion_swap_fp32(&quaternion1, &quaternion2);
|
||||
bgc_fp32_quaternion_swap(&quaternion1, &quaternion2);
|
||||
|
||||
if (quaternion1.s0 != _TEST_FP32_QUATERNION_LIST2[i].s0 ||
|
||||
quaternion1.x1 != _TEST_FP32_QUATERNION_LIST2[i].x1 ||
|
||||
|
|
@ -54,14 +54,14 @@ void test_quaternion_swap_fp32()
|
|||
|
||||
static const int _TEST_FP64_QUATERNION_AMOUNT = 4;
|
||||
|
||||
static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST1[] = {
|
||||
static const BGC_FP64_Quaternion _TEST_FP64_QUATERNION_LIST1[] = {
|
||||
{ 1.0, 2.0, 3.0, 4.0 },
|
||||
{ -4.0, -3.0, -2.0, -1.0 },
|
||||
{ -244.8, 100.0, -100.0, 344.7 },
|
||||
{ 1000.32, -100.1, 100.2, -271.3 }
|
||||
};
|
||||
|
||||
static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST2[] = {
|
||||
static const BGC_FP64_Quaternion _TEST_FP64_QUATERNION_LIST2[] = {
|
||||
{ 3.6, -0.123, 5.3, 1003.28 },
|
||||
{ 204.07, -781.89, -0.0032, 891.3 },
|
||||
{ -20.02, -1.0003, 5.322, 0.9275 },
|
||||
|
|
@ -70,15 +70,15 @@ static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST2[] = {
|
|||
|
||||
void test_quaternion_swap_fp64()
|
||||
{
|
||||
BgcQuaternionFP64 quaternion1, quaternion2;
|
||||
BGC_FP64_Quaternion quaternion1, quaternion2;
|
||||
|
||||
print_testing_name("bgc_quaternion_swap_fp64");
|
||||
print_testing_name("bgc_fp64_quaternion_swap");
|
||||
|
||||
for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) {
|
||||
bgc_quaternion_copy_fp64(&_TEST_FP64_QUATERNION_LIST1[i], &quaternion1);
|
||||
bgc_quaternion_copy_fp64(&_TEST_FP64_QUATERNION_LIST2[i], &quaternion2);
|
||||
bgc_fp64_quaternion_copy(&_TEST_FP64_QUATERNION_LIST1[i], &quaternion1);
|
||||
bgc_fp64_quaternion_copy(&_TEST_FP64_QUATERNION_LIST2[i], &quaternion2);
|
||||
|
||||
bgc_quaternion_swap_fp64(&quaternion1, &quaternion2);
|
||||
bgc_fp64_quaternion_swap(&quaternion1, &quaternion2);
|
||||
|
||||
if (quaternion1.s0 != _TEST_FP64_QUATERNION_LIST2[i].s0 ||
|
||||
quaternion1.x1 != _TEST_FP64_QUATERNION_LIST2[i].x1 ||
|
||||
|
|
|
|||
|
|
@ -12,22 +12,22 @@ static const TestNumberPairFP32 _TEST_FP32_DATA_CLOSE[] = {
|
|||
{1.0f, 1.0f},
|
||||
{-1.0f, -1.0f},
|
||||
|
||||
{-0.4f * BGC_EPSYLON_FP32, 0.4f * BGC_EPSYLON_FP32},
|
||||
{-0.4f * BGC_FP32_EPSYLON, 0.4f * BGC_FP32_EPSYLON},
|
||||
|
||||
{1.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32},
|
||||
{1.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32},
|
||||
{1.0f + 0.75f * BGC_EPSYLON_FP32, 1.0f},
|
||||
{1.0f - 0.75f * BGC_EPSYLON_FP32, 1.0f},
|
||||
{1.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON},
|
||||
{1.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON},
|
||||
{1.0f + 0.75f * BGC_FP32_EPSYLON, 1.0f},
|
||||
{1.0f - 0.75f * BGC_FP32_EPSYLON, 1.0f},
|
||||
|
||||
{-1.0f, -1.0f + 0.75f * BGC_EPSYLON_FP32},
|
||||
{-1.0f, -1.0f - 0.75f * BGC_EPSYLON_FP32},
|
||||
{-1.0f + 0.75f * BGC_EPSYLON_FP32, -1.0f},
|
||||
{-1.0f - 0.75f * BGC_EPSYLON_FP32, -1.0f},
|
||||
{-1.0f, -1.0f + 0.75f * BGC_FP32_EPSYLON},
|
||||
{-1.0f, -1.0f - 0.75f * BGC_FP32_EPSYLON},
|
||||
{-1.0f + 0.75f * BGC_FP32_EPSYLON, -1.0f},
|
||||
{-1.0f - 0.75f * BGC_FP32_EPSYLON, -1.0f},
|
||||
|
||||
{100.0f, 100.0f * (1.0f + 0.75f * BGC_EPSYLON_FP32)},
|
||||
{100.0f, 100.0f * (1.0f - 0.75f * BGC_EPSYLON_FP32)},
|
||||
{-100.0f, -100.0f * (1.0f + 0.75f * BGC_EPSYLON_FP32)},
|
||||
{-100.0f, -100.0f * (1.0f - 0.75f * BGC_EPSYLON_FP32)}
|
||||
{100.0f, 100.0f * (1.0f + 0.75f * BGC_FP32_EPSYLON)},
|
||||
{100.0f, 100.0f * (1.0f - 0.75f * BGC_FP32_EPSYLON)},
|
||||
{-100.0f, -100.0f * (1.0f + 0.75f * BGC_FP32_EPSYLON)},
|
||||
{-100.0f, -100.0f * (1.0f - 0.75f * BGC_FP32_EPSYLON)}
|
||||
};
|
||||
|
||||
static const TestNumberPairFP32 _TEST_FP32_DATA_DIFFERENT[] = {
|
||||
|
|
@ -35,31 +35,31 @@ static const TestNumberPairFP32 _TEST_FP32_DATA_DIFFERENT[] = {
|
|||
{1.0f, 0.999f},
|
||||
{-1.0f, -0.999f},
|
||||
|
||||
{-0.6f * BGC_EPSYLON_FP32, 0.6f * BGC_EPSYLON_FP32},
|
||||
{-0.6f * BGC_FP32_EPSYLON, 0.6f * BGC_FP32_EPSYLON},
|
||||
|
||||
{1.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32},
|
||||
{1.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32},
|
||||
{1.0f + 1.25f * BGC_EPSYLON_FP32, 1.0f},
|
||||
{1.0f - 1.25f * BGC_EPSYLON_FP32, 1.0f},
|
||||
{1.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON},
|
||||
{1.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON},
|
||||
{1.0f + 1.25f * BGC_FP32_EPSYLON, 1.0f},
|
||||
{1.0f - 1.25f * BGC_FP32_EPSYLON, 1.0f},
|
||||
|
||||
{-1.0f, -1.0f + 1.25f * BGC_EPSYLON_FP32},
|
||||
{-1.0f, -1.0f - 1.25f * BGC_EPSYLON_FP32},
|
||||
{-1.0f + 1.25f * BGC_EPSYLON_FP32, -1.0f},
|
||||
{-1.0f - 1.25f * BGC_EPSYLON_FP32, -1.0f},
|
||||
{-1.0f, -1.0f + 1.25f * BGC_FP32_EPSYLON},
|
||||
{-1.0f, -1.0f - 1.25f * BGC_FP32_EPSYLON},
|
||||
{-1.0f + 1.25f * BGC_FP32_EPSYLON, -1.0f},
|
||||
{-1.0f - 1.25f * BGC_FP32_EPSYLON, -1.0f},
|
||||
|
||||
{100.0f, 100.0f * (1.0f + 1.25f * BGC_EPSYLON_FP32)},
|
||||
{100.0f, 100.0f * (1.0f - 1.25f * BGC_EPSYLON_FP32)},
|
||||
{-100.0f, -100.0f * (1.0f + 1.25f * BGC_EPSYLON_FP32)},
|
||||
{-100.0f, -100.0f * (1.0f - 1.25f * BGC_EPSYLON_FP32)}
|
||||
{100.0f, 100.0f * (1.0f + 1.25f * BGC_FP32_EPSYLON)},
|
||||
{100.0f, 100.0f * (1.0f - 1.25f * BGC_FP32_EPSYLON)},
|
||||
{-100.0f, -100.0f * (1.0f + 1.25f * BGC_FP32_EPSYLON)},
|
||||
{-100.0f, -100.0f * (1.0f - 1.25f * BGC_FP32_EPSYLON)}
|
||||
};
|
||||
|
||||
void test_are_close_fp32()
|
||||
{
|
||||
print_testing_name("bgc_are_close_fp32");
|
||||
print_testing_name("bgc_fp32_are_close");
|
||||
|
||||
// Testing close pairs of values:
|
||||
for (int i = 0; i < _TEST_FP32_CLOSE_NUMBERS_AMOUNT; i++) {
|
||||
if (!bgc_are_close_fp32(_TEST_FP32_DATA_CLOSE[i].number1, _TEST_FP32_DATA_CLOSE[i].number2)) {
|
||||
if (!bgc_fp32_are_close(_TEST_FP32_DATA_CLOSE[i].number1, _TEST_FP32_DATA_CLOSE[i].number2)) {
|
||||
print_testing_error("A pair of close numbers was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ void test_are_close_fp32()
|
|||
|
||||
// Testing different pairs of values:
|
||||
for (int i = 0; i < _TEST_FP32_DIFFERENT_NUMBERS_AMOUNT; i++) {
|
||||
if (bgc_are_close_fp32(_TEST_FP32_DATA_DIFFERENT[i].number1, _TEST_FP32_DATA_DIFFERENT[i].number2)) {
|
||||
if (bgc_fp32_are_close(_TEST_FP32_DATA_DIFFERENT[i].number1, _TEST_FP32_DATA_DIFFERENT[i].number2)) {
|
||||
print_testing_error("A pair of close numbers was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -86,22 +86,22 @@ static const TestNumberPairFP64 _TEST_FP64_DATA_CLOSE[] = {
|
|||
{1.0, 1.0},
|
||||
{-1.0, -1.0},
|
||||
|
||||
{-0.4 * BGC_EPSYLON_FP64, 0.4 * BGC_EPSYLON_FP64},
|
||||
{-0.4 * BGC_FP64_EPSYLON, 0.4 * BGC_FP64_EPSYLON},
|
||||
|
||||
{1.0, 1.0 + 0.75 * BGC_EPSYLON_FP64},
|
||||
{1.0, 1.0 - 0.75 * BGC_EPSYLON_FP64},
|
||||
{1.0 + 0.75 * BGC_EPSYLON_FP64, 1.0},
|
||||
{1.0 - 0.75 * BGC_EPSYLON_FP64, 1.0},
|
||||
{1.0, 1.0 + 0.75 * BGC_FP64_EPSYLON},
|
||||
{1.0, 1.0 - 0.75 * BGC_FP64_EPSYLON},
|
||||
{1.0 + 0.75 * BGC_FP64_EPSYLON, 1.0},
|
||||
{1.0 - 0.75 * BGC_FP64_EPSYLON, 1.0},
|
||||
|
||||
{-1.0, -1.0 + 0.75 * BGC_EPSYLON_FP64},
|
||||
{-1.0, -1.0 - 0.75 * BGC_EPSYLON_FP64},
|
||||
{-1.0 + 0.75 * BGC_EPSYLON_FP64, -1.0},
|
||||
{-1.0 - 0.75 * BGC_EPSYLON_FP64, -1.0},
|
||||
{-1.0, -1.0 + 0.75 * BGC_FP64_EPSYLON},
|
||||
{-1.0, -1.0 - 0.75 * BGC_FP64_EPSYLON},
|
||||
{-1.0 + 0.75 * BGC_FP64_EPSYLON, -1.0},
|
||||
{-1.0 - 0.75 * BGC_FP64_EPSYLON, -1.0},
|
||||
|
||||
{100.0, 100.0 * (1.0 + 0.75 * BGC_EPSYLON_FP64)},
|
||||
{100.0, 100.0 * (1.0 - 0.75 * BGC_EPSYLON_FP64)},
|
||||
{-100.0, -100.0 * (1.0 + 0.75 * BGC_EPSYLON_FP64)},
|
||||
{-100.0, -100.0 * (1.0 - 0.75 * BGC_EPSYLON_FP64)}
|
||||
{100.0, 100.0 * (1.0 + 0.75 * BGC_FP64_EPSYLON)},
|
||||
{100.0, 100.0 * (1.0 - 0.75 * BGC_FP64_EPSYLON)},
|
||||
{-100.0, -100.0 * (1.0 + 0.75 * BGC_FP64_EPSYLON)},
|
||||
{-100.0, -100.0 * (1.0 - 0.75 * BGC_FP64_EPSYLON)}
|
||||
};
|
||||
|
||||
static const TestNumberPairFP64 _TEST_FP64_DATA_DIFFERENT[] = {
|
||||
|
|
@ -109,31 +109,31 @@ static const TestNumberPairFP64 _TEST_FP64_DATA_DIFFERENT[] = {
|
|||
{1.0, 0.999999},
|
||||
{-1.0, -0.999999},
|
||||
|
||||
{-0.6 * BGC_EPSYLON_FP64, 0.6 * BGC_EPSYLON_FP64},
|
||||
{-0.6 * BGC_FP64_EPSYLON, 0.6 * BGC_FP64_EPSYLON},
|
||||
|
||||
{1.0, 1.0 + 1.25 * BGC_EPSYLON_FP64},
|
||||
{1.0, 1.0 - 1.25 * BGC_EPSYLON_FP64},
|
||||
{1.0 + 1.25 * BGC_EPSYLON_FP64, 1.0},
|
||||
{1.0 - 1.25 * BGC_EPSYLON_FP64, 1.0},
|
||||
{1.0, 1.0 + 1.25 * BGC_FP64_EPSYLON},
|
||||
{1.0, 1.0 - 1.25 * BGC_FP64_EPSYLON},
|
||||
{1.0 + 1.25 * BGC_FP64_EPSYLON, 1.0},
|
||||
{1.0 - 1.25 * BGC_FP64_EPSYLON, 1.0},
|
||||
|
||||
{-1.0, -1.0 + 1.25 * BGC_EPSYLON_FP64},
|
||||
{-1.0, -1.0 - 1.25 * BGC_EPSYLON_FP64},
|
||||
{-1.0 + 1.25 * BGC_EPSYLON_FP64, -1.0},
|
||||
{-1.0 - 1.25 * BGC_EPSYLON_FP64, -1.0},
|
||||
{-1.0, -1.0 + 1.25 * BGC_FP64_EPSYLON},
|
||||
{-1.0, -1.0 - 1.25 * BGC_FP64_EPSYLON},
|
||||
{-1.0 + 1.25 * BGC_FP64_EPSYLON, -1.0},
|
||||
{-1.0 - 1.25 * BGC_FP64_EPSYLON, -1.0},
|
||||
|
||||
{100.0, 100.0 * (1.0 + 1.25 * BGC_EPSYLON_FP64)},
|
||||
{100.0, 100.0 * (1.0 - 1.25 * BGC_EPSYLON_FP64)},
|
||||
{-100.0, -100.0 * (1.0 + 1.25 * BGC_EPSYLON_FP64)},
|
||||
{-100.0, -100.0 * (1.0 - 1.25 * BGC_EPSYLON_FP64)}
|
||||
{100.0, 100.0 * (1.0 + 1.25 * BGC_FP64_EPSYLON)},
|
||||
{100.0, 100.0 * (1.0 - 1.25 * BGC_FP64_EPSYLON)},
|
||||
{-100.0, -100.0 * (1.0 + 1.25 * BGC_FP64_EPSYLON)},
|
||||
{-100.0, -100.0 * (1.0 - 1.25 * BGC_FP64_EPSYLON)}
|
||||
};
|
||||
|
||||
void test_are_close_fp64()
|
||||
{
|
||||
print_testing_name("bgc_are_close_fp64");
|
||||
print_testing_name("bgc_fp64_are_close");
|
||||
|
||||
// Testing close pairs of values:
|
||||
for (int i = 0; i < _TEST_FP64_CLOSE_NUMBERS_AMOUNT; i++) {
|
||||
if (!bgc_are_close_fp64(_TEST_FP64_DATA_CLOSE[i].number1, _TEST_FP64_DATA_CLOSE[i].number2)) {
|
||||
if (!bgc_fp64_are_close(_TEST_FP64_DATA_CLOSE[i].number1, _TEST_FP64_DATA_CLOSE[i].number2)) {
|
||||
print_testing_error("A pair of close numbers was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@ void test_are_close_fp64()
|
|||
|
||||
// Testing different pairs of values:
|
||||
for (int i = 0; i < _TEST_FP64_DIFFERENT_NUMBERS_AMOUNT; i++) {
|
||||
if (bgc_are_close_fp64(_TEST_FP64_DATA_DIFFERENT[i].number1, _TEST_FP64_DATA_DIFFERENT[i].number2)) {
|
||||
if (bgc_fp64_are_close(_TEST_FP64_DATA_DIFFERENT[i].number1, _TEST_FP64_DATA_DIFFERENT[i].number2)) {
|
||||
print_testing_error("A pair of different numbers was recognized as close numbers");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,24 +9,24 @@ static const int _TEST_FP32_NONUNIT_NUMBERS_AMOUNT = 4;
|
|||
|
||||
static const float _TEST_FP32_UNIT_NUMBERS[] = {
|
||||
1.0f,
|
||||
1.0f + 0.75f * BGC_EPSYLON_FP32,
|
||||
1.0f - 0.75f * BGC_EPSYLON_FP32
|
||||
1.0f + 0.75f * BGC_FP32_EPSYLON,
|
||||
1.0f - 0.75f * BGC_FP32_EPSYLON
|
||||
};
|
||||
|
||||
static const float _TEST_FP32_NONUNIT_NUMBERS[] = {
|
||||
0.0f,
|
||||
-1.0f,
|
||||
1.0f + 1.25f * BGC_EPSYLON_FP32,
|
||||
1.0f - 1.25f * BGC_EPSYLON_FP32
|
||||
1.0f + 1.25f * BGC_FP32_EPSYLON,
|
||||
1.0f - 1.25f * BGC_FP32_EPSYLON
|
||||
};
|
||||
|
||||
void test_is_unit_fp32()
|
||||
{
|
||||
print_testing_name("bgc_is_unit_fp32");
|
||||
print_testing_name("bgc_fp32_is_unit");
|
||||
|
||||
// Testing unit values:
|
||||
for (int i = 0; i < _TEST_FP32_UNIT_NUMBERS_AMOUNT; i++) {
|
||||
if (!bgc_is_unit_fp32(_TEST_FP32_UNIT_NUMBERS[i])) {
|
||||
if (!bgc_fp32_is_unit(_TEST_FP32_UNIT_NUMBERS[i])) {
|
||||
print_testing_error("A unit value was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ void test_is_unit_fp32()
|
|||
|
||||
// Testing non-unit values:
|
||||
for (int i = 0; i < _TEST_FP32_NONUNIT_NUMBERS_AMOUNT; i++) {
|
||||
if (bgc_is_unit_fp32(_TEST_FP32_NONUNIT_NUMBERS[i])) {
|
||||
if (bgc_fp32_is_unit(_TEST_FP32_NONUNIT_NUMBERS[i])) {
|
||||
print_testing_error("A non-unit value was recognized as a unit value");
|
||||
return;
|
||||
}
|
||||
|
|
@ -50,24 +50,24 @@ static const int _TEST_FP64_NONUNIT_NUMBERS_AMOUNT = 4;
|
|||
|
||||
static const double _TEST_FP64_UNIT_NUMBERS[] = {
|
||||
1.0,
|
||||
1.0 + 0.75 * BGC_EPSYLON_FP64,
|
||||
1.0 - 0.75 * BGC_EPSYLON_FP64
|
||||
1.0 + 0.75 * BGC_FP64_EPSYLON,
|
||||
1.0 - 0.75 * BGC_FP64_EPSYLON
|
||||
};
|
||||
|
||||
static const double _TEST_FP64_NONUNIT_NUMBERS[] = {
|
||||
0.0,
|
||||
-1.0,
|
||||
1.0 + 1.25 * BGC_EPSYLON_FP64,
|
||||
1.0 - 1.25 * BGC_EPSYLON_FP64
|
||||
1.0 + 1.25 * BGC_FP64_EPSYLON,
|
||||
1.0 - 1.25 * BGC_FP64_EPSYLON
|
||||
};
|
||||
|
||||
void test_is_unit_fp64()
|
||||
{
|
||||
print_testing_name("bgc_is_unit_fp64");
|
||||
print_testing_name("bgc_fp64_is_unit");
|
||||
|
||||
// Testing unit values:
|
||||
for (int i = 0; i < _TEST_FP64_UNIT_NUMBERS_AMOUNT; i++) {
|
||||
if (!bgc_is_unit_fp64(_TEST_FP64_UNIT_NUMBERS[i])) {
|
||||
if (!bgc_fp64_is_unit(_TEST_FP64_UNIT_NUMBERS[i])) {
|
||||
print_testing_error("A unit value was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ void test_is_unit_fp64()
|
|||
|
||||
// Testing non-unit values:
|
||||
for (int i = 0; i < _TEST_FP64_NONUNIT_NUMBERS_AMOUNT; i++) {
|
||||
if (bgc_is_unit_fp64(_TEST_FP64_NONUNIT_NUMBERS[i])) {
|
||||
if (bgc_fp64_is_unit(_TEST_FP64_NONUNIT_NUMBERS[i])) {
|
||||
print_testing_error("A non-unit value was recognized as a unit value");
|
||||
return;
|
||||
}
|
||||
|
|
@ -91,24 +91,24 @@ static const int _TEST_FP32_DATA_SQUARE_NONUNIT_AMOUNT = 4;
|
|||
|
||||
static const float _TEST_FP32_DATA_SQUARE_UNIT[] = {
|
||||
1.0f,
|
||||
1.0f + 1.75f * BGC_EPSYLON_FP32,
|
||||
1.0f - 1.75f * BGC_EPSYLON_FP32
|
||||
1.0f + 1.75f * BGC_FP32_EPSYLON,
|
||||
1.0f - 1.75f * BGC_FP32_EPSYLON
|
||||
};
|
||||
|
||||
static const float _TEST_FP32_DATA_SQUARE_NONUNIT[] = {
|
||||
0.0f,
|
||||
-1.0f,
|
||||
1.0f + 2.25f * BGC_EPSYLON_FP32,
|
||||
1.0f - 2.25f * BGC_EPSYLON_FP32
|
||||
1.0f + 2.25f * BGC_FP32_EPSYLON,
|
||||
1.0f - 2.25f * BGC_FP32_EPSYLON
|
||||
};
|
||||
|
||||
void test_is_sqare_unit_fp32()
|
||||
void test_is_square_unit_fp32()
|
||||
{
|
||||
print_testing_name("bgc_is_sqare_unit_fp32");
|
||||
print_testing_name("bgc_fp32_is_square_unit");
|
||||
|
||||
// Testing unit values:
|
||||
for (int i = 0; i < _TEST_FP32_DATA_SQUARE_UNIT_AMOUNT; i++) {
|
||||
if (!bgc_is_sqare_unit_fp32(_TEST_FP32_DATA_SQUARE_UNIT[i])) {
|
||||
if (!bgc_fp32_is_square_unit(_TEST_FP32_DATA_SQUARE_UNIT[i])) {
|
||||
print_testing_error("A square unit value was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ void test_is_sqare_unit_fp32()
|
|||
|
||||
// Testing non-unit values:
|
||||
for (int i = 0; i < _TEST_FP32_DATA_SQUARE_NONUNIT_AMOUNT; i++) {
|
||||
if (bgc_is_sqare_unit_fp32(_TEST_FP32_DATA_SQUARE_NONUNIT[i])) {
|
||||
if (bgc_fp32_is_square_unit(_TEST_FP32_DATA_SQUARE_NONUNIT[i])) {
|
||||
print_testing_error("A non-unit value was recognized as a square unit value");
|
||||
return;
|
||||
}
|
||||
|
|
@ -132,24 +132,24 @@ static const int _TEST_FP64_DATA_SQUARE_NONUNIT_AMOUNT = 4;
|
|||
|
||||
static const double _TEST_FP64_DATA_SQUARE_UNIT[] = {
|
||||
1.0,
|
||||
1.0 + 1.75 * BGC_EPSYLON_FP64,
|
||||
1.0 - 1.75 * BGC_EPSYLON_FP64
|
||||
1.0 + 1.75 * BGC_FP64_EPSYLON,
|
||||
1.0 - 1.75 * BGC_FP64_EPSYLON
|
||||
};
|
||||
|
||||
static const double _TEST_FP64_DATA_SQUARE_NONUNIT[] = {
|
||||
0.0,
|
||||
-1.0,
|
||||
1.0 + 2.25 * BGC_EPSYLON_FP64,
|
||||
1.0 - 2.25 * BGC_EPSYLON_FP64
|
||||
1.0 + 2.25 * BGC_FP64_EPSYLON,
|
||||
1.0 - 2.25 * BGC_FP64_EPSYLON
|
||||
};
|
||||
|
||||
void test_is_sqare_unit_fp64()
|
||||
void test_is_square_unit_fp64()
|
||||
{
|
||||
print_testing_name("bgc_is_sqare_unit_fp64");
|
||||
print_testing_name("bgc_fp64_is_square_unit");
|
||||
|
||||
// Testing unit values:
|
||||
for (int i = 0; i < _TEST_FP64_DATA_SQUARE_UNIT_AMOUNT; i++) {
|
||||
if (!bgc_is_sqare_unit_fp64(_TEST_FP64_DATA_SQUARE_UNIT[i])) {
|
||||
if (!bgc_fp64_is_square_unit(_TEST_FP64_DATA_SQUARE_UNIT[i])) {
|
||||
print_testing_error("A square unit value was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -157,7 +157,7 @@ void test_is_sqare_unit_fp64()
|
|||
|
||||
// Testing non-unit values:
|
||||
for (int i = 0; i < _TEST_FP64_DATA_SQUARE_NONUNIT_AMOUNT; i++) {
|
||||
if (bgc_is_sqare_unit_fp64(_TEST_FP64_DATA_SQUARE_NONUNIT[i])) {
|
||||
if (bgc_fp64_is_square_unit(_TEST_FP64_DATA_SQUARE_NONUNIT[i])) {
|
||||
print_testing_error("A non-unit value was recognized as a square unit value");
|
||||
return;
|
||||
}
|
||||
|
|
@ -171,6 +171,6 @@ void test_is_unit()
|
|||
test_is_unit_fp32();
|
||||
test_is_unit_fp64();
|
||||
|
||||
test_is_sqare_unit_fp32();
|
||||
test_is_sqare_unit_fp64();
|
||||
test_is_square_unit_fp32();
|
||||
test_is_square_unit_fp64();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ void test_is_unit_fp32();
|
|||
|
||||
void test_is_unit_fp64();
|
||||
|
||||
void test_is_sqare_unit_fp32();
|
||||
void test_is_square_unit_fp32();
|
||||
|
||||
void test_is_sqare_unit_fp64();
|
||||
void test_is_square_unit_fp64();
|
||||
|
||||
void test_is_unit();
|
||||
|
||||
|
|
|
|||
|
|
@ -9,24 +9,24 @@ static const int _TEST_FP32_NONZERO_NUMBERS_AMOUNT = 4;
|
|||
|
||||
static const float _TEST_FP32_ZERO_NUMBERS[] = {
|
||||
0.0f,
|
||||
0.75f * BGC_EPSYLON_FP32,
|
||||
-0.75f * BGC_EPSYLON_FP32
|
||||
0.75f * BGC_FP32_EPSYLON,
|
||||
-0.75f * BGC_FP32_EPSYLON
|
||||
};
|
||||
|
||||
static const float _TEST_FP32_NONZERO_NUMBERS[] = {
|
||||
1.0f,
|
||||
-1.0f,
|
||||
1.25f * BGC_EPSYLON_FP32,
|
||||
-1.25f * BGC_EPSYLON_FP32
|
||||
1.25f * BGC_FP32_EPSYLON,
|
||||
-1.25f * BGC_FP32_EPSYLON
|
||||
};
|
||||
|
||||
void test_is_zero_fp32()
|
||||
{
|
||||
print_testing_name("bgc_is_zero_fp32");
|
||||
print_testing_name("bgc_fp32_is_zero");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP32_ZERO_NUMBERS_AMOUNT; i++) {
|
||||
if (!bgc_is_zero_fp32(_TEST_FP32_ZERO_NUMBERS[i])) {
|
||||
if (!bgc_fp32_is_zero(_TEST_FP32_ZERO_NUMBERS[i])) {
|
||||
print_testing_error("A zero value was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ void test_is_zero_fp32()
|
|||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP32_NONZERO_NUMBERS_AMOUNT; i++) {
|
||||
if (bgc_is_zero_fp32(_TEST_FP32_NONZERO_NUMBERS[i])) {
|
||||
if (bgc_fp32_is_zero(_TEST_FP32_NONZERO_NUMBERS[i])) {
|
||||
print_testing_error("A non-zero value was recognized as a zero value");
|
||||
return;
|
||||
}
|
||||
|
|
@ -50,24 +50,24 @@ static const int _TEST_FP64_NONZERO_NUMBERS_AMOUNT = 4;
|
|||
|
||||
static const double _TEST_FP64_ZERO_NUMBERS[] = {
|
||||
0.0,
|
||||
0.75 * BGC_EPSYLON_FP64,
|
||||
-0.75 * BGC_EPSYLON_FP64
|
||||
0.75 * BGC_FP64_EPSYLON,
|
||||
-0.75 * BGC_FP64_EPSYLON
|
||||
};
|
||||
|
||||
static const double _TEST_FP64_NONZERO_NUMBERS[] = {
|
||||
1.0,
|
||||
-1.0,
|
||||
1.25 * BGC_EPSYLON_FP64,
|
||||
-1.25 * BGC_EPSYLON_FP64
|
||||
1.25 * BGC_FP64_EPSYLON,
|
||||
-1.25 * BGC_FP64_EPSYLON
|
||||
};
|
||||
|
||||
void test_is_zero_fp64()
|
||||
{
|
||||
print_testing_name("bgc_is_zero_fp64");
|
||||
print_testing_name("bgc_fp64_is_zero");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP64_ZERO_NUMBERS_AMOUNT; i++) {
|
||||
if (!bgc_is_zero_fp64(_TEST_FP64_ZERO_NUMBERS[i])) {
|
||||
if (!bgc_fp64_is_zero(_TEST_FP64_ZERO_NUMBERS[i])) {
|
||||
print_testing_error("A zero value was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ void test_is_zero_fp64()
|
|||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP64_NONZERO_NUMBERS_AMOUNT; i++) {
|
||||
if (bgc_is_zero_fp64(_TEST_FP64_NONZERO_NUMBERS[i])) {
|
||||
if (bgc_fp64_is_zero(_TEST_FP64_NONZERO_NUMBERS[i])) {
|
||||
print_testing_error("A non-zero value was recognized as a zero value");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ void test_vector2()
|
|||
|
||||
const int TEST_FP32_VECTOR2_AMOUNT_1 = 5;
|
||||
|
||||
const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_1[] = {
|
||||
const BGC_FP32_Vector2 TEST_FP32_VECTOR2_COMMON_1[] = {
|
||||
{ 3.0f, 4.0f },
|
||||
{ -3.0f, -4.0f },
|
||||
{ 10000.0f, -20000.0f },
|
||||
|
|
@ -30,7 +30,7 @@ const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_1[] = {
|
|||
{ -123.5f, 3.7283f }
|
||||
};
|
||||
|
||||
const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_2[] = {
|
||||
const BGC_FP32_Vector2 TEST_FP32_VECTOR2_COMMON_2[] = {
|
||||
{ -3.0f, -4.0f },
|
||||
{ -3.0f, -4.0f },
|
||||
{ 0.002f, -0.05f },
|
||||
|
|
@ -49,7 +49,7 @@ int test_vector2_fp32_square_modulus()
|
|||
float square_modulus;
|
||||
|
||||
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
||||
square_modulus = bgc_vector2_get_square_modulus_fp32(&TEST_FP32_VECTOR2_COMMON_1[i]);
|
||||
square_modulus = bgc_fp32_vector2_get_square_modulus(&TEST_FP32_VECTOR2_COMMON_1[i]);
|
||||
|
||||
if (!test_are_equal_fp32(square_modulus, FP32_VECTOR2_SQUARE_MODULUS_1[i])) {
|
||||
print_testing_failed();
|
||||
|
|
@ -72,7 +72,7 @@ int test_vector2_fp32_modulus()
|
|||
float square_modulus;
|
||||
|
||||
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
||||
square_modulus = bgc_vector2_get_modulus_fp32(&TEST_FP32_VECTOR2_COMMON_1[i]);
|
||||
square_modulus = bgc_fp32_vector2_get_modulus(&TEST_FP32_VECTOR2_COMMON_1[i]);
|
||||
|
||||
if (!test_are_equal_fp32(square_modulus, FP32_VECTOR2_MODULUS_1[i])) {
|
||||
print_testing_failed();
|
||||
|
|
@ -86,7 +86,7 @@ int test_vector2_fp32_modulus()
|
|||
|
||||
// ===================== Add ==================== //
|
||||
|
||||
const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_1_2_SUM[] = {
|
||||
const BGC_FP32_Vector2 TEST_FP32_VECTOR2_COMMON_1_2_SUM[] = {
|
||||
{ 0.0f, 0.0f },
|
||||
{ -6.0f, -8.0f },
|
||||
{ 10000.002f, -20000.05f },
|
||||
|
|
@ -98,10 +98,10 @@ int test_vector2_add_fp32()
|
|||
{
|
||||
print_testing_name("vector2_fp32_t add");
|
||||
|
||||
BgcVector2FP32 vector;
|
||||
BGC_FP32_Vector2 vector;
|
||||
|
||||
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
||||
bgc_vector2_add_fp32(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);
|
||||
bgc_fp32_vector2_add(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);
|
||||
|
||||
if (!test_are_equal_fp32(vector.x1, TEST_FP32_VECTOR2_COMMON_1_2_SUM[i].x1) ||
|
||||
!test_are_equal_fp32(vector.x2, TEST_FP32_VECTOR2_COMMON_1_2_SUM[i].x2)) {
|
||||
|
|
@ -116,7 +116,7 @@ int test_vector2_add_fp32()
|
|||
|
||||
// ================== Subtract ================== //
|
||||
|
||||
const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_1_2_DIFF[] = {
|
||||
const BGC_FP32_Vector2 TEST_FP32_VECTOR2_COMMON_1_2_DIFF[] = {
|
||||
{ 6.0f, 8.0f },
|
||||
{ 0.0f, 0.0f },
|
||||
{ 9999.998f, -19999.95f },
|
||||
|
|
@ -128,10 +128,10 @@ int test_vector2_subtract_fp32()
|
|||
{
|
||||
print_testing_name("vector2_fp32_t subtract");
|
||||
|
||||
BgcVector2FP32 vector;
|
||||
BGC_FP32_Vector2 vector;
|
||||
|
||||
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
||||
bgc_vector2_subtract_fp32(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);
|
||||
bgc_fp32_vector2_subtract(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);
|
||||
|
||||
if (!test_are_equal_fp32(vector.x1, TEST_FP32_VECTOR2_COMMON_1_2_DIFF[i].x1) ||
|
||||
!test_are_equal_fp32(vector.x2, TEST_FP32_VECTOR2_COMMON_1_2_DIFF[i].x2)) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
// ==================== FP32 ==================== //
|
||||
|
||||
static const int _TEST_FP32_VECTOR2_AMOUNT = 4;
|
||||
static const BgcVector2FP32 _TEST_FP32_VECTOR2_LIST[] = {
|
||||
static const BGC_FP32_Vector2 _TEST_FP32_VECTOR2_LIST[] = {
|
||||
{ 1.0f, 2.0f },
|
||||
{ -2.0f, -1.0f },
|
||||
{ 100.0f, -100.0f },
|
||||
|
|
@ -16,13 +16,13 @@ static const BgcVector2FP32 _TEST_FP32_VECTOR2_LIST[] = {
|
|||
|
||||
void test_vector2_copy_fp32()
|
||||
{
|
||||
BgcVector2FP32 vector;
|
||||
BGC_FP32_Vector2 vector;
|
||||
|
||||
print_testing_name("bgc_vector2_copy_fp32");
|
||||
print_testing_name("bgc_fp32_vector2_copy");
|
||||
|
||||
for (int i = 0; i < _TEST_FP32_VECTOR2_AMOUNT; i++) {
|
||||
|
||||
bgc_vector2_copy_fp32(&_TEST_FP32_VECTOR2_LIST[i], &vector);
|
||||
bgc_fp32_vector2_copy(&_TEST_FP32_VECTOR2_LIST[i], &vector);
|
||||
|
||||
if (vector.x1 != _TEST_FP32_VECTOR2_LIST[i].x1 || vector.x2 != _TEST_FP32_VECTOR2_LIST[i].x2) {
|
||||
print_testing_failed();
|
||||
|
|
@ -36,7 +36,7 @@ void test_vector2_copy_fp32()
|
|||
// ==================== FP64 ==================== //
|
||||
|
||||
static const int _TEST_FP64_VECTOR2_AMOUNT = 4;
|
||||
static const BgcVector2FP64 _TEST_FP64_VECTOR2_LIST[] = {
|
||||
static const BGC_FP64_Vector2 _TEST_FP64_VECTOR2_LIST[] = {
|
||||
{ 1.0, 2.0 },
|
||||
{ -2.0, -1.0 },
|
||||
{ 100.0, -100.0 },
|
||||
|
|
@ -45,13 +45,13 @@ static const BgcVector2FP64 _TEST_FP64_VECTOR2_LIST[] = {
|
|||
|
||||
void test_vector2_copy_fp64()
|
||||
{
|
||||
BgcVector2FP64 vector;
|
||||
BGC_FP64_Vector2 vector;
|
||||
|
||||
print_testing_name("bgc_vector2_copy_fp64");
|
||||
print_testing_name("bgc_fp64_vector2_copy");
|
||||
|
||||
for (int i = 0; i < _TEST_FP64_VECTOR2_AMOUNT; i++) {
|
||||
|
||||
bgc_vector2_copy_fp64(&_TEST_FP64_VECTOR2_LIST[i], &vector);
|
||||
bgc_fp64_vector2_copy(&_TEST_FP64_VECTOR2_LIST[i], &vector);
|
||||
|
||||
if (vector.x1 != _TEST_FP64_VECTOR2_LIST[i].x1 || vector.x2 != _TEST_FP64_VECTOR2_LIST[i].x2) {
|
||||
print_testing_failed();
|
||||
|
|
|
|||
|
|
@ -7,32 +7,32 @@
|
|||
static const int _TEST_FP32_UNIT_VECTOR2_AMOUNT = 6;
|
||||
static const int _TEST_FP32_NONUNIT_VECTOR2_AMOUNT = 7;
|
||||
|
||||
static const BgcVector2FP32 _TEST_FP32_UNIT_VECTOR2_LIST[] = {
|
||||
static const BGC_FP32_Vector2 _TEST_FP32_UNIT_VECTOR2_LIST[] = {
|
||||
{ 1.0f, 0.0f },
|
||||
{ 0.0f, -1.0f },
|
||||
{ 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32 },
|
||||
{ 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32 }
|
||||
{ 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON },
|
||||
{ 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON }
|
||||
};
|
||||
|
||||
static const BgcVector2FP32 _TEST_FP32_NONUNIT_VECTOR2_LIST[] = {
|
||||
static const BGC_FP32_Vector2 _TEST_FP32_NONUNIT_VECTOR2_LIST[] = {
|
||||
{ 0.0f, 0.0f },
|
||||
{ 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f },
|
||||
{ 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32 },
|
||||
{ 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32 },
|
||||
{ 0.8f + 1.25f * BGC_EPSYLON_FP32, 0.6f + 1.25f * BGC_EPSYLON_FP32 },
|
||||
{ 0.6f - 1.25f * BGC_EPSYLON_FP32, 0.8f - 1.25f * BGC_EPSYLON_FP32 }
|
||||
{ 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f },
|
||||
{ 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON },
|
||||
{ 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON },
|
||||
{ 0.8f + 1.25f * BGC_FP32_EPSYLON, 0.6f + 1.25f * BGC_FP32_EPSYLON },
|
||||
{ 0.6f - 1.25f * BGC_FP32_EPSYLON, 0.8f - 1.25f * BGC_FP32_EPSYLON }
|
||||
};
|
||||
|
||||
void test_vector2_is_unit_fp32()
|
||||
{
|
||||
print_testing_name("bgc_vector2_is_unit_fp32");
|
||||
print_testing_name("bgc_fp32_vector2_is_unit");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP32_UNIT_VECTOR2_AMOUNT; i++) {
|
||||
if (!bgc_vector2_is_unit_fp32(&_TEST_FP32_UNIT_VECTOR2_LIST[i])) {
|
||||
if (!bgc_fp32_vector2_is_unit(&_TEST_FP32_UNIT_VECTOR2_LIST[i])) {
|
||||
print_testing_error("A unit vector was not recognized");
|
||||
return;
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ void test_vector2_is_unit_fp32()
|
|||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP32_NONUNIT_VECTOR2_AMOUNT; i++) {
|
||||
if (bgc_vector2_is_unit_fp32(&_TEST_FP32_NONUNIT_VECTOR2_LIST[i])) {
|
||||
if (bgc_fp32_vector2_is_unit(&_TEST_FP32_NONUNIT_VECTOR2_LIST[i])) {
|
||||
print_testing_error("A non-unit vector was recognized as a unit vector");
|
||||
return;
|
||||
}
|
||||
|
|
@ -54,32 +54,32 @@ void test_vector2_is_unit_fp32()
|
|||
static const int _TEST_FP64_UNIT_VECTOR2_AMOUNT = 6;
|
||||
static const int _TEST_FP64_NONUNIT_VECTOR2_AMOUNT = 7;
|
||||
|
||||
static const BgcVector2FP64 _TEST_FP64_UNIT_VECTOR2_LIST[] = {
|
||||
static const BGC_FP64_Vector2 _TEST_FP64_UNIT_VECTOR2_LIST[] = {
|
||||
{ -1.0, 0.0 },
|
||||
{ 0.0, 1.0 },
|
||||
{ 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64 },
|
||||
{ 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64 }
|
||||
{ 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON },
|
||||
{ 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON }
|
||||
};
|
||||
|
||||
static const BgcVector2FP64 _TEST_FP64_NONUNIT_VECTOR2_LIST[] = {
|
||||
static const BGC_FP64_Vector2 _TEST_FP64_NONUNIT_VECTOR2_LIST[] = {
|
||||
{ 0.0, 0.0 },
|
||||
{ 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0 },
|
||||
{ 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64 },
|
||||
{ 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64 },
|
||||
{ 0.6 + 1.25 * BGC_EPSYLON_FP64, 0.8 + 1.25 * BGC_EPSYLON_FP64 },
|
||||
{ 0.8 - 1.25 * BGC_EPSYLON_FP64, 0.6 - 1.25 * BGC_EPSYLON_FP64 }
|
||||
{ 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0 },
|
||||
{ 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON },
|
||||
{ 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON },
|
||||
{ 0.6 + 1.25 * BGC_FP64_EPSYLON, 0.8 + 1.25 * BGC_FP64_EPSYLON },
|
||||
{ 0.8 - 1.25 * BGC_FP64_EPSYLON, 0.6 - 1.25 * BGC_FP64_EPSYLON }
|
||||
};
|
||||
|
||||
void test_vector2_is_unit_fp64()
|
||||
{
|
||||
print_testing_name("bgc_vector2_is_unit_fp64");
|
||||
print_testing_name("bgc_fp64_vector2_is_unit");
|
||||
|
||||
// Testing zero values:
|
||||