/
thomas-king
/
Scanner
Обзор
Документация
Войти
/
thomas-king
/
Scanner
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
include/UnitTests/TestSuit.h
59 строк
1 KB
Ace Rodstin
Replace GoogleTest with UnitTest.
02 ноя 2023, 18:07
02 ноя 2023, 18:07
8350eca
Код
Авторство
О чём код?
// // TestSuit.h // UnitTests // // Created by Ace Rodstin on 11/1/23. // Updated by Ace Rodstin on 11/2/23. // // Copyright © 2023 Ace Rodstin. All rights reserved. // #ifndef UNIT_TESTS_TEST_SUIT_HEADER_FILE #define UNIT_TESTS_TEST_SUIT_HEADER_FILE #include <vector> #include <string> #include <utility> #include <iostream> #include "TestCase.h" #include "Asserts.h" using namespace std; namespace unit_tests { class TestSuit { public: using Id = string; TestSuit(Id id, vector<TestCase> tests); virtual void setup(); virtual void tearDown(); void run(); void assertEqual(long double& lhs, long double& rhs, int precision); template<class T> void assertEqual(T& lhs, T& rhs) { bool isEqual = lhs == rhs; if (!isEqual) { cout << "Assertion failure: " << lhs << " is not equal to " << rhs << "." << endl; } TestCase::isSuccess &= isEqual; } private: Id id; vector<TestCase> tests; }; } #endif