int main(void) { // data structures int linked_list_failed = run_test_suite(create_linked_list_test_suite()); int chained_hash_table_failed = run_test_suite(create_chained_hash_table_test_suite()); int stack_failed = run_test_suite(create_stack_test_suite()); int queue_failed = run_test_suite(create_queue_test_suite()); int circular_buffer_failed = run_test_suite(create_circular_buffer_test_suite()); int doubly_linked_list_failed = run_test_suite(create_doubly_linked_list_test_suite()); // algorithms int sort_failed = run_test_suite(create_sort_test_suite()); // helpers int bit_helper_failed = run_test_suite(create_bit_helper_test_suite()); int failed = linked_list_failed + chained_hash_table_failed + circular_buffer_failed + stack_failed + queue_failed + doubly_linked_list_failed + sort_failed + bit_helper_failed; return failed == 0 ? 0 : 1; }
int main(int argc, char **argv) { char optchar; opterr = 0; while ((optchar = getopt(argc, argv, "t:rf")) != -1) { switch (optchar) { case 't': run_test_suite(atoi(optarg)); return EXIT_SUCCESS; break; case 'r': printf("---- RESULTS ----\n"); printf("Elapsed execution time: %.6fs\n", longrunning_rotation()); printf("---- END RESULTS ----\n"); return EXIT_SUCCESS; break; case 'f': printf("---- RESULTS ----\n"); printf("Elapsed execution time: %.6fs\n", longrunning_flipcount()); printf("---- END RESULTS ----\n"); return EXIT_SUCCESS; break; } } print_usage(argv[0]); }
int liblinphone_tester_run_tests(const char *suite_name, const char *test_name) { int i; int ret; /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); for (i = 0; i < liblinphone_tester_nb_test_suites(); i++) { run_test_suite(test_suite[i]); } if (suite_name){ CU_pSuite suite; CU_basic_set_mode(CU_BRM_VERBOSE); suite=CU_get_suite(suite_name); if (!suite) { ms_error("Could not find suite '%s'. Available suites are:", suite_name); liblinphone_tester_list_suites(); return -1; } else if (test_name) { CU_pTest test=CU_get_test_by_name(test_name, suite); if (!test) { ms_error("Could not find test '%s' in suite '%s'. Available tests are:", test_name, suite_name); // do not use suite_name here, since this method is case sentisitive liblinphone_tester_list_suite_tests(suite->pName); return -2; } else { CU_ErrorCode err= CU_basic_run_test(suite, test); if (err != CUE_SUCCESS) ms_error("CU_basic_run_test error %d", err); } } else { CU_basic_run_suite(suite); } } else { #if HAVE_CU_CURSES if (curses) { /* Run tests using the CUnit curses interface */ CU_curses_run_tests(); } else #endif { /* Run all tests using the CUnit Basic interface */ CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); } } ret=CU_get_number_of_tests_failed()!=0; /* Redisplay list of failed tests on end */ if (CU_get_number_of_failure_records()){ CU_basic_show_failures(CU_get_failure_list()); printf("\n"); } CU_cleanup_registry(); return ret; }
int main() { int err; TestSuite *suite = create_test_suite(); add_test_with_context(suite, eclGetContextInteractively, runs); add_test_with_context(suite, eclGetContextInteractively, returnsAContextIfNoErrorOccured); add_test_with_context(suite, eclGetContextInteractively, returnsAValidContext); add_test_with_context(suite, eclGetContextInteractively, returnsADeviceIfNoErrorOccured); add_test_with_context(suite, eclGetContextInteractively, returnsAValidDevice); add_test_with_context(suite, eclGetContextInteractively, returnsACommandQueueIfNoErrorOccured); add_test_with_context(suite, eclGetContextInteractively, returnsAValidCommandQueue); add_test_with_context(suite, eclGetContextInteractively, commandQueueConsistentWithContext); add_test_with_context(suite, eclGetContextInteractively, commandQueueConsistentWithDevice); add_test_with_context(suite, eclGetContextInteractively, doesntCrashDueToBogusPlatformChoice); add_test_with_context(suite, eclGetContextInteractively, recoversFromBogusPlatformChoice); add_test_with_context(suite, eclGetContextInteractively, doesntCrashDueToBogusDeviceChoice); add_test_with_context(suite, eclGetContextInteractively, recoversFromBogusDeviceChoice); err = run_test_suite(suite, create_text_reporter()); destroy_test_suite(suite); return err; }
int main(int argc, char **argv) { TestSuite *suite = stream_tests(); if (argc > 1) { return run_single_test(suite, argv[1], create_text_reporter()); } return run_test_suite(suite, create_text_reporter()); }
int __cdecl #else int #endif main(int __UNUSED(argc), const char ** __UNUSED(argv[])) { // squelch warnings __UNUSED_ARG(argc); __UNUSED_ARG(argv); return run_test_suite(suite_methods, ARRAY_SIZE(suite_methods)); }
int main(int argc, char **argv) { TestSuite *suite = create_test_suite(); add_suite(suite, density_contrast_tests()); add_suite(suite, cic_tests()); if (argc > 1) { return run_single_test(suite, argv[1], create_text_reporter()); } return run_test_suite(suite, create_text_reporter()); }
/* * Main test case entry */ int main(int argc, char** argv) { TestSuite *suite = create_test_suite(); add_suite(suite, atmi_test_all()); if (argc > 1) { return run_single_test(suite,argv[1],create_text_reporter()); } return run_test_suite(suite, create_text_reporter()); }
int main(int argc, char **argv) { TestSuite *suite = create_test_suite(); add_test(suite, reading_lines_from_empty_stream_gives_null); add_test(suite, one_character_stream_gives_one_character_line); add_test(suite, one_word_stream_gives_one_word_line); add_test(suite, drops_line_ending_from_word_and_stops); add_test(suite, single_line_ending_gives_empty_line); add_test(suite, one_character_is_made_into_a_one_letter_paragraph); add_test(suite, no_line_endings_makes_one_paragraph); add_test(suite, line_endings_generate_separate_paragraphs); add_test(suite, resources_are_paired_with_the_functions); add_test(suite, empty_paragraphs_are_ignored); if (argc > 1) { return run_single_test(suite, argv[1], create_text_reporter()); } return run_test_suite(suite, create_text_reporter()); }
int main(int argc, char **argv) { PetscInitialize(&argc, &argv, NULL, help); TestSuite *suite = create_test_suite(); add_test(suite, first_derivative_of_constant_is_zero); add_test(suite, first_derivative_fourth_order_of_constant_is_zero); add_test(suite, first_derivative_of_linear_function_is_computed_exactly); add_test(suite, first_derivative_fourth_order_of_linear_function_is_computed_exactly); add_test(suite, second_derivative_of_constant_is_zero); add_test(suite, second_derivative_fourth_order_of_constant_is_zero); add_test(suite, second_derivative_of_linear_function_is_zero); add_test(suite, second_derivative_fourth_order_of_linear_function_is_zero); int result = run_test_suite(suite, create_text_reporter()); destroy_test_suite(suite); PetscFinalize(); return result; }
int mediastreamer2_tester_run_tests(const char *suite_name, const char *test_name) { int i; /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); for (i = 0; i < mediastreamer2_tester_nb_test_suites(); i++) { run_test_suite(test_suite[i]); } #if HAVE_CU_GET_SUITE if (suite_name){ CU_pSuite suite; CU_basic_set_mode(CU_BRM_VERBOSE); suite=CU_get_suite(suite_name); if (test_name) { CU_pTest test=CU_get_test_by_name(test_name, suite); CU_basic_run_test(suite, test); } else CU_basic_run_suite(suite); } else #endif { #if HAVE_CU_CURSES if (curses) { /* Run tests using the CUnit curses interface */ CU_curses_run_tests(); } else #endif { /* Run all tests using the CUnit Basic interface */ CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); } } CU_cleanup_registry(); return CU_get_error(); }
int liblinphone_tester_run_tests(const char *suite_name, const char *test_name) { int i; int ret; /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); for (i = 0; i < liblinphone_tester_nb_test_suites(); i++) { run_test_suite(test_suite[i]); } if (suite_name){ CU_pSuite suite; CU_basic_set_mode(CU_BRM_VERBOSE); suite=CU_get_suite_by_name(suite_name, CU_get_registry()); if (test_name) { CU_pTest test=CU_get_test_by_name(test_name, suite); CU_ErrorCode err= CU_basic_run_test(suite, test); if (err != CUE_SUCCESS) ms_error("CU_basic_run_test error %d", err); } else CU_basic_run_suite(suite); } else { #if HAVE_CU_CURSES if (curses) { /* Run tests using the CUnit curses interface */ CU_curses_run_tests(); } else #endif { /* Run all tests using the CUnit Basic interface */ CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); } } ret=CU_get_number_of_tests_failed()!=0; CU_cleanup_registry(); return ret; }
/*----------------------------------------------------------------------*/ static int run_tests(TestReporter *reporter, const char *suite_name, const char *symbolic_name, void *test_library_handle, TestItem test_items[], bool verbose) { int status; ContextSuite *context_suites = NULL; TestSuite *suite = create_named_test_suite(suite_name); const int number_of_matches = add_matching_tests_to_suite(test_library_handle, symbolic_name, test_items, suite, &context_suites); if (error_when_matching(number_of_matches)) return EXIT_FAILURE; if (symbolic_name != NULL && number_of_matches == 1) { bool found = matching_test_exists(symbolic_name, test_items); if (verbose) printf(" to only run one test: '%s' ...\n", symbolic_name); if (!found) { fprintf(stderr, "ERROR: No such test: '%s' in '%s'\n", symbolic_name, suite_name); return EXIT_FAILURE; } status = run_single_test(suite, test_name_of(symbolic_name), reporter); } else { if (verbose) { if (number_of_matches != count(test_items)) printf(" to run %d matching tests ...\n", number_of_matches); else printf(" to run all %d discovered tests ...\n", count(test_items)); } if (number_of_matches > 0) status = run_test_suite(suite, reporter); else { fprintf(stderr, "ERROR: No such test: '%s' in '%s'\n", symbolic_name, suite_name); status = EXIT_FAILURE; } } destroy_test_suite(suite); destroy_context_suites(context_suites); return(status); }
int main(int argc, char **argv) { PetscInitialize(&argc, &argv, NULL, help); TestSuite *suite = create_test_suite(); add_test_with_context(suite, FFT, can_be_constructed_from_DMDA); add_test_with_context(suite, FFT, registers_the_right_DM); add_test_with_context(suite, FFT, creates_output_vector_of_correct_size); add_test_with_context(suite, FFT, transforms_constant_into_delta_function); add_test_with_context(suite, FFT, can_transform_second_component); add_test_with_context(suite, FFT, i_transform_is_inverse_of_transform); add_test_with_context(suite, FFT, PSD_of_delta_function_is_flat); add_test_with_context(suite, FFT, yields_PSD_of_the_correct_size); int result; if (argc > 2) { result = run_single_test(suite, argv[1], create_text_reporter()); } else { result = run_test_suite(suite, create_text_reporter()); } destroy_test_suite(suite); PetscFinalize(); return result; }
int main(int argc, char **argv) { PetscInitialize(&argc, &argv, NULL, help); TestSuite *suite = create_test_suite(); add_test_with_context(suite, FourthOrderJacobian, can_be_built); add_test_with_context(suite, FourthOrderJacobian, is_consistent_for_constant_fields); add_test_with_context(suite, FourthOrderJacobian, is_consistent_for_sine_waves); add_test_with_context(suite, FourthOrderJacobian, is_consistent_for_gaussian); add_test_with_context(suite, FourthOrderJacobian, is_consistent_for_constant_right_moving); add_test_with_context(suite, FourthOrderJacobian, is_consistent_for_sine_wave_right_moving); add_test_with_context(suite, FourthOrderJacobian, is_consistent_for_gaussian_right_moving); /* Disable this test for now, need the right Chi3 physics add_test(suite, prec_consistent_sine_wave_non_zero_gamma); */ int result; if (argc > 2) { result = run_single_test(suite, argv[1], create_text_reporter()); } else { result = run_test_suite(suite, create_text_reporter()); } destroy_test_suite(suite); PetscFinalize(); return result; }
int liblinphone_tester_run_tests(const char *suite_name, const char *test_name) { int i; int ret; /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); for (i = 0; i < liblinphone_tester_nb_test_suites(); i++) { run_test_suite(test_suite[i]); } CU_set_test_start_handler(test_start_message_handler); CU_set_test_complete_handler(test_complete_message_handler); CU_set_all_test_complete_handler(test_all_tests_complete_message_handler); CU_set_suite_init_failure_handler(test_suite_init_failure_message_handler); CU_set_suite_cleanup_failure_handler(test_suite_cleanup_failure_message_handler); CU_set_suite_start_handler(test_suite_start_message_handler); if( liblinphone_tester_xml_file != NULL ){ CU_set_output_filename(liblinphone_tester_xml_file); } if( liblinphone_tester_xml_enabled != 0 ){ CU_automated_run_tests(); } else { #if !HAVE_CU_GET_SUITE if( suite_name ){ ms_warning("Tester compiled without CU_get_suite() function, running all tests instead of suite '%s'\n", suite_name); } #else if (suite_name){ CU_pSuite suite; suite=CU_get_suite(suite_name); if (!suite) { ms_error("Could not find suite '%s'. Available suites are:", suite_name); liblinphone_tester_list_suites(); return -1; } else if (test_name) { CU_pTest test=CU_get_test_by_name(test_name, suite); if (!test) { ms_error("Could not find test '%s' in suite '%s'. Available tests are:", test_name, suite_name); // do not use suite_name here, since this method is case sensitive liblinphone_tester_list_suite_tests(suite->pName); return -2; } else { CU_ErrorCode err= CU_run_test(suite, test); if (err != CUE_SUCCESS) ms_error("CU_basic_run_test error %d", err); } } else { CU_run_suite(suite); } } else #endif { #if HAVE_CU_CURSES if (curses) { /* Run tests using the CUnit curses interface */ CU_curses_run_tests(); } else #endif { /* Run all tests using the CUnit Basic interface */ CU_run_all_tests(); } } } ret=CU_get_number_of_tests_failed()!=0; /* Redisplay list of failed tests on end */ if (CU_get_number_of_failure_records()){ CU_basic_show_failures(CU_get_failure_list()); liblinphone_tester_fprintf(stdout,"\n"); } CU_cleanup_registry(); if( liblinphone_tester_keep_accounts_flag == 0){ liblinphone_tester_clear_accounts(); } return ret; }
int main (int argc, char *argv[]) { run_test_suite(); printf("Finished\n"); return 0; }
int main(int argc, char **argv) { TestSuite *suite = create_config_suite(); return run_test_suite(suite, create_text_reporter()); }
static int run_all_test_suites(/*@notnull@*/ test_runner * runner) /*@globals fileSystem, internalState @*/ /*@modifies fileSystem, internalState, runner, runner->buffer, runner->suite_number, runner->suites->suite, runner->stats @*/ { const char * summary1; const char * summary2; printf("Running all the tests...\n\n"); for(runner->suite_number = 0; runner->suite_number < runner->suites->count; runner->suite_number++){ /*@-boundsread@*/ test_suite * suite = runner->suites->suite[runner->suite_number]; /*@=boundsread@*/ run_test_suite(runner, suite); if(!suite->is_requirement){ switch(suite->status){ case STATUS_PASSED: runner->stats.suites.passed++; /*@switchbreak@*/ break; case STATUS_WARNING: runner->stats.suites.warnings++; /*@switchbreak@*/ break; default: /* STATUS_FAILED */ runner->stats.suites.failed++; } runner->stats.tests.passed += suite->stats.passed; runner->stats.tests.warnings += suite->stats.warnings; runner->stats.tests.failed += suite->stats.failed; } } calculate_total(&runner->stats.requirements); calculate_total(&runner->stats.tests); calculate_total(&runner->stats.suites); /* delete temporary files */ (void)remove(runner->out); (void)remove(runner->err); if(runner->report != NULL){ printf("\n\nGenerating report...\n"); generate_report(runner); printf("\tTest report created.\n"); open_report(runner); } if(runner->stats.suites.failed > 0){ summary1 = "Some of the tests failed."; }else if(runner->stats.suites.warnings > 0){ summary1 = "Some *non-critical* test didn't pass."; }else{ summary1 = "All tests passed successfully."; } if(runner->stats.suites.failed == 0 && runner->stats.suites.warnings == 0){ summary2 = ""; }else if(runner->stats.requirements.total == 0){ summary2 = "\n\tPlease verify platform requirements."; }else if(runner->stats.requirements.failed > 0 || runner->stats.requirements.warnings > 0){ summary2 = "\n\tIt could be related to some error on **platform requirements**."; }else{ summary2 = "\n\tPlease report it at: http://code.google.com/p/exceptions4c/"; } printf("\n%s%s\n\n", summary1, summary2); return(EXIT_SUCCESS); }
int main(int argc, char **argv) { return run_test_suite(our_tests(), create_text_reporter()); }
/* main */ int main(int argc, char *argv[]) { printf("TESTING STARTING"); return run_test_suite(); }
int main(int argc, char **argv) { TestSuite *suite = create_test_suite(); add_test_with_context(suite, CrashExample, seg_faults_for_null_dereference); add_test_with_context(suite, CrashExample, will_loop_forever); return run_test_suite(suite, create_text_reporter()); }
int test_ptrs_cli(int argc, char **argv) { return run_test_suite(ptrs_test); }
int test_type_base_memory_manager_cli(int argc, char **argv) { return run_test_suite(type_base_memory_manager_test); }
/* main */ int main(int argc, char *argv[]) { return run_test_suite(); }
int test_type_base_type_cli(int argc, char **argv) { return run_test_suite(type_base_type_test); }
int test_bnf_cli(int argc, char **argv) { return run_test_suite(bnf_test); }
int test_unicode_cli(int argc, char **argv) { return run_test_suite(unicode_test); }
int run() { return (run_test_suite(&g_main_test_suite)); }
int test_ansi_c_ast_base_cli(int argc, char **argv) { return run_test_suite(ansi_c_ast_base_test); }