aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvimene <vincent.menegaux@gmail.com>2023-11-28 05:18:04 +0100
committervimene <vincent.menegaux@gmail.com>2023-11-28 05:18:04 +0100
commitdc5c6f08f6bd83356a5dbf2f31e15354210f5937 (patch)
tree9d0d6063cf0a4807e04ab51ec9f1f102587816f8
parente730e8bdc69ef89dfa28d2606d260cb8b72f4740 (diff)
downloadengine-dc5c6f08f6bd83356a5dbf2f31e15354210f5937.tar.gz
started working on tests
-rw-r--r--.gitignore4
-rw-r--r--Makefile.am9
-rw-r--r--configure.ac20
-rw-r--r--tests/test.c1
4 files changed, 27 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 1f3617b..2485dc3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,10 @@
+# binaries
/engine
/engine.exe
+# tests binaries
+/engine-tests
+
# autotools files
.deps/
.dirstamp
diff --git a/Makefile.am b/Makefile.am
index 82c6e3d..0045247 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,5 @@
ACLOCAL_AMFLAGS = -Im4 --install
-AM_CPPFLAGS = $(DEPS_CFLAGS) -Wall -Wextra
-
bin_PROGRAMS = engine
engine_SOURCES = src/engine.cpp \
src/fb/chfb.h src/fb/chfb.cpp src/fb/pixfb.h src/fb/pixfb.cpp \
@@ -13,7 +11,14 @@ engine_SOURCES = src/engine.cpp \
src/o3d/vertex_data.h src/o3d/vertex_data.cpp \
src/o3d/camera.h src/o3d/camera.cpp \
src/o3d/scene.h src/o3d/scene.cpp
+engine_CPPFLAGS = -Wall -Wextra $(DEPS_CPPFLAGS)
engine_LDFLAGS = -Wall -Wextra
engine_LDADD = $(DEPS_LIBS)
+check_PROGRAMS = engine-tests
+engine_tests_SOURCES = tests/test.c
+engine_tests_CPPFLAGS = -Wall -Wextra $(TESTS_DEPS_CPPFLAGS)
+engine_tests_LDFLAGS = -Wall -Wextra
+engine_tests_LDADD = $(TESTS_DEPS_LIBS)
+
EXTRA_DIST = m4/NOTES
diff --git a/configure.ac b/configure.ac
index 13ccb1a..9ee41b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,7 +11,7 @@ SDL_VERSION=2.0
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
sdl_prefix="$withval", sdl_prefix="")
-DEPS_CFLAGS=""
+DEPS_CPPFLAGS=""
DEPS_LIBS=""
AS_IF([test "x$sdl_prefix" = x], [
@@ -20,22 +20,32 @@ AS_IF([test "x$sdl_prefix" = x], [
sdl_config="$sdl_prefix/bin/sdl2-config"
SDL_CFLAGS=`"$sdl_config" --prefix="$sdl_prefix" --cflags`
SDL_LIBS=`"$sdl_config" --prefix="$sdl_prefix" --libs`
- # TODO: check if sdl is present, check version
+ dnl TODO: check if sdl is present, check version
])
-DEPS_CFLAGS="$SDL_CFLAGS $DEPS_CFLAGS"
+DEPS_CPPFLAGS="$SDL_CFLAGS $DEPS_CPPFLAGS"
DEPS_LIBS="$SDL_LIBS $DEPS_LIBS"
AC_CANONICAL_HOST
AS_IF([test "$host_os" != mingw32], [
PKG_CHECK_MODULES([NCURSES], [ncurses])
- DEPS_CFLAGS="$NCURSES_CFLAGS $DEPS_CFLAGS"
+ DEPS_CPPFLAGS="$NCURSES_CFLAGS $DEPS_CPPFLAGS"
DEPS_LIBS="$NCURSES_LIBS $DEPS_LIBS"
AC_DEFINE([ENABLE_NCURSES], [], [Enable ncurses])
])
-AC_SUBST(DEPS_CFLAGS)
+AC_SUBST(DEPS_CPPFLAGS)
AC_SUBST(DEPS_LIBS)
+TESTS_DEPS_CPPFLAGS=""
+TESTS_DEPS_LIBS=""
+
+PKG_CHECK_MODULES([CRITERION], [criterion >= 1.8.1])
+TESTS_DEPS_CPPFLAGS="$CRITERION_CFLAGS $TESTS_DEPS_CPPFLAGS"
+TESTS_DEPS_LIBS="$CRITERION_LIBS $TESTS_DEPS_LIBS"
+
+AC_SUBST(TESTS_DEPS_CPPFLAGS)
+AC_SUBST(TESTS_DEPS_LIBS)
+
AC_PROG_CXX
AC_TYPE_UINT32_T
AC_CHECK_FUNCS([floor setlocale])
diff --git a/tests/test.c b/tests/test.c
new file mode 100644
index 0000000..06fa399
--- /dev/null
+++ b/tests/test.c
@@ -0,0 +1 @@
+#include <criterion/criterion.h>