diff --git a/basic-geometry-test/basic-geometry-test.cbp b/basic-geometry-test/basic-geometry-test.cbp
index c0dcc54..7b826db 100644
--- a/basic-geometry-test/basic-geometry-test.cbp
+++ b/basic-geometry-test/basic-geometry-test.cbp
@@ -65,6 +65,10 @@
+
+
+
+
@@ -117,6 +121,10 @@
+
+
+
+
@@ -145,6 +153,10 @@
+
+
+
+
diff --git a/basic-geometry-test/basic-geometry-test.vcxproj b/basic-geometry-test/basic-geometry-test.vcxproj
index 82b567a..2895814 100644
--- a/basic-geometry-test/basic-geometry-test.vcxproj
+++ b/basic-geometry-test/basic-geometry-test.vcxproj
@@ -154,6 +154,7 @@
+
@@ -166,6 +167,7 @@
+
@@ -173,6 +175,7 @@
+
@@ -191,6 +194,7 @@
+
@@ -203,6 +207,7 @@
+
@@ -210,6 +215,7 @@
+
diff --git a/basic-geometry-test/basic-geometry-test.vcxproj.filters b/basic-geometry-test/basic-geometry-test.vcxproj.filters
index e18957e..a91ee1d 100644
--- a/basic-geometry-test/basic-geometry-test.vcxproj.filters
+++ b/basic-geometry-test/basic-geometry-test.vcxproj.filters
@@ -105,6 +105,15 @@
tests\versor
+
+ tests\vector2
+
+
+ tests\vector3
+
+
+ tests\quaternion
+
@@ -210,6 +219,15 @@
tests\versor
+
+ tests\vector2
+
+
+ tests\vector3
+
+
+ tests\quaternion
+
diff --git a/basic-geometry-test/tests/quaternion.c b/basic-geometry-test/tests/quaternion.c
index fd71e36..a24b47f 100644
--- a/basic-geometry-test/tests/quaternion.c
+++ b/basic-geometry-test/tests/quaternion.c
@@ -11,4 +11,5 @@ void test_quaternion()
test_quaternion_swap();
test_quaternion_is_zero();
test_quaternion_is_unit();
+ test_quaternion_modulus();
}
diff --git a/basic-geometry-test/tests/quaternion.h b/basic-geometry-test/tests/quaternion.h
index 182e29d..faff13f 100644
--- a/basic-geometry-test/tests/quaternion.h
+++ b/basic-geometry-test/tests/quaternion.h
@@ -9,6 +9,7 @@
#include "./quaternion/quaternion_swap.h"
#include "./quaternion/quaternion_is_zero.h"
#include "./quaternion/quaternion_is_unit.h"
+#include "./quaternion/quaternion_modulus.h"
void test_quaternion();
diff --git a/basic-geometry-test/tests/quaternion/quaternion_modulus.c b/basic-geometry-test/tests/quaternion/quaternion_modulus.c
new file mode 100644
index 0000000..5d6b4e6
--- /dev/null
+++ b/basic-geometry-test/tests/quaternion/quaternion_modulus.c
@@ -0,0 +1,117 @@
+#include "./quaternion_modulus.h"
+
+#include "./../../helpers.h"
+
+// ==================== FP32 ==================== //
+
+static const int _TEST_FP32_QUATERNION_AMOUNT = 4;
+
+static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST[] = {
+ { 0.0f, 4.0f, 3.0f, 0.0f },
+ { -1.0f, 1.0f, -1.0f, 1.0f },
+ { 100.0f, -100.0f, 0.0f, 100.0f },
+ { -0.86602540378f, 0.5f, -1.0f, 1.0f }
+};
+
+static const float _TEST_FP32_SQUARE_MODULUS_LIST[] = {
+ 25.0f,
+ 4.0f,
+ 30000.0f,
+ 3.0f
+};
+
+static const float _TEST_FP32_MODULUS_LIST[] = {
+ 5.0f,
+ 2.0f,
+ 173.20508076f,
+ 1.7320508076f
+};
+
+void test_quaternion_square_modulus_fp32()
+{
+ print_testing_name("bgc_quaternion_get_square_modulus_fp32");
+
+ for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) {
+ if (!bgc_are_close_fp32(bgc_quaternion_get_square_modulus_fp32(&_TEST_FP32_QUATERNION_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) {
+ print_testing_failed();
+ return;
+ }
+ }
+
+ print_testing_success();
+}
+
+void test_quaternion_modulus_fp32()
+{
+ print_testing_name("bgc_quaternion_get_modulus_fp32");
+
+ for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) {
+ if (!bgc_are_close_fp32(bgc_quaternion_get_modulus_fp32(&_TEST_FP32_QUATERNION_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) {
+ print_testing_failed();
+ return;
+ }
+ }
+
+ print_testing_success();
+}
+
+// ==================== FP64 ==================== //
+
+static const int _TEST_FP64_QUATERNION_AMOUNT = 4;
+
+static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST[] = {
+ { 0.0, 4.0, 3.0, 0.0 },
+ { -1.0, 1.0, -1.0, 1.0 },
+ { 100.0, -100.0, 0.0, 100.0 },
+ { -0.866025403784438647, 0.5, -1.0, 1.0 }
+};
+
+static const double _TEST_FP64_SQUARE_MODULUS_LIST[] = {
+ 25.0,
+ 4.0,
+ 30000.0,
+ 3.0
+};
+
+static const double _TEST_FP64_MODULUS_LIST[] = {
+ 5.0,
+ 2.0,
+ 173.20508075688772935,
+ 1.7320508075688772935
+};
+
+void test_quaternion_square_modulus_fp64()
+{
+ print_testing_name("bgc_quaternion_get_square_modulus_fp64");
+
+ for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) {
+ if (!bgc_are_close_fp64(bgc_quaternion_get_square_modulus_fp64(&_TEST_FP64_QUATERNION_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) {
+ print_testing_failed();
+ return;
+ }
+ }
+
+ print_testing_success();
+}
+
+void test_quaternion_modulus_fp64()
+{
+ print_testing_name("bgc_quaternion_get_modulus_fp64");
+
+ for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) {
+ if (!bgc_are_close_fp64(bgc_quaternion_get_modulus_fp64(&_TEST_FP64_QUATERNION_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) {
+ print_testing_failed();
+ return;
+ }
+ }
+
+ print_testing_success();
+}
+
+void test_quaternion_modulus()
+{
+ test_quaternion_square_modulus_fp32();
+ test_quaternion_square_modulus_fp64();
+ test_quaternion_modulus_fp32();
+ test_quaternion_modulus_fp64();
+}
diff --git a/basic-geometry-test/tests/quaternion/quaternion_modulus.h b/basic-geometry-test/tests/quaternion/quaternion_modulus.h
new file mode 100644
index 0000000..164fcda
--- /dev/null
+++ b/basic-geometry-test/tests/quaternion/quaternion_modulus.h
@@ -0,0 +1,14 @@
+#ifndef _TEST_QUATERNION_MODULUS_H_
+#define _TEST_QUATERNION_MODULUS_H_
+
+void test_quaternion_square_modulus_fp32();
+
+void test_quaternion_square_modulus_fp64();
+
+void test_quaternion_modulus_fp32();
+
+void test_quaternion_modulus_fp64();
+
+void test_quaternion_modulus();
+
+#endif
diff --git a/basic-geometry-test/tests/quaternion/quaternion_square_modulus.c b/basic-geometry-test/tests/quaternion/quaternion_square_modulus.c
deleted file mode 100644
index be94e40..0000000
--- a/basic-geometry-test/tests/quaternion/quaternion_square_modulus.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "./quaternion_square_modulus.h"
-
-#include "./../../helpers.h"
-
-void test_quaternion_square_modulus_fp32()
-{
- print_testing_name("bgc_quaternion_is_zero_fp32");
-
- print_testing_success();
-}
-
-void test_quaternion_square_modulus_fp64()
-{
- print_testing_name("bgc_quaternion_is_zero_fp64");
-
- print_testing_success();
-}
-
-void test_quaternion_square_modulus()
-{
- test_quaternion_square_modulus_fp32();
- test_quaternion_square_modulus_fp64();
-}
diff --git a/basic-geometry-test/tests/quaternion/quaternion_square_modulus.h b/basic-geometry-test/tests/quaternion/quaternion_square_modulus.h
deleted file mode 100644
index e75fcc5..0000000
--- a/basic-geometry-test/tests/quaternion/quaternion_square_modulus.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _TEST_QUATERNION_SQUARE_MODULUS_H_
-#define _TEST_QUATERNION_SQUARE_MODULUS_H_
-
-void test_quaternion_square_modulus_fp32();
-
-void test_quaternion_square_modulus_fp64();
-
-void test_quaternion_square_modulus();
-
-#endif
diff --git a/basic-geometry-test/tests/vector2.c b/basic-geometry-test/tests/vector2.c
index 656621a..44ec217 100644
--- a/basic-geometry-test/tests/vector2.c
+++ b/basic-geometry-test/tests/vector2.c
@@ -10,6 +10,7 @@ void test_vector2()
test_vector2_swap();
test_vector2_is_zero();
test_vector2_is_unit();
+ test_vector2_modulus();
}
diff --git a/basic-geometry-test/tests/vector2.h b/basic-geometry-test/tests/vector2.h
index a19a5b4..7d9599b 100644
--- a/basic-geometry-test/tests/vector2.h
+++ b/basic-geometry-test/tests/vector2.h
@@ -8,6 +8,7 @@
#include "./vector2/vector2_swap.h"
#include "./vector2/vector2_is_zero.h"
#include "./vector2/vector2_is_unit.h"
+#include "./vector2/vector2_modulus.h"
void test_vector2();
diff --git a/basic-geometry-test/tests/vector2/vector2_modulus.c b/basic-geometry-test/tests/vector2/vector2_modulus.c
new file mode 100644
index 0000000..63f13d5
--- /dev/null
+++ b/basic-geometry-test/tests/vector2/vector2_modulus.c
@@ -0,0 +1,117 @@
+#include "./vector2_modulus.h"
+
+#include "./../../helpers.h"
+
+// ==================== FP32 ==================== //
+
+static const int _TEST_FP32_VECTOR2_AMOUNT = 4;
+
+static const BgcVector2FP32 _TEST_FP32_VECTOR2_LIST[] = {
+ { 4.0f, 3.0f },
+ { -3.0f, -4.0f },
+ { 100.0f, -100.0f },
+ { -0.86602540378f, 0.5f }
+};
+
+static const float _TEST_FP32_SQUARE_MODULUS_LIST[] = {
+ 25.0f,
+ 25.0f,
+ 20000.0f,
+ 1.0f
+};
+
+static const float _TEST_FP32_MODULUS_LIST[] = {
+ 5.0f,
+ 5.0f,
+ 141.4213562373f,
+ 1.0f
+};
+
+void test_vector2_square_modulus_fp32()
+{
+ print_testing_name("bgc_vector2_get_square_modulus_fp32");
+
+ for (int i = 0; i < _TEST_FP32_VECTOR2_AMOUNT; i++) {
+ if (!bgc_are_close_fp32(bgc_vector2_get_square_modulus_fp32(&_TEST_FP32_VECTOR2_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) {
+ print_testing_failed();
+ return;
+ }
+ }
+
+ print_testing_success();
+}
+
+void test_vector2_modulus_fp32()
+{
+ print_testing_name("bgc_vector2_get_modulus_fp32");
+
+ for (int i = 0; i < _TEST_FP32_VECTOR2_AMOUNT; i++) {
+ if (!bgc_are_close_fp32(bgc_vector2_get_modulus_fp32(&_TEST_FP32_VECTOR2_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) {
+ print_testing_failed();
+ return;
+ }
+ }
+
+ print_testing_success();
+}
+
+// ==================== FP64 ==================== //
+
+static const int _TEST_FP64_VECTOR2_AMOUNT = 4;
+
+static const BgcVector2FP64 _TEST_FP64_VECTOR2_LIST[] = {
+ { 4.0, 3.0 },
+ { -3.0, -4.0 },
+ { 100.0, -100.0 },
+ { -0.866025403784438647, 0.5 }
+};
+
+static const double _TEST_FP64_SQUARE_MODULUS_LIST[] = {
+ 25.0,
+ 25.0,
+ 20000.0,
+ 1.0
+};
+
+static const double _TEST_FP64_MODULUS_LIST[] = {
+ 5.0,
+ 5.0,
+ 141.42135623730950488,
+ 1.0
+};
+
+void test_vector2_square_modulus_fp64()
+{
+ print_testing_name("bgc_vector2_get_square_modulus_fp64");
+
+ for (int i = 0; i < _TEST_FP64_VECTOR2_AMOUNT; i++) {
+ if (!bgc_are_close_fp64(bgc_vector2_get_square_modulus_fp64(&_TEST_FP64_VECTOR2_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) {
+ print_testing_failed();
+ return;
+ }
+ }
+
+ print_testing_success();
+}
+
+void test_vector2_modulus_fp64()
+{
+ print_testing_name("bgc_vector2_get_modulus_fp64");
+
+ for (int i = 0; i < _TEST_FP64_VECTOR2_AMOUNT; i++) {
+ if (!bgc_are_close_fp64(bgc_vector2_get_modulus_fp64(&_TEST_FP64_VECTOR2_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) {
+ print_testing_failed();
+ return;
+ }
+ }
+
+ print_testing_success();
+}
+
+void test_vector2_modulus()
+{
+ test_vector2_square_modulus_fp32();
+ test_vector2_square_modulus_fp64();
+ test_vector2_modulus_fp32();
+ test_vector2_modulus_fp64();
+}
diff --git a/basic-geometry-test/tests/vector2/vector2_modulus.h b/basic-geometry-test/tests/vector2/vector2_modulus.h
new file mode 100644
index 0000000..a94db73
--- /dev/null
+++ b/basic-geometry-test/tests/vector2/vector2_modulus.h
@@ -0,0 +1,14 @@
+#ifndef _TEST_VECTOR2_MODULUS_H_
+#define _TEST_VECTOR2_MODULUS_H_
+
+void test_vector2_square_modulus_fp32();
+
+void test_vector2_square_modulus_fp64();
+
+void test_vector2_modulus_fp32();
+
+void test_vector2_modulus_fp64();
+
+void test_vector2_modulus();
+
+#endif
diff --git a/basic-geometry-test/tests/vector3.c b/basic-geometry-test/tests/vector3.c
index e3e9bd2..c4d7c82 100644
--- a/basic-geometry-test/tests/vector3.c
+++ b/basic-geometry-test/tests/vector3.c
@@ -10,4 +10,5 @@ void test_vector3()
test_vector3_swap();
test_vector3_is_zero();
test_vector3_is_unit();
+ test_vector3_modulus();
}
diff --git a/basic-geometry-test/tests/vector3.h b/basic-geometry-test/tests/vector3.h
index 33fb265..13a6c6d 100644
--- a/basic-geometry-test/tests/vector3.h
+++ b/basic-geometry-test/tests/vector3.h
@@ -8,6 +8,7 @@
#include "./vector3/vector3_swap.h"
#include "./vector3/vector3_is_zero.h"
#include "./vector3/vector3_is_unit.h"
+#include "./vector3/vector3_modulus.h"
void test_vector3();
diff --git a/basic-geometry-test/tests/vector3/vector3_modulus.c b/basic-geometry-test/tests/vector3/vector3_modulus.c
new file mode 100644
index 0000000..c080032
--- /dev/null
+++ b/basic-geometry-test/tests/vector3/vector3_modulus.c
@@ -0,0 +1,117 @@
+#include "./vector3_modulus.h"
+
+#include "./../../helpers.h"
+
+// ==================== FP32 ==================== //
+
+static const int _TEST_FP32_VECTOR3_AMOUNT = 4;
+
+static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST[] = {
+ { 4.0f, 3.0f, 0.0f },
+ { 0.0f, -3.0f, -4.0f },
+ { 100.0f, -100.0f, 100.0f },
+ { -0.86602540378f, 0.5f, -1.0f }
+};
+
+static const float _TEST_FP32_SQUARE_MODULUS_LIST[] = {
+ 25.0f,
+ 25.0f,
+ 30000.0f,
+ 2.0f
+};
+
+static const float _TEST_FP32_MODULUS_LIST[] = {
+ 5.0f,
+ 5.0f,
+ 173.20508076f,
+ 1.4142135624f
+};
+
+void test_vector3_square_modulus_fp32()
+{
+ print_testing_name("bgc_vector3_get_square_modulus_fp32");
+
+ for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) {
+ if (!bgc_are_close_fp32(bgc_vector3_get_square_modulus_fp32(&_TEST_FP32_VECTOR3_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) {
+ print_testing_failed();
+ return;
+ }
+ }
+
+ print_testing_success();
+}
+
+void test_vector3_modulus_fp32()
+{
+ print_testing_name("bgc_vector3_get_modulus_fp32");
+
+ for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) {
+ if (!bgc_are_close_fp32(bgc_vector3_get_modulus_fp32(&_TEST_FP32_VECTOR3_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) {
+ print_testing_failed();
+ return;
+ }
+ }
+
+ print_testing_success();
+}
+
+// ==================== FP64 ==================== //
+
+static const int _TEST_FP64_VECTOR3_AMOUNT = 4;
+
+static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST[] = {
+ { 0.0, 4.0, 3.0 },
+ { -3.0, 0.0, -4.0 },
+ { 100.0, -100.0, 100.0 },
+ { -0.866025403784438647, 0.5, 1.0 }
+};
+
+static const double _TEST_FP64_SQUARE_MODULUS_LIST[] = {
+ 25.0,
+ 25.0,
+ 30000.0,
+ 2.0
+};
+
+static const double _TEST_FP64_MODULUS_LIST[] = {
+ 5.0,
+ 5.0,
+ 173.20508075688772935,
+ 1.4142135623730950488
+};
+
+void test_vector3_square_modulus_fp64()
+{
+ print_testing_name("bgc_vector3_get_square_modulus_fp64");
+
+ for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) {
+ if (!bgc_are_close_fp64(bgc_vector3_get_square_modulus_fp64(&_TEST_FP64_VECTOR3_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) {
+ print_testing_failed();
+ return;
+ }
+ }
+
+ print_testing_success();
+}
+
+void test_vector3_modulus_fp64()
+{
+ print_testing_name("bgc_vector3_get_modulus_fp64");
+
+ for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) {
+ if (!bgc_are_close_fp64(bgc_vector3_get_modulus_fp64(&_TEST_FP64_VECTOR3_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) {
+ print_testing_failed();
+ return;
+ }
+ }
+
+ print_testing_success();
+}
+
+void test_vector3_modulus()
+{
+ test_vector3_square_modulus_fp32();
+ test_vector3_square_modulus_fp64();
+ test_vector3_modulus_fp32();
+ test_vector3_modulus_fp64();
+}
diff --git a/basic-geometry-test/tests/vector3/vector3_modulus.h b/basic-geometry-test/tests/vector3/vector3_modulus.h
new file mode 100644
index 0000000..65ddec4
--- /dev/null
+++ b/basic-geometry-test/tests/vector3/vector3_modulus.h
@@ -0,0 +1,14 @@
+#ifndef _TEST_VECTOR3_MODULUS_H_
+#define _TEST_VECTOR3_MODULUS_H_
+
+void test_vector3_square_modulus_fp32();
+
+void test_vector3_square_modulus_fp64();
+
+void test_vector3_modulus_fp32();
+
+void test_vector3_modulus_fp64();
+
+void test_vector3_modulus();
+
+#endif