/
thomas-king
/
Raze
Обзор
Документация
Войти
/
thomas-king
/
Raze
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
lib/UnitTests/TestSuit.cpp
62 строки
1 KB
Ace Rodstin
Update tests
23 ноя 2023, 13:35
23 ноя 2023, 13:35
24b75eb
Код
Авторство
О чём код?
// // TestSuit.cpp // UnitTests // // Created by Ace Rodstin on 11/1/23. // Updated by Ace Rodstin on 11/27/23. // // Copyright (C) Ace Rodstin 2023. All rights reserved. // #include "UnitTests/TestSuit.h" using namespace unit_tests; TestSuit::TestSuit(Id id, vector<TestCase> tests): id { id }, tests { tests } {} void TestSuit::run() { cout << "======= " << id << " =======" << endl; int successes = 0; int failures = 0; int total = 0; for (auto test : tests) { setup(); auto isSuccess = test.run(); string resultMark; if (isSuccess) { successes++; resultMark = "[V]"; } else { failures++; resultMark = "[X]"; } total++; cout << id << "." << test.getId() << " " << resultMark << endl; if (!isSuccess) { auto failedAssertion = test.getFailedAssertion(); cout << failedAssertion.getErrorMessage() << endl; } tearDown(); } cout << "Succeeded: " << successes << "/" << total << " tests. "; cout << "Failed: " << failures << "/" << total << " tests." << endl; } void TestSuit::setup() { } void TestSuit::tearDown() { }