Переход на версию 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_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) {

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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();

View file

@ -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");

View file

@ -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 ||