test.cc (611B)
1 #include "test.h" 2 3 int g_passes = 0; 4 int g_total = 0; 5 6 int main() 7 { 8 std::cerr << "-------------" << std::endl; 9 10 test_audio(); 11 test_fft(); 12 test_utils(); 13 14 if (g_passes < g_total) { 15 std::cerr << "\x1b[31;1m" << (g_total - g_passes) << "/" << g_total; 16 std::cerr << " tests failed" << "\x1b[0m" << std::endl; 17 return -1; 18 } else { 19 std::cerr << "\x1b[32;1m" << g_total << " tests passed" << "\x1b[0m" << std::endl; 20 return 0; 21 } 22 } 23 24 void run(const std::string& message, std::function<void ()> func) 25 { 26 std::cerr << message << std::endl; 27 func(); 28 }