Переход на версию 0.3: изменение подхода к именованию сущностей, добавление, изменение и удаление ряда функций

This commit is contained in:
Andrey Pokidov 2026-01-30 19:37:49 +07:00
parent d33daf4e2d
commit f7e41645fe
87 changed files with 4580 additions and 4051 deletions

View file

@ -7,7 +7,7 @@
// ==================== FP32 ==================== //
static const int _TEST_FP32_VECTOR3_AMOUNT = 4;
static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST[] = {
static const BGC_FP32_Vector3 _TEST_FP32_VECTOR3_LIST[] = {
{ 1.0f, 2.0f, 3.0f },
{ -3.0f, -2.0f, -1.0f },
{ 100.0f, -100.0f, 0.001f },
@ -16,13 +16,13 @@ static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST[] = {
void test_vector3_copy_fp32()
{
BgcVector3FP32 vector;
BGC_FP32_Vector3 vector;
print_testing_name("bgc_vector3_copy_fp32");
print_testing_name("bgc_fp32_vector3_copy");
for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) {
bgc_vector3_copy_fp32(&_TEST_FP32_VECTOR3_LIST[i], &vector);
bgc_fp32_vector3_copy(&_TEST_FP32_VECTOR3_LIST[i], &vector);
if (vector.x1 != _TEST_FP32_VECTOR3_LIST[i].x1 ||
vector.x2 != _TEST_FP32_VECTOR3_LIST[i].x2 ||
@ -38,7 +38,7 @@ void test_vector3_copy_fp32()
// ==================== FP64 ==================== //
static const int _TEST_FP64_VECTOR3_AMOUNT = 4;
static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST[] = {
static const BGC_FP64_Vector3 _TEST_FP64_VECTOR3_LIST[] = {
{ 1.0, 2.0, 3.0 },
{ -3.0, -2.0, -1.0 },
{ 100.0, -100.0, 0.001 },
@ -47,13 +47,13 @@ static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST[] = {
void test_vector3_copy_fp64()
{
BgcVector3FP64 vector;
BGC_FP64_Vector3 vector;
print_testing_name("bgc_vector3_copy_fp64");
print_testing_name("bgc_fp64_vector3_copy");
for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) {
bgc_vector3_copy_fp64(&_TEST_FP64_VECTOR3_LIST[i], &vector);
bgc_fp64_vector3_copy(&_TEST_FP64_VECTOR3_LIST[i], &vector);
if (vector.x1 != _TEST_FP64_VECTOR3_LIST[i].x1 ||
vector.x2 != _TEST_FP64_VECTOR3_LIST[i].x2 ||

View file

@ -7,38 +7,38 @@
static const int _TEST_FP32_UNIT_VECTOR3_AMOUNT = 10;
static const int _TEST_FP32_NONUNIT_VECTOR3_AMOUNT = 9;
static const BgcVector3FP32 _TEST_FP32_UNIT_VECTOR3_LIST[] = {
static const BGC_FP32_Vector3 _TEST_FP32_UNIT_VECTOR3_LIST[] = {
{ 1.0f, 0.0f, 0.0f },
{ 0.0f, -1.0f, 0.0f },
{ 0.0f, -0.8f, 0.6f },
{ -0.6f, 0.0f, 0.8f },
{ 1.0f + 0.75f * BGC_EPSYLON_FP32, 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, -1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f },
{ 0.0f, 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32 },
{ 0.0f, 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32 }
{ 1.0f + 0.75f * BGC_FP32_EPSYLON, 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, -1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON },
{ 0.0f, 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON }
};
static const BgcVector3FP32 _TEST_FP32_NONUNIT_VECTOR3_LIST[] = {
static const BGC_FP32_Vector3 _TEST_FP32_NONUNIT_VECTOR3_LIST[] = {
{ 0.0f, 0.0f, 0.0f },
{ 1.0f + 1.25f * BGC_EPSYLON_FP32, 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, 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f },
{ 0.0f, 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32 },
{ 0.0f, 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32 },
{ 0.8f + 1.25f * BGC_EPSYLON_FP32, -0.6f - 1.25f * BGC_EPSYLON_FP32, 0.0f },
{ 0.6f - 1.25f * BGC_EPSYLON_FP32, -0.8f + 1.25f * BGC_EPSYLON_FP32, 0.0f }
{ 1.0f + 1.25f * BGC_FP32_EPSYLON, 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, 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON },
{ 0.0f, 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON },
{ 0.8f + 1.25f * BGC_FP32_EPSYLON, -0.6f - 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.6f - 1.25f * BGC_FP32_EPSYLON, -0.8f + 1.25f * BGC_FP32_EPSYLON, 0.0f }
};
void test_vector3_is_unit_fp32()
{
print_testing_name("bgc_vector3_is_unit_fp32");
print_testing_name("bgc_fp32_vector3_is_unit");
// Testing zero values:
for (int i = 0; i < _TEST_FP32_UNIT_VECTOR3_AMOUNT; i++) {
if (!bgc_vector3_is_unit_fp32(&_TEST_FP32_UNIT_VECTOR3_LIST[i])) {
if (!bgc_fp32_vector3_is_unit(&_TEST_FP32_UNIT_VECTOR3_LIST[i])) {
print_testing_error("A unit vector was not recognized");
return;
}
@ -46,7 +46,7 @@ void test_vector3_is_unit_fp32()
// Testing non-zero values:
for (int i = 0; i < _TEST_FP32_NONUNIT_VECTOR3_AMOUNT; i++) {
if (bgc_vector3_is_unit_fp32(&_TEST_FP32_NONUNIT_VECTOR3_LIST[i])) {
if (bgc_fp32_vector3_is_unit(&_TEST_FP32_NONUNIT_VECTOR3_LIST[i])) {
print_testing_error("A non-unit vector was recognized as a unit vector");
return;
}
@ -60,38 +60,38 @@ void test_vector3_is_unit_fp32()
static const int _TEST_FP64_UNIT_VECTOR3_AMOUNT = 10;
static const int _TEST_FP64_NONUNIT_VECTOR3_AMOUNT = 9;
static const BgcVector3FP64 _TEST_FP64_UNIT_VECTOR3_LIST[] = {
static const BGC_FP64_Vector3 _TEST_FP64_UNIT_VECTOR3_LIST[] = {
{ 1.0, 0.0, 0.0 },
{ 0.0, -1.0, 0.0 },
{ 0.0, -0.8, 0.6 },
{ -0.6, 0.0, 0.8 },
{ 1.0 + 0.75 * BGC_EPSYLON_FP64, 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, -1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0 },
{ 0.0, 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64 },
{ 0.0, 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64 }
{ 1.0 + 0.75 * BGC_FP64_EPSYLON, 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, -1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON },
{ 0.0, 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON }
};
static const BgcVector3FP64 _TEST_FP64_NONUNIT_VECTOR3_LIST[] = {
static const BGC_FP64_Vector3 _TEST_FP64_NONUNIT_VECTOR3_LIST[] = {
{ 0.0, 0.0, 0.0 },
{ 1.0 + 1.25 * BGC_EPSYLON_FP64, 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, 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0 },
{ 0.0, 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64 },
{ 0.0, 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64 },
{ 0.8 + 1.25 * BGC_EPSYLON_FP64, -0.6 - 1.25 * BGC_EPSYLON_FP64, 0.0 },
{ 0.6 - 1.25 * BGC_EPSYLON_FP64, -0.8 + 1.25 * BGC_EPSYLON_FP64, 0.0 }
{ 1.0 + 1.25 * BGC_FP64_EPSYLON, 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, 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON },
{ 0.0, 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON },
{ 0.8 + 1.25 * BGC_FP64_EPSYLON, -0.6 - 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.6 - 1.25 * BGC_FP64_EPSYLON, -0.8 + 1.25 * BGC_FP64_EPSYLON, 0.0 }
};
void test_vector3_is_unit_fp64()
{
print_testing_name("bgc_vector3_is_unit_fp64");
print_testing_name("bgc_fp64_vector3_is_unit");
// Testing zero values:
for (int i = 0; i < _TEST_FP64_UNIT_VECTOR3_AMOUNT; i++) {
if (!bgc_vector3_is_unit_fp64(&_TEST_FP64_UNIT_VECTOR3_LIST[i])) {
if (!bgc_fp64_vector3_is_unit(&_TEST_FP64_UNIT_VECTOR3_LIST[i])) {
print_testing_error("A unit vector was not recognized");
return;
}
@ -99,7 +99,7 @@ void test_vector3_is_unit_fp64()
// Testing non-zero values:
for (int i = 0; i < _TEST_FP64_NONUNIT_VECTOR3_AMOUNT; i++) {
if (bgc_vector3_is_unit_fp64(&_TEST_FP64_NONUNIT_VECTOR3_LIST[i])) {
if (bgc_fp64_vector3_is_unit(&_TEST_FP64_NONUNIT_VECTOR3_LIST[i])) {
print_testing_error("A non-unit vector was recognized as a unit vector");
return;
}

View file

@ -7,35 +7,35 @@
static const int _TEST_FP32_ZERO_VECTOR3_AMOUNT = 7;
static const int _TEST_FP32_NONZERO_VECTOR3_AMOUNT = 9;
static const BgcVector3FP32 _TEST_FP32_ZERO_VECTOR3_LIST[] = {
static const BGC_FP32_Vector3 _TEST_FP32_ZERO_VECTOR3_LIST[] = {
{ 0.0f, 0.0f, 0.0f },
{ 0.75f * BGC_EPSYLON_FP32, 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.75f * BGC_EPSYLON_FP32, 0.0f },
{ 0.0f, 0.0f, 0.75f * BGC_EPSYLON_FP32 },
{ 0.0f, 0.0f, -0.75f * BGC_EPSYLON_FP32 }
{ 0.75f * BGC_FP32_EPSYLON, 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.75f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, 0.75f * BGC_FP32_EPSYLON },
{ 0.0f, 0.0f, -0.75f * BGC_FP32_EPSYLON }
};
static const BgcVector3FP32 _TEST_FP32_NONZERO_VECTOR3_LIST[] = {
static const BGC_FP32_Vector3 _TEST_FP32_NONZERO_VECTOR3_LIST[] = {
{ 0.0f, 1.0f, 0.0f },
{ 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
{ -1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
{ 0.0f, 1.25f * BGC_EPSYLON_FP32, 0.0f },
{ 0.0f, -1.25f * BGC_EPSYLON_FP32, 0.0f },
{ 0.0f, 0.0f, 1.25f * BGC_EPSYLON_FP32 },
{ 0.0f, 0.0f, -1.25f * BGC_EPSYLON_FP32 },
{ 1.25f * BGC_EPSYLON_FP32, 1.25f * BGC_EPSYLON_FP32, 0.0f },
{ -1.25f * BGC_EPSYLON_FP32, -1.25f * BGC_EPSYLON_FP32, 0.0f }
{ 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ -1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 0.0f, 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, -1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, 1.25f * BGC_FP32_EPSYLON },
{ 0.0f, 0.0f, -1.25f * BGC_FP32_EPSYLON },
{ 1.25f * BGC_FP32_EPSYLON, 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ -1.25f * BGC_FP32_EPSYLON, -1.25f * BGC_FP32_EPSYLON, 0.0f }
};
void test_vector3_is_zero_fp32()
{
print_testing_name("bgc_vector3_is_zero_fp32");
print_testing_name("bgc_fp32_vector3_is_zero");
// Testing zero values:
for (int i = 0; i < _TEST_FP32_ZERO_VECTOR3_AMOUNT; i++) {
if (!bgc_vector3_is_zero_fp32(&_TEST_FP32_ZERO_VECTOR3_LIST[i])) {
if (!bgc_fp32_vector3_is_zero(&_TEST_FP32_ZERO_VECTOR3_LIST[i])) {
print_testing_error("A zero vector was not recongized");
return;
}
@ -43,7 +43,7 @@ void test_vector3_is_zero_fp32()
// Testing non-zero values:
for (int i = 0; i < _TEST_FP32_NONZERO_VECTOR3_AMOUNT; i++) {
if (bgc_vector3_is_zero_fp32(&_TEST_FP32_NONZERO_VECTOR3_LIST[i])) {
if (bgc_fp32_vector3_is_zero(&_TEST_FP32_NONZERO_VECTOR3_LIST[i])) {
print_testing_error("A non-zero vector was recongized as a zero vector");
return;
}
@ -57,35 +57,35 @@ void test_vector3_is_zero_fp32()
static const int _TEST_FP64_ZERO_VECTOR3_AMOUNT = 7;
static const int _TEST_FP64_NONZERO_VECTOR3_AMOUNT = 9;
static const BgcVector3FP64 _TEST_FP64_ZERO_VECTOR3_LIST[] = {
static const BGC_FP64_Vector3 _TEST_FP64_ZERO_VECTOR3_LIST[] = {
{ 0.0, 0.0, 0.0 },
{ 0.75 * BGC_EPSYLON_FP64, 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.75 * BGC_EPSYLON_FP64, 0.0 },
{ 0.0, 0.0, 0.75 * BGC_EPSYLON_FP64 },
{ 0.0, 0.0, -0.75 * BGC_EPSYLON_FP64 }
{ 0.75 * BGC_FP64_EPSYLON, 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.75 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, 0.75 * BGC_FP64_EPSYLON },
{ 0.0, 0.0, -0.75 * BGC_FP64_EPSYLON }
};
static const BgcVector3FP64 _TEST_FP64_NONZERO_VECTOR3_LIST[] = {
static const BGC_FP64_Vector3 _TEST_FP64_NONZERO_VECTOR3_LIST[] = {
{ 0.0, 1.0, 0.0 },
{ 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 },
{ -1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 },
{ 0.0, 1.25 * BGC_EPSYLON_FP64, 0.0 },
{ 0.0, -1.25 * BGC_EPSYLON_FP64, 0.0 },
{ 0.0, 0.0, 1.25 * BGC_EPSYLON_FP64 },
{ 0.0, 0.0, -1.25 * BGC_EPSYLON_FP64 },
{ 1.25 * BGC_EPSYLON_FP64, 1.25 * BGC_EPSYLON_FP64, 0.0 },
{ -BGC_EPSYLON_FP64, -BGC_EPSYLON_FP64, 0.0 }
{ 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ -1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 0.0, 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, -1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, 1.25 * BGC_FP64_EPSYLON },
{ 0.0, 0.0, -1.25 * BGC_FP64_EPSYLON },
{ 1.25 * BGC_FP64_EPSYLON, 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ -BGC_FP64_EPSYLON, -BGC_FP64_EPSYLON, 0.0 }
};
void test_vector3_is_zero_fp64()
{
print_testing_name("bgc_vector3_is_zero_fp64");
print_testing_name("bgc_fp64_vector3_is_zero");
// Testing zero values:
for (int i = 0; i < _TEST_FP64_ZERO_VECTOR3_AMOUNT; i++) {
if (!bgc_vector3_is_zero_fp64(&_TEST_FP64_ZERO_VECTOR3_LIST[i])) {
if (!bgc_fp64_vector3_is_zero(&_TEST_FP64_ZERO_VECTOR3_LIST[i])) {
print_testing_error("A zero vector was not recongized");
return;
}
@ -93,7 +93,7 @@ void test_vector3_is_zero_fp64()
// Testing non-zero values:
for (int i = 0; i < _TEST_FP64_NONZERO_VECTOR3_AMOUNT; i++) {
if (bgc_vector3_is_zero_fp64(&_TEST_FP64_NONZERO_VECTOR3_LIST[i])) {
if (bgc_fp64_vector3_is_zero(&_TEST_FP64_NONZERO_VECTOR3_LIST[i])) {
print_testing_error("A non-zero vector was recongized as a zero vector");
return;
}

View file

@ -6,7 +6,7 @@
static const int _TEST_FP32_VECTOR3_AMOUNT = 4;
static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST[] = {
static const BGC_FP32_Vector3 _TEST_FP32_VECTOR3_LIST[] = {
{ 4.0f, 3.0f, 0.0f },
{ 0.0f, -3.0f, -4.0f },
{ 100.0f, -100.0f, 100.0f },
@ -29,10 +29,10 @@ static const float _TEST_FP32_MODULUS_LIST[] = {
void test_vector3_square_modulus_fp32()
{
print_testing_name("bgc_vector3_get_square_modulus_fp32");
print_testing_name("bgc_fp32_vector3_get_square_modulus");
for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) {
if (!bgc_are_close_fp32(bgc_vector3_get_square_modulus_fp32(&_TEST_FP32_VECTOR3_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) {
if (!bgc_fp32_are_close(bgc_fp32_vector3_get_square_modulus(&_TEST_FP32_VECTOR3_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) {
print_testing_failed();
return;
}
@ -43,10 +43,10 @@ void test_vector3_square_modulus_fp32()
void test_vector3_modulus_fp32()
{
print_testing_name("bgc_vector3_get_modulus_fp32");
print_testing_name("bgc_fp32_vector3_get_modulus");
for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) {
if (!bgc_are_close_fp32(bgc_vector3_get_modulus_fp32(&_TEST_FP32_VECTOR3_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) {
if (!bgc_fp32_are_close(bgc_fp32_vector3_get_modulus(&_TEST_FP32_VECTOR3_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) {
print_testing_failed();
return;
}
@ -59,7 +59,7 @@ void test_vector3_modulus_fp32()
static const int _TEST_FP64_VECTOR3_AMOUNT = 4;
static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST[] = {
static const BGC_FP64_Vector3 _TEST_FP64_VECTOR3_LIST[] = {
{ 0.0, 4.0, 3.0 },
{ -3.0, 0.0, -4.0 },
{ 100.0, -100.0, 100.0 },
@ -82,10 +82,10 @@ static const double _TEST_FP64_MODULUS_LIST[] = {
void test_vector3_square_modulus_fp64()
{
print_testing_name("bgc_vector3_get_square_modulus_fp64");
print_testing_name("bgc_fp64_vector3_get_square_modulus");
for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) {
if (!bgc_are_close_fp64(bgc_vector3_get_square_modulus_fp64(&_TEST_FP64_VECTOR3_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) {
if (!bgc_fp64_are_close(bgc_fp64_vector3_get_square_modulus(&_TEST_FP64_VECTOR3_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) {
print_testing_failed();
return;
}
@ -96,10 +96,10 @@ void test_vector3_square_modulus_fp64()
void test_vector3_modulus_fp64()
{
print_testing_name("bgc_vector3_get_modulus_fp64");
print_testing_name("bgc_fp64_vector3_get_modulus");
for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) {
if (!bgc_are_close_fp64(bgc_vector3_get_modulus_fp64(&_TEST_FP64_VECTOR3_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) {
if (!bgc_fp64_are_close(bgc_fp64_vector3_get_modulus(&_TEST_FP64_VECTOR3_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) {
print_testing_failed();
return;
}

View file

@ -4,11 +4,11 @@
void test_vector3_reset_fp32()
{
BgcVector3FP32 vector;
BGC_FP32_Vector3 vector;
print_testing_name("bgc_vector3_reset_fp32");
print_testing_name("bgc_fp32_vector3_reset");
bgc_vector3_reset_fp32(&vector);
bgc_fp32_vector3_reset(&vector);
if (vector.x1 != 0.0f || vector.x2 != 0.0f || vector.x3 != 0.0f) {
print_testing_failed();
@ -20,11 +20,11 @@ void test_vector3_reset_fp32()
void test_vector3_reset_fp64()
{
BgcVector3FP64 vector;
BGC_FP64_Vector3 vector;
print_testing_name("bgc_vector3_reset_fp64");
print_testing_name("bgc_fp64_vector3_reset");
bgc_vector3_reset_fp64(&vector);
bgc_fp64_vector3_reset(&vector);
if (vector.x1 != 0.0 || vector.x2 != 0.0 || vector.x3 != 0.0) {
print_testing_failed();

View file

@ -8,25 +8,25 @@
void test_vector3_set_values_fp32()
{
BgcVector3FP32 vector;
BGC_FP32_Vector3 vector;
print_testing_name("bgc_vector3_set_values_fp32");
print_testing_name("bgc_fp32_vector3_make");
bgc_vector3_set_values_fp32(1.0f, 2.0f, 3.0f, &vector);
bgc_fp32_vector3_make(1.0f, 2.0f, 3.0f, &vector);
if (vector.x1 != 1.0f || vector.x2 != 2.0f || vector.x3 != 3.0f) {
print_testing_error("First step failed");
return;
}
bgc_vector3_set_values_fp32(-3.0f, -5.0f, -7.0f, &vector);
bgc_fp32_vector3_make(-3.0f, -5.0f, -7.0f, &vector);
if (vector.x1 != -3.0f || vector.x2 != -5.0f || vector.x3 != -7.0f) {
print_testing_error("Second step failed");
return;
}
bgc_vector3_set_values_fp32(-2.0f, 2.0f, 4.0f, &vector);
bgc_fp32_vector3_make(-2.0f, 2.0f, 4.0f, &vector);
if (vector.x1 != -2.0f || vector.x2 != 2.0f || vector.x3 != 4.0f) {
print_testing_error("Third step failed");
@ -40,26 +40,26 @@ void test_vector3_set_values_fp32()
void test_vector3_set_values_fp64()
{
BgcVector3FP64 vector;
BGC_FP64_Vector3 vector;
print_testing_name("bgc_vector3_set_values_fp64");
print_testing_name("bgc_fp64_vector3_make");
bgc_vector3_set_values_fp64(1.0, 2.0, 3.0, &vector);
bgc_fp64_vector3_make(1.0, 2.0, 3.0, &vector);
if (vector.x1 != 1.0 || vector.x2 != 2.0 || vector.x3 != 3.0) {
print_testing_error("First step failed");
return;
}
bgc_vector3_set_values_fp64(-3.0, -5.0, -7.0, &vector);
bgc_fp64_vector3_make(-3.0, -5.0, -7.0, &vector);
if (vector.x1 != -3.0 || vector.x2 != -5.0 || vector.x3 != -7.0) {
print_testing_error("Second step failed");
return;
}
bgc_vector3_set_values_fp64(-2.0, 2.0, 4.0, &vector);
bgc_fp64_vector3_make(-2.0, 2.0, 4.0, &vector);
if (vector.x1 != -2.0 || vector.x2 != 2.0 || vector.x3 != 4.0) {
print_testing_error("Third step failed");

View file

@ -8,14 +8,14 @@
static const int _TEST_FP32_VECTOR3_AMOUNT = 4;
static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST1[] = {
static const BGC_FP32_Vector3 _TEST_FP32_VECTOR3_LIST1[] = {
{ 1.0f, 2.0f, 3.0f },
{ -3.0f, -2.0f, -1.0f },
{ 100.0f, -100.0f, 344.7f },
{ -100.1f, 100.2f, -271.3f }
};
static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST2[] = {
static const BGC_FP32_Vector3 _TEST_FP32_VECTOR3_LIST2[] = {
{ 3.6f, 5.3f, -0.123f },
{ 204.07f, -781.89f, 891.3f },
{ -20.02f, -1.0003f, 0.9275f },
@ -24,15 +24,15 @@ static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST2[] = {
void test_vector3_swap_fp32()
{
BgcVector3FP32 vector1, vector2;
BGC_FP32_Vector3 vector1, vector2;
print_testing_name("bgc_vector3_swap_fp32");
print_testing_name("bgc_fp32_vector3_swap");
for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) {
bgc_vector3_copy_fp32(&_TEST_FP32_VECTOR3_LIST1[i], &vector1);
bgc_vector3_copy_fp32(&_TEST_FP32_VECTOR3_LIST2[i], &vector2);
bgc_fp32_vector3_copy(&_TEST_FP32_VECTOR3_LIST1[i], &vector1);
bgc_fp32_vector3_copy(&_TEST_FP32_VECTOR3_LIST2[i], &vector2);
bgc_vector3_swap_fp32(&vector1, &vector2);
bgc_fp32_vector3_swap(&vector1, &vector2);
if (vector1.x1 != _TEST_FP32_VECTOR3_LIST2[i].x1 ||
vector1.x2 != _TEST_FP32_VECTOR3_LIST2[i].x2 ||
@ -52,14 +52,14 @@ void test_vector3_swap_fp32()
static const int _TEST_FP64_VECTOR3_AMOUNT = 4;
static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST1[] = {
static const BGC_FP64_Vector3 _TEST_FP64_VECTOR3_LIST1[] = {
{ 1.0, 2.0, 3.0 },
{ -3.0, -2.0, -1.0 },
{ 100.0, -100.0, 344.7 },
{ -100.1, 100.2, -271.3 }
};
static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST2[] = {
static const BGC_FP64_Vector3 _TEST_FP64_VECTOR3_LIST2[] = {
{ 3.6, 5.3, -0.123 },
{ 204.07, -781.89, 891.3 },
{ -20.02, -1.0003, 0.9275 },
@ -68,15 +68,15 @@ static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST2[] = {
void test_vector3_swap_fp64()
{
BgcVector3FP64 vector1, vector2;
BGC_FP64_Vector3 vector1, vector2;
print_testing_name("bgc_vector3_swap_fp64");
print_testing_name("bgc_fp64_vector3_swap");
for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) {
bgc_vector3_copy_fp64(&_TEST_FP64_VECTOR3_LIST1[i], &vector1);
bgc_vector3_copy_fp64(&_TEST_FP64_VECTOR3_LIST2[i], &vector2);
bgc_fp64_vector3_copy(&_TEST_FP64_VECTOR3_LIST1[i], &vector1);
bgc_fp64_vector3_copy(&_TEST_FP64_VECTOR3_LIST2[i], &vector2);
bgc_vector3_swap_fp64(&vector1, &vector2);
bgc_fp64_vector3_swap(&vector1, &vector2);
if (vector1.x1 != _TEST_FP64_VECTOR3_LIST2[i].x1 ||
vector1.x2 != _TEST_FP64_VECTOR3_LIST2[i].x2 ||