From 899ca7dd52aa4f89c8ebbbcf6503c36a89e7c86a Mon Sep 17 00:00:00 2001 From: Andrey Pokidov Date: Tue, 11 Feb 2025 00:01:29 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=BE=D0=B4=D1=83=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D1=8B=D0=B5=20=D1=82=D0=B5=D1=81=D1=82=D1=8B=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BA=D0=B2=D0=B0=D1=82=D0=B5=D1=80=D0=BD=D0=B8=D0=BE?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic-geometry-test.vcxproj | 16 +++ .../basic-geometry-test.vcxproj.filters | 51 +++++++ basic-geometry-test/main.c | 5 + basic-geometry-test/tests/quaternion.c | 28 ++++ basic-geometry-test/tests/quaternion.h | 13 ++ .../tests/quaternion/quaternion_copy.c | 86 ++++++++++++ .../tests/quaternion/quaternion_copy.h | 10 ++ .../tests/quaternion/quaternion_is_zero.c | 128 ++++++++++++++++++ .../tests/quaternion/quaternion_is_zero.h | 10 ++ .../tests/quaternion/quaternion_reset.c | 52 +++++++ .../tests/quaternion/quaternion_reset.h | 10 ++ .../quaternion/quaternion_set_to_identity.c | 52 +++++++ .../quaternion/quaternion_set_to_identity.h | 10 ++ .../tests/quaternion/quaternion_set_values.c | 86 ++++++++++++ .../tests/quaternion/quaternion_set_values.h | 10 ++ .../tests/quaternion/quaternion_swap.c | 114 ++++++++++++++++ .../tests/quaternion/quaternion_swap.h | 10 ++ basic-geometry-test/tests/utilities.c | 47 ------- basic-geometry-test/tests/utilities.h | 6 - .../tests/utilities/are_close.c | 31 +++-- .../tests/utilities/are_close.h | 2 + basic-geometry-test/tests/utilities/is_unit.c | 21 +++ basic-geometry-test/tests/utilities/is_unit.h | 2 + basic-geometry-test/tests/utilities/is_zero.c | 13 ++ basic-geometry-test/tests/utilities/is_zero.h | 2 + basic-geometry-test/tests/vector2.c | 56 +------- basic-geometry-test/tests/vector2.h | 9 +- .../tests/vector2/vector2_copy.c | 13 ++ .../tests/vector2/vector2_copy.h | 2 + .../tests/vector2/vector2_is_zero.c | 112 +++++++++++++++ .../tests/vector2/vector2_is_zero.h | 10 ++ .../tests/vector2/vector2_reset.c | 13 ++ .../tests/vector2/vector2_reset.h | 2 + .../tests/vector2/vector2_set_values.c | 13 ++ .../tests/vector2/vector2_set_values.h | 2 + .../tests/vector2/vector2_swap.c | 15 +- .../tests/vector2/vector2_swap.h | 2 + basic-geometry-test/tests/vector3.c | 56 +------- basic-geometry-test/tests/vector3.h | 13 +- .../tests/vector3/vector3_copy.c | 21 ++- .../tests/vector3/vector3_copy.h | 2 + .../tests/vector3/vector3_is_zero.c | 120 ++++++++++++++++ .../tests/vector3/vector3_is_zero.h | 10 ++ .../tests/vector3/vector3_reset.c | 13 ++ .../tests/vector3/vector3_reset.h | 2 + .../tests/vector3/vector3_set_values.c | 13 ++ .../tests/vector3/vector3_set_values.h | 2 + .../tests/vector3/vector3_swap.c | 15 +- .../tests/vector3/vector3_swap.h | 2 + basic-geometry-test/tests/versor.c | 78 ----------- basic-geometry-test/tests/versor.h | 12 -- .../tests/versor/versor_are_close.c | 13 ++ .../tests/versor/versor_are_close.h | 2 + .../tests/versor/versor_combine.c | 13 ++ .../tests/versor/versor_combine.h | 2 + .../tests/versor/versor_copy.c | 13 ++ .../tests/versor/versor_copy.h | 2 + .../tests/versor/versor_reset.c | 13 ++ .../tests/versor/versor_reset.h | 2 + .../tests/versor/versor_set_values.c | 13 ++ .../tests/versor/versor_set_values.h | 2 + .../tests/versor/versor_swap.c | 13 ++ .../tests/versor/versor_swap.h | 6 +- 63 files changed, 1233 insertions(+), 284 deletions(-) create mode 100644 basic-geometry-test/tests/quaternion.c create mode 100644 basic-geometry-test/tests/quaternion.h create mode 100644 basic-geometry-test/tests/quaternion/quaternion_copy.c create mode 100644 basic-geometry-test/tests/quaternion/quaternion_copy.h create mode 100644 basic-geometry-test/tests/quaternion/quaternion_is_zero.c create mode 100644 basic-geometry-test/tests/quaternion/quaternion_is_zero.h create mode 100644 basic-geometry-test/tests/quaternion/quaternion_reset.c create mode 100644 basic-geometry-test/tests/quaternion/quaternion_reset.h create mode 100644 basic-geometry-test/tests/quaternion/quaternion_set_to_identity.c create mode 100644 basic-geometry-test/tests/quaternion/quaternion_set_to_identity.h create mode 100644 basic-geometry-test/tests/quaternion/quaternion_set_values.c create mode 100644 basic-geometry-test/tests/quaternion/quaternion_set_values.h create mode 100644 basic-geometry-test/tests/quaternion/quaternion_swap.c create mode 100644 basic-geometry-test/tests/quaternion/quaternion_swap.h create mode 100644 basic-geometry-test/tests/vector2/vector2_is_zero.c create mode 100644 basic-geometry-test/tests/vector2/vector2_is_zero.h create mode 100644 basic-geometry-test/tests/vector3/vector3_is_zero.c create mode 100644 basic-geometry-test/tests/vector3/vector3_is_zero.h diff --git a/basic-geometry-test/basic-geometry-test.vcxproj b/basic-geometry-test/basic-geometry-test.vcxproj index 966d1a5..5cf7146 100644 --- a/basic-geometry-test/basic-geometry-test.vcxproj +++ b/basic-geometry-test/basic-geometry-test.vcxproj @@ -150,16 +150,24 @@ + + + + + + + + @@ -174,16 +182,24 @@ + + + + + + + + diff --git a/basic-geometry-test/basic-geometry-test.vcxproj.filters b/basic-geometry-test/basic-geometry-test.vcxproj.filters index c776e36..bc52e7a 100644 --- a/basic-geometry-test/basic-geometry-test.vcxproj.filters +++ b/basic-geometry-test/basic-geometry-test.vcxproj.filters @@ -66,6 +66,30 @@ tests\versor + + tests\quaternion + + + tests\quaternion + + + tests\quaternion + + + tests\quaternion + + + tests + + + tests\quaternion + + + tests\vector3 + + + tests\vector2 + @@ -132,6 +156,30 @@ tests\versor + + tests\quaternion + + + tests\quaternion + + + tests\quaternion + + + tests\quaternion + + + tests + + + tests\quaternion + + + tests\vector3 + + + tests\vector2 + @@ -149,5 +197,8 @@ {d6f82407-8310-4b32-b153-aa67e766c72a} + + {e8bafdb8-66e5-4393-bc89-8bff83bcccd6} + \ No newline at end of file diff --git a/basic-geometry-test/main.c b/basic-geometry-test/main.c index 88da6da..2004ab9 100644 --- a/basic-geometry-test/main.c +++ b/basic-geometry-test/main.c @@ -6,6 +6,7 @@ #include "tests/utilities.h" #include "tests/vector2.h" #include "tests/vector3.h" +#include "tests/quaternion.h" #include "tests/versor.h" #define PROGRAM_SUCCESS 0 @@ -25,6 +26,10 @@ int main() return PROGRAM_FAILED; } + if (test_quaternion() == TEST_FAILED) { + return PROGRAM_FAILED; + } + if (test_versor() == TEST_FAILED) { return PROGRAM_FAILED; } diff --git a/basic-geometry-test/tests/quaternion.c b/basic-geometry-test/tests/quaternion.c new file mode 100644 index 0000000..03a6357 --- /dev/null +++ b/basic-geometry-test/tests/quaternion.c @@ -0,0 +1,28 @@ +#include "quaternion.h" + +int test_quaternion() +{ + print_testing_section("BGC Quaternion"); + + if (test_bgc_quaternion_reset() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_quaternion_set_to_identity() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_quaternion_set_values() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_quaternion_copy() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_quaternion_swap() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/quaternion.h b/basic-geometry-test/tests/quaternion.h new file mode 100644 index 0000000..18ab9d2 --- /dev/null +++ b/basic-geometry-test/tests/quaternion.h @@ -0,0 +1,13 @@ +#ifndef _TEST_QUATERNION_H_ +#define _TEST_QUATERNION_H_ + +#include "./../helpers.h" +#include "./quaternion/quaternion_reset.h" +#include "./quaternion/quaternion_set_to_identity.h" +#include "./quaternion/quaternion_set_values.h" +#include "./quaternion/quaternion_copy.h" +#include "./quaternion/quaternion_swap.h" + +int test_quaternion(); + +#endif diff --git a/basic-geometry-test/tests/quaternion/quaternion_copy.c b/basic-geometry-test/tests/quaternion/quaternion_copy.c new file mode 100644 index 0000000..189a6b7 --- /dev/null +++ b/basic-geometry-test/tests/quaternion/quaternion_copy.c @@ -0,0 +1,86 @@ +#include "./quaternion_copy.h" + +#include + +#include "./../../helpers.h" + +// ==================== FP32 ==================== // + +static const int _TEST_FP32_QUATERNION_AMOUNT = 4; +static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST[] = { + { 1.0f, 2.0f, 3.0f, 4.0f }, + { -4.0f, -3.0f, -2.0f, -1.0f }, + { -0.001f, 100.0f, -100.0f, 0.001f }, + { 0.001f, -100.0f, 100.0f, -0.001f } +}; + +int test_bgc_quaternion_copy_fp32() +{ + BgcQuaternionFP32 vector; + + print_testing_name("bgc_quaternion_copy_fp32"); + + for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) { + + bgc_quaternion_copy_fp32(&_TEST_FP32_QUATERNION_LIST[i], &vector); + + if (vector.s0 != _TEST_FP32_QUATERNION_LIST[i].s0 || + vector.x1 != _TEST_FP32_QUATERNION_LIST[i].x1 || + vector.x2 != _TEST_FP32_QUATERNION_LIST[i].x2 || + vector.x3 != _TEST_FP32_QUATERNION_LIST[i].x3) { + print_testing_failed(); + return TEST_FAILED; + } + } + + print_testing_success(); + + return TEST_SUCCES; +} + +// ==================== FP64 ==================== // + +static const int _TEST_FP64_QUATERNION_AMOUNT = 4; +static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST[] = { + { 1.0, 2.0, 3.0, 4.0 }, + { -4.0, -3.0, -2.0, -1.0 }, + { -0.001, 100.0, -100.0, 0.001 }, + { 0.001, -100.0, 100.0, -0.001 } +}; + +int test_bgc_quaternion_copy_fp64() +{ + BgcQuaternionFP64 vector; + + print_testing_name("bgc_quaternion_copy_fp64"); + + for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) { + + bgc_quaternion_copy_fp64(&_TEST_FP64_QUATERNION_LIST[i], &vector); + + if (vector.s0 != _TEST_FP64_QUATERNION_LIST[i].s0 || + vector.x1 != _TEST_FP64_QUATERNION_LIST[i].x1 || + vector.x2 != _TEST_FP64_QUATERNION_LIST[i].x2 || + vector.x3 != _TEST_FP64_QUATERNION_LIST[i].x3) { + print_testing_failed(); + return TEST_FAILED; + } + } + + print_testing_success(); + + return TEST_SUCCES; +} + +int test_bgc_quaternion_copy() +{ + if (test_bgc_quaternion_copy_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_quaternion_copy_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/quaternion/quaternion_copy.h b/basic-geometry-test/tests/quaternion/quaternion_copy.h new file mode 100644 index 0000000..85a6a85 --- /dev/null +++ b/basic-geometry-test/tests/quaternion/quaternion_copy.h @@ -0,0 +1,10 @@ +#ifndef _TEST_QUATERNION_COPY_H_ +#define _TEST_QUATERNION_COPY_H_ + +int test_bgc_quaternion_copy_fp32(); + +int test_bgc_quaternion_copy_fp64(); + +int test_bgc_quaternion_copy(); + +#endif diff --git a/basic-geometry-test/tests/quaternion/quaternion_is_zero.c b/basic-geometry-test/tests/quaternion/quaternion_is_zero.c new file mode 100644 index 0000000..9f71f2f --- /dev/null +++ b/basic-geometry-test/tests/quaternion/quaternion_is_zero.c @@ -0,0 +1,128 @@ +#include "./quaternion_is_zero.h" + +#include "./../../helpers.h" + +// ==================== FP32 ==================== // + +static const int _TEST_FP32_ZERO_QUATERNION_AMOUNT = 9; +static const int _TEST_FP32_NONZERO_QUATERNION_AMOUNT = 11; + +static const BgcQuaternionFP32 _TEST_FP32_ZERO_QUATERNION_LIST[] = { + { 0.0f, 0.0f, 0.0f, 0.0f }, + { BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, + { -BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, + { 0.0f, BGC_EPSYLON_FP32, 0.0f, 0.0f }, + { 0.0f, -BGC_EPSYLON_FP32, 0.0f, 0.0f }, + { 0.0f, 0.0f, BGC_EPSYLON_FP32, 0.0f }, + { 0.0f, 0.0f, -BGC_EPSYLON_FP32, 0.0f }, + { 0.0f, 0.0f, 0.0f, BGC_EPSYLON_FP32 }, + { 0.0f, 0.0f, 0.0f, -BGC_EPSYLON_FP32 } +}; + +static const BgcQuaternionFP32 _TEST_FP32_NONZERO_NUMBERS[] = { + { 0.0f, 1.0f, 0.0f, 0.0f }, + { 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, + { -1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, + { 0.0f, 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, + { 0.0f, -1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, + { 0.0f, 0.0f, 1.5f * BGC_EPSYLON_FP32, 0.0f }, + { 0.0f, 0.0f, -1.5f * BGC_EPSYLON_FP32, 0.0f }, + { 0.0f, 0.0f, 0.0f, 1.5f * BGC_EPSYLON_FP32 }, + { 0.0f, 0.0f, 0.0f, -1.5f * BGC_EPSYLON_FP32 }, + { BGC_EPSYLON_FP32, BGC_EPSYLON_FP32, 0.0f, 0.0f }, + { -BGC_EPSYLON_FP32, -BGC_EPSYLON_FP32, 0.0f, 0.0f } +}; + +int test_bgc_quaternion_is_zero_fp32() +{ + print_testing_name("bgc_quaternion_is_zero_fp32"); + + // Testing zero values: + for (int i = 0; i < _TEST_FP32_ZERO_QUATERNION_AMOUNT; i++) { + if (!bgc_quaternion_is_zero_fp32(&_TEST_FP32_ZERO_QUATERNION_LIST[i])) { + print_testing_failed(); + return TEST_FAILED; + } + } + + // Testing non-zero values: + for (int i = 0; i < _TEST_FP32_ZERO_QUATERNION_AMOUNT; i++) { + if (bgc_quaternion_is_zero_fp32(&_TEST_FP32_NONZERO_NUMBERS[i])) { + print_testing_failed(); + return TEST_FAILED; + } + } + + print_testing_success(); + + return TEST_SUCCES; +} + +// ==================== FP64 ==================== // + +static const int _TEST_FP64_ZERO_QUATERNION_AMOUNT = 9; +static const int _TEST_FP64_NONZERO_QUATERNION_AMOUNT = 11; + +static const BgcQuaternionFP64 _TEST_FP64_ZERO_QUATERNION_LIST[] = { + { 0.0, 0.0, 0.0, 0.0 }, + { BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, + { -BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, + { 0.0, BGC_EPSYLON_FP64, 0.0, 0.0 }, + { 0.0, -BGC_EPSYLON_FP64, 0.0, 0.0 }, + { 0.0, 0.0, BGC_EPSYLON_FP64, 0.0 }, + { 0.0, 0.0, -BGC_EPSYLON_FP64, 0.0 }, + { 0.0, 0.0, 0.0, BGC_EPSYLON_FP64 }, + { 0.0, 0.0, 0.0, -BGC_EPSYLON_FP64 } +}; + +static const BgcQuaternionFP64 _TEST_FP64_NONZERO_NUMBERS[] = { + { 0.0, 1.0, 0.0, 0.0 }, + { 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, + { -1.5 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, + { 0.0, 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0 }, + { 0.0, -1.5 * BGC_EPSYLON_FP64, 0.0, 0.0 }, + { 0.0, 0.0, 1.5 * BGC_EPSYLON_FP64, 0.0 }, + { 0.0, 0.0, -1.5 * BGC_EPSYLON_FP64, 0.0 }, + { 0.0, 0.0, 0.0, 1.5 * BGC_EPSYLON_FP64 }, + { 0.0, 0.0, 0.0, -1.5 * BGC_EPSYLON_FP64 }, + { BGC_EPSYLON_FP64, BGC_EPSYLON_FP64, 0.0, 0.0 }, + { -BGC_EPSYLON_FP64, -BGC_EPSYLON_FP64, 0.0, 0.0 } +}; + +int test_bgc_quaternion_is_zero_fp64() +{ + print_testing_name("bgc_quaternion_is_zero_fp64"); + + // Testing zero values: + for (int i = 0; i < _TEST_FP64_ZERO_QUATERNION_AMOUNT; i++) { + if (!test_bgc_quaternion_is_zero_fp64(&_TEST_FP64_ZERO_QUATERNION_LIST[i])) { + print_testing_failed(); + return TEST_FAILED; + } + } + + // Testing non-zero values: + for (int i = 0; i < _TEST_FP64_ZERO_QUATERNION_AMOUNT; i++) { + if (test_bgc_quaternion_is_zero_fp64(&_TEST_FP64_NONZERO_NUMBERS[i])) { + print_testing_failed(); + return TEST_FAILED; + } + } + + print_testing_success(); + + return TEST_SUCCES; +} + +int test_bgc_quaternion_is_zero() +{ + if (test_bgc_quaternion_is_zero_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_quaternion_is_zero_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/quaternion/quaternion_is_zero.h b/basic-geometry-test/tests/quaternion/quaternion_is_zero.h new file mode 100644 index 0000000..2f98145 --- /dev/null +++ b/basic-geometry-test/tests/quaternion/quaternion_is_zero.h @@ -0,0 +1,10 @@ +#ifndef _TEST_QUATERNION_IS_ZERO_H_ +#define _TEST_QUATERNION_IS_ZERO_H_ + +int test_bgc_quaternion_is_zero_fp32(); + +int test_bgc_quaternion_is_zero_fp64(); + +int test_bgc_quaternion_is_zero(); + +#endif diff --git a/basic-geometry-test/tests/quaternion/quaternion_reset.c b/basic-geometry-test/tests/quaternion/quaternion_reset.c new file mode 100644 index 0000000..d497957 --- /dev/null +++ b/basic-geometry-test/tests/quaternion/quaternion_reset.c @@ -0,0 +1,52 @@ +#include "./quaternion_reset.h" + +#include "./../../helpers.h" + +int test_bgc_quaternion_reset_fp32() +{ + BgcQuaternionFP32 vector; + + print_testing_name("bgc_quaternion_reset_fp32"); + + bgc_quaternion_reset_fp32(&vector); + + if (vector.s0 != 0.0f || vector.x1 != 0.0f || vector.x2 != 0.0f || vector.x3 != 0.0f) { + print_testing_failed(); + return TEST_FAILED; + } + + print_testing_success(); + + return TEST_SUCCES; +} + +int test_bgc_quaternion_reset_fp64() +{ + BgcQuaternionFP64 vector; + + print_testing_name("bgc_quaternion_reset_fp64"); + + bgc_quaternion_reset_fp64(&vector); + + if (vector.s0 != 0.0 || vector.x1 != 0.0 || vector.x2 != 0.0 || vector.x3 != 0.0) { + print_testing_failed(); + return TEST_FAILED; + } + + print_testing_success(); + + return TEST_SUCCES; +} + +int test_bgc_quaternion_reset() +{ + if (test_bgc_quaternion_reset_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_quaternion_reset_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/quaternion/quaternion_reset.h b/basic-geometry-test/tests/quaternion/quaternion_reset.h new file mode 100644 index 0000000..55fc3a1 --- /dev/null +++ b/basic-geometry-test/tests/quaternion/quaternion_reset.h @@ -0,0 +1,10 @@ +#ifndef _TEST_QUATERNION_RESET_H_ +#define _TEST_QUATERNION_RESET_H_ + +int test_bgc_quaternion_reset_fp32(); + +int test_bgc_quaternion_reset_fp64(); + +int test_bgc_quaternion_reset(); + +#endif diff --git a/basic-geometry-test/tests/quaternion/quaternion_set_to_identity.c b/basic-geometry-test/tests/quaternion/quaternion_set_to_identity.c new file mode 100644 index 0000000..c152714 --- /dev/null +++ b/basic-geometry-test/tests/quaternion/quaternion_set_to_identity.c @@ -0,0 +1,52 @@ +#include "./quaternion_reset.h" + +#include "./../../helpers.h" + +int test_bgc_quaternion_set_to_identity_fp32() +{ + BgcQuaternionFP32 vector; + + print_testing_name("bgc_quaternion_set_to_identity_fp32"); + + bgc_quaternion_set_to_identity_fp32(&vector); + + if (vector.s0 != 1.0f || vector.x1 != 0.0f || vector.x2 != 0.0f || vector.x3 != 0.0f) { + print_testing_failed(); + return TEST_FAILED; + } + + print_testing_success(); + + return TEST_SUCCES; +} + +int test_bgc_quaternion_set_to_identity_fp64() +{ + BgcQuaternionFP64 vector; + + print_testing_name("bgc_quaternion_set_to_identity_fp64"); + + bgc_quaternion_set_to_identity_fp64(&vector); + + if (vector.s0 != 1.0 || vector.x1 != 0.0 || vector.x2 != 0.0 || vector.x3 != 0.0) { + print_testing_failed(); + return TEST_FAILED; + } + + print_testing_success(); + + return TEST_SUCCES; +} + +int test_bgc_quaternion_set_to_identity() +{ + if (test_bgc_quaternion_set_to_identity_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_quaternion_set_to_identity_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/quaternion/quaternion_set_to_identity.h b/basic-geometry-test/tests/quaternion/quaternion_set_to_identity.h new file mode 100644 index 0000000..d680a69 --- /dev/null +++ b/basic-geometry-test/tests/quaternion/quaternion_set_to_identity.h @@ -0,0 +1,10 @@ +#ifndef _TEST_QUATERNION_SET_TO_IDENTITY_H_ +#define _TEST_QUATERNION_SET_TO_IDENTITY_H_ + +int test_bgc_quaternion_set_to_identity_fp32(); + +int test_bgc_quaternion_set_to_identity_fp64(); + +int test_bgc_quaternion_set_to_identity(); + +#endif diff --git a/basic-geometry-test/tests/quaternion/quaternion_set_values.c b/basic-geometry-test/tests/quaternion/quaternion_set_values.c new file mode 100644 index 0000000..9117996 --- /dev/null +++ b/basic-geometry-test/tests/quaternion/quaternion_set_values.c @@ -0,0 +1,86 @@ +#include "./quaternion_set_values.h" + +#include + +#include "./../../helpers.h" + +// ==================== FP32 ==================== // + +int test_bgc_quaternion_set_values_fp32() +{ + BgcQuaternionFP32 vector; + + print_testing_name("bgc_quaternion_set_values_fp32"); + + bgc_quaternion_set_values_fp32(1.0f, 2.0f, 3.0f, 4.0f, &vector); + + if (vector.s0 != 1.0f || vector.x1 != 2.0f || vector.x2 != 3.0f || vector.x3 != 4.0f) { + print_testing_failed(); + return TEST_FAILED; + } + + bgc_quaternion_set_values_fp32(-1.0f, -3.0f, -5.0f, -7.0f, &vector); + + if (vector.s0 != -1.0f || vector.x1 != -3.0f || vector.x2 != -5.0f || vector.x3 != -7.0f) { + print_testing_failed(); + return TEST_FAILED; + } + + bgc_quaternion_set_values_fp32(-8.0f, -2.0f, 2.0f, 4.0f, &vector); + + if (vector.s0 != -8.0f || vector.x1 != -2.0f || vector.x2 != 2.0f || vector.x3 != 4.0f) { + print_testing_failed(); + return TEST_FAILED; + } + + print_testing_success(); + + return TEST_SUCCES; +} + +// ==================== FP64 ==================== // + +int test_bgc_quaternion_set_values_fp64() +{ + BgcQuaternionFP64 vector; + + print_testing_name("bgc_quaternion_set_values_fp64"); + + bgc_quaternion_set_values_fp64(1.0, 2.0, 3.0, 4.0, &vector); + + if (vector.s0 != 1.0 || vector.x1 != 2.0 || vector.x2 != 3.0 || vector.x3 != 4.0) { + print_testing_failed(); + return TEST_FAILED; + } + + bgc_quaternion_set_values_fp64(-1.0, -3.0, -5.0, -7.0, &vector); + + if (vector.s0 != -1.0 || vector.x1 != -3.0 || vector.x2 != -5.0 || vector.x3 != -7.0) { + print_testing_failed(); + return TEST_FAILED; + } + + bgc_quaternion_set_values_fp64(-8.0, -2.0, 2.0, 4.0, &vector); + + if (vector.s0 != -8.0 || vector.x1 != -2.0 || vector.x2 != 2.0 || vector.x3 != 4.0) { + print_testing_failed(); + return TEST_FAILED; + } + + print_testing_success(); + + return TEST_SUCCES; +} + +int test_bgc_quaternion_set_values() +{ + if (test_bgc_quaternion_set_values_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_quaternion_set_values_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/quaternion/quaternion_set_values.h b/basic-geometry-test/tests/quaternion/quaternion_set_values.h new file mode 100644 index 0000000..25eab6d --- /dev/null +++ b/basic-geometry-test/tests/quaternion/quaternion_set_values.h @@ -0,0 +1,10 @@ +#ifndef _TEST_QUATERNION_SET_VALUES_H_ +#define _TEST_QUATERNION_SET_VALUES_H_ + +int test_bgc_quaternion_set_values_fp32(); + +int test_bgc_quaternion_set_values_fp64(); + +int test_bgc_quaternion_set_values(); + +#endif diff --git a/basic-geometry-test/tests/quaternion/quaternion_swap.c b/basic-geometry-test/tests/quaternion/quaternion_swap.c new file mode 100644 index 0000000..e02c2d7 --- /dev/null +++ b/basic-geometry-test/tests/quaternion/quaternion_swap.c @@ -0,0 +1,114 @@ +#include "./quaternion_swap.h" + +#include + +#include "./../../helpers.h" + +// ==================== FP32 ==================== // + +static const int _TEST_FP32_QUATERNION_AMOUNT = 4; + +static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST1[] = { + { 1.0f, 2.0f, 3.0f, 4.0f }, + { -4.0f, -3.0f, -2.0f, -1.0f }, + { -244.8f, 100.0f, -100.0f, 344.7f }, + { 1000.32f, -100.1f, 100.2f, -271.3f } +}; + +static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST2[] = { + { 3.6f, -0.123f, 5.3f, 1003.28f }, + { 204.07f, -781.89f, -0.0032f, 891.3f }, + { -20.02f, -1.0003f, 5.322f, 0.9275f }, + { 1000.0f, -0.00025f, -0.419f, 0.844f } +}; + +int test_bgc_quaternion_swap_fp32() +{ + BgcQuaternionFP32 quaternion1, quaternion2; + + print_testing_name("bgc_quaternion_swap_fp32"); + + for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) { + bgc_quaternion_copy_fp32(&_TEST_FP32_QUATERNION_LIST1[i], &quaternion1); + bgc_quaternion_copy_fp32(&_TEST_FP32_QUATERNION_LIST2[i], &quaternion2); + + bgc_quaternion_swap_fp32(&quaternion1, &quaternion2); + + if (quaternion1.s0 != _TEST_FP32_QUATERNION_LIST2[i].s0 || + quaternion1.x1 != _TEST_FP32_QUATERNION_LIST2[i].x1 || + quaternion1.x2 != _TEST_FP32_QUATERNION_LIST2[i].x2 || + quaternion1.x3 != _TEST_FP32_QUATERNION_LIST2[i].x3 || + quaternion2.s0 != _TEST_FP32_QUATERNION_LIST1[i].s0 || + quaternion2.x1 != _TEST_FP32_QUATERNION_LIST1[i].x1 || + quaternion2.x2 != _TEST_FP32_QUATERNION_LIST1[i].x2 || + quaternion2.x3 != _TEST_FP32_QUATERNION_LIST1[i].x3) { + print_testing_failed(); + return TEST_FAILED; + } + } + + print_testing_success(); + + return TEST_SUCCES; +} + +// ==================== FP64 ==================== // + +static const int _TEST_FP64_QUATERNION_AMOUNT = 4; + +static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST1[] = { + { 1.0, 2.0, 3.0, 4.0 }, + { -4.0, -3.0, -2.0, -1.0 }, + { -244.8, 100.0, -100.0, 344.7 }, + { 1000.32, -100.1, 100.2, -271.3 } +}; + +static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST2[] = { + { 3.6, -0.123, 5.3, 1003.28 }, + { 204.07, -781.89, -0.0032, 891.3 }, + { -20.02, -1.0003, 5.322, 0.9275 }, + { 1000.0, -0.00025, -0.419, 0.844 } +}; + +int test_bgc_quaternion_swap_fp64() +{ + BgcQuaternionFP64 quaternion1, quaternion2; + + print_testing_name("bgc_quaternion_swap_fp64"); + + for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) { + bgc_quaternion_copy_fp64(&_TEST_FP64_QUATERNION_LIST1[i], &quaternion1); + bgc_quaternion_copy_fp64(&_TEST_FP64_QUATERNION_LIST2[i], &quaternion2); + + bgc_quaternion_swap_fp64(&quaternion1, &quaternion2); + + if (quaternion1.s0 != _TEST_FP64_QUATERNION_LIST2[i].s0 || + quaternion1.x1 != _TEST_FP64_QUATERNION_LIST2[i].x1 || + quaternion1.x2 != _TEST_FP64_QUATERNION_LIST2[i].x2 || + quaternion1.x3 != _TEST_FP64_QUATERNION_LIST2[i].x3 || + quaternion2.s0 != _TEST_FP64_QUATERNION_LIST1[i].s0 || + quaternion2.x1 != _TEST_FP64_QUATERNION_LIST1[i].x1 || + quaternion2.x2 != _TEST_FP64_QUATERNION_LIST1[i].x2 || + quaternion2.x3 != _TEST_FP64_QUATERNION_LIST1[i].x3) { + print_testing_failed(); + return TEST_FAILED; + } + } + + print_testing_success(); + + return TEST_SUCCES; +} + +int test_bgc_quaternion_swap() +{ + if (test_bgc_quaternion_swap_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_quaternion_swap_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/quaternion/quaternion_swap.h b/basic-geometry-test/tests/quaternion/quaternion_swap.h new file mode 100644 index 0000000..639c771 --- /dev/null +++ b/basic-geometry-test/tests/quaternion/quaternion_swap.h @@ -0,0 +1,10 @@ +#ifndef _TEST_QUATERNION_SWAP_H_ +#define _TEST_QUATERNION_SWAP_H_ + +int test_bgc_quaternion_swap_fp32(); + +int test_bgc_quaternion_swap_fp64(); + +int test_bgc_quaternion_swap(); + +#endif diff --git a/basic-geometry-test/tests/utilities.c b/basic-geometry-test/tests/utilities.c index edffa1a..a29318d 100644 --- a/basic-geometry-test/tests/utilities.c +++ b/basic-geometry-test/tests/utilities.c @@ -2,53 +2,6 @@ #include "./../helpers.h" -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; -} - -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; -} - -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; -} - int test_utilities() { print_testing_section("BGC Utilities"); diff --git a/basic-geometry-test/tests/utilities.h b/basic-geometry-test/tests/utilities.h index 901216b..3b644d0 100644 --- a/basic-geometry-test/tests/utilities.h +++ b/basic-geometry-test/tests/utilities.h @@ -5,12 +5,6 @@ #include "./utilities/is_unit.h" #include "./utilities/are_close.h" -int test_bgc_is_zero(); - -int test_bgc_is_unit(); - -int test_bgc_are_close(); - int test_utilities(); #endif diff --git a/basic-geometry-test/tests/utilities/are_close.c b/basic-geometry-test/tests/utilities/are_close.c index a6734a0..ea9411f 100644 --- a/basic-geometry-test/tests/utilities/are_close.c +++ b/basic-geometry-test/tests/utilities/are_close.c @@ -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; +} diff --git a/basic-geometry-test/tests/utilities/are_close.h b/basic-geometry-test/tests/utilities/are_close.h index 4fdea3f..27e5540 100644 --- a/basic-geometry-test/tests/utilities/are_close.h +++ b/basic-geometry-test/tests/utilities/are_close.h @@ -5,4 +5,6 @@ int test_bgc_are_close_fp32(); int test_bgc_are_close_fp64(); +int test_bgc_are_close(); + #endif diff --git a/basic-geometry-test/tests/utilities/is_unit.c b/basic-geometry-test/tests/utilities/is_unit.c index 4d19432..b4f3be1 100644 --- a/basic-geometry-test/tests/utilities/is_unit.c +++ b/basic-geometry-test/tests/utilities/is_unit.c @@ -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; +} diff --git a/basic-geometry-test/tests/utilities/is_unit.h b/basic-geometry-test/tests/utilities/is_unit.h index 7f35c0c..5815ab2 100644 --- a/basic-geometry-test/tests/utilities/is_unit.h +++ b/basic-geometry-test/tests/utilities/is_unit.h @@ -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 diff --git a/basic-geometry-test/tests/utilities/is_zero.c b/basic-geometry-test/tests/utilities/is_zero.c index 473a877..731b78f 100644 --- a/basic-geometry-test/tests/utilities/is_zero.c +++ b/basic-geometry-test/tests/utilities/is_zero.c @@ -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; +} diff --git a/basic-geometry-test/tests/utilities/is_zero.h b/basic-geometry-test/tests/utilities/is_zero.h index 47db0ec..38f73d7 100644 --- a/basic-geometry-test/tests/utilities/is_zero.h +++ b/basic-geometry-test/tests/utilities/is_zero.h @@ -5,4 +5,6 @@ int test_bgc_is_zero_fp32(); int test_bgc_is_zero_fp64(); +int test_bgc_is_zero(); + #endif diff --git a/basic-geometry-test/tests/vector2.c b/basic-geometry-test/tests/vector2.c index a3c01cd..ef5aef7 100644 --- a/basic-geometry-test/tests/vector2.c +++ b/basic-geometry-test/tests/vector2.c @@ -1,57 +1,5 @@ #include "vector2.h" -int test_bgc_vector2_reset() -{ - if (test_bgc_vector2_reset_fp32() != TEST_SUCCES) { - return TEST_FAILED; - } - - if (test_bgc_vector2_reset_fp64() != TEST_SUCCES) { - return TEST_FAILED; - } - - return TEST_SUCCES; -} - -int test_bgc_vector2_set_values() -{ - if (test_bgc_vector2_set_values_fp32() != TEST_SUCCES) { - return TEST_FAILED; - } - - if (test_bgc_vector2_set_values_fp64() != TEST_SUCCES) { - return TEST_FAILED; - } - - return TEST_SUCCES; -} - -int test_bgc_vector2_copy() -{ - if (test_bgc_vector2_copy_fp32() != TEST_SUCCES) { - return TEST_FAILED; - } - - if (test_bgc_vector2_copy_fp64() != TEST_SUCCES) { - return TEST_FAILED; - } - - return TEST_SUCCES; -} - -int test_bgc_vector2_swap() -{ - if (test_bgc_vector2_swap_fp32() != TEST_SUCCES) { - return TEST_FAILED; - } - - if (test_bgc_vector2_swap_fp64() != TEST_SUCCES) { - return TEST_FAILED; - } - - return TEST_SUCCES; -} - int test_vector2() { print_testing_section("BGC Vector2"); @@ -72,6 +20,10 @@ int test_vector2() return TEST_FAILED; } + if (test_bgc_vector2_is_zero() != TEST_SUCCES) { + return TEST_FAILED; + } + return TEST_SUCCES; } diff --git a/basic-geometry-test/tests/vector2.h b/basic-geometry-test/tests/vector2.h index e1c38ad..a9060c6 100644 --- a/basic-geometry-test/tests/vector2.h +++ b/basic-geometry-test/tests/vector2.h @@ -6,6 +6,7 @@ #include "./vector2/vector2_set_values.h" #include "./vector2/vector2_copy.h" #include "./vector2/vector2_swap.h" +#include "./vector2/vector2_is_zero.h" /* int test_fp32_vector2(); @@ -19,14 +20,6 @@ int test_vector2_add_fp32(); int test_vector2_subtract_fp32(); */ -int test_bgc_vector2_reset(); - -int test_bgc_vector2_set_values(); - -int test_bgc_vector2_copy(); - -int test_bgc_vector2_swap(); - int test_vector2(); #endif diff --git a/basic-geometry-test/tests/vector2/vector2_copy.c b/basic-geometry-test/tests/vector2/vector2_copy.c index fc4106a..9c64ec0 100644 --- a/basic-geometry-test/tests/vector2/vector2_copy.c +++ b/basic-geometry-test/tests/vector2/vector2_copy.c @@ -65,3 +65,16 @@ int test_bgc_vector2_copy_fp64() return TEST_SUCCES; } + +int test_bgc_vector2_copy() +{ + if (test_bgc_vector2_copy_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_vector2_copy_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/vector2/vector2_copy.h b/basic-geometry-test/tests/vector2/vector2_copy.h index a99d5dc..42f522c 100644 --- a/basic-geometry-test/tests/vector2/vector2_copy.h +++ b/basic-geometry-test/tests/vector2/vector2_copy.h @@ -5,4 +5,6 @@ int test_bgc_vector2_copy_fp32(); int test_bgc_vector2_copy_fp64(); +int test_bgc_vector2_copy(); + #endif diff --git a/basic-geometry-test/tests/vector2/vector2_is_zero.c b/basic-geometry-test/tests/vector2/vector2_is_zero.c new file mode 100644 index 0000000..4aca263 --- /dev/null +++ b/basic-geometry-test/tests/vector2/vector2_is_zero.c @@ -0,0 +1,112 @@ +#include "./vector2_is_zero.h" + +#include "./../../helpers.h" + +// ==================== FP32 ==================== // + +static const int _TEST_FP32_ZERO_QUATERNION_AMOUNT = 5; +static const int _TEST_FP32_NONZERO_QUATERNION_AMOUNT = 7; + +static const BgcVector2FP32 _TEST_FP32_ZERO_QUATERNION_LIST[] = { + { 0.0f, 0.0f }, + { BGC_EPSYLON_FP32, 0.0f }, + { -BGC_EPSYLON_FP32, 0.0f }, + { 0.0f, BGC_EPSYLON_FP32 }, + { 0.0f, -BGC_EPSYLON_FP32 } +}; + +static const BgcVector2FP32 _TEST_FP32_NONZERO_NUMBERS[] = { + { 0.0f, 1.0f }, + { 1.5f * BGC_EPSYLON_FP32, 0.0f }, + { -1.5f * BGC_EPSYLON_FP32, 0.0f }, + { 0.0f, 1.5f * BGC_EPSYLON_FP32 }, + { 0.0f, -1.5f * BGC_EPSYLON_FP32 }, + { BGC_EPSYLON_FP32, BGC_EPSYLON_FP32 }, + { -BGC_EPSYLON_FP32, -BGC_EPSYLON_FP32 } +}; + +int test_bgc_vector2_is_zero_fp32() +{ + print_testing_name("bgc_vector2_is_zero_fp32"); + + // Testing zero values: + for (int i = 0; i < _TEST_FP32_ZERO_QUATERNION_AMOUNT; i++) { + if (!bgc_vector2_is_zero_fp32(&_TEST_FP32_ZERO_QUATERNION_LIST[i])) { + print_testing_failed(); + return TEST_FAILED; + } + } + + // Testing non-zero values: + for (int i = 0; i < _TEST_FP32_ZERO_QUATERNION_AMOUNT; i++) { + if (bgc_vector2_is_zero_fp32(&_TEST_FP32_NONZERO_NUMBERS[i])) { + print_testing_failed(); + return TEST_FAILED; + } + } + + print_testing_success(); + + return TEST_SUCCES; +} + +// ==================== FP64 ==================== // + +static const int _TEST_FP64_ZERO_QUATERNION_AMOUNT = 5; +static const int _TEST_FP64_NONZERO_QUATERNION_AMOUNT = 7; + +static const BgcVector2FP64 _TEST_FP64_ZERO_QUATERNION_LIST[] = { + { 0.0, 0.0 }, + { BGC_EPSYLON_FP64, 0.0 }, + { -BGC_EPSYLON_FP64, 0.0 }, + { 0.0, BGC_EPSYLON_FP64 }, + { 0.0, -BGC_EPSYLON_FP64 } +}; + +static const BgcVector2FP64 _TEST_FP64_NONZERO_NUMBERS[] = { + { 0.0, 1.0 }, + { 1.5 * BGC_EPSYLON_FP64, 0.0 }, + { -1.5 * BGC_EPSYLON_FP64, 0.0 }, + { 0.0, 1.5 * BGC_EPSYLON_FP64 }, + { 0.0, -1.5 * BGC_EPSYLON_FP64 }, + { BGC_EPSYLON_FP64, BGC_EPSYLON_FP64 }, + { -BGC_EPSYLON_FP64, -BGC_EPSYLON_FP64 } +}; + +int test_bgc_vector2_is_zero_fp64() +{ + print_testing_name("bgc_vector2_is_zero_fp64"); + + // Testing zero values: + for (int i = 0; i < _TEST_FP64_ZERO_QUATERNION_AMOUNT; i++) { + if (!bgc_vector2_is_zero_fp64(&_TEST_FP64_ZERO_QUATERNION_LIST[i])) { + print_testing_failed(); + return TEST_FAILED; + } + } + + // Testing non-zero values: + for (int i = 0; i < _TEST_FP64_ZERO_QUATERNION_AMOUNT; i++) { + if (bgc_vector2_is_zero_fp64(&_TEST_FP64_NONZERO_NUMBERS[i])) { + print_testing_failed(); + return TEST_FAILED; + } + } + + print_testing_success(); + + return TEST_SUCCES; +} + +int test_bgc_vector2_is_zero() +{ + if (test_bgc_vector2_is_zero_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_vector2_is_zero_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/vector2/vector2_is_zero.h b/basic-geometry-test/tests/vector2/vector2_is_zero.h new file mode 100644 index 0000000..46603e1 --- /dev/null +++ b/basic-geometry-test/tests/vector2/vector2_is_zero.h @@ -0,0 +1,10 @@ +#ifndef _TEST_VECTOR2_IS_ZERO_H_ +#define _TEST_VECTOR2_IS_ZERO_H_ + +int test_bgc_vector2_is_zero_fp32(); + +int test_bgc_vector2_is_zero_fp64(); + +int test_bgc_vector2_is_zero(); + +#endif diff --git a/basic-geometry-test/tests/vector2/vector2_reset.c b/basic-geometry-test/tests/vector2/vector2_reset.c index a1cb87b..f8a1845 100644 --- a/basic-geometry-test/tests/vector2/vector2_reset.c +++ b/basic-geometry-test/tests/vector2/vector2_reset.c @@ -37,3 +37,16 @@ int test_bgc_vector2_reset_fp64() return TEST_SUCCES; } + +int test_bgc_vector2_reset() +{ + if (test_bgc_vector2_reset_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_vector2_reset_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/vector2/vector2_reset.h b/basic-geometry-test/tests/vector2/vector2_reset.h index 71f5ac8..aafcaa1 100644 --- a/basic-geometry-test/tests/vector2/vector2_reset.h +++ b/basic-geometry-test/tests/vector2/vector2_reset.h @@ -5,4 +5,6 @@ int test_bgc_vector2_reset_fp32(); int test_bgc_vector2_reset_fp64(); +int test_bgc_vector2_reset(); + #endif diff --git a/basic-geometry-test/tests/vector2/vector2_set_values.c b/basic-geometry-test/tests/vector2/vector2_set_values.c index 2ba97a4..fa08e6c 100644 --- a/basic-geometry-test/tests/vector2/vector2_set_values.c +++ b/basic-geometry-test/tests/vector2/vector2_set_values.c @@ -72,3 +72,16 @@ int test_bgc_vector2_set_values_fp64() return TEST_SUCCES; } + +int test_bgc_vector2_set_values() +{ + if (test_bgc_vector2_set_values_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_vector2_set_values_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/vector2/vector2_set_values.h b/basic-geometry-test/tests/vector2/vector2_set_values.h index 349a3ba..8ac66aa 100644 --- a/basic-geometry-test/tests/vector2/vector2_set_values.h +++ b/basic-geometry-test/tests/vector2/vector2_set_values.h @@ -5,4 +5,6 @@ int test_bgc_vector2_set_values_fp32(); int test_bgc_vector2_set_values_fp64(); +int test_bgc_vector2_set_values(); + #endif diff --git a/basic-geometry-test/tests/vector2/vector2_swap.c b/basic-geometry-test/tests/vector2/vector2_swap.c index ba45df7..744acba 100644 --- a/basic-geometry-test/tests/vector2/vector2_swap.c +++ b/basic-geometry-test/tests/vector2/vector2_swap.c @@ -4,8 +4,6 @@ #include "./../../helpers.h" - - // ==================== FP32 ==================== // static const int _TEST_FP32_VECTOR2_AMOUNT = 4; @@ -93,3 +91,16 @@ int test_bgc_vector2_swap_fp64() return TEST_SUCCES; } + +int test_bgc_vector2_swap() +{ + if (test_bgc_vector2_swap_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_vector2_swap_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/vector2/vector2_swap.h b/basic-geometry-test/tests/vector2/vector2_swap.h index 8befa4c..46369f0 100644 --- a/basic-geometry-test/tests/vector2/vector2_swap.h +++ b/basic-geometry-test/tests/vector2/vector2_swap.h @@ -5,4 +5,6 @@ int test_bgc_vector2_swap_fp32(); int test_bgc_vector2_swap_fp64(); +int test_bgc_vector2_swap(); + #endif diff --git a/basic-geometry-test/tests/vector3.c b/basic-geometry-test/tests/vector3.c index a0872bf..a85d11a 100644 --- a/basic-geometry-test/tests/vector3.c +++ b/basic-geometry-test/tests/vector3.c @@ -1,57 +1,5 @@ #include "vector3.h" -int test_bgc_vector3_reset() -{ - if (test_bgc_vector3_reset_fp32() != TEST_SUCCES) { - return TEST_FAILED; - } - - if (test_bgc_vector3_reset_fp64() != TEST_SUCCES) { - return TEST_FAILED; - } - - return TEST_SUCCES; -} - -int test_bgc_vector3_set_values() -{ - if (test_bgc_vector3_set_values_fp32() != TEST_SUCCES) { - return TEST_FAILED; - } - - if (test_bgc_vector3_set_values_fp64() != TEST_SUCCES) { - return TEST_FAILED; - } - - return TEST_SUCCES; -} - -int test_bgc_vector3_copy() -{ - if (test_bgc_vector3_copy_fp32() != TEST_SUCCES) { - return TEST_FAILED; - } - - if (test_bgc_vector3_copy_fp64() != TEST_SUCCES) { - return TEST_FAILED; - } - - return TEST_SUCCES; -} - -int test_bgc_vector3_swap() -{ - if (test_bgc_vector3_swap_fp32() != TEST_SUCCES) { - return TEST_FAILED; - } - - if (test_bgc_vector3_swap_fp64() != TEST_SUCCES) { - return TEST_FAILED; - } - - return TEST_SUCCES; -} - int test_vector3() { print_testing_section("BGC Vector3"); @@ -72,5 +20,9 @@ int test_vector3() return TEST_FAILED; } + if (test_bgc_vector3_is_zero() != TEST_SUCCES) { + return TEST_FAILED; + } + return TEST_SUCCES; } diff --git a/basic-geometry-test/tests/vector3.h b/basic-geometry-test/tests/vector3.h index 8fb0099..92943d1 100644 --- a/basic-geometry-test/tests/vector3.h +++ b/basic-geometry-test/tests/vector3.h @@ -1,19 +1,12 @@ -#ifndef _TEST_Vector3_H_ -#define _TEST_Vector3_H_ +#ifndef _TEST_VECTOR3_H_ +#define _TEST_VECTOR3_H_ #include "./../helpers.h" #include "./vector3/vector3_reset.h" #include "./vector3/vector3_set_values.h" #include "./vector3/vector3_copy.h" #include "./vector3/vector3_swap.h" - -int test_bgc_vector3_reset(); - -int test_bgc_vector3_set_values(); - -int test_bgc_vector3_copy(); - -int test_bgc_vector3_swap(); +#include "./vector3/vector3_is_zero.h" int test_vector3(); diff --git a/basic-geometry-test/tests/vector3/vector3_copy.c b/basic-geometry-test/tests/vector3/vector3_copy.c index 37820e7..e546455 100644 --- a/basic-geometry-test/tests/vector3/vector3_copy.c +++ b/basic-geometry-test/tests/vector3/vector3_copy.c @@ -8,8 +8,8 @@ static const int _TEST_FP32_VECTOR3_AMOUNT = 4; static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST[] = { - { 1.0f, 2.0f, 3.0 }, - { -3.0, -2.0f, -1.0f }, + { 1.0f, 2.0f, 3.0f }, + { -3.0f, -2.0f, -1.0f }, { 100.0f, -100.0f, 0.001f }, { -100.0f, 100.0f, -0.001f } }; @@ -43,8 +43,8 @@ static const int _TEST_FP64_VECTOR3_AMOUNT = 4; static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST[] = { { 1.0, 2.0, 3.0 }, { -3.0, -2.0, -1.0 }, - { 100.0, -100.0, 0.001f }, - { -100.0, 100.0, -0.001f } + { 100.0, -100.0, 0.001 }, + { -100.0, 100.0, -0.001 } }; int test_bgc_vector3_copy_fp64() @@ -69,3 +69,16 @@ int test_bgc_vector3_copy_fp64() return TEST_SUCCES; } + +int test_bgc_vector3_copy() +{ + if (test_bgc_vector3_copy_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_vector3_copy_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/vector3/vector3_copy.h b/basic-geometry-test/tests/vector3/vector3_copy.h index 94f3113..100a7e3 100644 --- a/basic-geometry-test/tests/vector3/vector3_copy.h +++ b/basic-geometry-test/tests/vector3/vector3_copy.h @@ -5,4 +5,6 @@ int test_bgc_vector3_copy_fp32(); int test_bgc_vector3_copy_fp64(); +int test_bgc_vector3_copy(); + #endif diff --git a/basic-geometry-test/tests/vector3/vector3_is_zero.c b/basic-geometry-test/tests/vector3/vector3_is_zero.c new file mode 100644 index 0000000..4950e6e --- /dev/null +++ b/basic-geometry-test/tests/vector3/vector3_is_zero.c @@ -0,0 +1,120 @@ +#include "./vector3_is_zero.h" + +#include "./../../helpers.h" + +// ==================== FP32 ==================== // + +static const int _TEST_FP32_ZERO_QUATERNION_AMOUNT = 7; +static const int _TEST_FP32_NONZERO_QUATERNION_AMOUNT = 9; + +static const BgcVector3FP32 _TEST_FP32_ZERO_QUATERNION_LIST[] = { + { 0.0f, 0.0f, 0.0f }, + { BGC_EPSYLON_FP32, 0.0f, 0.0f }, + { -BGC_EPSYLON_FP32, 0.0f, 0.0f }, + { 0.0f, BGC_EPSYLON_FP32, 0.0f }, + { 0.0f, -BGC_EPSYLON_FP32, 0.0f }, + { 0.0f, 0.0f, BGC_EPSYLON_FP32 }, + { 0.0f, 0.0f, -BGC_EPSYLON_FP32 } +}; + +static const BgcVector3FP32 _TEST_FP32_NONZERO_NUMBERS[] = { + { 0.0f, 1.0f, 0.0f }, + { 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, + { -1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, + { 0.0f, 1.5f * BGC_EPSYLON_FP32, 0.0f }, + { 0.0f, -1.5f * BGC_EPSYLON_FP32, 0.0f }, + { 0.0f, 0.0f, 1.5f * BGC_EPSYLON_FP32 }, + { 0.0f, 0.0f, -1.5f * BGC_EPSYLON_FP32 }, + { BGC_EPSYLON_FP32, BGC_EPSYLON_FP32, 0.0f }, + { -BGC_EPSYLON_FP32, -BGC_EPSYLON_FP32, 0.0f } +}; + +int test_bgc_vector3_is_zero_fp32() +{ + print_testing_name("bgc_vector3_is_zero_fp32"); + + // Testing zero values: + for (int i = 0; i < _TEST_FP32_ZERO_QUATERNION_AMOUNT; i++) { + if (!bgc_vector3_is_zero_fp32(&_TEST_FP32_ZERO_QUATERNION_LIST[i])) { + print_testing_failed(); + return TEST_FAILED; + } + } + + // Testing non-zero values: + for (int i = 0; i < _TEST_FP32_ZERO_QUATERNION_AMOUNT; i++) { + if (bgc_vector3_is_zero_fp32(&_TEST_FP32_NONZERO_NUMBERS[i])) { + print_testing_failed(); + return TEST_FAILED; + } + } + + print_testing_success(); + + return TEST_SUCCES; +} + +// ==================== FP64 ==================== // + +static const int _TEST_FP64_ZERO_QUATERNION_AMOUNT = 7; +static const int _TEST_FP64_NONZERO_QUATERNION_AMOUNT = 9; + +static const BgcVector3FP64 _TEST_FP64_ZERO_QUATERNION_LIST[] = { + { 0.0, 0.0, 0.0 }, + { BGC_EPSYLON_FP64, 0.0, 0.0 }, + { -BGC_EPSYLON_FP64, 0.0, 0.0 }, + { 0.0, BGC_EPSYLON_FP64, 0.0 }, + { 0.0, -BGC_EPSYLON_FP64, 0.0 }, + { 0.0, 0.0, BGC_EPSYLON_FP64 }, + { 0.0, 0.0, -BGC_EPSYLON_FP64 } +}; + +static const BgcVector3FP64 _TEST_FP64_NONZERO_NUMBERS[] = { + { 0.0, 1.0, 0.0 }, + { 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0 }, + { -1.5 * BGC_EPSYLON_FP64, 0.0, 0.0 }, + { 0.0, 1.5 * BGC_EPSYLON_FP64, 0.0 }, + { 0.0, -1.5 * BGC_EPSYLON_FP64, 0.0 }, + { 0.0, 0.0, 1.5 * BGC_EPSYLON_FP64 }, + { 0.0, 0.0, -1.5 * BGC_EPSYLON_FP64 }, + { BGC_EPSYLON_FP64, BGC_EPSYLON_FP64, 0.0 }, + { -BGC_EPSYLON_FP64, -BGC_EPSYLON_FP64, 0.0 } +}; + +int test_bgc_vector3_is_zero_fp64() +{ + print_testing_name("bgc_vector3_is_zero_fp64"); + + // Testing zero values: + for (int i = 0; i < _TEST_FP64_ZERO_QUATERNION_AMOUNT; i++) { + if (!bgc_vector3_is_zero_fp64(&_TEST_FP64_ZERO_QUATERNION_LIST[i])) { + print_testing_failed(); + return TEST_FAILED; + } + } + + // Testing non-zero values: + for (int i = 0; i < _TEST_FP64_ZERO_QUATERNION_AMOUNT; i++) { + if (bgc_vector3_is_zero_fp64(&_TEST_FP64_NONZERO_NUMBERS[i])) { + print_testing_failed(); + return TEST_FAILED; + } + } + + print_testing_success(); + + return TEST_SUCCES; +} + +int test_bgc_vector3_is_zero() +{ + if (test_bgc_vector3_is_zero_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_vector3_is_zero_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/vector3/vector3_is_zero.h b/basic-geometry-test/tests/vector3/vector3_is_zero.h new file mode 100644 index 0000000..12dbc87 --- /dev/null +++ b/basic-geometry-test/tests/vector3/vector3_is_zero.h @@ -0,0 +1,10 @@ +#ifndef _TEST_VECTOR3_IS_ZERO_H_ +#define _TEST_VECTOR3_IS_ZERO_H_ + +int test_bgc_vector3_is_zero_fp32(); + +int test_bgc_vector3_is_zero_fp64(); + +int test_bgc_vector3_is_zero(); + +#endif diff --git a/basic-geometry-test/tests/vector3/vector3_reset.c b/basic-geometry-test/tests/vector3/vector3_reset.c index 2c3f1ad..3fd29a0 100644 --- a/basic-geometry-test/tests/vector3/vector3_reset.c +++ b/basic-geometry-test/tests/vector3/vector3_reset.c @@ -37,3 +37,16 @@ int test_bgc_vector3_reset_fp64() return TEST_SUCCES; } + +int test_bgc_vector3_reset() +{ + if (test_bgc_vector3_reset_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_vector3_reset_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/vector3/vector3_reset.h b/basic-geometry-test/tests/vector3/vector3_reset.h index c891e12..c41c222 100644 --- a/basic-geometry-test/tests/vector3/vector3_reset.h +++ b/basic-geometry-test/tests/vector3/vector3_reset.h @@ -5,4 +5,6 @@ int test_bgc_vector3_reset_fp32(); int test_bgc_vector3_reset_fp64(); +int test_bgc_vector3_reset(); + #endif diff --git a/basic-geometry-test/tests/vector3/vector3_set_values.c b/basic-geometry-test/tests/vector3/vector3_set_values.c index 905d52b..4f4eff7 100644 --- a/basic-geometry-test/tests/vector3/vector3_set_values.c +++ b/basic-geometry-test/tests/vector3/vector3_set_values.c @@ -72,3 +72,16 @@ int test_bgc_vector3_set_values_fp64() return TEST_SUCCES; } + +int test_bgc_vector3_set_values() +{ + if (test_bgc_vector3_set_values_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_vector3_set_values_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/vector3/vector3_set_values.h b/basic-geometry-test/tests/vector3/vector3_set_values.h index 6b19d5f..6de5296 100644 --- a/basic-geometry-test/tests/vector3/vector3_set_values.h +++ b/basic-geometry-test/tests/vector3/vector3_set_values.h @@ -5,4 +5,6 @@ int test_bgc_vector3_set_values_fp32(); int test_bgc_vector3_set_values_fp64(); +int test_bgc_vector3_set_values(); + #endif diff --git a/basic-geometry-test/tests/vector3/vector3_swap.c b/basic-geometry-test/tests/vector3/vector3_swap.c index 19a1a8d..23206bb 100644 --- a/basic-geometry-test/tests/vector3/vector3_swap.c +++ b/basic-geometry-test/tests/vector3/vector3_swap.c @@ -4,8 +4,6 @@ #include "./../../helpers.h" - - // ==================== FP32 ==================== // static const int _TEST_FP32_VECTOR3_AMOUNT = 4; @@ -97,3 +95,16 @@ int test_bgc_vector3_swap_fp64() return TEST_SUCCES; } + +int test_bgc_vector3_swap() +{ + if (test_bgc_vector3_swap_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_vector3_swap_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/vector3/vector3_swap.h b/basic-geometry-test/tests/vector3/vector3_swap.h index de810fe..94a8181 100644 --- a/basic-geometry-test/tests/vector3/vector3_swap.h +++ b/basic-geometry-test/tests/vector3/vector3_swap.h @@ -5,4 +5,6 @@ int test_bgc_vector3_swap_fp32(); int test_bgc_vector3_swap_fp64(); +int test_bgc_vector3_swap(); + #endif diff --git a/basic-geometry-test/tests/versor.c b/basic-geometry-test/tests/versor.c index 939ecb7..cf4e33d 100644 --- a/basic-geometry-test/tests/versor.c +++ b/basic-geometry-test/tests/versor.c @@ -2,84 +2,6 @@ #include "./../helpers.h" -int test_bgc_versor_reset() -{ - if (test_bgc_versor_reset_fp32() != TEST_SUCCES) { - return TEST_FAILED; - } - - if (test_bgc_versor_reset_fp64() != TEST_SUCCES) { - return TEST_FAILED; - } - - return TEST_SUCCES; -} - -int test_bgc_versor_set_values() -{ - if (test_bgc_versor_set_values_fp32() != TEST_SUCCES) { - return TEST_FAILED; - } - - if (test_bgc_versor_set_values_fp64() != TEST_SUCCES) { - return TEST_FAILED; - } - - return TEST_SUCCES; -} - -int test_bgc_versor_copy() -{ - if (test_bgc_versor_copy_fp32() != TEST_SUCCES) { - return TEST_FAILED; - } - - if (test_bgc_versor_copy_fp64() != TEST_SUCCES) { - return TEST_FAILED; - } - - return TEST_SUCCES; -} - -int test_bgc_versor_swap() -{ - if (test_bgc_versor_swap_fp32() != TEST_SUCCES) { - return TEST_FAILED; - } - - if (test_bgc_versor_swap_fp64() != TEST_SUCCES) { - return TEST_FAILED; - } - - return TEST_SUCCES; -} - -int test_bgc_versor_are_close() -{ - if (test_bgc_versor_are_close_fp32() != TEST_SUCCES) { - return TEST_FAILED; - } - - if (test_bgc_versor_are_close_fp64() != TEST_SUCCES) { - return TEST_FAILED; - } - - return TEST_SUCCES; -} - -int test_bgc_versor_combine() -{ - if (test_bgc_versor_combine_fp32() != TEST_SUCCES) { - return TEST_FAILED; - } - - if (test_bgc_versor_combine_fp64() != TEST_SUCCES) { - return TEST_FAILED; - } - - return TEST_SUCCES; -} - int test_versor() { print_testing_section("BGC Versor"); diff --git a/basic-geometry-test/tests/versor.h b/basic-geometry-test/tests/versor.h index 0e8df7d..7459d15 100644 --- a/basic-geometry-test/tests/versor.h +++ b/basic-geometry-test/tests/versor.h @@ -8,18 +8,6 @@ #include "./versor/versor_are_close.h" #include "./versor/versor_combine.h" -int test_bgc_versor_reset(); - -int test_bgc_versor_set_values(); - -int test_bgc_versor_copy(); - -int test_bgc_versor_swap(); - -int test_bgc_versor_are_close(); - -int test_bgc_versor_combine(); - int test_versor(); #endif diff --git a/basic-geometry-test/tests/versor/versor_are_close.c b/basic-geometry-test/tests/versor/versor_are_close.c index 5328d9c..1e4853b 100644 --- a/basic-geometry-test/tests/versor/versor_are_close.c +++ b/basic-geometry-test/tests/versor/versor_are_close.c @@ -244,3 +244,16 @@ int test_bgc_versor_are_close_fp64() return TEST_SUCCES; } + +int test_bgc_versor_are_close() +{ + if (test_bgc_versor_are_close_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_versor_are_close_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/versor/versor_are_close.h b/basic-geometry-test/tests/versor/versor_are_close.h index e61f107..f7ab662 100644 --- a/basic-geometry-test/tests/versor/versor_are_close.h +++ b/basic-geometry-test/tests/versor/versor_are_close.h @@ -5,4 +5,6 @@ int test_bgc_versor_are_close_fp32(); int test_bgc_versor_are_close_fp64(); +int test_bgc_versor_are_close(); + #endif diff --git a/basic-geometry-test/tests/versor/versor_combine.c b/basic-geometry-test/tests/versor/versor_combine.c index 9aa9f0f..355649e 100644 --- a/basic-geometry-test/tests/versor/versor_combine.c +++ b/basic-geometry-test/tests/versor/versor_combine.c @@ -115,3 +115,16 @@ int test_bgc_versor_combine_fp64() return TEST_SUCCES; } + +int test_bgc_versor_combine() +{ + if (test_bgc_versor_combine_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_versor_combine_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/versor/versor_combine.h b/basic-geometry-test/tests/versor/versor_combine.h index a2fb779..154dfb6 100644 --- a/basic-geometry-test/tests/versor/versor_combine.h +++ b/basic-geometry-test/tests/versor/versor_combine.h @@ -5,4 +5,6 @@ int test_bgc_versor_combine_fp32(); int test_bgc_versor_combine_fp64(); +int test_bgc_versor_combine(); + #endif diff --git a/basic-geometry-test/tests/versor/versor_copy.c b/basic-geometry-test/tests/versor/versor_copy.c index 7d533c8..94a304e 100644 --- a/basic-geometry-test/tests/versor/versor_copy.c +++ b/basic-geometry-test/tests/versor/versor_copy.c @@ -79,3 +79,16 @@ int test_bgc_versor_copy_fp64() return TEST_SUCCES; } + +int test_bgc_versor_copy() +{ + if (test_bgc_versor_copy_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_versor_copy_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/versor/versor_copy.h b/basic-geometry-test/tests/versor/versor_copy.h index 0716429..80fe404 100644 --- a/basic-geometry-test/tests/versor/versor_copy.h +++ b/basic-geometry-test/tests/versor/versor_copy.h @@ -5,4 +5,6 @@ int test_bgc_versor_copy_fp32(); int test_bgc_versor_copy_fp64(); +int test_bgc_versor_copy(); + #endif diff --git a/basic-geometry-test/tests/versor/versor_reset.c b/basic-geometry-test/tests/versor/versor_reset.c index 87acdbb..7917c54 100644 --- a/basic-geometry-test/tests/versor/versor_reset.c +++ b/basic-geometry-test/tests/versor/versor_reset.c @@ -37,3 +37,16 @@ int test_bgc_versor_reset_fp64() return TEST_SUCCES; } + +int test_bgc_versor_reset() +{ + if (test_bgc_versor_reset_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_versor_reset_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/versor/versor_reset.h b/basic-geometry-test/tests/versor/versor_reset.h index 7fca1fa..65134e5 100644 --- a/basic-geometry-test/tests/versor/versor_reset.h +++ b/basic-geometry-test/tests/versor/versor_reset.h @@ -5,4 +5,6 @@ int test_bgc_versor_reset_fp32(); int test_bgc_versor_reset_fp64(); +int test_bgc_versor_reset(); + #endif diff --git a/basic-geometry-test/tests/versor/versor_set_values.c b/basic-geometry-test/tests/versor/versor_set_values.c index 8eab851..b5db84e 100644 --- a/basic-geometry-test/tests/versor/versor_set_values.c +++ b/basic-geometry-test/tests/versor/versor_set_values.c @@ -139,3 +139,16 @@ int test_bgc_versor_set_values_fp64() return TEST_SUCCES; } + +int test_bgc_versor_set_values() +{ + if (test_bgc_versor_set_values_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_versor_set_values_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/versor/versor_set_values.h b/basic-geometry-test/tests/versor/versor_set_values.h index d0e8525..e14dbda 100644 --- a/basic-geometry-test/tests/versor/versor_set_values.h +++ b/basic-geometry-test/tests/versor/versor_set_values.h @@ -5,4 +5,6 @@ int test_bgc_versor_set_values_fp32(); int test_bgc_versor_set_values_fp64(); +int test_bgc_versor_set_values(); + #endif diff --git a/basic-geometry-test/tests/versor/versor_swap.c b/basic-geometry-test/tests/versor/versor_swap.c index bf8be8a..b133886 100644 --- a/basic-geometry-test/tests/versor/versor_swap.c +++ b/basic-geometry-test/tests/versor/versor_swap.c @@ -109,3 +109,16 @@ int test_bgc_versor_swap_fp64() return TEST_SUCCES; } + +int test_bgc_versor_swap() +{ + if (test_bgc_versor_swap_fp32() != TEST_SUCCES) { + return TEST_FAILED; + } + + if (test_bgc_versor_swap_fp64() != TEST_SUCCES) { + return TEST_FAILED; + } + + return TEST_SUCCES; +} diff --git a/basic-geometry-test/tests/versor/versor_swap.h b/basic-geometry-test/tests/versor/versor_swap.h index 175ff4b..b6551c5 100644 --- a/basic-geometry-test/tests/versor/versor_swap.h +++ b/basic-geometry-test/tests/versor/versor_swap.h @@ -1,8 +1,10 @@ -#ifndef _TEST_VECTOR2_SWAP_H_ -#define _TEST_VECTOR2_SWAP_H_ +#ifndef _TEST_VERSOR_SWAP_H_ +#define _TEST_VERSOR_SWAP_H_ int test_bgc_versor_swap_fp32(); int test_bgc_versor_swap_fp64(); +int test_bgc_versor_swap(); + #endif