Уточнение погрешности (epsylon), поддержка тестов для Code::Blocks
This commit is contained in:
parent
899ca7dd52
commit
47ba771b68
6 changed files with 92 additions and 60 deletions
|
|
@ -49,6 +49,30 @@
|
|||
<Unit filename="main.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="tests/quaternion.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="tests/quaternion.h" />
|
||||
<Unit filename="tests/quaternion/quaternion_copy.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="tests/quaternion/quaternion_copy.h" />
|
||||
<Unit filename="tests/quaternion/quaternion_reset.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="tests/quaternion/quaternion_reset.h" />
|
||||
<Unit filename="tests/quaternion/quaternion_set_to_identity.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="tests/quaternion/quaternion_set_to_identity.h" />
|
||||
<Unit filename="tests/quaternion/quaternion_set_values.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="tests/quaternion/quaternion_set_values.h" />
|
||||
<Unit filename="tests/quaternion/quaternion_swap.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="tests/quaternion/quaternion_swap.h" />
|
||||
<Unit filename="tests/utilities.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
|
|
@ -73,6 +97,10 @@
|
|||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="tests/vector2/vector2_copy.h" />
|
||||
<Unit filename="tests/vector2/vector2_is_zero.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="tests/vector2/vector2_is_zero.h" />
|
||||
<Unit filename="tests/vector2/vector2_reset.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
|
|
@ -93,6 +121,10 @@
|
|||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="tests/vector3/vector3_copy.h" />
|
||||
<Unit filename="tests/vector3/vector3_is_zero.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="tests/vector3/vector3_is_zero.h" />
|
||||
<Unit filename="tests/vector3/vector3_reset.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ int test_bgc_quaternion_is_zero_fp32()
|
|||
}
|
||||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP32_ZERO_QUATERNION_AMOUNT; i++) {
|
||||
for (int i = 0; i < _TEST_FP32_NONZERO_QUATERNION_AMOUNT; i++) {
|
||||
if (bgc_quaternion_is_zero_fp32(&_TEST_FP32_NONZERO_NUMBERS[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
|
|
@ -102,7 +102,7 @@ int test_bgc_quaternion_is_zero_fp64()
|
|||
}
|
||||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP64_ZERO_QUATERNION_AMOUNT; i++) {
|
||||
for (int i = 0; i < _TEST_FP64_NONZERO_QUATERNION_AMOUNT; i++) {
|
||||
if (test_bgc_quaternion_is_zero_fp64(&_TEST_FP64_NONZERO_NUMBERS[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
|
|
|
|||
|
|
@ -20,22 +20,22 @@ static const _TestNumberPairFP32 _TEST_FP32_DATA_CLOSE[] = {
|
|||
{1.0f, 1.0f},
|
||||
{-1.0f, -1.0f},
|
||||
|
||||
{-0.5f * BGC_EPSYLON_FP32, 0.5f * BGC_EPSYLON_FP32},
|
||||
{-0.4f * BGC_EPSYLON_FP32, 0.4f * BGC_EPSYLON_FP32},
|
||||
|
||||
{1.0f, 1.0f + BGC_EPSYLON_FP32},
|
||||
{1.0f, 1.0f - BGC_EPSYLON_FP32},
|
||||
{1.0f + BGC_EPSYLON_FP32, 1.0f},
|
||||
{1.0f - BGC_EPSYLON_FP32, 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 + BGC_EPSYLON_FP32},
|
||||
{-1.0f, -1.0f - BGC_EPSYLON_FP32},
|
||||
{-1.0f + BGC_EPSYLON_FP32, -1.0f},
|
||||
{-1.0f - BGC_EPSYLON_FP32, -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},
|
||||
|
||||
{100.0f, 100.0f * (1.0f + BGC_EPSYLON_FP32)},
|
||||
{100.0f, 100.0f * (1.0f - BGC_EPSYLON_FP32)},
|
||||
{-100.0f, -100.0f * (1.0f + BGC_EPSYLON_FP32)},
|
||||
{-100.0f, -100.0f * (1.0f - 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_EPSYLON_FP32)}
|
||||
};
|
||||
|
||||
static const _TestNumberPairFP32 _TEST_FP32_DATA_DIFFERENT[] = {
|
||||
|
|
@ -45,20 +45,20 @@ static const _TestNumberPairFP32 _TEST_FP32_DATA_DIFFERENT[] = {
|
|||
|
||||
{-0.6f * BGC_EPSYLON_FP32, 0.6f * BGC_EPSYLON_FP32},
|
||||
|
||||
{1.0f, 1.0f + 1.5f * BGC_EPSYLON_FP32},
|
||||
{1.0f, 1.0f - 1.5f * BGC_EPSYLON_FP32},
|
||||