mirror of
https://github.com/Mercantec-GHC/h5-projekt-mst.git
synced 2026-08-26 21:27:38 +02:00
add tests
This commit is contained in:
parent
2db3c32093
commit
452262effd
@ -41,6 +41,8 @@ sources = \
|
||||
src/tcp.cpp \
|
||||
src/http.cpp
|
||||
|
||||
tests = \
|
||||
tests/true.cpp
|
||||
|
||||
target=$(build_dir)/backend
|
||||
|
||||
@ -53,6 +55,15 @@ $(obj_dir)/%.o: %.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) $< -c -o $@ -MMD -MP $(CXXFLAGS)
|
||||
|
||||
test: $(sources:%.cpp=$(obj_dir)/%.o) run_tests
|
||||
|
||||
run_tests: $(tests:tests/%.cpp=$(build_dir)/tests/test_%)
|
||||
printf "%s\n" $2 | xargs -I % sh -c 'echo "- %..." && ./% && echo "- %: OK" || echo "- %: FAILED" && exit 1'
|
||||
|
||||
$(build_dir)/tests/test_%: tests/%.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) $< -o $@ -MMD -MP $(CXXFLAGS)
|
||||
|
||||
format:
|
||||
$(CLANG_FORMAT) -style=file -i src/*
|
||||
|
||||
|
||||
6
backend/tests/true.cpp
Normal file
6
backend/tests/true.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
assert(true);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user