1 #pragma once 2 #include "Util/Util.h" 3 4 #if defined(__HAIKU__) 5 #include <sys/stat.h> 6 #endif 7 8 #ifdef _WIN32 9 #include <windows.h> 10 #endif 11 12 class TestRunner 13 { 14 public: 15 bool runTests(const std::wstring& dir); 16 private: 17 enum class ConsoleColors { White, Red, Green }; 18 19 StringList getTestsList(const std::wstring& dir, const std::wstring& prefix = L"/"); 20 bool executeTest(const std::wstring& dir, const std::wstring& testName, std::wstring& errorString); 21 StringList listSubfolders(const std::wstring& dir); 22 void initConsole(); 23 void changeConsoleColor(ConsoleColors color); 24 void restoreConsole(); 25 26 #ifdef _WIN32 27 HANDLE hstdin; 28 HANDLE hstdout; 29 CONSOLE_SCREEN_BUFFER_INFO csbi; 30 #endif 31 32 }; 33 34 bool runTests(const std::wstring& dir); 35