void test_procedure() { if (!uci.engine_initialized) init_engine(position); assert(test_bitscan()); assert(test_bittwiddles()); assert(test_fen()); assert(test_genmove()); assert(test_make_unmake()); assert(test_hash()); assert(test_eval()); assert(test_capture_gen()); assert(test_check_gen()); assert(test_alt_move_gen()); assert(test_see()); assert(test_position()); assert(test_hash_table()); assert(test_ep_capture()); assert(test_book()); test_search(); }
int test_all(void) { /* Seed PRNG with current time */ fprintf(stderr, "test_all: seeding PRNG...\n"); time_t const seed = time(NULL); if (seed < ((time_t) 0)) { perror("time"); return(-1); } srand((unsigned int) seed); fprintf(stderr, "test_hash_table: starting...\n"); int const hash_table_exit = test_hash_table(); fprintf(stderr, "test_hash_table: done, exit code: %d\n", hash_table_exit); /*fprintf(stderr, "test_splay_tree: starting...\n"); int const splay_tree_exit = test_splay_tree(); fprintf(stderr, "test_splay_tree: done, exit code: %d\n", splay_tree_exit);*/ fprintf(stderr, "test_sort: starting...\n"); int const sort_exit = test_sort(); fprintf(stderr, "test_sort: done, exit code: %d\n", sort_exit); int const exit_code = (hash_table_exit < 0 || /*splay_tree_exit < 0 || */sort_exit < 0 ? -1 : 0); fprintf(stderr, "test_all: done, exit code: %d\n", exit_code); return exit_code; }
int main(int argc, char **argv) { cortex_init(); cmd_init(argc, argv); ctx_msg_out = NULL; ctx_tst_out = stdout; test_status("Tests running k=%i..%i...", get_min_kmer_size(), get_max_kmer_size()); test_status("[version] "VERSION_STATUS_STR"\n"); // Binary Kmer tests should work for all values of MAXK test_bkmer_functions(); test_hash_table(); #if MAX_KMER_SIZE == 31 // not kmer dependent test_util(); test_dna_functions(); test_binary_seq_functions(); // only written in k=31 test_db_node(); test_build_graph(); test_supernode(); test_subgraph(); test_cleaning(); test_paths(); // test_path_sets(); // TODO: replace with test_path_subset() test_graph_walker(); test_corrected_aln(); test_repeat_walker(); test_graph_crawler(); test_bubble_caller(); test_kmer_occur(); test_infer_edges_tests(); #endif cmd_destroy(); // Check we free'd all our memory size_t still_alloced = alloc_get_num_allocs() - alloc_get_num_frees(); TASSERT2(still_alloced == 0, "%zu not free'd", still_alloced); // Finished char num_test_str[100], num_passed_str[100]; size_t tests_num_passed = tests_num_run - tests_num_failed; ulong_to_str(tests_num_run, num_test_str); ulong_to_str(tests_num_passed, num_passed_str); test_status("Tests passed: %s / %s (%.1f%%)", num_passed_str, num_test_str, (100.0*tests_num_passed)/tests_num_run); if(tests_num_failed) test_status("%zu tests failed", tests_num_failed); else test_status("All tests passed."); cortex_destroy(); // Return 1 if any tests failed, 0 on success return tests_num_failed ? 1 : 0; }