13 static std::deque<valfuzz::test_pair> registered_tests = {};
14 return registered_tests;
25#if __cplusplus >= 202002L
28 static std::atomic<bool>
29 has_failed_once =
false;
30 return has_failed_once;
35 static std::function<void()> function_execute_before = []() {};
36 return function_execute_before;
41 static std::function<void()> function_execute_after = []() {};
42 return function_execute_after;
48 function_execute_before = f;
54 function_execute_after = f;
60 has_failed_once_ref = has_failed_once;
67 tests.push_back({name, test});
75 std::lock_guard<std::mutex> lock(tests_mutex);
89 for (
auto &test : tests)
91 if (test.first == name)
95 std::cout <<
"Running test: " << test.first <<
"\n";
98 test.second(test.first);
105 std::cout <<
"Test \"" << name <<
"\" not found\n";
112 auto test = std::optional<valfuzz::test_pair>{};
119 std::cout <<
"Running test: \"" << test.value().first <<
"\"\n";
121 test.value().second(test.value().first);
131 for (
long unsigned int i = 0;
134 thread_pool.push_back(std::thread(
_run_tests));
std::deque< valfuzz::test_pair > & get_tests()
std::function< void()> & get_function_execute_after()
std::optional< valfuzz::test_pair > pop_test_or_null()
std::atomic< long unsigned int > & get_max_num_threads()
void set_function_execute_before(std::function< void()> f)
long unsigned int get_num_tests()
std::vector< std::thread > & get_thread_pool()
std::mutex & get_tests_mutex()
std::atomic< bool > & get_verbose()
void run_one_test(const std::string &name)
void set_function_execute_after(std::function< void()> f)
void set_has_failed_once(bool has_failed_once)
std::pair< std::string, test_function > test_pair
std::atomic< bool > & get_is_threaded()
std::function< void(std::string)> test_function
std::atomic< bool > & get_has_failed_once()
std::function< void()> & get_function_execute_before()
void add_test(const std::string &name, test_function test)
std::mutex & get_stream_mutex()