// -*- c++ -*- // Distributed under the BSD 2-Clause License. // See accompanying file LICENSE for details. #include "unittest.h" #include #include "execute.h" #include "task.h" int runUnitTests(std::set>& 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) { auto name = task->name(); if(name.empty()) { name = task->target(); } std::cout << name << ": " << std::flush; auto ret = execute(task->targetFile(), {}, settings.verbose > 0); ok &= ret == 0; if(ret == 0) { std::cout << " OK\n"; } else { std::cout << " FAILED\n"; } } } return ok ? 0 : 1; }