#include "./quaternion_copy.h" #include #include "./../../helpers.h" // ==================== FP32 ==================== // static const int _TEST_FP32_QUATERNION_AMOUNT = 4; static const BGC_FP32_Quaternion _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 } }; void test_quaternion_copy_fp32() { BGC_FP32_Quaternion vector; print_testing_name("bgc_fp32_quaternion_copy"); for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) { bgc_fp32_quaternion_copy(&_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; } } print_testing_success(); } // ==================== FP64 ==================== // static const int _TEST_FP64_QUATERNION_AMOUNT = 4; static const BGC_FP64_Quaternion _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 } }; void test_quaternion_copy_fp64() { BGC_FP64_Quaternion vector; print_testing_name("bgc_fp64_quaternion_copy"); for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) { bgc_fp64_quaternion_copy(&_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; } } print_testing_success(); } void test_quaternion_copy() { test_quaternion_copy_fp32(); test_quaternion_copy_fp64(); }