Модульные тесты для кватернионов

This commit is contained in:
Andrey Pokidov 2025-02-11 00:01:29 +07:00
parent 2fae0154ac
commit 899ca7dd52
63 changed files with 1233 additions and 284 deletions

View file

@ -13,7 +13,7 @@ typedef struct {
// ==================== FP32 ==================== //
static const int _TEST_FP32_CLOSE_NUMBERS_AMOUNT = 16;
static const int _TEST_FP32_DIFFERENT_NUMBERS_AMOUNT = 16;
static const int _TEST_FP32_DIFFERENT_NUMBERS_AMOUNT = 12;
static const _TestNumberPairFP32 _TEST_FP32_DATA_CLOSE[] = {
{0.0f, 0.0f},
@ -32,10 +32,10 @@ static const _TestNumberPairFP32 _TEST_FP32_DATA_CLOSE[] = {
{-1.0f + BGC_EPSYLON_FP32, -1.0f},
{-1.0f - BGC_EPSYLON_FP32, -1.0f},
{100.0f, 100.0f + 99.0f * BGC_EPSYLON_FP32},
{100.0f, 100.0f - 99.0f * BGC_EPSYLON_FP32},
{-100.0f, -100.0f + 99.0f * BGC_EPSYLON_FP32},
{-100.0f, -100.0f - 99.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 - BGC_EPSYLON_FP32)}
};
static const _TestNumberPairFP32 _TEST_FP32_DATA_DIFFERENT[] = {
@ -55,10 +55,10 @@ static const _TestNumberPairFP32 _TEST_FP32_DATA_DIFFERENT[] = {
{-1.0f + 1.5f * BGC_EPSYLON_FP32, -1.0f},
{-1.0f - 1.5f * BGC_EPSYLON_FP32, -1.0f},
{100.0f, 100.0f + 101.0f * BGC_EPSYLON_FP32},
{100.0f, 100.0f - 101.0f * BGC_EPSYLON_FP32},
{-100.0f, -100.0f + 101.0f * BGC_EPSYLON_FP32},
{-100.0f, -100.0f - 101.0f * BGC_EPSYLON_FP32}
{100.0f, 100.0f * (1.0f + 1.5f * BGC_EPSYLON_FP32)},
{100.0f, 100.0f * (1.0f - 1.5f * BGC_EPSYLON_FP32)},
{-100.0f, -100.0f * (1.0f + 1.5f * BGC_EPSYLON_FP32)},
{-100.0f, -100.0f * (1.0f - 1.5f * BGC_EPSYLON_FP32)}
};
int test_bgc_are_close_fp32()
@ -161,3 +161,16 @@ int test_bgc_are_close_fp64()
return TEST_SUCCES;
}
int test_bgc_are_close()
{
if (test_bgc_are_close_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
if (test_bgc_are_close_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
return TEST_SUCCES;
}

View file

@ -5,4 +5,6 @@ int test_bgc_are_close_fp32();
int test_bgc_are_close_fp64();
int test_bgc_are_close();
#endif

View file

@ -177,3 +177,24 @@ int test_bgc_is_sqare_value_unit_fp64()
return TEST_SUCCES;
}
int test_bgc_is_unit()
{
if (test_bgc_is_unit_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
if (test_bgc_is_unit_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
if (test_bgc_is_sqare_value_unit_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
if (test_bgc_is_sqare_value_unit_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
return TEST_SUCCES;
}

View file

@ -9,4 +9,6 @@ int test_bgc_is_sqare_value_unit_fp32();
int test_bgc_is_sqare_value_unit_fp64();
int test_bgc_is_unit();
#endif

View file

@ -91,3 +91,16 @@ int test_bgc_is_zero_fp64()
return TEST_SUCCES;
}
int test_bgc_is_zero()
{
if (test_bgc_is_zero_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
if (test_bgc_is_zero_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
return TEST_SUCCES;
}

View file

@ -5,4 +5,6 @@ int test_bgc_is_zero_fp32();
int test_bgc_is_zero_fp64();
int test_bgc_is_zero();
#endif