diff --git a/basic-geometry-test/basic-geometry-test.vcxproj b/basic-geometry-test/basic-geometry-test.vcxproj
index be411b3..966d1a5 100644
--- a/basic-geometry-test/basic-geometry-test.vcxproj
+++ b/basic-geometry-test/basic-geometry-test.vcxproj
@@ -155,8 +155,18 @@
+
+
+
+
+
+
+
+
+
+
@@ -169,8 +179,18 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/basic-geometry-test/basic-geometry-test.vcxproj.filters b/basic-geometry-test/basic-geometry-test.vcxproj.filters
index 39dd6e5..c776e36 100644
--- a/basic-geometry-test/basic-geometry-test.vcxproj.filters
+++ b/basic-geometry-test/basic-geometry-test.vcxproj.filters
@@ -36,6 +36,36 @@
tests\versor
+
+ tests\vector2
+
+
+ tests\vector2
+
+
+ tests\vector3
+
+
+ tests\vector3
+
+
+ tests\vector2
+
+
+ tests\vector2
+
+
+ tests\vector3
+
+
+ tests\vector3
+
+
+ tests\versor
+
+
+ tests\versor
+
@@ -72,6 +102,36 @@
tests\versor
+
+ tests\vector2
+
+
+ tests\vector2
+
+
+ tests\vector3
+
+
+ tests\vector3
+
+
+ tests\vector2
+
+
+ tests\vector2
+
+
+ tests\vector3
+
+
+ tests\vector3
+
+
+ tests\versor
+
+
+ tests\versor
+
diff --git a/basic-geometry-test/main.c b/basic-geometry-test/main.c
index ea53cdd..88da6da 100644
--- a/basic-geometry-test/main.c
+++ b/basic-geometry-test/main.c
@@ -4,6 +4,8 @@
#include "helpers.h"
#include "tests/utilities.h"
+#include "tests/vector2.h"
+#include "tests/vector3.h"
#include "tests/versor.h"
#define PROGRAM_SUCCESS 0
@@ -15,6 +17,14 @@ int main()
return PROGRAM_FAILED;
}
+ if (test_vector2() == TEST_FAILED) {
+ return PROGRAM_FAILED;
+ }
+
+ if (test_vector3() == TEST_FAILED) {
+ return PROGRAM_FAILED;
+ }
+
if (test_versor() == TEST_FAILED) {
return PROGRAM_FAILED;
}
diff --git a/basic-geometry-test/tests/vector2.c b/basic-geometry-test/tests/vector2.c
index c942cae..a3c01cd 100644
--- a/basic-geometry-test/tests/vector2.c
+++ b/basic-geometry-test/tests/vector2.c
@@ -1,5 +1,81 @@
#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");
+
+ if (test_bgc_vector2_reset() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_bgc_vector2_set_values() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_bgc_vector2_copy() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_bgc_vector2_swap() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ return TEST_SUCCES;
+}
+
+
const int TEST_FP32_VECTOR2_AMOUNT_1 = 5;
const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_1[] = {
diff --git a/basic-geometry-test/tests/vector2.h b/basic-geometry-test/tests/vector2.h
index 9980b6b..e1c38ad 100644
--- a/basic-geometry-test/tests/vector2.h
+++ b/basic-geometry-test/tests/vector2.h
@@ -2,6 +2,11 @@
#define _TEST_VECTOR2_H_
#include "./../helpers.h"
+#include "./vector2/vector2_reset.h"
+#include "./vector2/vector2_set_values.h"
+#include "./vector2/vector2_copy.h"
+#include "./vector2/vector2_swap.h"
+
/*
int test_fp32_vector2();
@@ -13,4 +18,15 @@ 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
new file mode 100644
index 0000000..fc4106a
--- /dev/null
+++ b/basic-geometry-test/tests/vector2/vector2_copy.c
@@ -0,0 +1,67 @@
+#include "./vector2_copy.h"
+
+#include
+
+#include "./../../helpers.h"
+
+// ==================== FP32 ==================== //
+
+static const int _TEST_FP32_VECTOR2_AMOUNT = 4;
+static const BgcVector2FP32 _TEST_FP32_VECTOR2_LIST[] = {
+ { 1.0f, 2.0f },
+ { -2.0f, -1.0f },
+ { 100.0f, -100.0f },
+ { -100.0f, 100.0f }
+};
+
+int test_bgc_vector2_copy_fp32()
+{
+ BgcVector2FP32 vector;
+
+ print_testing_name("bgc_vector2_copy_fp32");
+
+ for (int i = 0; i < _TEST_FP32_VECTOR2_AMOUNT; i++) {
+
+ bgc_vector2_copy_fp32(&_TEST_FP32_VECTOR2_LIST[i], &vector);
+
+ if (vector.x1 != _TEST_FP32_VECTOR2_LIST[i].x1 || vector.x2 != _TEST_FP32_VECTOR2_LIST[i].x2) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+// ==================== FP64 ==================== //
+
+static const int _TEST_FP64_VECTOR2_AMOUNT = 4;
+static const BgcVector2FP64 _TEST_FP64_VECTOR2_LIST[] = {
+ { 1.0, 2.0 },
+ { -2.0, -1.0 },
+ { 100.0, -100.0 },
+ { -100.0, 100.0 }
+};
+
+int test_bgc_vector2_copy_fp64()
+{
+ BgcVector2FP64 vector;
+
+ print_testing_name("bgc_vector2_copy_fp64");
+
+ for (int i = 0; i < _TEST_FP64_VECTOR2_AMOUNT; i++) {
+
+ bgc_vector2_copy_fp64(&_TEST_FP64_VECTOR2_LIST[i], &vector);
+
+ if (vector.x1 != _TEST_FP64_VECTOR2_LIST[i].x1 || vector.x2 != _TEST_FP64_VECTOR2_LIST[i].x2) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
diff --git a/basic-geometry-test/tests/vector2/vector2_copy.h b/basic-geometry-test/tests/vector2/vector2_copy.h
new file mode 100644
index 0000000..a99d5dc
--- /dev/null
+++ b/basic-geometry-test/tests/vector2/vector2_copy.h
@@ -0,0 +1,8 @@
+#ifndef _TEST_VECTOR2_COPY_H_
+#define _TEST_VECTOR2_COPY_H_
+
+int test_bgc_vector2_copy_fp32();
+
+int test_bgc_vector2_copy_fp64();
+
+#endif
diff --git a/basic-geometry-test/tests/vector2/vector2_reset.c b/basic-geometry-test/tests/vector2/vector2_reset.c
new file mode 100644
index 0000000..a1cb87b
--- /dev/null
+++ b/basic-geometry-test/tests/vector2/vector2_reset.c
@@ -0,0 +1,39 @@
+#include "./vector2_reset.h"
+
+#include "./../../helpers.h"
+
+int test_bgc_vector2_reset_fp32()
+{
+ BgcVector2FP32 vector;
+
+ print_testing_name("bgc_vector2_reset_fp32");
+
+ bgc_vector2_reset_fp32(&vector);
+
+ if (vector.x1 != 0.0f || vector.x2 != 0.0f) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+int test_bgc_vector2_reset_fp64()
+{
+ BgcVector2FP64 vector;
+
+ print_testing_name("bgc_vector2_reset_fp64");
+
+ bgc_vector2_reset_fp64(&vector);
+
+ if (vector.x1 != 0.0 || vector.x2 != 0.0) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
diff --git a/basic-geometry-test/tests/vector2/vector2_reset.h b/basic-geometry-test/tests/vector2/vector2_reset.h
new file mode 100644
index 0000000..71f5ac8
--- /dev/null
+++ b/basic-geometry-test/tests/vector2/vector2_reset.h
@@ -0,0 +1,8 @@
+#ifndef _TEST_VECTOR2_RESET_H_
+#define _TEST_VECTOR2_RESET_H_
+
+int test_bgc_vector2_reset_fp32();
+
+int test_bgc_vector2_reset_fp64();
+
+#endif
diff --git a/basic-geometry-test/tests/vector2/vector2_set_values.c b/basic-geometry-test/tests/vector2/vector2_set_values.c
new file mode 100644
index 0000000..2ba97a4
--- /dev/null
+++ b/basic-geometry-test/tests/vector2/vector2_set_values.c
@@ -0,0 +1,74 @@
+#include "./vector2_set_values.h"
+
+#include
+
+#include "./../../helpers.h"
+
+// ==================== FP32 ==================== //
+
+int test_bgc_vector2_set_values_fp32()
+{
+ BgcVector2FP32 vector;
+
+ print_testing_name("bgc_vector2_set_values_fp32");
+
+ bgc_vector2_set_values_fp32(1.0f, 2.0f, &vector);
+
+ if (vector.x1 != 1.0f || vector.x2 != 2.0f) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+
+ bgc_vector2_set_values_fp32(-3.0f, -5.0f, &vector);
+
+ if (vector.x1 != -3.0f || vector.x2 != -5.0f) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+
+ bgc_vector2_set_values_fp32(-2.0f, 2.0f, &vector);
+
+ if (vector.x1 != -2.0f || vector.x2 != 2.0f) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+// ==================== FP64 ==================== //
+
+int test_bgc_vector2_set_values_fp64()
+{
+ BgcVector2FP64 vector;
+
+ print_testing_name("bgc_vector2_set_values_fp64");
+
+
+ bgc_vector2_set_values_fp64(1.0, 2.0, &vector);
+
+ if (vector.x1 != 1.0 || vector.x2 != 2.0) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+
+ bgc_vector2_set_values_fp64(-3.0, -5.0, &vector);
+
+ if (vector.x1 != -3.0 || vector.x2 != -5.0) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+
+ bgc_vector2_set_values_fp64(-2.0, 2.0, &vector);
+
+ if (vector.x1 != -2.0 || vector.x2 != 2.0) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+
+ print_testing_success();
+
+ 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
new file mode 100644
index 0000000..349a3ba
--- /dev/null
+++ b/basic-geometry-test/tests/vector2/vector2_set_values.h
@@ -0,0 +1,8 @@
+#ifndef _TEST_VECTOR2_SET_VALUES_H_
+#define _TEST_VECTOR2_SET_VALUES_H_
+
+int test_bgc_vector2_set_values_fp32();
+
+int test_bgc_vector2_set_values_fp64();
+
+#endif
diff --git a/basic-geometry-test/tests/vector2/vector2_swap.c b/basic-geometry-test/tests/vector2/vector2_swap.c
new file mode 100644
index 0000000..ba45df7
--- /dev/null
+++ b/basic-geometry-test/tests/vector2/vector2_swap.c
@@ -0,0 +1,95 @@
+#include "./vector2_swap.h"
+
+#include
+
+#include "./../../helpers.h"
+
+
+
+// ==================== FP32 ==================== //
+
+static const int _TEST_FP32_VECTOR2_AMOUNT = 4;
+
+static const BgcVector2FP32 _TEST_FP32_VECTOR2_LIST1[] = {
+ { 1.0f, 2.0f },
+ { -2.0f, -1.0f },
+ { 100.0f, -100.0f },
+ { -100.1f, 100.2f }
+};
+
+static const BgcVector2FP32 _TEST_FP32_VECTOR2_LIST2[] = {
+ { 3.6f, 5.3f },
+ { 204.07f, -781.89f },
+ { -20.02f, -1.0003f },
+ { 1000.0f, -0.00025f }
+};
+
+int test_bgc_vector2_swap_fp32()
+{
+ BgcVector2FP32 vector1, vector2;
+
+ print_testing_name("bgc_vector2_swap_fp32");
+
+ for (int i = 0; i < _TEST_FP32_VECTOR2_AMOUNT; i++) {
+ bgc_vector2_copy_fp32(&_TEST_FP32_VECTOR2_LIST1[i], &vector1);
+ bgc_vector2_copy_fp32(&_TEST_FP32_VECTOR2_LIST2[i], &vector2);
+
+ bgc_vector2_swap_fp32(&vector1, &vector2);
+
+ if (vector1.x1 != _TEST_FP32_VECTOR2_LIST2[i].x1 ||
+ vector1.x2 != _TEST_FP32_VECTOR2_LIST2[i].x2 ||
+ vector2.x1 != _TEST_FP32_VECTOR2_LIST1[i].x1 ||
+ vector2.x2 != _TEST_FP32_VECTOR2_LIST1[i].x2) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+// ==================== FP64 ==================== //
+
+static const int _TEST_FP64_VECTOR2_AMOUNT = 4;
+
+static const BgcVector2FP64 _TEST_FP64_VECTOR2_LIST1[] = {
+ { 1.0, 2.0 },
+ { -2.0, -1.0 },
+ { 100.0, -100.0 },
+ { -100.1, 100.2 }
+};
+
+static const BgcVector2FP64 _TEST_FP64_VECTOR2_LIST2[] = {
+ { 3.6, 5.3 },
+ { 204.07, -781.89 },
+ { -20.02, -1.0003 },
+ { 1000.0, -0.00025 }
+};
+
+int test_bgc_vector2_swap_fp64()
+{
+ BgcVector2FP64 vector1, vector2;
+
+ print_testing_name("bgc_vector2_swap_fp64");
+
+ for (int i = 0; i < _TEST_FP64_VECTOR2_AMOUNT; i++) {
+ bgc_vector2_copy_fp64(&_TEST_FP64_VECTOR2_LIST1[i], &vector1);
+ bgc_vector2_copy_fp64(&_TEST_FP64_VECTOR2_LIST2[i], &vector2);
+
+ bgc_vector2_swap_fp64(&vector1, &vector2);
+
+ if (vector1.x1 != _TEST_FP64_VECTOR2_LIST2[i].x1 ||
+ vector1.x2 != _TEST_FP64_VECTOR2_LIST2[i].x2 ||
+ vector2.x1 != _TEST_FP64_VECTOR2_LIST1[i].x1 ||
+ vector2.x2 != _TEST_FP64_VECTOR2_LIST1[i].x2) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
diff --git a/basic-geometry-test/tests/vector2/vector2_swap.h b/basic-geometry-test/tests/vector2/vector2_swap.h
new file mode 100644
index 0000000..8befa4c
--- /dev/null
+++ b/basic-geometry-test/tests/vector2/vector2_swap.h
@@ -0,0 +1,8 @@
+#ifndef _TEST_VECTOR2_SWAP_H_
+#define _TEST_VECTOR2_SWAP_H_
+
+int test_bgc_vector2_swap_fp32();
+
+int test_bgc_vector2_swap_fp64();
+
+#endif
diff --git a/basic-geometry-test/tests/vector3.c b/basic-geometry-test/tests/vector3.c
index e69de29..a0872bf 100644
--- a/basic-geometry-test/tests/vector3.c
+++ b/basic-geometry-test/tests/vector3.c
@@ -0,0 +1,76 @@
+#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");
+
+ if (test_bgc_vector3_reset() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_bgc_vector3_set_values() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_bgc_vector3_copy() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_bgc_vector3_swap() != 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 21760e6..8fb0099 100644
--- a/basic-geometry-test/tests/vector3.h
+++ b/basic-geometry-test/tests/vector3.h
@@ -1 +1,20 @@
-#include "../helpers.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();
+
+int test_vector3();
+
+#endif
diff --git a/basic-geometry-test/tests/vector3/vector3_copy.c b/basic-geometry-test/tests/vector3/vector3_copy.c
new file mode 100644
index 0000000..37820e7
--- /dev/null
+++ b/basic-geometry-test/tests/vector3/vector3_copy.c
@@ -0,0 +1,71 @@
+#include "./vector3_copy.h"
+
+#include
+
+#include "./../../helpers.h"
+
+// ==================== FP32 ==================== //
+
+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 },
+ { 100.0f, -100.0f, 0.001f },
+ { -100.0f, 100.0f, -0.001f }
+};
+
+int test_bgc_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;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+// ==================== FP64 ==================== //
+
+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 }
+};
+
+int test_bgc_vector3_copy_fp64()
+{
+ BgcVector3FP64 vector;
+
+ print_testing_name("bgc_vector3_copy_fp64");
+
+ for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) {
+
+ bgc_vector3_copy_fp64(&_TEST_FP64_VECTOR3_LIST[i], &vector);
+
+ if (vector.x1 != _TEST_FP64_VECTOR3_LIST[i].x1 ||
+ vector.x2 != _TEST_FP64_VECTOR3_LIST[i].x2 ||
+ vector.x3 != _TEST_FP64_VECTOR3_LIST[i].x3) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
diff --git a/basic-geometry-test/tests/vector3/vector3_copy.h b/basic-geometry-test/tests/vector3/vector3_copy.h
new file mode 100644
index 0000000..94f3113
--- /dev/null
+++ b/basic-geometry-test/tests/vector3/vector3_copy.h
@@ -0,0 +1,8 @@
+#ifndef _TEST_VECTOR3_COPY_H_
+#define _TEST_VECTOR3_COPY_H_
+
+int test_bgc_vector3_copy_fp32();
+
+int test_bgc_vector3_copy_fp64();
+
+#endif
diff --git a/basic-geometry-test/tests/vector3/vector3_reset.c b/basic-geometry-test/tests/vector3/vector3_reset.c
new file mode 100644
index 0000000..2c3f1ad
--- /dev/null
+++ b/basic-geometry-test/tests/vector3/vector3_reset.c
@@ -0,0 +1,39 @@
+#include "./vector3_reset.h"
+
+#include "./../../helpers.h"
+
+int test_bgc_vector3_reset_fp32()
+{
+ BgcVector3FP32 vector;
+
+ print_testing_name("bgc_vector3_reset_fp32");
+
+ bgc_vector3_reset_fp32(&vector);
+
+ if (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_vector3_reset_fp64()
+{
+ BgcVector3FP64 vector;
+
+ print_testing_name("bgc_vector3_reset_fp64");
+
+ bgc_vector3_reset_fp64(&vector);
+
+ if (vector.x1 != 0.0 || vector.x2 != 0.0 || vector.x3 != 0.0) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
diff --git a/basic-geometry-test/tests/vector3/vector3_reset.h b/basic-geometry-test/tests/vector3/vector3_reset.h
new file mode 100644
index 0000000..c891e12
--- /dev/null
+++ b/basic-geometry-test/tests/vector3/vector3_reset.h
@@ -0,0 +1,8 @@
+#ifndef _TEST_VECTOR3_RESET_H_
+#define _TEST_VECTOR3_RESET_H_
+
+int test_bgc_vector3_reset_fp32();
+
+int test_bgc_vector3_reset_fp64();
+
+#endif
diff --git a/basic-geometry-test/tests/vector3/vector3_set_values.c b/basic-geometry-test/tests/vector3/vector3_set_values.c
new file mode 100644
index 0000000..905d52b
--- /dev/null
+++ b/basic-geometry-test/tests/vector3/vector3_set_values.c
@@ -0,0 +1,74 @@
+#include "./vector3_set_values.h"
+
+#include
+
+#include "./../../helpers.h"
+
+// ==================== FP32 ==================== //
+
+int test_bgc_vector3_set_values_fp32()
+{
+ BgcVector3FP32 vector;
+
+ print_testing_name("bgc_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;
+ }
+
+ 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;
+ }
+
+ 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_success();
+
+ return TEST_SUCCES;
+}
+
+// ==================== FP64 ==================== //
+
+int test_bgc_vector3_set_values_fp64()
+{
+ BgcVector3FP64 vector;
+
+ print_testing_name("bgc_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;
+ }
+
+ 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;
+ }
+
+ 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_success();
+
+ 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
new file mode 100644
index 0000000..6b19d5f
--- /dev/null
+++ b/basic-geometry-test/tests/vector3/vector3_set_values.h
@@ -0,0 +1,8 @@
+#ifndef _TEST_VECTOR3_SET_VALUES_H_
+#define _TEST_VECTOR3_SET_VALUES_H_
+
+int test_bgc_vector3_set_values_fp32();
+
+int test_bgc_vector3_set_values_fp64();
+
+#endif
diff --git a/basic-geometry-test/tests/vector3/vector3_swap.c b/basic-geometry-test/tests/vector3/vector3_swap.c
new file mode 100644
index 0000000..19a1a8d
--- /dev/null
+++ b/basic-geometry-test/tests/vector3/vector3_swap.c
@@ -0,0 +1,99 @@
+#include "./vector3_swap.h"
+
+#include
+
+#include "./../../helpers.h"
+
+
+
+// ==================== FP32 ==================== //
+
+static const int _TEST_FP32_VECTOR3_AMOUNT = 4;
+
+static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST1[] = {
+ { 1.0f, 2.0f, 3.0f },
+ { -3.0f, -2.0f, -1.0f },
+ { 100.0f, -100.0f, 344.7f },
+ { -100.1f, 100.2f, -271.3f }
+};
+
+static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST2[] = {
+ { 3.6f, 5.3f, -0.123f },
+ { 204.07f, -781.89f, 891.3f },
+ { -20.02f, -1.0003f, 0.9275f },
+ { 1000.0f, -0.00025f, -0.419f }
+};
+
+int test_bgc_vector3_swap_fp32()
+{
+ BgcVector3FP32 vector1, vector2;
+
+ print_testing_name("bgc_vector3_swap_fp32");
+
+ for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) {
+ bgc_vector3_copy_fp32(&_TEST_FP32_VECTOR3_LIST1[i], &vector1);
+ bgc_vector3_copy_fp32(&_TEST_FP32_VECTOR3_LIST2[i], &vector2);
+
+ bgc_vector3_swap_fp32(&vector1, &vector2);
+
+ if (vector1.x1 != _TEST_FP32_VECTOR3_LIST2[i].x1 ||
+ vector1.x2 != _TEST_FP32_VECTOR3_LIST2[i].x2 ||
+ vector1.x3 != _TEST_FP32_VECTOR3_LIST2[i].x3 ||
+ vector2.x1 != _TEST_FP32_VECTOR3_LIST1[i].x1 ||
+ vector2.x2 != _TEST_FP32_VECTOR3_LIST1[i].x2 ||
+ vector2.x3 != _TEST_FP32_VECTOR3_LIST1[i].x3) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+// ==================== FP64 ==================== //
+
+static const int _TEST_FP64_VECTOR3_AMOUNT = 4;
+
+static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST1[] = {
+ { 1.0, 2.0, 3.0 },
+ { -3.0, -2.0, -1.0 },
+ { 100.0, -100.0, 344.7 },
+ { -100.1, 100.2, -271.3 }
+};
+
+static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST2[] = {
+ { 3.6, 5.3, -0.123 },
+ { 204.07, -781.89, 891.3 },
+ { -20.02, -1.0003, 0.9275 },
+ { 1000.0, -0.00025, -0.419 }
+};
+
+int test_bgc_vector3_swap_fp64()
+{
+ BgcVector3FP64 vector1, vector2;
+
+ print_testing_name("bgc_vector3_swap_fp64");
+
+ for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) {
+ bgc_vector3_copy_fp64(&_TEST_FP64_VECTOR3_LIST1[i], &vector1);
+ bgc_vector3_copy_fp64(&_TEST_FP64_VECTOR3_LIST2[i], &vector2);
+
+ bgc_vector3_swap_fp64(&vector1, &vector2);
+
+ if (vector1.x1 != _TEST_FP64_VECTOR3_LIST2[i].x1 ||
+ vector1.x2 != _TEST_FP64_VECTOR3_LIST2[i].x2 ||
+ vector1.x3 != _TEST_FP64_VECTOR3_LIST2[i].x3 ||
+ vector2.x1 != _TEST_FP64_VECTOR3_LIST1[i].x1 ||
+ vector2.x2 != _TEST_FP64_VECTOR3_LIST1[i].x2 ||
+ vector2.x3 != _TEST_FP64_VECTOR3_LIST1[i].x3) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
diff --git a/basic-geometry-test/tests/vector3/vector3_swap.h b/basic-geometry-test/tests/vector3/vector3_swap.h
new file mode 100644
index 0000000..de810fe
--- /dev/null
+++ b/basic-geometry-test/tests/vector3/vector3_swap.h
@@ -0,0 +1,8 @@
+#ifndef _TEST_VECTOR3_SWAP_H_
+#define _TEST_VECTOR3_SWAP_H_
+
+int test_bgc_vector3_swap_fp32();
+
+int test_bgc_vector3_swap_fp64();
+
+#endif
diff --git a/basic-geometry-test/tests/versor.c b/basic-geometry-test/tests/versor.c
index a545694..939ecb7 100644
--- a/basic-geometry-test/tests/versor.c
+++ b/basic-geometry-test/tests/versor.c
@@ -28,6 +28,32 @@ int test_bgc_versor_set_values()
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) {
@@ -66,6 +92,14 @@ int test_versor()
return TEST_FAILED;
}
+ if (test_bgc_versor_copy() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_bgc_versor_swap() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
if (test_bgc_versor_are_close() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/versor.h b/basic-geometry-test/tests/versor.h
index d3e0cfd..4b8fac9 100644
--- a/basic-geometry-test/tests/versor.h
+++ b/basic-geometry-test/tests/versor.h
@@ -3,12 +3,18 @@
#include "./versor/versor_reset.h"
#include "./versor/versor_set_values.h"
+#include "./versor/versor_copy.h"
+#include "./versor/versor_swap.h"
#include "./versor/versor_are_close.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();
diff --git a/basic-geometry-test/tests/versor/versor_copy.c b/basic-geometry-test/tests/versor/versor_copy.c
new file mode 100644
index 0000000..7d533c8
--- /dev/null
+++ b/basic-geometry-test/tests/versor/versor_copy.c
@@ -0,0 +1,81 @@
+#include "./versor_copy.h"
+
+#include
+
+#include "./../../helpers.h"
+
+// ==================== FP32 ==================== //
+
+static const int _TEST_FP32_VERSOR_AMOUNT = 8;
+static const BgcVersorFP32 _TEST_FP32_VERSOR_LIST[] = {
+ { 1.0f, 0.0f, 0.0f, 0.0f },
+ { -1.0f, 0.0f, 0.0f, 0.0f },
+ { 0.182574185835f, 0.36514837167f, 0.54772255751f, 0.73029674334f },
+ { 0.182574185835f, -0.36514837167f, 0.54772255751f, -0.73029674334f },
+ { 0.5f, 0.5f, 0.5f, 0.5f },
+ { 0.5f, -0.5f, -0.5f, -0.5f },
+ { 0.7071067812f, -0.7071067812f, 0.0f, 0.0f },
+ { 0.7071067812f, 0.0f, 0.0f, -0.7071067812f }
+};
+
+int test_bgc_versor_copy_fp32()
+{
+ BgcVersorFP32 versor;
+
+ print_testing_name("bgc_versor_copy_fp32");
+
+ for (int i = 0; i < _TEST_FP32_VERSOR_AMOUNT; i++) {
+
+ bgc_versor_copy_fp32(&_TEST_FP32_VERSOR_LIST[i], &versor);
+
+ if (versor.s0 != _TEST_FP32_VERSOR_LIST[i].s0 ||
+ versor.x1 != _TEST_FP32_VERSOR_LIST[i].x1 ||
+ versor.x2 != _TEST_FP32_VERSOR_LIST[i].x2 ||
+ versor.x3 != _TEST_FP32_VERSOR_LIST[i].x3) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+// ==================== FP64 ==================== //
+
+static const int _TEST_FP64_VERSOR_AMOUNT = 8;
+static const BgcVersorFP64 _TEST_FP64_VERSOR_LIST[] = {
+ { 1.0f, 0.0f, 0.0f, 0.0f },
+ { -1.0f, 0.0f, 0.0f, 0.0f },
+ { 0.1825741858350553712, 0.3651483716701107423, 0.5477225575051661135, 0.7302967433402214846 },
+ { 0.1825741858350553712, -0.3651483716701107423, 0.5477225575051661135, -0.7302967433402214846 },
+ { 0.5f, 0.5f, 0.5f, 0.5f },
+ { 0.5f, -0.5f, -0.5f, -0.5f },
+ { 0.7071067811865475, -0.7071067811865475, 0.0, 0.0 },
+ { 0.7071067811865475, 0.0, 0.0, -0.7071067811865475 }
+};
+
+int test_bgc_versor_copy_fp64()
+{
+ BgcVersorFP64 versor;
+
+ print_testing_name("bgc_versor_copy_fp64");
+
+ for (int i = 0; i < _TEST_FP64_VERSOR_AMOUNT; i++) {
+
+ bgc_versor_copy_fp64(&_TEST_FP64_VERSOR_LIST[i], &versor);
+
+ if (versor.s0 != _TEST_FP64_VERSOR_LIST[i].s0 ||
+ versor.x1 != _TEST_FP64_VERSOR_LIST[i].x1 ||
+ versor.x2 != _TEST_FP64_VERSOR_LIST[i].x2 ||
+ versor.x3 != _TEST_FP64_VERSOR_LIST[i].x3) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
diff --git a/basic-geometry-test/tests/versor/versor_copy.h b/basic-geometry-test/tests/versor/versor_copy.h
new file mode 100644
index 0000000..0716429
--- /dev/null
+++ b/basic-geometry-test/tests/versor/versor_copy.h
@@ -0,0 +1,8 @@
+#ifndef _TEST_VERSOR_COPY_H_
+#define _TEST_VERSOR_COPY_H_
+
+int test_bgc_versor_copy_fp32();
+
+int test_bgc_versor_copy_fp64();
+
+#endif
diff --git a/basic-geometry-test/tests/versor/versor_reset.c b/basic-geometry-test/tests/versor/versor_reset.c
index 9019585..87acdbb 100644
--- a/basic-geometry-test/tests/versor/versor_reset.c
+++ b/basic-geometry-test/tests/versor/versor_reset.c
@@ -1,7 +1,5 @@
#include "./versor_reset.h"
-#include
-
#include "./../../helpers.h"
int test_bgc_versor_reset_fp32()
diff --git a/basic-geometry-test/tests/versor/versor_swap.c b/basic-geometry-test/tests/versor/versor_swap.c
new file mode 100644
index 0000000..bf8be8a
--- /dev/null
+++ b/basic-geometry-test/tests/versor/versor_swap.c
@@ -0,0 +1,111 @@
+#include "./versor_swap.h"
+
+#include
+
+#include "./../../helpers.h"
+
+typedef struct {
+ float s0, x1, x2, x3;
+} _TestVersorDataFP32;
+
+typedef struct {
+ double s0, x1, x2, x3;
+} _TestVersorDataFP64;
+
+// ==================== FP32 ==================== //
+
+static const int _TEST_FP32_VERSOR_AMOUNT = 3;
+
+static const _TestVersorDataFP32 _TEST_FP32_VERSOR_LIST1[] = {
+ { 1.0f, 2.0f, 3.0f, 4.0f },
+ { -4.0f, -3.0f, -2.0f, -1.0f },
+ { 0.5f, -0.5f, -0.5f, -0.5f }
+};
+
+static const _TestVersorDataFP32 _TEST_FP32_VERSOR_LIST2[] = {
+ { -0.5f, 0.5f, 0.5f, 0.5f },
+ { -1.0f, -2.0f, -3.0f, -4.0f },
+ { 4.0f, 3.0f, 2.0f, 1.0f }
+};
+
+int test_bgc_versor_swap_fp32()
+{
+ BgcVersorFP32 versor1a, versor2a, versor1b, versor2b;
+
+ print_testing_name("bgc_versor_swap_fp32");
+
+ for (int i = 0; i < _TEST_FP32_VERSOR_AMOUNT; i++) {
+ bgc_versor_set_values_fp32(
+ _TEST_FP32_VERSOR_LIST1[i].s0,
+ _TEST_FP32_VERSOR_LIST1[i].x1,
+ _TEST_FP32_VERSOR_LIST1[i].x2,
+ _TEST_FP32_VERSOR_LIST1[i].x3,
+ &versor1a
+ );
+
+ bgc_versor_set_values_fp32(
+ _TEST_FP32_VERSOR_LIST2[i].s0,
+ _TEST_FP32_VERSOR_LIST2[i].x1,
+ _TEST_FP32_VERSOR_LIST2[i].x2,
+ _TEST_FP32_VERSOR_LIST2[i].x3,
+ &versor2a
+ );
+
+ bgc_versor_copy_fp32(&versor1a, &versor1b);
+ bgc_versor_copy_fp32(&versor2a, &versor2b);
+
+ bgc_versor_swap_fp32(&versor1b, &versor2b);
+
+ if (versor1a.s0 != versor2b.s0 || versor1a.x1 != versor2b.x1 || versor1a.x2 != versor2b.x2 || versor1a.x3 != versor2b.x3 ||
+ versor2a.s0 != versor1b.s0 || versor2a.x1 != versor1b.x1 || versor2a.x2 != versor1b.x2 || versor2a.x3 != versor1b.x3) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+// ==================== FP64 ==================== //
+
+int test_bgc_versor_swap_fp64()
+{
+ BgcVersorFP64 versor1a, versor2a, versor1b, versor2b;
+
+ print_testing_name("bgc_versor_swap_fp64");
+
+ for (int i = 0; i < _TEST_FP32_VERSOR_AMOUNT; i++) {
+ bgc_versor_set_values_fp64(
+ _TEST_FP32_VERSOR_LIST1[i].s0,
+ _TEST_FP32_VERSOR_LIST1[i].x1,
+ _TEST_FP32_VERSOR_LIST1[i].x2,
+ _TEST_FP32_VERSOR_LIST1[i].x3,
+ &versor1a
+ );
+
+ bgc_versor_set_values_fp64(
+ _TEST_FP32_VERSOR_LIST2[i].s0,
+ _TEST_FP32_VERSOR_LIST2[i].x1,
+ _TEST_FP32_VERSOR_LIST2[i].x2,
+ _TEST_FP32_VERSOR_LIST2[i].x3,
+ &versor2a
+ );
+
+ bgc_versor_copy_fp64(&versor1a, &versor1b);
+ bgc_versor_copy_fp64(&versor2a, &versor2b);
+
+ bgc_versor_swap_fp64(&versor1b, &versor2b);
+
+ if (versor1a.s0 != versor2b.s0 || versor1a.x1 != versor2b.x1 || versor1a.x2 != versor2b.x2 || versor1a.x3 != versor2b.x3 ||
+ versor2a.s0 != versor1b.s0 || versor2a.x1 != versor1b.x1 || versor2a.x2 != versor1b.x2 || versor2a.x3 != versor1b.x3) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
diff --git a/basic-geometry-test/tests/versor/versor_swap.h b/basic-geometry-test/tests/versor/versor_swap.h
new file mode 100644
index 0000000..8befa4c
--- /dev/null
+++ b/basic-geometry-test/tests/versor/versor_swap.h
@@ -0,0 +1,8 @@
+#ifndef _TEST_VECTOR2_SWAP_H_
+#define _TEST_VECTOR2_SWAP_H_
+
+int test_bgc_vector2_swap_fp32();
+
+int test_bgc_vector2_swap_fp64();
+
+#endif