tester.cxx 939 B

12345678910111213141516171819202122
  1. #include "tester.hxx"
  2. thread_local size_t log_depth = 0;
  3. RAIIPerfomanceTest __test_perf("Test perfomance: ");
  4. void __signal_handler(int signum) {
  5. std::cout << std::string(log_depth, '|') INFO << "\x1B[97;41m[✗]\x1B[97;101m: ";
  6. std::cout.flush();
  7. switch (signum) {
  8. case SIGILL: std::cout << "Recived signal SIGILL - Illegal instruction"; std::cout.flush(); break;
  9. case SIGABRT: std::cout << "Recived signal SIGABRT - Abnormal termination"; std::cout.flush(); break;
  10. case SIGFPE: std::cout << "Recived signal SIGFPE - Erroneous arithmetic operation"; std::cout.flush(); break;
  11. case SIGSEGV: std::cout << "Recived signal SIGSEGV - Invalid access to storage"; std::cout.flush(); break;
  12. case SIGTERM: std::cout << "Recived signal SIGTERM - Termination request"; std::cout.flush(); break;
  13. }
  14. std::cout << "\033[0m\n\r";
  15. std::cout.flush();
  16. __test_init.is_success = false;
  17. std::exit(signum);
  18. }