Use doctest as test framework

This commit is contained in:
madmaurice 2023-08-28 22:31:24 +02:00
parent b64c82ec92
commit eb6faab89f
6 changed files with 7148 additions and 18 deletions

View file

@ -1,9 +1,8 @@
include Makeconf
emu-objs := $(addsuffix .o,$(modules))
test-targets := $(patsubst %,tests/%.bin, $(tests))
clean-objs := $(emu-objs) $(test-targets) libemu.a vgbc
clean-objs := $(emu-objs) libemu.a vgbc vgbc.test
test-srcs := $(wildcard tests/*.cpp)
.PHONY: all test clean
@ -12,15 +11,8 @@ all: vgbc $(test-targets)
clean:
rm -rf $(clean-objs)
test: $(test-targets)
@for test in $(tests); do \
if ./tests/$$test.bin; then \
echo "-- $$test successful"; \
else \
echo "-- $$test failed"; \
exit 1; \
fi \
done
test: vgbc.test
@./$< -s
%.o: %.cpp
g++ $(CXX_FLAGS) -c -o $@ $^
@ -28,8 +20,8 @@ test: $(test-targets)
libemu.a: $(emu-objs)
ar -rc $@ $^
tests/%.bin: tests/%.cpp libemu.a
g++ $(CXX_FLAGS) -o $@ $^
vgbc: main.c libemu.a
g++ $(CXX_FLAGS) -o $@ $^
vgbc.test: $(test-srcs) libemu.a
g++ $(CXX_FLAGS) -o $@ $^