// -*- 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::vector>& tasks, const ctor::settings& settings) { bool ok{true}; std::cout << "Running unit-tests:" << std::endl; // Run unit-tests for(const auto& task : tasks) { if(task->targetType() == ctor::target_type::unit_test) { auto name = task->name(); if(name.empty()) { name = task->target(); } std::cout << name << ": " << std::flush; auto ret = execute(settings, task->targetFile().string(), {}, {}); ok &= ret == 0; if(ret == 0) { std::cout << " OK" << std::endl; } else { std::cout << " FAILED" << std::endl; } } } return ok ? 0 : 1; }