Упрощение тестов
This commit is contained in:
parent
fcf793c758
commit
7f242c4b63
71 changed files with 518 additions and 943 deletions
|
@ -14,27 +14,25 @@ static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST[] = {
|
|||
{ -100.0f, 100.0f, -0.001f }
|
||||
};
|
||||
|
||||
int test_vector3_copy_fp32()
|
||||
void test_vector3_copy_fp32()
|
||||
{
|
||||
BgcVector3FP32 vector;
|
||||
|
||||
print_testing_name("bgc_vector3_copy_fp32");
|
||||
|
||||
for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) {
|
||||
|
||||
|
||||
bgc_vector3_copy_fp32(&_TEST_FP32_VECTOR3_LIST[i], &vector);
|
||||
|
||||
if (vector.x1 != _TEST_FP32_VECTOR3_LIST[i].x1 ||
|
||||
vector.x2 != _TEST_FP32_VECTOR3_LIST[i].x2 ||
|
||||
vector.x3 != _TEST_FP32_VECTOR3_LIST[i].x3) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
print_testing_success();
|
||||
|
||||
return TEST_SUCCESS;
|
||||
}
|
||||
|
||||
// ==================== FP64 ==================== //
|
||||
|
@ -47,7 +45,7 @@ static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST[] = {
|
|||
{ -100.0, 100.0, -0.001 }
|
||||
};
|
||||
|
||||
int test_vector3_copy_fp64()
|
||||
void test_vector3_copy_fp64()
|
||||
{
|
||||
BgcVector3FP64 vector;
|
||||
|
||||
|
@ -61,24 +59,15 @@ int test_vector3_copy_fp64()
|
|||
vector.x2 != _TEST_FP64_VECTOR3_LIST[i].x2 ||
|
||||
vector.x3 != _TEST_FP64_VECTOR3_LIST[i].x3) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
print_testing_success();
|
||||
|
||||
return TEST_SUCCESS;
|
||||
}
|
||||
|
||||
int test_vector3_copy()
|
||||
void test_vector3_copy()
|
||||
{
|
||||
if (test_vector3_copy_fp32() != TEST_SUCCESS) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_vector3_copy_fp64() != TEST_SUCCESS) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
return TEST_SUCCESS;
|
||||
test_vector3_copy_fp32();
|
||||
test_vector3_copy_fp64();
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _TEST_VECTOR3_COPY_H_
|
||||
#define _TEST_VECTOR3_COPY_H_
|
||||
|
||||
int test_vector3_copy_fp32();
|
||||
void test_vector3_copy_fp32();
|
||||
|
||||
int test_vector3_copy_fp64();
|
||||
void test_vector3_copy_fp64();
|
||||
|
||||
int test_vector3_copy();
|
||||
void test_vector3_copy();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,29 +32,27 @@ static const BgcVector3FP32 _TEST_FP32_NONUNIT_VECTOR3_LIST[] = {
|
|||
{ 0.6f - 1.25f * BGC_EPSYLON_FP32, -0.8f + 1.25f * BGC_EPSYLON_FP32, 0.0f }
|
||||
};
|
||||
|
||||
int test_vector3_is_unit_fp32()
|
||||
void test_vector3_is_unit_fp32()
|
||||
{
|
||||
print_testing_name("bgc_vector3_is_unit_fp32");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP32_UNIT_VECTOR3_AMOUNT; i++) {
|
||||
if (!bgc_vector3_is_unit_fp32(&_TEST_FP32_UNIT_VECTOR3_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
print_testing_error("A unit vector was not recognized");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP32_NONUNIT_VECTOR3_AMOUNT; i++) {
|
||||
if (bgc_vector3_is_unit_fp32(&_TEST_FP32_NONUNIT_VECTOR3_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
print_testing_error("A non-unit vector was recognized as a unit vector");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
print_testing_success();
|
||||
|
||||
return TEST_SUCCESS;
|
||||
}
|
||||
|
||||
// ==================== FP64 ==================== //
|
||||
|
@ -87,40 +85,31 @@ static const BgcVector3FP64 _TEST_FP64_NONUNIT_VECTOR3_LIST[] = {
|
|||
{ 0.6 - 1.25 * BGC_EPSYLON_FP64, -0.8 + 1.25 * BGC_EPSYLON_FP64, 0.0 }
|
||||
};
|
||||
|
||||
int test_vector3_is_unit_fp64()
|
||||
void test_vector3_is_unit_fp64()
|
||||
{
|
||||
print_testing_name("bgc_vector3_is_unit_fp64");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP64_UNIT_VECTOR3_AMOUNT; i++) {
|
||||
if (!bgc_vector3_is_unit_fp64(&_TEST_FP64_UNIT_VECTOR3_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
print_testing_error("A unit vector was not recognized");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP64_NONUNIT_VECTOR3_AMOUNT; i++) {
|
||||
if (bgc_vector3_is_unit_fp64(&_TEST_FP64_NONUNIT_VECTOR3_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
print_testing_error("A non-unit vector was recognized as a unit vector");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
print_testing_success();
|
||||
|
||||
return TEST_SUCCESS;
|
||||
}
|
||||
|
||||
int test_vector3_is_unit()
|
||||
void test_vector3_is_unit()
|
||||
{
|
||||
if (test_vector3_is_unit_fp32() != TEST_SUCCESS) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_vector3_is_unit_fp64() != TEST_SUCCESS) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
return TEST_SUCCESS;
|
||||
test_vector3_is_unit_fp32();
|
||||
test_vector3_is_unit_fp64();
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _TEST_VECTOR3_IS_UNIT_H_
|
||||
#define _TEST_VECTOR3_IS_UNIT_H_
|
||||
|
||||
int test_vector3_is_unit_fp32();
|
||||
void test_vector3_is_unit_fp32();
|
||||
|
||||
int test_vector3_is_unit_fp64();
|
||||
void test_vector3_is_unit_fp64();
|
||||
|
||||
int test_vector3_is_unit();
|
||||
void test_vector3_is_unit();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,29 +29,27 @@ static const BgcVector3FP32 _TEST_FP32_NONZERO_VECTOR3_LIST[] = {
|
|||
{ -1.25f * BGC_EPSYLON_FP32, -1.25f * BGC_EPSYLON_FP32, 0.0f }
|
||||
};
|
||||
|
||||
int test_vector3_is_zero_fp32()
|
||||
void test_vector3_is_zero_fp32()
|
||||
{
|
||||
print_testing_name("bgc_vector3_is_zero_fp32");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP32_ZERO_VECTOR3_AMOUNT; i++) {
|
||||
if (!bgc_vector3_is_zero_fp32(&_TEST_FP32_ZERO_VECTOR3_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
print_testing_error("A zero vector was not recongized");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP32_NONZERO_VECTOR3_AMOUNT; i++) {
|
||||
if (bgc_vector3_is_zero_fp32(&_TEST_FP32_NONZERO_VECTOR3_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
print_testing_error("A non-zero vector was recongized as a zero vector");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
print_testing_success();
|
||||
|
||||
return TEST_SUCCESS;
|
||||
}
|
||||
|
||||
// ==================== FP64 ==================== //
|
||||
|
@ -81,40 +79,31 @@ static const BgcVector3FP64 _TEST_FP64_NONZERO_VECTOR3_LIST[] = {
|
|||
{ -BGC_EPSYLON_FP64, -BGC_EPSYLON_FP64, 0.0 }
|
||||
};
|
||||
|
||||
int test_vector3_is_zero_fp64()
|
||||
void test_vector3_is_zero_fp64()
|
||||
{
|
||||
print_testing_name("bgc_vector3_is_zero_fp64");
|
||||
|
||||
// Testing zero values:
|
||||
for (int i = 0; i < _TEST_FP64_ZERO_VECTOR3_AMOUNT; i++) {
|
||||
if (!bgc_vector3_is_zero_fp64(&_TEST_FP64_ZERO_VECTOR3_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
print_testing_error("A zero vector was not recongized");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Testing non-zero values:
|
||||
for (int i = 0; i < _TEST_FP64_NONZERO_VECTOR3_AMOUNT; i++) {
|
||||
if (bgc_vector3_is_zero_fp64(&_TEST_FP64_NONZERO_VECTOR3_LIST[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
print_testing_error("A non-zero vector was recongized as a zero vector");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
print_testing_success();
|
||||
|
||||
return TEST_SUCCESS;
|
||||
}
|
||||
|
||||
int test_vector3_is_zero()
|
||||
void test_vector3_is_zero()
|
||||
{
|
||||
if (test_vector3_is_zero_fp32() != TEST_SUCCESS) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_vector3_is_zero_fp64() != TEST_SUCCESS) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
return TEST_SUCCESS;
|
||||
test_vector3_is_zero_fp32();
|
||||
test_vector3_is_zero_fp64();
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _TEST_VECTOR3_IS_ZERO_H_
|
||||
#define _TEST_VECTOR3_IS_ZERO_H_
|
||||
|
||||
int test_vector3_is_zero_fp32();
|
||||
void test_vector3_is_zero_fp32();
|
||||
|
||||
int test_vector3_is_zero_fp64();
|
||||
void test_vector3_is_zero_fp64();
|
||||
|
||||
int test_vector3_is_zero();
|
||||
void test_vector3_is_zero();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "./../../helpers.h"
|
||||
|
||||
int test_vector3_reset_fp32()
|
||||
void test_vector3_reset_fp32()
|
||||
{
|
||||
BgcVector3FP32 vector;
|
||||
|
||||
|
@ -12,15 +12,13 @@ int test_vector3_reset_fp32()
|
|||
|
||||
if (vector.x1 != 0.0f || vector.x2 != 0.0f || vector.x3 != 0.0f) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
return;
|
||||
}
|
||||
|
||||
print_testing_success();
|
||||
|
||||
return TEST_SUCCESS;
|
||||
}
|
||||
|
||||
int test_vector3_reset_fp64()
|
||||
void test_vector3_reset_fp64()
|
||||
{
|
||||
BgcVector3FP64 vector;
|
||||
|
||||
|
@ -30,23 +28,14 @@ int test_vector3_reset_fp64()
|
|||
|
||||
if (vector.x1 != 0.0 || vector.x2 != 0.0 || vector.x3 != 0.0) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
return;
|
||||
}
|
||||
|
||||
print_testing_success();
|
||||
|
||||
return TEST_SUCCESS;
|
||||
}
|
||||
|
||||
int test_vector3_reset()
|
||||
void test_vector3_reset()
|
||||
{
|
||||
if (test_vector3_reset_fp32() != TEST_SUCCESS) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_vector3_reset_fp64() != TEST_SUCCESS) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
return TEST_SUCCESS;
|
||||
test_vector3_reset_fp32();
|
||||
test_vector3_reset_fp64();
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _TEST_VECTOR3_RESET_H_
|
||||
#define _TEST_VECTOR3_RESET_H_
|
||||
|
||||
int test_vector3_reset_fp32();
|
||||
void test_vector3_reset_fp32();
|
||||
|
||||
int test_vector3_reset_fp64();
|
||||
void test_vector3_reset_fp64();
|
||||
|
||||
int test_vector3_reset();
|
||||
void test_vector3_reset();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
// ==================== FP32 ==================== //
|
||||
|
||||
int test_vector3_set_values_fp32()
|
||||
void test_vector3_set_values_fp32()
|
||||
{
|
||||
BgcVector3FP32 vector;
|
||||
|
||||
|
@ -15,32 +15,30 @@ int test_vector3_set_values_fp32()
|
|||
bgc_vector3_set_values_fp32(1.0f, 2.0f, 3.0f, &vector);
|
||||
|
||||
if (vector.x1 != 1.0f || vector.x2 != 2.0f || vector.x3 != 3.0f) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
print_testing_error("First step failed");
|
||||
return;
|
||||
}
|
||||
|
||||
bgc_vector3_set_values_fp32(-3.0f, -5.0f, -7.0f, &vector);
|
||||
|
||||
if (vector.x1 != -3.0f || vector.x2 != -5.0f || vector.x3 != -7.0f) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
print_testing_error("Second step failed");
|
||||
return;
|
||||
}
|
||||
|
||||
bgc_vector3_set_values_fp32(-2.0f, 2.0f, 4.0f, &vector);
|
||||
|
||||
if (vector.x1 != -2.0f || vector.x2 != 2.0f || vector.x3 != 4.0f) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
print_testing_error("Third step failed");
|
||||
return;
|
||||
}
|
||||
|
||||
print_testing_success();
|
||||
|
||||
return TEST_SUCCESS;
|
||||
}
|
||||
|
||||
// ==================== FP64 ==================== //
|
||||
|
||||
int test_vector3_set_values_fp64()
|
||||
void test_vector3_set_values_fp64()
|
||||
{
|
||||
BgcVector3FP64 vector;
|
||||
|
||||
|
@ -50,38 +48,29 @@ int test_vector3_set_values_fp64()
|
|||
bgc_vector3_set_values_fp64(1.0, 2.0, 3.0, &vector);
|
||||
|
||||
if (vector.x1 != 1.0 || vector.x2 != 2.0 || vector.x3 != 3.0) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
print_testing_error("First step failed");
|
||||
return;
|
||||
}
|
||||
|
||||
bgc_vector3_set_values_fp64(-3.0, -5.0, -7.0, &vector);
|
||||
|
||||
if (vector.x1 != -3.0 || vector.x2 != -5.0 || vector.x3 != -7.0) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
print_testing_error("Second step failed");
|
||||
return;
|
||||
}
|
||||
|
||||
bgc_vector3_set_values_fp64(-2.0, 2.0, 4.0, &vector);
|
||||
|
||||
if (vector.x1 != -2.0 || vector.x2 != 2.0 || vector.x3 != 4.0) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
print_testing_error("Third step failed");
|
||||
return;
|
||||
}
|
||||
|
||||
print_testing_success();
|
||||
|
||||
return TEST_SUCCESS;
|
||||
}
|
||||
|
||||
int test_vector3_set_values()
|
||||
void test_vector3_set_values()
|
||||
{
|
||||
if (test_vector3_set_values_fp32() != TEST_SUCCESS) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_vector3_set_values_fp64() != TEST_SUCCESS) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
return TEST_SUCCESS;
|
||||
test_vector3_set_values_fp32();
|
||||
test_vector3_set_values_fp64();
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _TEST_VECTOR3_SET_VALUES_H_
|
||||
#define _TEST_VECTOR3_SET_VALUES_H_
|
||||
|
||||
int test_vector3_set_values_fp32();
|
||||
void test_vector3_set_values_fp32();
|
||||
|
||||
int test_vector3_set_values_fp64();
|
||||
void test_vector3_set_values_fp64();
|
||||
|
||||
int test_vector3_set_values();
|
||||
void test_vector3_set_values();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,7 @@ static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST2[] = {
|
|||
{ 1000.0f, -0.00025f, -0.419f }
|
||||
};
|
||||
|
||||
int test_vector3_swap_fp32()
|
||||
void test_vector3_swap_fp32()
|
||||
{
|
||||
BgcVector3FP32 vector1, vector2;
|
||||
|
||||
|
@ -41,13 +41,11 @@ int test_vector3_swap_fp32()
|
|||
vector2.x2 != _TEST_FP32_VECTOR3_LIST1[i].x2 ||
|
||||
vector2.x3 != _TEST_FP32_VECTOR3_LIST1[i].x3) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
print_testing_success();
|
||||
|
||||
return TEST_SUCCESS;
|
||||
}
|
||||
|
||||
// ==================== FP64 ==================== //
|
||||
|
@ -68,7 +66,7 @@ static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST2[] = {
|
|||
{ 1000.0, -0.00025, -0.419 }
|
||||
};
|
||||
|
||||
int test_vector3_swap_fp64()
|
||||
void test_vector3_swap_fp64()
|
||||
{
|
||||
BgcVector3FP64 vector1, vector2;
|
||||
|
||||
|
@ -87,24 +85,15 @@ int test_vector3_swap_fp64()
|
|||
vector2.x2 != _TEST_FP64_VECTOR3_LIST1[i].x2 ||
|
||||
vector2.x3 != _TEST_FP64_VECTOR3_LIST1[i].x3) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
print_testing_success();
|
||||
|
||||
return TEST_SUCCESS;
|
||||
}
|
||||
|
||||
int test_vector3_swap()
|
||||
void test_vector3_swap()
|
||||
{
|
||||
if (test_vector3_swap_fp32() != TEST_SUCCESS) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_vector3_swap_fp64() != TEST_SUCCESS) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
return TEST_SUCCESS;
|
||||
test_vector3_swap_fp32();
|
||||
test_vector3_swap_fp64();
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _TEST_VECTOR3_SWAP_H_
|
||||
#define _TEST_VECTOR3_SWAP_H_
|
||||
|
||||
int test_vector3_swap_fp32();
|
||||
void test_vector3_swap_fp32();
|
||||
|
||||
int test_vector3_swap_fp64();
|
||||
void test_vector3_swap_fp64();
|
||||
|
||||
int test_vector3_swap();
|
||||
void test_vector3_swap();
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue