Небольшие исправления в модульных тестах

This commit is contained in:
Andrey Pokidov 2025-02-12 12:35:10 +07:00
parent 2d8240265c
commit fffe2be43b
8 changed files with 132 additions and 92 deletions

View file

@ -77,6 +77,10 @@
<Option compilerVar="CC" /> <Option compilerVar="CC" />
</Unit> </Unit>
<Unit filename="tests/quaternion/quaternion_set_values.h" /> <Unit filename="tests/quaternion/quaternion_set_values.h" />
<Unit filename="tests/quaternion/quaternion_square_modulus.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_square_modulus.h" />
<Unit filename="tests/quaternion/quaternion_swap.c"> <Unit filename="tests/quaternion/quaternion_swap.c">
<Option compilerVar="CC" /> <Option compilerVar="CC" />
</Unit> </Unit>

View file

@ -9,28 +9,28 @@ static const int _TEST_FP32_NONZERO_QUATERNION_AMOUNT = 11;
static const BgcQuaternionFP32 _TEST_FP32_ZERO_QUATERNION_LIST[] = { static const BgcQuaternionFP32 _TEST_FP32_ZERO_QUATERNION_LIST[] = {
{ 0.0f, 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f, 0.0f },
{ BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, { 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
{ -BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, { -0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
{ 0.0f, BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 0.0f, 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
{ 0.0f, -BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 0.0f, -0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
{ 0.0f, 0.0f, BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 0.0f, 0.75f * BGC_EPSYLON_FP32, 0.0f },
{ 0.0f, 0.0f, -BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 0.0f, -0.75f * BGC_EPSYLON_FP32, 0.0f },
{ 0.0f, 0.0f, 0.0f, BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 0.0f, 0.75f * BGC_EPSYLON_FP32 },
{ 0.0f, 0.0f, 0.0f, -BGC_EPSYLON_FP32 } { 0.0f, 0.0f, 0.0f, -0.75f * BGC_EPSYLON_FP32 }
}; };
static const BgcQuaternionFP32 _TEST_FP32_NONZERO_QUATERION_LIST[] = { static const BgcQuaternionFP32 _TEST_FP32_NONZERO_QUATERION_LIST[] = {
{ 0.0f, 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f },
{ 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, { 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
{ -1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, { -1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
{ 0.0f, 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 0.0f, 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
{ 0.0f, -1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 0.0f, -1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
{ 0.0f, 0.0f, 1.5f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 0.0f, 1.25f * BGC_EPSYLON_FP32, 0.0f },
{ 0.0f, 0.0f, -1.5f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 0.0f, -1.25f * BGC_EPSYLON_FP32, 0.0f },
{ 0.0f, 0.0f, 0.0f, 1.5f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 0.0f, 1.25f * BGC_EPSYLON_FP32 },
{ 0.0f, 0.0f, 0.0f, -1.5f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 0.0f, -1.25f * BGC_EPSYLON_FP32 },
{ BGC_EPSYLON_FP32, BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 1.25f * BGC_EPSYLON_FP32, 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
{ -BGC_EPSYLON_FP32, -BGC_EPSYLON_FP32, 0.0f, 0.0f } { -1.25f * BGC_EPSYLON_FP32, -1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }
}; };
int test_quaternion_is_zero_fp32() int test_quaternion_is_zero_fp32()
@ -65,28 +65,28 @@ static const int _TEST_FP64_NONZERO_QUATERNION_AMOUNT = 11;
static const BgcQuaternionFP64 _TEST_FP64_ZERO_QUATERNION_LIST[] = { static const BgcQuaternionFP64 _TEST_FP64_ZERO_QUATERNION_LIST[] = {
{ 0.0, 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0, 0.0 },
{ BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, { 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
{ -BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, { -0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
{ 0.0, BGC_EPSYLON_FP64, 0.0, 0.0 }, { 0.0, 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 },
{ 0.0, -BGC_EPSYLON_FP64, 0.0, 0.0 }, { 0.0, -0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 },
{ 0.0, 0.0, BGC_EPSYLON_FP64, 0.0 }, { 0.0, 0.0, 0.75 * BGC_EPSYLON_FP64, 0.0 },
{ 0.0, 0.0, -BGC_EPSYLON_FP64, 0.0 }, { 0.0, 0.0, -0.75 * BGC_EPSYLON_FP64, 0.0 },
{ 0.0, 0.0, 0.0, BGC_EPSYLON_FP64 }, { 0.0, 0.0, 0.0, 0.75 * BGC_EPSYLON_FP64 },
{ 0.0, 0.0, 0.0, -BGC_EPSYLON_FP64 } { 0.0, 0.0, 0.0, -0.75 * BGC_EPSYLON_FP64 }
}; };
static const BgcQuaternionFP64 _TEST_FP64_NONZERO_QUATERION_LIST[] = { static const BgcQuaternionFP64 _TEST_FP64_NONZERO_QUATERION_LIST[] = {
{ 0.0, 1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0, 0.0 },
{ 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, { 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
{ -1.5 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, { -1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
{ 0.0, 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 0.0, 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 },
{ 0.0, -1.5 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 0.0, -1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 },
{ 0.0, 0.0, 1.5 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, 0.0, 1.25 * BGC_EPSYLON_FP64, 0.0 },
{ 0.0, 0.0, -1.5 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, 0.0, -1.25 * BGC_EPSYLON_FP64, 0.0 },
{ 0.0, 0.0, 0.0, 1.5 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, 0.0, 1.25 * BGC_EPSYLON_FP64 },
{ 0.0, 0.0, 0.0, -1.5 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, 0.0, -1.25 * BGC_EPSYLON_FP64 },
{ BGC_EPSYLON_FP64, BGC_EPSYLON_FP64, 0.0, 0.0 }, { 1.25 * BGC_EPSYLON_FP64, 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 },
{ -BGC_EPSYLON_FP64, -BGC_EPSYLON_FP64, 0.0, 0.0 } { -1.25 * BGC_EPSYLON_FP64, -1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }
}; };
int test_quaternion_is_zero_fp64() int test_quaternion_is_zero_fp64()

View file

Internal server error - Personal Git Server: Beyond coding. We Forge.

500

Internal server error

Forgejo version: 11.0.1+gitea-1.22.0

@ -0,0 +1,34 @@
#include "./quaternion_square_modulus.h"