diff --git a/Makefile.am b/Makefile.am
index 7776cb9..91f4eee 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -243,11 +243,6 @@ test_tests_SOURCES=\
test/runner.c \
test/src/test_common.c \
test/src/tests.c \
- test/src/test_cam.c \
- test/src/test_cam_lh_zo.c \
- test/src/test_cam_rh_zo.c \
- test/src/test_cam_lh_no.c \
- test/src/test_cam_rh_no.c \
test/src/test_clamp.c \
test/src/test_euler.c \
test/src/test_bezier.c \
diff --git a/meson.build b/meson.build
index 430e7b2..2005d2e 100644
--- a/meson.build
+++ b/meson.build
@@ -108,11 +108,6 @@ if get_option('build_tests') == true
test_src = files(
'test/runner.c',
'test/src/test_bezier.c',
- 'test/src/test_cam.c',
- 'test/src/test_cam_lh_no.c',
- 'test/src/test_cam_lh_zo.c',
- 'test/src/test_cam_rh_no.c',
- 'test/src/test_cam_rh_zo.c',
'test/src/test_clamp.c',
'test/src/test_common.c',
'test/src/test_euler.c',
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0c76203..b90437a 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -5,11 +5,6 @@ set(TESTFILES
runner.c
src/test_euler.c
src/test_bezier.c
- src/test_cam.c
- src/test_cam_lh_zo.c
- src/test_cam_rh_zo.c
- src/test_cam_lh_no.c
- src/test_cam_rh_no.c
src/test_struct.c
src/test_clamp.c
src/test_common.c
diff --git a/test/src/test_cam.c b/test/src/test_cam.c
deleted file mode 100644
index b5fbf2b..0000000
--- a/test/src/test_cam.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c), Recep Aslantas.
- *
- * MIT License (MIT), http://opensource.org/licenses/MIT
- * Full license can be found in the LICENSE file
- */
-
-#include "test_common.h"
-
-TEST_IMPL(camera_lookat) {
- mat4 view1, view2;
- vec3 center,
- eye = {0.024f, 14.6f, 67.04f},
- dir = {0.0f, 0.0f, -1.0f},
- up = {0.0f, 1.0f, 0.0f};
-
- glm_vec3_add(eye, dir, center);
- glm_lookat(eye, center, up, view1);
-
- glm_look(eye, dir, up, view2);
-
- ASSERTIFY(test_assert_mat4_eq(view1, view2))
-
- TEST_SUCCESS
-}
-
-TEST_IMPL(camera_decomp) {
- mat4 proj, proj2;
- vec4 sizes;
- float aspect, fovy, nearZ, farZ;
-
- aspect = 0.782f;
- fovy = glm_rad(49.984f);
- nearZ = 0.1f;
- farZ = 100.0f;
-
- glm_perspective(fovy, aspect, nearZ, farZ, proj);
- ASSERT(fabsf(aspect - glm_persp_aspect(proj)) < GLM_FLT_EPSILON)
- ASSERT(fabsf(fovy - glm_persp_fovy(proj)) < GLM_FLT_EPSILON)
- ASSERT(fabsf(49.984f - glm_deg(glm_persp_fovy(proj))) < GLM_FLT_EPSILON)
-
- glm_persp_sizes(proj, fovy, sizes);
-
- glm_frustum(-sizes[0] * 0.5f,
- sizes[0] * 0.5f,
- -sizes[1] * 0.5f,
- sizes[1] * 0.5f,
- nearZ,
- farZ,
- proj2);
-
- ASSERTIFY(test_assert_mat4_eq(proj, proj2))
-
- TEST_SUCCESS
-}
diff --git a/test/src/test_camera.h b/test/src/test_cam.h
similarity index 57%
rename from test/src/test_camera.h
rename to test/src/test_cam.h
index fb1075a..9558b6f 100644
--- a/test/src/test_camera.h
+++ b/test/src/test_cam.h
@@ -11,16 +11,16 @@ TEST_IMPL(GLM_PREFIX, frustum) {
mat4 proj;
vec4 vp = {0.0f, 0.0f, 800.0f, 600.0f};
float left, right, top, bottom, znear, zfar;
-
+
znear = 0.1f;
zfar = 100.0f;
left = -100.0f;
right = 100.0f;
bottom = -100.0f;
top = 100.0f;
-
+
GLM(frustum)(left, right, bottom, top, znear, zfar, proj);
-
+
ASSERT(test_eq(proj[0][1], 0.0f))
ASSERT(test_eq(proj[0][2], 0.0f))
ASSERT(test_eq(proj[0][3], 0.0f))
@@ -42,22 +42,22 @@ TEST_IMPL(GLM_PREFIX, frustum) {
/* perspective test */
GLM(mat4_mulv)(proj, v1, v3);
GLM(project)(v3, proj, vp, v3);
-
+
ASSERT(v3[0] > v1[0])
ASSERT(v3[1] > v1[1])
-
+
GLM(mat4_mulv)(proj, v2, v4);
GLM(project)(v4, proj, vp, v4);
-
+
ASSERT(v4[0] < v3[0])
ASSERT(v4[1] < v3[1])
-
+
/* not infinity */
ASSERT(!GLM(vec4_isinf)(proj[0]))
ASSERT(!GLM(vec4_isinf)(proj[1]))
ASSERT(!GLM(vec4_isinf)(proj[2]))
ASSERT(!GLM(vec4_isinf)(proj[3]))
-
+
/* not NaN */
ASSERT(!GLM(vec4_isnan)(proj[0]))
ASSERT(!GLM(vec4_isnan)(proj[1]))
@@ -66,3 +66,50 @@ TEST_IMPL(GLM_PREFIX, frustum) {
TEST_SUCCESS
}
+
+TEST_IMPL(GLM_PREFIX, camera_lookat) {
+ mat4 view1, view2;
+ vec3 center,
+ eye = {0.024f, 14.6f, 67.04f},
+ dir = {0.0f, 0.0f, -1.0f},
+ up = {0.0f, 1.0f, 0.0f};
+
+ glm_vec3_add(eye, dir, center);
+ glm_lookat(eye, center, up, view1);
+
+ glm_look(eye, dir, up, view2);
+
+ ASSERTIFY(test_assert_mat4_eq(view1, view2))
+
+ TEST_SUCCESS
+}
+
+TEST_IMPL(GLM_PREFIX, camera_decomp) {
+ mat4 proj, proj2;
+ vec4 sizes;
+ float aspect, fovy, nearZ, farZ;
+
+ aspect = 0.782f;
+ fovy = glm_rad(49.984f);
+ nearZ = 0.1f;
+ farZ = 100.0f;
+
+ glm_perspective(fovy, aspect, nearZ, farZ, proj);
+ ASSERT(fabsf(aspect - glm_persp_aspect(proj)) < GLM_FLT_EPSILON)
+ ASSERT(fabsf(fovy - glm_persp_fovy(proj)) < GLM_FLT_EPSILON)
+ ASSERT(fabsf(49.984f - glm_deg(glm_persp_fovy(proj))) < GLM_FLT_EPSILON)
+
+ glm_persp_sizes(proj, fovy, sizes);
+
+ glm_frustum(-sizes[0] * 0.5f,
+ sizes[0] * 0.5f,
+ -sizes[1] * 0.5f,
+ sizes[1] * 0.5f,
+ nearZ,
+ farZ,
+ proj2);
+
+ ASSERTIFY(test_assert_mat4_eq(proj, proj2))
+
+ TEST_SUCCESS
+}
diff --git a/test/src/test_cam_lh_no.c b/test/src/test_cam_lh_no.h
similarity index 81%
rename from test/src/test_cam_lh_no.c
rename to test/src/test_cam_lh_no.h
index 33a285a..d282a1a 100644
--- a/test/src/test_cam_lh_no.c
+++ b/test/src/test_cam_lh_no.h
@@ -6,15 +6,17 @@
*/
#include "test_common.h"
+#include "../../include/cglm/clipspace/persp_lh_no.h"
+#include "../../include/cglm/call/clipspace/persp_lh_no.h"
-TEST_IMPL(perspective_lh_no) {
+TEST_IMPL(GLM_PREFIX, perspective_lh_no) {
mat4 dst;
const float fovy = glm_rad(45.0f);
const float aspect = 640/480.0f;
const float zNearVal = 0.1f;
const float zFarVal = 100.0f;
- glm_perspective_lh_no(fovy, aspect, zNearVal, zFarVal, dst);
+ GLM(perspective_lh_no)(fovy, aspect, zNearVal, zFarVal, dst);
/* Sanity mk. I: longhand version */
ASSERT(test_eq(dst[0][0], 1.0f / (tanf(fovy / 2) * aspect)))
diff --git a/test/src/test_cam_lh_zo.c b/test/src/test_cam_lh_zo.h
similarity index 81%
rename from test/src/test_cam_lh_zo.c
rename to test/src/test_cam_lh_zo.h
index f5f50af..98be0fb 100644
--- a/test/src/test_cam_lh_zo.c
+++ b/test/src/test_cam_lh_zo.h
@@ -6,15 +6,17 @@
*/
#include "test_common.h"
+#include "../../include/cglm/clipspace/persp_lh_zo.h"
+#include "../../include/cglm/call/clipspace/persp_lh_zo.h"
-TEST_IMPL(perspective_lh_zo) {
+TEST_IMPL(GLM_PREFIX, perspective_lh_zo) {
mat4 dst;
const float fovy = glm_rad(45.0f);
const float aspect = 640/480.0f;
const float zNearVal = 0.1f;
const float zFarVal = 100.0f;
- glm_perspective_lh_zo(fovy, aspect, zNearVal, zFarVal, dst);
+ GLM(perspective_lh_zo)(fovy, aspect, zNearVal, zFarVal, dst);
/* Sanity mk. I: longhand version */
ASSERT(test_eq(dst[0][0], 1.0f / (tanf(fovy / 2) * aspect)))
diff --git a/test/src/test_cam_rh_no.c b/test/src/test_cam_rh_no.h
similarity index 81%
rename from test/src/test_cam_rh_no.c
rename to test/src/test_cam_rh_no.h
index 2bcadcd..1fcd597 100644
--- a/test/src/test_cam_rh_no.c
+++ b/test/src/test_cam_rh_no.h
@@ -6,15 +6,17 @@
*/
#include "test_common.h"
+#include "../../include/cglm/clipspace/persp_rh_no.h"
+#include "../../include/cglm/call/clipspace/persp_rh_no.h"
-TEST_IMPL(perspective_rh_no) {
+TEST_IMPL(GLM_PREFIX, perspective_rh_no) {
mat4 dst;
const float fovy = glm_rad(45.0f);
const float aspect = 640/480.0f;
const float zNearVal = 0.1f;
const float zFarVal = 100.0f;
- glm_perspective_rh_no(fovy, aspect, zNearVal, zFarVal, dst);
+ GLM(perspective_rh_no)(fovy, aspect, zNearVal, zFarVal, dst);
/* Sanity mk. I: longhand version */
ASSERT(test_eq(dst[0][0], 1.0f / (tanf(fovy / 2) * aspect)))
diff --git a/test/src/test_cam_rh_zo.c b/test/src/test_cam_rh_zo.h
similarity index 80%
rename from test/src/test_cam_rh_zo.c
rename to test/src/test_cam_rh_zo.h
index 95281a7..76f72ea 100644
--- a/test/src/test_cam_rh_zo.c
+++ b/test/src/test_cam_rh_zo.h
@@ -6,15 +6,17 @@
*/
#include "test_common.h"
+#include "../../include/cglm/clipspace/persp_rh_zo.h"
+#include "../../include/cglm/call/clipspace/persp_rh_zo.h"
-TEST_IMPL(perspective_rh_zo) {
+TEST_IMPL(GLM_PREFIX, perspective_rh_zo) {
mat4 dst;
const float fovy = glm_rad(45.0f);
const float aspect = 640/480.0f;
const float zNearVal = 0.1f;
const float zFarVal = 100.0f;
- glm_perspective_rh_zo(fovy, aspect, zNearVal, zFarVal, dst);
+ GLM(perspective_rh_zo)(fovy, aspect, zNearVal, zFarVal, dst);
/* Sanity mk. I: longhand version */
ASSERT(test_eq(dst[0][0], 1 / (tanf(fovy / 2) * aspect)))
diff --git a/test/src/test_common.h b/test/src/test_common.h
index 9162a8d..841f77b 100644
--- a/test/src/test_common.h
+++ b/test/src/test_common.h
@@ -10,6 +10,10 @@
#include "../include/common.h"
+#if !defined(_WIN32) && !defined(_MSC_VER)
+# pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#endif
+
void
test_rand_mat4(mat4 dest);
diff --git a/test/src/tests.c b/test/src/tests.c
index 1505e32..580454e 100644
--- a/test/src/tests.c
+++ b/test/src/tests.c
@@ -28,7 +28,11 @@
#include "test_affine2d.h"
#include "test_affine_mat.h"
#include "test_ray.h"
-#include "test_camera.h"
+#include "test_cam.h"
+#include "test_cam_lh_no.h"
+#include "test_cam_lh_zo.h"
+#include "test_cam_rh_no.h"
+#include "test_cam_rh_zo.h"
#undef GLM
#undef GLM_PREFIX
@@ -55,7 +59,11 @@
#include "test_affine2d.h"
#include "test_affine_mat.h"
#include "test_ray.h"
-#include "test_camera.h"
+#include "test_cam.h"
+#include "test_cam_lh_no.h"
+#include "test_cam_lh_zo.h"
+#include "test_cam_rh_no.h"
+#include "test_cam_rh_zo.h"
#undef GLM
#undef GLM_PREFIX
diff --git a/test/tests.h b/test/tests.h
index 659a98e..035ac33 100644
--- a/test/tests.h
+++ b/test/tests.h
@@ -223,12 +223,19 @@ TEST_DECLARE(glmc_mat2_swap_row)
TEST_DECLARE(glmc_mat2_rmc)
/* camera (incl [LR]H cross [NZ]O) */
-TEST_DECLARE(perspective_lh_zo)
-TEST_DECLARE(perspective_rh_zo)
-TEST_DECLARE(perspective_lh_no)
-TEST_DECLARE(perspective_rh_no)
-TEST_DECLARE(camera_lookat)
-TEST_DECLARE(camera_decomp)
+TEST_DECLARE(glm_perspective_lh_zo)
+TEST_DECLARE(glm_perspective_rh_zo)
+TEST_DECLARE(glm_perspective_lh_no)
+TEST_DECLARE(glm_perspective_rh_no)
+TEST_DECLARE(glm_camera_lookat)
+TEST_DECLARE(glm_camera_decomp)
+
+TEST_DECLARE(glmc_perspective_lh_zo)
+TEST_DECLARE(glmc_perspective_rh_zo)
+TEST_DECLARE(glmc_perspective_lh_no)
+TEST_DECLARE(glmc_perspective_rh_no)
+TEST_DECLARE(glmc_camera_lookat)
+TEST_DECLARE(glmc_camera_decomp)
TEST_DECLARE(glm_frustum)
@@ -1057,12 +1064,19 @@ TEST_LIST {
TEST_ENTRY(glmc_mat2_rmc)
/* camera (incl [LR]H cross [NZ]O) */
- TEST_ENTRY(perspective_lh_zo)
- TEST_ENTRY(perspective_rh_zo)
- TEST_ENTRY(perspective_lh_no)
- TEST_ENTRY(perspective_rh_no)
- TEST_ENTRY(camera_lookat)
- TEST_ENTRY(camera_decomp)
+ TEST_ENTRY(glm_perspective_lh_zo)
+ TEST_ENTRY(glm_perspective_rh_zo)
+ TEST_ENTRY(glm_perspective_lh_no)
+ TEST_ENTRY(glm_perspective_rh_no)
+ TEST_ENTRY(glm_camera_lookat)
+ TEST_ENTRY(glm_camera_decomp)
+
+ TEST_ENTRY(glmc_perspective_lh_zo)
+ TEST_ENTRY(glmc_perspective_rh_zo)
+ TEST_ENTRY(glmc_perspective_lh_no)
+ TEST_ENTRY(glmc_perspective_rh_no)
+ TEST_ENTRY(glmc_camera_lookat)
+ TEST_ENTRY(glmc_camera_decomp)
TEST_ENTRY(glm_frustum)
diff --git a/win/cglm-test.vcxproj.filters b/win/cglm-test.vcxproj.filters
index b67b1f8..ade5d3e 100644
--- a/win/cglm-test.vcxproj.filters
+++ b/win/cglm-test.vcxproj.filters
@@ -17,9 +17,6 @@
src
-
- src
-
src
@@ -35,18 +32,6 @@
src
-
- src
-
-
- src
-
-
- src
-
-
- src
-
@@ -58,46 +43,28 @@
include
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
src
src
-
- src
-
-
- src
-
-
- src
-
-
- src
-
src
-
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
src
@@ -109,5 +76,35 @@
src
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
\ No newline at end of file