#ifndef TEST_H #define TEST_H #include class Test final { static constexpr const char* RED = "\033[0;31m"; static constexpr const char* GREEN = "\033[0;32m"; static constexpr const char* RESET = "\033[0m"; int tests; int successTests; const char* name; public: Test(const char* name); void finalize(); template void checkEqual(const T& wanted, const T& actual, const char* text) { if(wanted == actual) { tests++; successTests++; } else { tests++; std::cout << RED << name << " Test " << tests << ": " << text << " - " << RESET; std::cout << RED << "expected '" << wanted << "' got '" << actual << "'\n" << RESET; } } void checkFloat(float wanted, float actual, float error, const char* text); }; #endif