END_TEST /* Armado de la test suite */ Suite *network_suite(void){ Suite *s = suite_create("network"); TCase *tc_preconditions = tcase_create("Precondition"); TCase *tc_creation = tcase_create("Creation"); TCase *tc_functionality = tcase_create("Functionality"); /* Precondiciones */ tcase_add_test_raise_signal(tc_preconditions, test_network_destroy_null, SIGABRT); tcase_add_test_raise_signal(tc_preconditions, test_network_add_edge_null, SIGABRT); tcase_add_test_raise_signal(tc_preconditions, test_network_add_edge_null_2, SIGABRT); tcase_add_test_raise_signal(tc_preconditions, test_network_get_edge_null, SIGABRT); tcase_add_test_raise_signal(tc_preconditions, test_network_neighbours_null, SIGABRT); suite_add_tcase(s, tc_preconditions); /* Creation */ tcase_add_test(tc_creation, test_network_new_destroy); suite_add_tcase(s, tc_creation); /* Funcionalidad */ tcase_add_test(tc_functionality, test_network_get_edges); tcase_add_test(tc_functionality, test_network_nodes); tcase_add_test(tc_functionality, test_network_get_neightbours); suite_add_tcase(s, tc_functionality); return s; }
END_TEST /* ** ============ ** SETUP ** ============ */ Suite *token_suite() { Suite *s; TCase *tc_assertions; TCase *tc_core; s = suite_create("Token"); tc_assertions = tcase_create("Assertions"); tcase_add_test_raise_signal(tc_assertions, test_token_new_null_ptr, SIGABRT); tcase_add_test_raise_signal(tc_assertions, test_token_free_null_ptr, SIGABRT); tc_core = tcase_create("Core"); tcase_add_test(tc_core, test_token_new_malloc_fail); tcase_add_test(tc_core, test_token_new); suite_add_tcase(s, tc_assertions); suite_add_tcase(s, tc_core); return (s); }
END_TEST /* Now build the individual tests into a test suite */ Suite* cci_get_devices_suite(void) { Suite *s = NULL; TCase *tc = NULL; s = suite_create ("cci_get_devices"); if(s == NULL) { perror("suite_create(cci_get_devices)"); return NULL; } tc = tcase_create("get_devices_case"); if(tc == NULL) { perror("tcase_create(get_devices_case)"); return NULL; } tcase_add_test(tc, get_devices_correct); tcase_add_test_raise_signal(tc, get_devices_null, SIGSEGV); suite_add_tcase(s, tc); return s; }
END_TEST /* Now build the individual tests into a test suite */ Suite* cci_create_endpoint_suite(void) { Suite *s = NULL; TCase *tc = NULL; s = suite_create ("cci_create_endpoint"); if(s == NULL) { perror("suite_create(cci_create_endpoint)"); return NULL; } tc = tcase_create("create_endpoint_case"); if(tc == NULL) { perror("tcase_create(create_endpoint_case)"); return NULL; } tcase_add_test(tc, create_endpoint_correct); tcase_add_test(tc, create_endpoint_nonzero_flag); tcase_add_test_raise_signal(tc, create_endpoint_null_endpoint, SIGSEGV); tcase_add_test(tc, create_endpoint_null_fd); tcase_add_test(tc, create_endpoint_null_device); tcase_add_test(tc, create_endpoint_all_devices); tcase_add_test(tc, create_endpoint_loop); suite_add_tcase(s, tc); return s; }
END_TEST Suite *tests_get_response_suite(void) { Suite *suite; TCase *testcase; suite = suite_create("response"); testcase = tcase_create("base"); tcase_add_checked_fixture(testcase, set_up, tear_down); tcase_add_test(testcase, response_pool_get_test); tcase_add_test(testcase, response_pool_set_test); tcase_add_test(testcase, response_add_test); tcase_add_test(testcase, response_add_err_test); tcase_add_test(testcase, response_get_last_test); /* We expect this test to fail due to a segfault; see Bug#3711. */ tcase_add_test_raise_signal(testcase, response_pool_bug3711_test, SIGSEGV); suite_add_tcase(suite, testcase); return suite; }
END_TEST /*----------------------------------------------------------------------- * Testing harness */ Suite * test_suite() { Suite *s = suite_create("mempool"); TCase *tc_mempool = tcase_create("mempool"); tcase_add_test(tc_mempool, test_mempool_01); #if NDEBUG /* If we're not compiling assertions then this test won't abort */ tcase_add_test(tc_mempool, test_mempool_fail_01); #else tcase_add_test_raise_signal(tc_mempool, test_mempool_fail_01, SIGABRT); #endif tcase_add_test(tc_mempool, test_mempool_reuse_01); suite_add_tcase(s, tc_mempool); return s; }
END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_create = tcase_create ("create"); suite_add_tcase (s, tc_create); tcase_add_test (tc_create, test_create_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_create, test_create_fail_001, SIGABRT); #endif TCase* tc_destroy = tcase_create ("destroy"); suite_add_tcase (s, tc_destroy); tcase_add_test (tc_destroy, test_destroy_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_destroy, test_destroy_fail_001, SIGABRT); #endif TCase* tc_check = tcase_create ("check"); suite_add_tcase (s, tc_check); tcase_add_test (tc_check, test_check_pass_001); tcase_add_test (tc_check, test_check_pass_002); tcase_add_test (tc_check, test_check_pass_003); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_check, test_check_fail_001, SIGABRT); #endif TCase* tc_check2 = tcase_create ("check2"); suite_add_tcase (s, tc_check2); tcase_add_test (tc_check2, test_check2_pass_001); tcase_add_test (tc_check2, test_check2_pass_002); tcase_add_test (tc_check2, test_check2_pass_003); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_check2, test_check2_fail_001, SIGABRT); #endif return s; }
END_TEST Suite *test_suite(void) { Suite *s = suite_create("Metro-static"); TCase *tc_static = tcase_create("Static Functions"); tcase_add_checked_fixture(tc_static, setup_meter, teardown_meter); tcase_add_test_raise_signal(tc_static, test__tap_cb__0, SIGABRT); suite_add_tcase(s, tc_static); return s; }
END_TEST Suite *token_parser_dlredir_suite() { Suite *s; TCase *tc_assertions; TCase *tc_core; s = suite_create("Token parser dlredir"); tc_assertions = tcase_create("Assertions"); tcase_add_test_raise_signal(tc_assertions, test_dlredir_null_string, SIGABRT); tcase_add_test_raise_signal(tc_assertions, test_dlredir_null_token, SIGABRT); tc_core = tcase_create("Core"); tcase_add_test(tc_core, test_dlredir); suite_add_tcase(s, tc_core); suite_add_tcase(s, tc_assertions); return (s); }
END_TEST Suite *tests_get_response_suite(void) { Suite *suite; TCase *testcase; int bug3711_signo = 0; suite = suite_create("response"); testcase = tcase_create("base"); tcase_add_checked_fixture(testcase, set_up, tear_down); tcase_add_test(testcase, response_pool_get_test); tcase_add_test(testcase, response_pool_set_test); tcase_add_test(testcase, response_add_test); tcase_add_test(testcase, response_add_err_test); tcase_add_test(testcase, response_get_last_test); /* We expect this test to fail due to a segfault; see Bug#3711. * * Note that on some platforms (e.g. Darwin), the test case should fail * with a SIGBUS rather than SIGSEGV, hence the conditional here. */ #if defined(DARWIN9) bug3711_signo = SIGBUS; #else bug3711_signo = SIGSEGV; #endif /* Disable this test for now; it's a reproduction recipe rather than * a regression test, and only generates core files which can litter * the filesystems of build/test machines needlessly. */ #if 0 tcase_add_test_raise_signal(testcase, response_pool_bug3711_test, bug3711_signo); #endif suite_add_tcase(suite, testcase); return suite; }
static Suite * gst_object_suite (void) { Suite *s = suite_create ("GstObject"); TCase *tc_chain = tcase_create ("general"); /* turn off timeout */ tcase_set_timeout (tc_chain, 60); suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_fake_object_new); tcase_add_test (tc_chain, test_fake_object_name); #if 0 tcase_add_test (tc_chain, test_fake_object_name_threaded_wrong); #endif tcase_add_test (tc_chain, test_fake_object_name_threaded_right); tcase_add_test (tc_chain, test_fake_object_name_threaded_unique); tcase_add_test (tc_chain, test_fake_object_parentage); tcase_add_test (tc_chain, test_fake_object_parentage_dispose); tcase_add_test (tc_chain, test_fake_object_has_ancestor); //tcase_add_checked_fixture (tc_chain, setup, teardown); /* FIXME: GLib shouldn't crash here, but issue a warning and return a NULL * object, or at least g_error() and then abort properly ... (tpm) */ #ifndef HAVE_OSX /* Disabled for OS/X because a) it's a pretty silly test anyway and * b) different OS/X versions raise different signals and it isn't worth * the effort to try and detect which one should be producing which */ /* SEGV tests go last so we can debug the others */ tcase_add_test_raise_signal (tc_chain, test_fail_abstract_new, SIGSEGV); #endif return s; }
Suite * platform_sync_suite (void) { TCase *tc_sem = NULL; Suite *s = suite_create ("Synchronization"); /* synch APIs test case */ tc_sem = tcase_create ("synchronization"); tcase_add_test (tc_sem, test_sem_init_and_destroy); tcase_add_test (tc_sem, test_sem_post_and_wait); tcase_add_test_raise_signal (tc_sem, test_sem_init_null, SIGABRT); tcase_add_test (tc_sem, test_sem_destroy_null); tcase_add_test_raise_signal (tc_sem, test_sem_wait_null, SIGABRT); tcase_add_test_raise_signal (tc_sem, test_sem_post_null, SIGABRT); tcase_add_test (tc_sem, test_mutex_init_and_destroy); tcase_add_test (tc_sem, test_mutex_lock_and_unlock); tcase_add_test_raise_signal (tc_sem, test_mutex_init_null, SIGABRT); tcase_add_test (tc_sem, test_mutex_destroy_null); tcase_add_test_raise_signal (tc_sem, test_mutex_lock_null, SIGABRT); tcase_add_test_raise_signal (tc_sem, test_mutex_unlock_null, SIGABRT); suite_add_tcase (s, tc_sem); return s; }
END_TEST /**** And the suites are set up here ****/ void lwc_basic_suite(SRunner *sr) { Suite *s = suite_create("libwapcaplet: Basic tests"); TCase *tc_basic = tcase_create("Creation/Destruction"); #ifndef NDEBUG tcase_add_test_raise_signal(tc_basic, test_lwc_intern_string_aborts1, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_intern_string_aborts2, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_intern_substring_aborts1, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_intern_substring_aborts2, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_string_ref_aborts, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_string_unref_aborts, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_string_data_aborts, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_string_length_aborts, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_string_hash_value_aborts, SIGABRT); #endif suite_add_tcase(s, tc_basic); tc_basic = tcase_create("Ops with a context"); tcase_add_checked_fixture(tc_basic, with_simple_context_setup, with_simple_context_teardown); tcase_add_test(tc_basic, test_lwc_intern_string_ok); tcase_add_test(tc_basic, test_lwc_intern_string_twice_ok); tcase_add_test(tc_basic, test_lwc_intern_string_twice_same_ok); suite_add_tcase(s, tc_basic); tc_basic = tcase_create("Ops with a filled context"); tcase_add_checked_fixture(tc_basic, with_filled_context_setup, with_filled_context_teardown); tcase_add_test(tc_basic, test_lwc_interning_works); tcase_add_test(tc_basic, test_lwc_intern_substring); tcase_add_test(tc_basic, test_lwc_string_ref_ok); tcase_add_test(tc_basic, test_lwc_string_ref_unref_ok); tcase_add_test(tc_basic, test_lwc_string_unref_ok); tcase_add_test(tc_basic, test_lwc_string_isequal_ok); tcase_add_test(tc_basic, test_lwc_string_caseless_isequal_ok1); tcase_add_test(tc_basic, test_lwc_string_caseless_isequal_ok2); tcase_add_test(tc_basic, test_lwc_string_caseless_isequal_bad); tcase_add_test(tc_basic, test_lwc_extract_data_ok); tcase_add_test(tc_basic, test_lwc_string_hash_value_ok); tcase_add_test(tc_basic, test_lwc_string_is_nul_terminated); tcase_add_test(tc_basic, test_lwc_substring_is_nul_terminated); tcase_add_test(tc_basic, test_lwc_intern_substring_bad_size); tcase_add_test(tc_basic, test_lwc_intern_substring_bad_offset); tcase_add_test(tc_basic, test_lwc_string_iteration); suite_add_tcase(s, tc_basic); srunner_add_suite(sr, s); }
END_TEST Suite * array_utils_suite(void) { Suite * s = suite_create("array_utils"); TCase * tc_d_array = tcase_create("d_array_test_case"); tcase_add_test(tc_d_array, test_init_free_d_array); tcase_add_test_raise_signal(tc_d_array, test_init_d_array_fail, SIGABRT); tcase_add_test(tc_d_array, test_expand_d_array); tcase_add_test(tc_d_array, test_append_d_array); tcase_add_test(tc_d_array, test_set_d_array); tcase_add_test_raise_signal(tc_d_array, test_set_d_array_fail, SIGABRT); tcase_add_test(tc_d_array, test_get_d_array); tcase_add_test_raise_signal(tc_d_array, test_get_d_array_fail, SIGABRT); suite_add_tcase(s, tc_d_array); TCase * tc_i_array = tcase_create("i_array_test_case"); tcase_add_test(tc_i_array, test_init_free_i_array); tcase_add_test_raise_signal(tc_i_array, test_init_i_array_fail, SIGABRT); tcase_add_test(tc_i_array, test_expand_i_array); tcase_add_test(tc_i_array, test_append_i_array); tcase_add_test(tc_i_array, test_set_i_array); tcase_add_test_raise_signal(tc_i_array, test_set_i_array_fail, SIGABRT); tcase_add_test(tc_i_array, test_get_i_array); tcase_add_test_raise_signal(tc_i_array, test_get_i_array_fail, SIGABRT); suite_add_tcase(s, tc_i_array); TCase * tc_c_array = tcase_create("c_array_test_case"); tcase_add_test(tc_c_array, test_init_free_c_array); tcase_add_test_raise_signal(tc_c_array, test_init_c_array_fail, SIGABRT); tcase_add_test(tc_c_array, test_expand_c_array); tcase_add_test(tc_c_array, test_assign_c_array); tcase_add_test(tc_c_array, test_get_c_array); suite_add_tcase(s, tc_c_array); TCase * tc_s_array = tcase_create("s_array_test_case"); tcase_add_test(tc_s_array, test_init_free_s_array); tcase_add_test_raise_signal(tc_s_array, test_init_s_array_fail, SIGABRT); tcase_add_test(tc_s_array, test_expand_s_array); tcase_add_test(tc_s_array, test_append_s_array); tcase_add_test(tc_s_array, test_set_s_array); tcase_add_test_raise_signal(tc_s_array, test_set_s_array_fail, SIGABRT); tcase_add_test(tc_s_array, test_get_s_array); tcase_add_test_raise_signal(tc_s_array, test_get_s_array_fail, SIGABRT); suite_add_tcase(s, tc_s_array); TCase * tc_i_array_2d = tcase_create("i_array_2d_test_case"); tcase_add_test(tc_i_array_2d, test_init_free_i_array_2d); tcase_add_test_raise_signal(tc_i_array_2d, test_init_i_array_2d_fail, SIGABRT); tcase_add_test(tc_i_array_2d, test_expand_i_array_2d); tcase_add_test(tc_i_array_2d, test_append_i_array_2d); tcase_add_test(tc_i_array_2d, test_append_el_i_array_2d); tcase_add_test(tc_i_array_2d, test_set_i_array_2d); tcase_add_test(tc_i_array_2d, test_set_el_i_array_2d); tcase_add_test_raise_signal(tc_i_array_2d, test_set_i_array_2d_fail, SIGABRT); tcase_add_test(tc_i_array_2d, test_get_i_array_2d); tcase_add_test(tc_i_array_2d, test_get_el_i_array_2d); tcase_add_test_raise_signal(tc_i_array_2d, test_get_i_array_2d_fail, SIGABRT); suite_add_tcase(s, tc_i_array_2d); TCase * tc_arrays_equal = tcase_create("arrays_equal_test_case"); tcase_add_test(tc_arrays_equal, test_s_arrays_equal); tcase_add_test(tc_arrays_equal, test_i_arrays_equal); tcase_add_test(tc_arrays_equal, test_d_arrays_equal); suite_add_tcase(s, tc_arrays_equal); TCase * tc_get_matching_indices = tcase_create( "get_matching_indices_test_case"); tcase_add_test(tc_get_matching_indices, test_get_matching_indices); tcase_add_exit_test(tc_get_matching_indices, test_get_matching_indices_fail, 1); suite_add_tcase(s, tc_get_matching_indices); TCase * tc_get_doubles = tcase_create("get_doubles_test_case"); tcase_add_test(tc_get_doubles, test_get_doubles); suite_add_tcase(s, tc_get_doubles); TCase * tc_split_str = tcase_create("split_str_test_case"); tcase_add_test(tc_split_str, test_split_str); tcase_add_test(tc_split_str, test_split_str_d); tcase_add_test(tc_split_str, test_split_str_i); suite_add_tcase(s, tc_split_str); return s; }
END_TEST ////////////////////////////////////////////////////////////////////// ///////////// Test Suite ////////////////////////////////////////////////////////////////////// Suite* tester_suite() { // Create the test suite: Suite* s = suite_create("Public Assignment Tests"); /**** BEGIN UNIT TESTS ****/ TCase* tc_inc = tcase_create("Public Tests"); // TODO: fill in for p tcase_add_test(tc_inc, test_error_msg_SUCCESS); tcase_add_test(tc_inc, test_error_msg_ERR_UNKNOWN_CMD); tcase_add_test(tc_inc, test_error_msg_ERR_PIPE_READ_ERR); tcase_add_test(tc_inc, test_error_msg_ERR_PIPE_WRITE_ERR); tcase_add_test(tc_inc, test_error_msg_ERR_UNKNOWN_ACCOUNT); tcase_add_test(tc_inc, test_error_msg_ERR_UNKNOWN_ATM); tcase_add_test(tc_inc, test_error_msg_ERR_BAD_TRACE_FILE); tcase_add_test(tc_inc, test_command_ok); tcase_add_test(tc_inc, test_command_nofunds); tcase_add_test(tc_inc, test_command_connect); tcase_add_test(tc_inc, test_command_exit); tcase_add_test(tc_inc, test_command_deposit); tcase_add_test(tc_inc, test_command_withdraw); tcase_add_test(tc_inc, test_command_transfer); tcase_add_test(tc_inc, test_command_balance); tcase_add_test(tc_inc, test_trace_open_bad); tcase_add_test(tc_inc, test_trace_open_good); tcase_add_test(tc_inc, test_trace_atm_count); tcase_add_test(tc_inc, test_trace_account_count); tcase_add_test(tc_inc, test_trace_read_valid_commands); tcase_add_test(tc_inc, test_trace_read_single_cmd); tcase_add_test(tc_inc, test_trace_read_connects); tcase_add_test(tc_inc, test_trace_read_exits); tcase_add_test(tc_inc, test_trace_read_deposits); tcase_add_test(tc_inc, test_trace_read_withdraws); tcase_add_test(tc_inc, test_trace_read_transfers); tcase_add_test(tc_inc, test_trace_read_balances); tcase_add_test(tc_inc, test_atm_invalid_command_status); tcase_add_test(tc_inc, test_atm_invalid_pipe_write); tcase_add_test(tc_inc, test_atm_invalid_pipe_read); tcase_add_test(tc_inc, test_atm_invalid_pipe_write_closed); tcase_add_test_raise_signal(tc_inc, test_atm_invalid_pipe_read_signal, 13); tcase_add_test(tc_inc, test_atm_unknown_atm); tcase_add_test(tc_inc, test_atm_connect_success); tcase_add_test(tc_inc, test_atm_exit_success); tcase_add_test(tc_inc, test_atm_withdraw_success); tcase_add_test(tc_inc, test_atm_transfer_success); tcase_add_test(tc_inc, test_atm_balance_success); tcase_add_test(tc_inc, test_atm_balance_no_funds); tcase_add_test(tc_inc, test_bank_connect); tcase_add_test(tc_inc, test_bank_exit); tcase_add_test(tc_inc, test_bank_deposit); tcase_add_test(tc_inc, test_bank_withdraw); tcase_add_test(tc_inc, test_bank_transfer); tcase_add_test(tc_inc, test_bank_balance); tcase_add_test(tc_inc, test_bank_balance_bad_account); tcase_add_test(tc_inc, test_bank_balance_bad_atm); suite_add_tcase(s, tc_inc); /**** END UNIT TESTS ****/ // Return the suite: return s; }
Suite *make_sub_suite(void) { Suite *s; TCase *tc_simple; TCase *tc_signal; #if TIMEOUT_TESTS_ENABLED #if HAVE_WORKING_SETENV TCase *tc_timeout_env_int; TCase *tc_timeout_env_double; #endif /* HAVE_WORKING_SETENV */ TCase *tc_timeout_default; TCase *tc_timeout_usr_int; TCase *tc_timeout_usr_double; #if HAVE_WORKING_SETENV TCase *tc_timeout_env_scale_int; TCase *tc_timeout_scale_int; TCase *tc_timeout_usr_scale_int; TCase *tc_timeout_env_scale_double; TCase *tc_timeout_scale_double; TCase *tc_timeout_usr_scale_double; #endif /* HAVE_WORKING_SETENV */ #endif TCase *tc_limit; TCase *tc_messaging_and_fork; s = suite_create("Check Servant"); tc_simple = tcase_create("Simple Tests"); tc_signal = tcase_create("Signal Tests"); #if TIMEOUT_TESTS_ENABLED #if HAVE_WORKING_SETENV setenv("CK_DEFAULT_TIMEOUT", "6", 1); tc_timeout_env_int = tcase_create("Environment Integer Timeout Tests"); unsetenv("CK_DEFAULT_TIMEOUT"); setenv("CK_DEFAULT_TIMEOUT", "0.5", 1); tc_timeout_env_double = tcase_create("Environment Double Timeout Tests"); unsetenv("CK_DEFAULT_TIMEOUT"); #endif /* HAVE_WORKING_SETENV */ tc_timeout_default = tcase_create("Default Timeout Tests"); tc_timeout_usr_int = tcase_create("User Integer Timeout Tests"); tc_timeout_usr_double = tcase_create("User Double Timeout Tests"); #if HAVE_WORKING_SETENV setenv("CK_TIMEOUT_MULTIPLIER", "2", 1); tc_timeout_scale_int = tcase_create("Timeout Integer Scaling Tests"); tc_timeout_usr_scale_int = tcase_create("User Integer Timeout Scaling Tests"); setenv("CK_DEFAULT_TIMEOUT", "6", 1); tc_timeout_env_scale_int = tcase_create("Environment Integer Timeout Scaling Tests"); unsetenv("CK_DEFAULT_TIMEOUT"); unsetenv("CK_TIMEOUT_MULTIPLIER"); setenv("CK_TIMEOUT_MULTIPLIER", "0.4", 1); tc_timeout_scale_double = tcase_create("Timeout Double Scaling Tests"); tc_timeout_usr_scale_double = tcase_create("User Double Timeout Scaling Tests"); setenv("CK_DEFAULT_TIMEOUT", "0.9", 1); tc_timeout_env_scale_double = tcase_create("Environment Double Timeout Scaling Tests"); unsetenv("CK_DEFAULT_TIMEOUT"); unsetenv("CK_TIMEOUT_MULTIPLIER"); #endif /* HAVE_WORKING_SETENV */ #endif /* TIMEOUT_TESTS_ENABLED */ tc_limit = tcase_create("Limit Tests"); tc_messaging_and_fork = tcase_create("Msg and fork Tests"); suite_add_tcase (s, tc_simple); suite_add_tcase (s, tc_signal); #if TIMEOUT_TESTS_ENABLED #if HAVE_WORKING_SETENV suite_add_tcase (s, tc_timeout_env_int); suite_add_tcase (s, tc_timeout_env_double); #endif /* HAVE_WORKING_SETENV */ suite_add_tcase (s, tc_timeout_default); suite_add_tcase (s, tc_timeout_usr_int); suite_add_tcase (s, tc_timeout_usr_double); /* Add a second time to make sure tcase_set_timeout doesn't contaminate it. */ suite_add_tcase (s, tc_timeout_default); #if HAVE_WORKING_SETENV suite_add_tcase (s, tc_timeout_env_scale_int); suite_add_tcase (s, tc_timeout_env_scale_double); suite_add_tcase (s, tc_timeout_scale_int); suite_add_tcase (s, tc_timeout_scale_double); suite_add_tcase (s, tc_timeout_usr_scale_int); suite_add_tcase (s, tc_timeout_usr_scale_double); #endif #endif suite_add_tcase (s, tc_limit); suite_add_tcase (s, tc_messaging_and_fork); tcase_add_test (tc_simple, test_lno); tcase_add_test (tc_simple, test_mark_lno); tcase_add_test (tc_simple, test_pass); tcase_add_test (tc_simple, test_fail_unless); tcase_add_test (tc_simple, test_fail_if_pass); tcase_add_test (tc_simple, test_fail_if_fail); tcase_add_test (tc_simple, test_fail_null_msg); #if defined(__GNUC__) tcase_add_test (tc_simple, test_fail_no_msg); #endif /* __GNUC__ */ tcase_add_test (tc_simple, test_fail_if_null_msg); #if defined(__GNUC__) tcase_add_test (tc_simple, test_fail_if_no_msg); #endif /* __GNUC__ */ tcase_add_test (tc_simple, test_fail_vararg_msg_1); tcase_add_test (tc_simple, test_fail_vararg_msg_2); tcase_add_test (tc_simple, test_fail_vararg_msg_3); #if defined(__GNUC__) tcase_add_test (tc_simple, test_fail_empty); #endif /* __GNUC__ */ tcase_add_test (tc_simple, test_ck_abort); tcase_add_test (tc_simple, test_ck_abort_msg); tcase_add_test (tc_simple, test_ck_abort_msg_null); tcase_add_test (tc_simple, test_ck_assert); tcase_add_test (tc_simple, test_ck_assert_null); tcase_add_test (tc_simple, test_ck_assert_int_eq); tcase_add_test (tc_simple, test_ck_assert_int_ne); tcase_add_test (tc_simple, test_ck_assert_int_lt); tcase_add_test (tc_simple, test_ck_assert_int_le); tcase_add_test (tc_simple, test_ck_assert_int_gt); tcase_add_test (tc_simple, test_ck_assert_int_ge); tcase_add_test (tc_simple, test_ck_assert_int_expr); tcase_add_test (tc_simple, test_ck_assert_uint_eq); tcase_add_test (tc_simple, test_ck_assert_uint_ne); tcase_add_test (tc_simple, test_ck_assert_uint_lt); tcase_add_test (tc_simple, test_ck_assert_uint_le); tcase_add_test (tc_simple, test_ck_assert_uint_gt); tcase_add_test (tc_simple, test_ck_assert_uint_ge); tcase_add_test (tc_simple, test_ck_assert_uint_expr); tcase_add_test (tc_simple, test_ck_assert_str_eq); tcase_add_test (tc_simple, test_ck_assert_str_ne); tcase_add_test (tc_simple, test_ck_assert_str_lt); tcase_add_test (tc_simple, test_ck_assert_str_le); tcase_add_test (tc_simple, test_ck_assert_str_gt); tcase_add_test (tc_simple, test_ck_assert_str_ge); tcase_add_test (tc_simple, test_ck_assert_str_expr); tcase_add_test (tc_simple, test_ck_assert_ptr_eq); tcase_add_test (tc_simple, test_ck_assert_ptr_ne); tcase_add_test (tc_signal, test_segv); tcase_add_test_raise_signal (tc_signal, test_segv, 11); /* pass */ tcase_add_test_raise_signal (tc_signal, test_segv, 8); /* error */ tcase_add_test_raise_signal (tc_signal, test_pass, 8); /* fail */ tcase_add_test_raise_signal (tc_signal, test_fail_unless, 8); /* fail */ tcase_add_test (tc_signal, test_fpe); tcase_add_test (tc_signal, test_mark_point); #if TIMEOUT_TESTS_ENABLED #if HAVE_WORKING_SETENV tcase_add_test (tc_timeout_env_int, test_eternal); tcase_add_test (tc_timeout_env_int, test_sleep2); tcase_add_test (tc_timeout_env_int, test_sleep5); tcase_add_test (tc_timeout_env_int, test_sleep9); tcase_add_test (tc_timeout_env_double, test_eternal); #ifdef HAVE_LIBRT tcase_add_test (tc_timeout_env_double, test_sleep0_025); tcase_add_test (tc_timeout_env_double, test_sleep1); #endif /* HAVE_LIBRT */ tcase_add_test (tc_timeout_env_double, test_sleep2); tcase_add_test (tc_timeout_env_double, test_sleep5); tcase_add_test (tc_timeout_env_double, test_sleep9); #endif /* HAVE_WORKING_SETENV */ tcase_add_test (tc_timeout_default, test_eternal); #ifdef HAVE_LIBRT tcase_add_test (tc_timeout_default, test_sleep0_025); tcase_add_test (tc_timeout_default, test_sleep1); #endif /* HAVE_LIBRT */ tcase_add_test (tc_timeout_default, test_sleep2); tcase_add_test (tc_timeout_default, test_sleep5); tcase_add_test (tc_timeout_default, test_sleep9); tcase_set_timeout (tc_timeout_usr_int, 6); tcase_add_test (tc_timeout_usr_int, test_eternal); tcase_add_test (tc_timeout_usr_int, test_sleep2); tcase_add_test (tc_timeout_usr_int, test_sleep5); tcase_add_test (tc_timeout_usr_int, test_sleep9); tcase_set_timeout (tc_timeout_usr_double, 0.5); tcase_add_test (tc_timeout_usr_double, test_eternal); #ifdef HAVE_LIBRT tcase_add_test (tc_timeout_usr_double, test_sleep0_025); tcase_add_test (tc_timeout_usr_double, test_sleep1); #endif /* HAVE_LIBRT */ tcase_add_test (tc_timeout_usr_double, test_sleep2); tcase_add_test (tc_timeout_usr_double, test_sleep5); tcase_add_test (tc_timeout_usr_double, test_sleep9); #if HAVE_WORKING_SETENV tcase_add_test (tc_timeout_env_scale_int, test_eternal); #ifdef HAVE_LIBRT tcase_add_test (tc_timeout_env_scale_int, test_sleep0_025); tcase_add_test (tc_timeout_env_scale_int, test_sleep1); #endif /* HAVE_LIBRT */ tcase_add_test (tc_timeout_env_scale_int, test_sleep2); tcase_add_test (tc_timeout_env_scale_int, test_sleep5); tcase_add_test (tc_timeout_env_scale_int, test_sleep9); tcase_add_test (tc_timeout_env_scale_int, test_sleep14); tcase_add_test (tc_timeout_env_scale_double, test_eternal); #ifdef HAVE_LIBRT tcase_add_test (tc_timeout_env_scale_double, test_sleep0_025); tcase_add_test (tc_timeout_env_scale_double, test_sleep1); #endif /* HAVE_LIBRT */ tcase_add_test (tc_timeout_env_scale_double, test_sleep2); tcase_add_test (tc_timeout_env_scale_double, test_sleep5); tcase_add_test (tc_timeout_env_scale_double, test_sleep9); tcase_add_test (tc_timeout_env_scale_double, test_sleep14); tcase_add_test (tc_timeout_scale_int, test_eternal); #ifdef HAVE_LIBRT tcase_add_test (tc_timeout_scale_int, test_sleep0_025); tcase_add_test (tc_timeout_scale_int, test_sleep1); tcase_add_test (tc_timeout_scale_int, test_sleep2); #endif /* HAVE_LIBRT */ tcase_add_test (tc_timeout_scale_int, test_sleep5); tcase_add_test (tc_timeout_scale_int, test_sleep9); tcase_add_test (tc_timeout_scale_double, test_eternal); #ifdef HAVE_LIBRT tcase_add_test (tc_timeout_scale_double, test_sleep0_025); tcase_add_test (tc_timeout_scale_double, test_sleep1); #endif /* HAVE_LIBRT */ tcase_add_test (tc_timeout_scale_double, test_sleep2); tcase_add_test (tc_timeout_scale_double, test_sleep5); tcase_add_test (tc_timeout_scale_double, test_sleep9); setenv("CK_TIMEOUT_MULTIPLIER", "2", 1); tcase_set_timeout (tc_timeout_usr_scale_int, 6); unsetenv("CK_TIMEOUT_MULTIPLIER"); tcase_add_test (tc_timeout_usr_scale_int, test_eternal); #ifdef HAVE_LIBRT tcase_add_test (tc_timeout_usr_scale_int, test_sleep0_025); tcase_add_test (tc_timeout_usr_scale_int, test_sleep1); #endif /* HAVE_LIBRT */ tcase_add_test (tc_timeout_usr_scale_int, test_sleep2); tcase_add_test (tc_timeout_usr_scale_int, test_sleep5); tcase_add_test (tc_timeout_usr_scale_int, test_sleep9); tcase_add_test (tc_timeout_usr_scale_int, test_sleep14); setenv("CK_TIMEOUT_MULTIPLIER", "0.4", 1); tcase_set_timeout (tc_timeout_usr_scale_double, 0.9); unsetenv("CK_TIMEOUT_MULTIPLIER"); tcase_add_test (tc_timeout_usr_scale_double, test_eternal); #ifdef HAVE_LIBRT tcase_add_test (tc_timeout_usr_scale_double, test_sleep0_025); tcase_add_test (tc_timeout_usr_scale_double, test_sleep1); #endif /* HAVE_LIBRT */ tcase_add_test (tc_timeout_usr_scale_double, test_sleep2); tcase_add_test (tc_timeout_usr_scale_double, test_sleep5); tcase_add_test (tc_timeout_usr_scale_double, test_sleep9); tcase_add_test (tc_timeout_usr_scale_double, test_sleep14); #endif #endif tcase_add_test (tc_limit, test_early_exit); tcase_add_test (tc_limit, test_null); tcase_add_test (tc_limit, test_null_2); #ifdef _POSIX_VERSION tcase_add_test (tc_messaging_and_fork, test_fork1p_pass); tcase_add_test (tc_messaging_and_fork, test_fork1p_fail); tcase_add_test (tc_messaging_and_fork, test_fork1c_pass); tcase_add_test (tc_messaging_and_fork, test_fork1c_fail); tcase_add_test (tc_messaging_and_fork, test_fork2_pass); tcase_add_test (tc_messaging_and_fork, test_fork2_fail); #endif /* _POSIX_VERSION */ return s; }
END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_parse_raw = tcase_create ("parse-raw"); suite_add_tcase (s, tc_parse_raw); tcase_add_test (tc_parse_raw, test_parse_raw_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_parse_raw, test_parse_raw_fail_001, SIGABRT); #endif TCase* tc_parse_udp_encap = tcase_create ("parse-udp-encap"); suite_add_tcase (s, tc_parse_udp_encap); tcase_add_test (tc_parse_udp_encap, test_parse_udp_encap_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_parse_udp_encap, test_parse_udp_encap_fail_001, SIGABRT); #endif TCase* tc_verify_spm = tcase_create ("verify-spm"); suite_add_tcase (s, tc_verify_spm); tcase_add_test (tc_verify_spm, test_verify_spm_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_verify_spm, test_verify_spm_fail_001, SIGABRT); #endif TCase* tc_verify_spmr = tcase_create ("verify-spmr"); suite_add_tcase (s, tc_verify_spmr); tcase_add_test (tc_verify_spmr, test_verify_spmr_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_verify_spmr, test_verify_spmr_fail_001, SIGABRT); #endif TCase* tc_verify_nak = tcase_create ("verify-nak"); suite_add_tcase (s, tc_verify_nak); tcase_add_test (tc_verify_nak, test_verify_nak_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_verify_nak, test_verify_nak_fail_001, SIGABRT); #endif TCase* tc_verify_nnak = tcase_create ("verify-nnak"); suite_add_tcase (s, tc_verify_nnak); tcase_add_test (tc_verify_nnak, test_verify_nnak_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_verify_nnak, test_verify_nnak_fail_001, SIGABRT); #endif TCase* tc_verify_ncf = tcase_create ("verify-ncf"); suite_add_tcase (s, tc_verify_ncf); tcase_add_test (tc_verify_ncf, test_verify_ncf_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_verify_ncf, test_verify_ncf_fail_001, SIGABRT); #endif return s; }
END_TEST static Suite * litest_assert_macros_suite(void) { TCase *tc; Suite *s; s = suite_create("litest:assert macros"); tc = tcase_create("assert"); tcase_add_test_raise_signal(tc, litest_assert_trigger, SIGABRT); tcase_add_test(tc, litest_assert_notrigger); tcase_add_test_raise_signal(tc, litest_assert_msg_trigger, SIGABRT); tcase_add_test_raise_signal(tc, litest_assert_msg_NULL_trigger, SIGABRT); tcase_add_test(tc, litest_assert_msg_notrigger); suite_add_tcase(s, tc); tc = tcase_create("abort"); tcase_add_test_raise_signal(tc, litest_abort_msg_trigger, SIGABRT); tcase_add_test_raise_signal(tc, litest_abort_msg_NULL_trigger, SIGABRT); suite_add_tcase(s, tc); tc = tcase_create("int comparison "); tcase_add_test_raise_signal(tc, litest_int_eq_trigger, SIGABRT); tcase_add_test(tc, litest_int_eq_notrigger); tcase_add_test_raise_signal(tc, litest_int_ne_trigger, SIGABRT); tcase_add_test(tc, litest_int_ne_notrigger); tcase_add_test_raise_signal(tc, litest_int_le_trigger, SIGABRT); tcase_add_test(tc, litest_int_le_notrigger); tcase_add_test_raise_signal(tc, litest_int_lt_trigger_gt, SIGABRT); tcase_add_test_raise_signal(tc, litest_int_lt_trigger_eq, SIGABRT); tcase_add_test(tc, litest_int_lt_notrigger); tcase_add_test_raise_signal(tc, litest_int_ge_trigger, SIGABRT); tcase_add_test(tc, litest_int_ge_notrigger); tcase_add_test_raise_signal(tc, litest_int_gt_trigger_eq, SIGABRT); tcase_add_test_raise_signal(tc, litest_int_gt_trigger_lt, SIGABRT); tcase_add_test(tc, litest_int_gt_notrigger); suite_add_tcase(s, tc); tc = tcase_create("pointer comparison "); tcase_add_test_raise_signal(tc, litest_ptr_eq_trigger, SIGABRT); tcase_add_test_raise_signal(tc, litest_ptr_eq_trigger_NULL, SIGABRT); tcase_add_test_raise_signal(tc, litest_ptr_eq_trigger_NULL2, SIGABRT); tcase_add_test(tc, litest_ptr_eq_notrigger); tcase_add_test_raise_signal(tc, litest_ptr_ne_trigger, SIGABRT); tcase_add_test_raise_signal(tc, litest_ptr_ne_trigger_NULL, SIGABRT); tcase_add_test_raise_signal(tc, litest_ptr_ne_trigger_NULL2, SIGABRT); tcase_add_test(tc, litest_ptr_ne_notrigger); tcase_add_test_raise_signal(tc, litest_ptr_null_trigger, SIGABRT); tcase_add_test(tc, litest_ptr_null_notrigger); tcase_add_test_raise_signal(tc, litest_ptr_notnull_trigger, SIGABRT); tcase_add_test_raise_signal(tc, litest_ptr_notnull_trigger_NULL, SIGABRT); tcase_add_test(tc, litest_ptr_notnull_notrigger); suite_add_tcase(s, tc); tc = tcase_create("double comparison "); tcase_add_test(tc, ck_double_eq_and_ne); tcase_add_test(tc, ck_double_lt_gt); tcase_add_exit_test(tc, ck_double_eq_fails, 1); tcase_add_exit_test(tc, ck_double_ne_fails, 1); tcase_add_exit_test(tc, ck_double_lt_fails, 1); tcase_add_exit_test(tc, ck_double_gt_fails, 1); tcase_add_exit_test(tc, ck_double_le_fails, 1); tcase_add_exit_test(tc, ck_double_ge_fails, 1); suite_add_tcase(s, tc); return s; }
END_TEST Suite * partition_combinatorics_suite(void) { Suite * s = suite_create("partition_combinatorics"); TCase * tc_partition_counts = tcase_create("partition_count"); tcase_add_test_raise_signal(tc_partition_counts, test_cumulative_number_of_int_partitions_by_k_n0, SIGABRT); tcase_add_test(tc_partition_counts, test_cumulative_number_of_int_partitions_by_k_n1); tcase_add_test(tc_partition_counts, test_cumulative_number_of_int_partitions_by_k_n2); tcase_add_test(tc_partition_counts, test_cumulative_number_of_int_partitions_by_k_n3); tcase_add_test(tc_partition_counts, test_cumulative_number_of_int_partitions_by_k_n4); tcase_add_test(tc_partition_counts, test_cumulative_number_of_int_partitions_by_k_n7); tcase_add_test_raise_signal(tc_partition_counts, test_number_of_int_partitions_by_k_n0, SIGABRT); tcase_add_test(tc_partition_counts, test_number_of_int_partitions_by_k_n1); tcase_add_test(tc_partition_counts, test_number_of_int_partitions_by_k_n2); tcase_add_test(tc_partition_counts, test_number_of_int_partitions_by_k_n3); tcase_add_test(tc_partition_counts, test_number_of_int_partitions_by_k_n4); tcase_add_test(tc_partition_counts, test_number_of_int_partitions_by_k_n7); suite_add_tcase(s, tc_partition_counts); TCase * tc_partition_freqs = tcase_create("partition_freq"); tcase_add_test_raise_signal(tc_partition_freqs, test_cumulative_frequency_of_int_partitions_by_k_n0, SIGABRT); tcase_add_test(tc_partition_freqs, test_cumulative_frequency_of_int_partitions_by_k_n1); tcase_add_test(tc_partition_freqs, test_cumulative_frequency_of_int_partitions_by_k_n2); tcase_add_test(tc_partition_freqs, test_cumulative_frequency_of_int_partitions_by_k_n3); tcase_add_test(tc_partition_freqs, test_cumulative_frequency_of_int_partitions_by_k_n4); tcase_add_test(tc_partition_freqs, test_cumulative_frequency_of_int_partitions_by_k_n7); tcase_add_test_raise_signal(tc_partition_freqs, test_frequency_of_int_partitions_by_k_n0, SIGABRT); tcase_add_test(tc_partition_freqs, test_frequency_of_int_partitions_by_k_n1); tcase_add_test(tc_partition_freqs, test_frequency_of_int_partitions_by_k_n2); tcase_add_test(tc_partition_freqs, test_frequency_of_int_partitions_by_k_n3); tcase_add_test(tc_partition_freqs, test_frequency_of_int_partitions_by_k_n4); tcase_add_test(tc_partition_freqs, test_frequency_of_int_partitions_by_k_n7); suite_add_tcase(s, tc_partition_freqs); TCase * tc_num_partitions = tcase_create("number_of_partitions"); tcase_add_test(tc_num_partitions, test_number_of_int_partitions_neg); tcase_add_test(tc_num_partitions, test_number_of_int_partitions_n0); tcase_add_test(tc_num_partitions, test_number_of_int_partitions_n1); tcase_add_test(tc_num_partitions, test_number_of_int_partitions_n7); tcase_add_test(tc_num_partitions, test_number_of_int_partitions_n22); suite_add_tcase(s, tc_num_partitions); TCase * tc_generate_int_partitions = tcase_create( "generate_int_partitions"); tcase_add_test_raise_signal(tc_generate_int_partitions, test_generate_int_partitions_n0, SIGABRT); tcase_add_test(tc_generate_int_partitions, test_generate_int_partitions_n1); tcase_add_test(tc_generate_int_partitions, test_generate_int_partitions_n4); tcase_add_test(tc_generate_int_partitions, test_generate_int_partitions_n6); suite_add_tcase(s, tc_generate_int_partitions); return s; }
Suite *nsurl_suite(void) { Suite *s; TCase *tc_api_assert; TCase *tc_create; TCase *tc_access; TCase *tc_nice_nostrip; TCase *tc_nice_strip; TCase *tc_replace_query; TCase *tc_join; TCase *tc_compare; TCase *tc_fragment; TCase *tc_component; TCase *tc_parent; s = suite_create("nsurl"); /* Basic API operation assert checks */ tc_api_assert = tcase_create("API asserts"); tcase_add_unchecked_fixture(tc_api_assert, corestring_create, corestring_teardown); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_create_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_ref_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_unref_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_compare1_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_compare2_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_get_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_get_component1_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_get_component2_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_has_component1_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_has_component2_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_access_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_access_leaf_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_length_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_hash_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_join1_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_join2_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_defragment_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_refragment1_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_refragment2_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_replace_query1_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_replace_query2_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_replace_query3_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_nice_test, 6); tcase_add_test_raise_signal(tc_api_assert, nsurl_api_assert_parent_test, 6); suite_add_tcase(s, tc_api_assert); /* url creation */ tc_create = tcase_create("Create"); tcase_add_unchecked_fixture(tc_create, corestring_create, corestring_teardown); tcase_add_loop_test(tc_create, nsurl_create_test, 0, NELEMS(create_tests)); tcase_add_test(tc_create, nsurl_ref_test); suite_add_tcase(s, tc_create); /* url access and length */ tc_access = tcase_create("Access"); tcase_add_unchecked_fixture(tc_access, corestring_create, corestring_teardown); tcase_add_loop_test(tc_access, nsurl_access_test, 0, NELEMS(access_tests)); tcase_add_loop_test(tc_access, nsurl_access_leaf_test, 0, NELEMS(access_tests)); tcase_add_loop_test(tc_access, nsurl_length_test, 0, NELEMS(access_tests)); suite_add_tcase(s, tc_access); /* nice filename without strip */ tc_nice_nostrip = tcase_create("Nice (nostrip)"); tcase_add_unchecked_fixture(tc_nice_nostrip, corestring_create, corestring_teardown); tcase_add_loop_test(tc_nice_nostrip, nsurl_nice_nostrip_test, 0, NELEMS(nice_tests)); suite_add_tcase(s, tc_nice_nostrip); /* nice filename with strip */ tc_nice_strip = tcase_create("Nice (strip)"); tcase_add_unchecked_fixture(tc_nice_strip, corestring_create, corestring_teardown); tcase_add_loop_test(tc_nice_strip, nsurl_nice_strip_test, 0, NELEMS(nice_strip_tests)); suite_add_tcase(s, tc_nice_strip); /* replace query */ tc_replace_query = tcase_create("Replace Query"); tcase_add_unchecked_fixture(tc_replace_query, corestring_create, corestring_teardown); tcase_add_loop_test(tc_replace_query, nsurl_replace_query_test, 0, NELEMS(replace_query_tests)); suite_add_tcase(s, tc_replace_query); /* url join */ tc_join = tcase_create("Join"); tcase_add_unchecked_fixture(tc_join, corestring_create, corestring_teardown); tcase_add_loop_test(tc_join, nsurl_join_test, 0, NELEMS(join_tests)); tcase_add_loop_test(tc_join, nsurl_join_complex_test, 0, NELEMS(join_complex_tests)); suite_add_tcase(s, tc_join); /* url compare */ tc_compare = tcase_create("Compare"); tcase_add_unchecked_fixture(tc_compare, corestring_create, corestring_teardown); tcase_add_loop_test(tc_compare, nsurl_compare_test, 0, NELEMS(compare_tests)); suite_add_tcase(s, tc_compare); /* fragment */ tc_fragment = tcase_create("Fragment"); tcase_add_unchecked_fixture(tc_fragment, corestring_create, corestring_teardown); tcase_add_loop_test(tc_fragment, nsurl_defragment_test, 0, NELEMS(parent_tests)); tcase_add_loop_test(tc_fragment, nsurl_refragment_test, 0, NELEMS(parent_tests)); suite_add_tcase(s, tc_fragment); /* component */ tc_component = tcase_create("Component"); tcase_add_unchecked_fixture(tc_component, corestring_create, corestring_teardown); tcase_add_loop_test(tc_component, nsurl_get_component_test, 0, NELEMS(component_tests)); tcase_add_loop_test(tc_component, nsurl_has_component_test, 0, NELEMS(component_tests)); suite_add_tcase(s, tc_component); /* parent */ tc_parent = tcase_create("Parent"); tcase_add_unchecked_fixture(tc_parent, corestring_create, corestring_teardown); tcase_add_loop_test(tc_parent, nsurl_parent_test, 0, NELEMS(parent_tests)); suite_add_tcase(s, tc_parent); return s; }
/** Adds @fun expected to be abort()ed by g_assert() to @tc. */ void checkmore_add_aborting_test(TCase *tc, TFun fun) { tcase_add_test_raise_signal(tc, fun, SIGABRT); }