Продолжение переименования типов и функций
This commit is contained in:
parent
605afabd94
commit
3b6efaafa9
25 changed files with 768 additions and 916 deletions
|
@ -1,8 +1,8 @@
|
|||
#include "fp32_vector2_test.h"
|
||||
#include "vector2_fp32_test.h"
|
||||
|
||||
const int TEST_FP32_VECTOR2_AMOUNT_1 = 5;
|
||||
|
||||
const fp32_vector2_t TEST_FP32_VECTOR2_COMMON_1[] = {
|
||||
const vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1[] = {
|
||||
{ 3.0f, 4.0f },
|
||||
{ -3.0f, -4.0f },
|
||||
{ 10000.0f, -20000.0f },
|
||||
|
@ -10,7 +10,7 @@ const fp32_vector2_t TEST_FP32_VECTOR2_COMMON_1[] = {
|
|||
{ -123.5f, 3.7283f }
|
||||
};
|
||||
|
||||
const fp32_vector2_t TEST_FP32_VECTOR2_COMMON_2[] = {
|
||||
const vector2_fp32_t TEST_FP32_VECTOR2_COMMON_2[] = {
|
||||
{ -3.0f, -4.0f },
|
||||
{ -3.0f, -4.0f },
|
||||
{ 0.002f, -0.05f },
|
||||
|
@ -22,14 +22,14 @@ const fp32_vector2_t TEST_FP32_VECTOR2_COMMON_2[] = {
|
|||
|
||||
const float FP32_VECTOR2_SQUARE_MODULUS_1[] = { 25.0f, 25.0f, 500000000.0f, 100.01f, 15266.150221f };
|
||||
|
||||
int test_fp32_vector2_square_modulus()
|
||||
int test_vector2_fp32_square_modulus()
|
||||
{
|
||||
print_test_name("fp32_vector2_t square modulus");
|
||||
print_test_name("vector2_fp32_t square modulus");
|
||||
|
||||
float square_modulus;
|
||||
|
||||
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
||||
square_modulus = fp32_vector2_get_square_modulus(&TEST_FP32_VECTOR2_COMMON_1[i]);
|
||||
square_modulus = vector2_get_square_modulus_fp32(&TEST_FP32_VECTOR2_COMMON_1[i]);
|
||||
|
||||
if (!test_fp32_are_equal(square_modulus, FP32_VECTOR2_SQUARE_MODULUS_1[i], TEST_FP32_TWO_EPSYLON)) {
|
||||
print_test_failed();
|
||||
|
@ -45,14 +45,14 @@ int test_fp32_vector2_square_modulus()
|
|||
|
||||
const float FP32_VECTOR2_MODULUS_1[] = { 5.0f, 5.0f, 22360.68f, 10.0005f, 123.55626338f };
|
||||
|
||||
int test_fp32_vector2_modulus()
|
||||
int test_vector2_fp32_modulus()
|
||||
{
|
||||
print_test_name("fp32_vector2_t modulus");
|
||||
print_test_name("vector2_fp32_t modulus");
|
||||
|
||||
float square_modulus;
|
||||
|
||||
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
||||
square_modulus = fp32_vector2_get_modulus(&TEST_FP32_VECTOR2_COMMON_1[i]);
|
||||
square_modulus = vector2_get_modulus_fp32(&TEST_FP32_VECTOR2_COMMON_1[i]);
|
||||
|
||||
if (!test_fp32_are_equal(square_modulus, FP32_VECTOR2_MODULUS_1[i], TEST_FP32_EPSYLON)) {
|
||||
print_test_failed();
|
||||
|
@ -66,7 +66,7 @@ int test_fp32_vector2_modulus()
|
|||
|
||||
// ===================== Add ==================== //
|
||||
|
||||
const fp32_vector2_t TEST_FP32_VECTOR2_COMMON_1_2_SUM[] = {
|
||||
const vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1_2_SUM[] = {
|
||||
{ 0.0f, 0.0f },
|
||||
{ -6.0f, -8.0f },
|
||||
{ 10000.002f, -20000.05f },
|
||||
|
@ -74,14 +74,14 @@ const fp32_vector2_t TEST_FP32_VECTOR2_COMMON_1_2_SUM[] = {
|
|||
{ -122.0f, -19.6217f }
|
||||
};
|
||||
|
||||
int test_fp32_vector2_add()
|
||||
int test_vector2_fp32_add()
|
||||
{
|
||||
print_test_name("fp32_vector2_t add");
|
||||
print_test_name("vector2_fp32_t add");
|
||||
|
||||
fp32_vector2_t vector;
|
||||
vector2_fp32_t vector;
|
||||
|
||||
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
||||
fp32_vector2_add(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);
|
||||
vector2_fp32_add(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);
|
||||
|
||||
if (!test_fp32_are_equal(vector.x1, TEST_FP32_VECTOR2_COMMON_1_2_SUM[i].x1, TEST_FP32_EPSYLON) ||
|
||||
!test_fp32_are_equal(vector.x2, TEST_FP32_VECTOR2_COMMON_1_2_SUM[i].x2, TEST_FP32_EPSYLON)) {
|
||||
|
@ -96,7 +96,7 @@ int test_fp32_vector2_add()
|
|||
|
||||
// ================== Subtract ================== //
|
||||
|
||||
const fp32_vector2_t TEST_FP32_VECTOR2_COMMON_1_2_DIFF[] = {
|
||||
const vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1_2_DIFF[] = {
|
||||
{ 6.0f, 8.0f },
|
||||
{ 0.0f, 0.0f },
|
||||
{ 9999.998f, -19999.95f },
|
||||
|
@ -104,14 +104,14 @@ const fp32_vector2_t TEST_FP32_VECTOR2_COMMON_1_2_DIFF[] = {
|
|||
{ -125.0f, 27.0783f }
|
||||
};
|
||||
|
||||
int test_fp32_vector2_subtract()
|
||||
int test_vector2_fp32_subtract()
|
||||
{
|
||||
print_test_name("fp32_vector2_t subtract");
|
||||
print_test_name("vector2_fp32_t subtract");
|
||||
|
||||
fp32_vector2_t vector;
|
||||
vector2_fp32_t vector;
|
||||
|
||||
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
||||
fp32_vector2_subtract(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);
|
||||
vector2_fp32_subtract(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);
|
||||
|
||||
if (!test_fp32_are_equal(vector.x1, TEST_FP32_VECTOR2_COMMON_1_2_DIFF[i].x1, TEST_FP32_EPSYLON) ||
|
||||
!test_fp32_are_equal(vector.x2, TEST_FP32_VECTOR2_COMMON_1_2_DIFF[i].x2, TEST_FP32_EPSYLON)) {
|
||||
|
@ -128,21 +128,21 @@ int test_fp32_vector2_subtract()
|
|||
|
||||
int test_fp32_vector2()
|
||||
{
|
||||
print_test_section("fp32_vector2_t");
|
||||
print_test_section("vector2_fp32_t");
|
||||
|
||||
if (test_fp32_vector2_square_modulus() != TEST_RESULT_SUCCES) {
|
||||
if (test_vector2_fp32_square_modulus() != TEST_RESULT_SUCCES) {
|
||||
return TEST_RESULT_FAILED;
|
||||
}
|
||||
|
||||
if (test_fp32_vector2_modulus() != TEST_RESULT_SUCCES) {
|
||||
if (test_vector2_fp32_modulus() != TEST_RESULT_SUCCES) {
|
||||
return TEST_RESULT_FAILED;
|
||||
}
|
||||
|
||||
if (test_fp32_vector2_add() != TEST_RESULT_SUCCES) {
|
||||
if (test_vector2_fp32_add() != TEST_RESULT_SUCCES) {
|
||||
return TEST_RESULT_FAILED;
|
||||
}
|
||||
|
||||
if (test_fp32_vector2_subtract() != TEST_RESULT_SUCCES) {
|
||||
if (test_vector2_fp32_subtract() != TEST_RESULT_SUCCES) {
|
||||
return TEST_RESULT_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
|
||||
int test_fp32_vector2();
|
||||
|
||||
int test_fp32_vector2_square_modulus();
|
||||
int test_vector2_fp32_square_modulus();
|
||||
|
||||
int test_fp32_vector2_modulus();
|
||||
int test_vector2_fp32_modulus();
|
||||
|
||||
int test_fp32_vector2_add();
|
||||
int test_vector2_fp32_add();
|
||||
|
||||
int test_fp32_vector2_subtract();
|
||||
int test_vector2_fp32_subtract();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "geometry_test.h"
|
||||
#include "fp32_vector2_test.h"
|
||||
#include "vector2_fp32_test.h"
|
||||
|
||||
#define PROGRAM_RESULT_SUCCESS 0
|
||||
#define PROGRAM_RESULT_FAILED 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue