diff --git a/tests/test.h b/tests/test.h index 22f87b0..1bf804f 100644 --- a/tests/test.h +++ b/tests/test.h @@ -5,9 +5,22 @@ #include #include #include +#include #include +#define CHECK_STATUS(func_call, status) \ + { \ + bool s = func_call; \ + std::string funcname = #func_call; \ + if (s) { \ + std::cout << "-- TEST " << funcname << " PASS!\n"; \ + } else { \ + std::cout << "-- TEST " << funcname << " FAILED!\n"; \ + } \ + status &= s; \ + } + inline void throw_on_error(ctcStatus_t status, const char* message) { if (status != CTC_STATUS_SUCCESS) { throw std::runtime_error(message + (", stat = " + diff --git a/tests/test_cpu.cpp b/tests/test_cpu.cpp index e710fbc..048496b 100644 --- a/tests/test_cpu.cpp +++ b/tests/test_cpu.cpp @@ -374,16 +374,16 @@ int main(void) { std::cout << "Running CPU tests" << std::endl; bool status = true; - status &= small_test(); - status &= options_test(); - status &= inf_test(); - status &= run_tests(); + CHECK_STATUS(small_test(), status); + CHECK_STATUS(options_test(), status); + CHECK_STATUS(inf_test(), status); + CHECK_STATUS(run_tests(), status); if (status) { - std::cout << "Tests pass" << std::endl; + std::cout << "All tests PASS!" << std::endl; return 0; } else { - std::cout << "Some or all tests fail" << std::endl; + std::cout << "Some or all tests FAILED!" << std::endl; return 1; } } diff --git a/tests/test_gpu.cu b/tests/test_gpu.cu index a94d93a..784114c 100644 --- a/tests/test_gpu.cu +++ b/tests/test_gpu.cu @@ -678,16 +678,16 @@ int main(void) { #endif bool status = true; - status &= small_test(); - status &= options_test(); - status &= inf_test(); - status &= run_tests(); + CHECK_STATUS(small_test(), status); + CHECK_STATUS(options_test(), status); + CHECK_STATUS(inf_test(), status); + CHECK_STATUS(run_tests(), status); if (status) { - std::cout << "Tests pass" << std::endl; + std::cout << "All tests PASS!" << std::endl; return 0; } else { - std::cout << "Some or all tests fail" << std::endl; + std::cout << "Some or all tests FAILED!" << std::endl; return 1; } }