diff options
Diffstat (limited to 'src/unittest.cc')
-rw-r--r-- | src/unittest.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/unittest.cc b/src/unittest.cc new file mode 100644 index 0000000..d2d5167 --- /dev/null +++ b/src/unittest.cc @@ -0,0 +1,34 @@ +#include "unittest.h" + +#include <iostream> + +#include "execute.h" +#include "settings.h" +#include "task.h" + +int runUnitTests(std::list<std::shared_ptr<Task>>& tasks, + const Settings& settings) +{ + bool ok{true}; + std::cout << "Running unit-tests:\n"; + // Run unit-tests + for(const auto& task : tasks) + { + if(task->targetType() == TargetType::UnitTest) + { + std::cout << task->name() << ": "; + auto ret = execute(task->target(), {}, false); + ok &= ret == 0; + if(ret == 0) + { + std::cout << "OK\n"; + } + else + { + std::cout << "FAILED\n"; + } + } + } + + return ok ? 0 : 1; +} |