tests: add testsuite

This commit is contained in:
Bruno BELANYI 2020-11-08 16:57:38 +01:00
parent 26d30b43f4
commit f1537c5178
2 changed files with 90 additions and 1 deletions

View file

@ -1,7 +1,7 @@
CC = gcc
CPPFLAGS = -Isrc/ -D_POSIX_C_SOURCE=200809L
VPATH = src/
CFLAGS = -Wall -Wextra -pedantic -Werror -std=c99
VPATH = src/ tests/
USE_CLIMBING = 1
SRC = \
@ -16,7 +16,20 @@ all: $(BIN)
$(BIN):
$(BIN): $(OBJ) src/pratt.o
check: testsuite
./testsuite --verbose
TEST_SRC = \
tests/testsuite.c \
TEST_OBJ = $(TEST_SRC:.c=.o)
testsuite: LDFLAGS+=-lcriterion -fsanitize=address
testsuite: CFLAGS+=-fsanitize=address
testsuite: $(OBJ) $(TEST_OBJ)
.PHONY: clean
clean:
$(RM) $(OBJ) # remove object files
$(RM) $(BIN) # remove main program
$(RM) testsuite