2012-01-26 16:43:30 +01:00
|
|
|
# Makefile for running the unittests of libfixmath.
|
|
|
|
CC = gcc
|
|
|
|
|
|
|
|
# Basic CFLAGS for debugging
|
2021-04-29 08:40:06 +02:00
|
|
|
CFLAGS = -g -O0 -I../libfixmath -I.. -Wall -Wextra -Werror
|
2012-01-26 16:43:30 +01:00
|
|
|
|
|
|
|
# The files required for tests
|
2012-08-29 16:38:36 +02:00
|
|
|
FIX16_SRC = ../libfixmath/fix16.c ../libfixmath/fix16_sqrt.c ../libfixmath/fix16_str.c \
|
2012-02-27 17:40:07 +01:00
|
|
|
../libfixmath/fix16_exp.c ../libfixmath/fix16.h
|
2012-01-26 16:43:30 +01:00
|
|
|
|
2014-12-30 19:41:55 +01:00
|
|
|
all: run_fix16_unittests run_fix16_exp_unittests run_fix16_str_unittests run_fix16_macros_unittests
|
2012-01-26 16:43:30 +01:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f fix16_unittests_????
|
2019-06-16 22:02:12 +02:00
|
|
|
rm -f fix16_str_unittests_default
|
|
|
|
rm -f fix16_str_unittests_no_ctype
|
2019-06-16 21:11:57 +02:00
|
|
|
rm -f fix16_exp_unittests
|
|
|
|
rm -f fix16_macros_unittests
|
2012-01-26 16:43:30 +01:00
|
|
|
|
|
|
|
# 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
|
2019-06-16 22:02:12 +02:00
|
|
|
fix16_str_unittests_no_ctype: DEFINES=-DFIXMATH_NO_CTYPE
|
2012-01-26 16:43:30 +01:00
|
|
|
|
|
|
|
fix16_unittests_% : fix16_unittests.c $(FIX16_SRC)
|
|
|
|
$(CC) $(CFLAGS) $(DEFINES) -o $@ $^ -lm
|
2012-02-27 17:40:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Tests for the exponential function, run only in default config
|
|
|
|
run_fix16_exp_unittests: fix16_exp_unittests
|
|
|
|
./fix16_exp_unittests > /dev/null
|
|
|
|
|
|
|
|
fix16_exp_unittests: fix16_exp_unittests.c $(FIX16_SRC)
|
|
|
|
$(CC) $(CFLAGS) $(DEFINES) -o $@ $^ -lm
|
2012-08-29 16:38:36 +02:00
|
|
|
|
2019-06-16 22:02:12 +02:00
|
|
|
# Tests for string conversion, run only in default config and no ctype
|
|
|
|
run_fix16_str_unittests: fix16_str_unittests_default fix16_str_unittests_no_ctype
|
|
|
|
./fix16_str_unittests_default > /dev/null
|
|
|
|
./fix16_str_unittests_no_ctype > /dev/null
|
|
|
|
|
|
|
|
fix16_str_unittests_%: fix16_str_unittests.c $(FIX16_SRC)
|
2012-08-29 16:38:36 +02:00
|
|
|
$(CC) $(CFLAGS) $(DEFINES) -o $@ $^ -lm
|
|
|
|
|
2014-12-30 19:41:55 +01:00
|
|
|
# Tests for literal macros, run only in default config
|
|
|
|
run_fix16_macros_unittests: fix16_macros_unittests
|
|
|
|
./fix16_macros_unittests > /dev/null
|
|
|
|
|
|
|
|
fix16_macros_unittests: fix16_macros_unittests.c $(FIX16_SRC)
|
|
|
|
$(CC) $(CFLAGS) $(DEFINES) -o $@ $^ -lm
|
|
|
|
|