diff --git a/tests/makefile b/tests/makefile new file mode 100644 index 0000000..1522c56 --- /dev/null +++ b/tests/makefile @@ -0,0 +1,16 @@ +CC = g++ +CFLAGS = -std=c++17 -Wall + +CPPS = $(wildcard *.cpp) +EXES = $(patsubst %.cpp, %.out, $(CPPS)) + +.PHONY: all clean + +%.out: %.cpp + $(CC) $(CFLAGS) $< -o $@ + +all: $(EXES) + +clean: + -rm *.o + -rm *.out \ No newline at end of file diff --git a/tests/testutil.hpp b/tests/testutil.hpp index ac02174..2690320 100644 --- a/tests/testutil.hpp +++ b/tests/testutil.hpp @@ -1,6 +1,8 @@ #include #include #include +#include +#include namespace Util { @@ -33,4 +35,28 @@ void Execute(bool (*testFunction)(void), char const * const message) std::printf("[FAIL] Exception thrown during execution of <%s>, error: %s\n", message, e.what()); } } + +void Execute(bool (*testFunction)(std::vector &), char const * const message) +{ + std::vector issues; + try + { + if(testFunction(issues)) + { + std::printf("[PASS] %s\n", message); + } + else + { + for(auto & issue : issues) + { + std::printf(" Issue: %s\n", issue.c_str()); + } + std::printf("[FAIL] %s\n", message); + } + } + catch(std::exception & e) + { + std::printf("[FAIL] Exception thrown during execution of <%s>, error: %s\n", message, e.what()); + } +} }; \ No newline at end of file