aboutsummaryrefslogtreecommitdiff
path: root/unittests/Makefile
diff options
context:
space:
mode:
authorPetteri.Aimonen <Petteri.Aimonen@gmail.com>2012-01-26 15:43:30 +0000
committerPetteri.Aimonen <Petteri.Aimonen@gmail.com>2012-01-26 15:43:30 +0000
commit1076285d2655b82a4d19cbd46af305ea48fe7c52 (patch)
tree52b8f5423707b40881ada210a123a72ad552fffa /unittests/Makefile
parent681fd5aea1c1b6fb618e6c7902cf70e417d8233c (diff)
downloadlibfixmath-1076285d2655b82a4d19cbd46af305ea48fe7c52.tar.gz
Merging a bunch of separately developed functions:
fix16_mul, fix16_div, fix16_sqrt. They are faster & more accurate than the previous versions. Closes issue #13. Includes unittests for the functions in question, runnable by typing 'make' in the unittests folder.
Diffstat (limited to 'unittests/Makefile')
-rw-r--r--unittests/Makefile49
1 files changed, 49 insertions, 0 deletions
diff --git a/unittests/Makefile b/unittests/Makefile
new file mode 100644
index 0000000..80df66b
--- /dev/null
+++ b/unittests/Makefile
@@ -0,0 +1,49 @@
+# Makefile for running the unittests of libfixmath.
+CC = gcc
+
+# Basic CFLAGS for debugging
+CFLAGS = -g -O0 -I../libfixmath -Wall -Wextra -Werror
+
+# The files required for tests
+FIX16_SRC = ../libfixmath/fix16.c ../libfixmath/fix16_sqrt.c \
+ ../libfixmath/fix16.h
+
+all: run_fix16_unittests
+
+clean:
+ rm -f fix16_unittests_????
+
+# The library is tested automatically under different compilations
+# options.
+#
+# Test naming:
+# r = rounding, n = no rounding
+# o = overflow detection, n = no overflow detection
+# 64 = int64_t math, 32 = int32_t math
+
+run_fix16_unittests: \
+ fix16_unittests_ro64 fix16_unittests_no64 \
+ fix16_unittests_rn64 fix16_unittests_nn64 \
+ fix16_unittests_ro32 fix16_unittests_no32 \
+ fix16_unittests_rn32 fix16_unittests_nn32 \
+ fix16_unittests_ro08 fix16_unittests_no08 \
+ fix16_unittests_rn08 fix16_unittests_nn08
+ $(foreach test, $^, \
+ echo $(test) && \
+ ./$(test) > /dev/null && \
+ ) true
+
+fix16_unittests_no64: DEFINES=-DFIXMATH_NO_ROUNDING
+fix16_unittests_rn64: DEFINES=-DFIXMATH_NO_OVERFLOW
+fix16_unittests_nn64: DEFINES=-DFIXMATH_NO_ROUNDING -DFIXMATH_NO_OVERFLOW
+fix16_unittests_ro32: DEFINES=-DFIXMATH_NO_64BIT
+fix16_unittests_no32: DEFINES=-DFIXMATH_NO_ROUNDING -DFIXMATH_NO_64BIT
+fix16_unittests_rn32: DEFINES=-DFIXMATH_NO_OVERFLOW -DFIXMATH_NO_64BIT
+fix16_unittests_nn32: DEFINES=-DFIXMATH_NO_OVERFLOW -DFIXMATH_NO_ROUNDING -DFIXMATH_NO_64BIT
+fix16_unittests_ro08: DEFINES=-DFIXMATH_OPTIMIZE_8BIT
+fix16_unittests_no08: DEFINES=-DFIXMATH_NO_ROUNDING -DFIXMATH_OPTIMIZE_8BIT
+fix16_unittests_rn08: DEFINES=-DFIXMATH_NO_OVERFLOW -DFIXMATH_OPTIMIZE_8BIT
+fix16_unittests_nn08: DEFINES=-DFIXMATH_NO_OVERFLOW -DFIXMATH_NO_ROUNDING -DFIXMATH_OPTIMIZE_8BIT
+
+fix16_unittests_% : fix16_unittests.c $(FIX16_SRC)
+ $(CC) $(CFLAGS) $(DEFINES) -o $@ $^ -lm