コード例 #1
0
END_TEST


Suite* remove_default_suite(void)
{
  Suite *s;
  TCase *tests;

  s = suite_create("Remove Default Routes");
  tests = tcase_create("Core");
  suite_add_tcase(s, tests);

  // Add the tests
  tcase_add_loop_test(tests, test_removal,
                      0, sizeof(test_tables) / sizeof(table_t));

  return s;
}
コード例 #2
0
END_TEST

Suite *test_htmlnorm_suite(void)
{
	Suite *s = suite_create("htmlnorm");
	TCase *tc_htmlnorm_api;

	tc_htmlnorm_api = tcase_create("htmlnorm api");
	suite_add_tcase (s, tc_htmlnorm_api);
#ifdef CHECK_HAVE_LOOPS	
	tcase_add_loop_test(tc_htmlnorm_api, test_htmlnorm_api, 0, sizeof(tests)/sizeof(tests[0]));
#endif
	tcase_add_unchecked_fixture(tc_htmlnorm_api,
					htmlnorm_setup, htmlnorm_teardown);
	tcase_add_test(tc_htmlnorm_api, test_screnc_nullterminate);

	return s;
}
コード例 #3
0
ファイル: check_liboml2_omlvalue.c プロジェクト: alco90/soml
END_TEST

Suite*
omlvalue_suite (void)
{
  Suite* s = suite_create ("OmlValue");

  TCase* tc_omlvalue = tcase_create ("OmlValue");
  tcase_add_test (tc_omlvalue, test_stringU);
  tcase_add_test (tc_omlvalue, test_blobU);
  tcase_add_test (tc_omlvalue, test_intrinsic);
  tcase_add_test (tc_omlvalue, test_string);
  tcase_add_test (tc_omlvalue, test_blob);
  tcase_add_loop_test (tc_omlvalue, test_bool_loop, 0, LENGTH(booltest));

  suite_add_tcase (s, tc_omlvalue);

  return s;
}
コード例 #4
0
END_TEST

Suite *ike_delete_suite_create()
{
	Suite *s;
	TCase *tc;

	s = suite_create("ike delete");

	tc = tcase_create("regular");
	tcase_add_loop_test(tc, test_regular, 0, 2);
	suite_add_tcase(s, tc);

	tc = tcase_create("collisions");
	tcase_add_test(tc, test_collision);
	suite_add_tcase(s, tc);

	return s;
}
コード例 #5
0
ファイル: e-audiosynth.c プロジェクト: Buzztrax/buzztrax
TCase *
gst_buzztrax_audiosynth_example_case (void)
{
  TCase *tc = tcase_create ("GstBtAudiosynthExamples");

  tcase_add_test (tc, test_create_obj);
  tcase_add_test (tc, test_initialized_with_audio_caps);
  tcase_add_test (tc, test_audio_context_configures_buffer_size);
  tcase_add_test (tc, test_forward_first_buffer_starts_at_zero);
  tcase_add_test (tc, test_backwards_last_buffer_ends_at_zero);
  tcase_add_test (tc, test_buffers_are_contigous);
  tcase_add_loop_test (tc, test_num_buffers_with_stop_pos, 0, 2);
  tcase_add_test (tc, test_last_buffer_is_clipped);
  tcase_add_test (tc, test_no_reset_without_seeks);
  tcase_add_test (tc, test_reset_on_seek);
  tcase_add_test (tc, test_position_query_time);
  tcase_add_unchecked_fixture (tc, case_setup, case_teardown);
  return tc;
}
コード例 #6
0
ファイル: check_unisolve.c プロジェクト: robol/mpsolve-debian
END_TEST

/**
 * @brief Create the unisolve test suite
 */
Suite * unisolve_suite (int n)
{
  Suite *s = suite_create ("unisolve");

  TCase *tc_mpsolve = tcase_create ("MPSolve standard approach");

  /* Add our tests */
  tcase_add_loop_test (tc_mpsolve, test_unisolve, 0, n);

  /* Add test case to the suite */
  suite_add_tcase (s, tc_mpsolve);

  return s;
}
コード例 #7
0
ファイル: testringbuf.c プロジェクト: mbr/libu
END_TEST


TCase *testringbuf() {
	TCase *tc = tcase_create("testringbuf");
	tcase_add_test(tc, count_init);
	tcase_add_checked_fixture(tc, setup, teardown);
	tcase_add_test(tc, put_one_get_one);
	tcase_add_test(tc, mixed_read_write);
	tcase_add_test(tc, overflow_callback_gets_called);
	tcase_add_test(tc, underflow_callback_gets_called);
	tcase_add_test(tc, counter_overflow);
	tcase_add_test(tc, free_space);
	tcase_add_test(tc, available);

	/* try with 1-ringbuf_size elements in buffer */
	tcase_add_loop_test(tc, put_many_get_many, 1, ringbuf_size+1);

	return tc;
}
コード例 #8
0
ファイル: endpoints.c プロジェクト: simpleigh/hawser
END_TEST


TCase *
tcase_info_endpoints(void)
{
	static TCase *tc;
	tc = tcase_create("endpoints");

	tcase_add_loop_test(tc, test_endpoint_valid, 0, N_ENDPOINT_TESTS);
	tcase_add_test(tc, test_endpoint_starts_with_service);
	tcase_add_test(tc, test_endpoint_contains_region);
	tcase_add_test(tc, test_endpoint_ends_correctly);
	tcase_add_test(tc, test_endpoint_invalid_service);
	tcase_add_test(tc, test_endpoint_invalid_region);
	tcase_add_test(tc, test_endpoint_null_dest);
	tcase_add_test(tc, test_endpoint_bad_region);

	return tc;
}
コード例 #9
0
END_TEST

int main (void) {

  int number_failed;
  SRunner *sr;

  Suite *s = suite_create ("Template");

  /* String test case */
  TCase *tc = tcase_create ("Template");
  tcase_add_loop_test(tc, test_template, 0, 39);
  tcase_add_test(tc, test_template_file);
  suite_add_tcase (s, tc);

  sr = srunner_create(s);
  srunner_run_all(sr, CK_NORMAL);
  number_failed = srunner_ntests_failed(sr);
  srunner_free(sr);
  return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
コード例 #10
0
ファイル: flvmux.c プロジェクト: DylanZA/gst-plugins-good
static Suite *
flvmux_suite (void)
{
  Suite *s = suite_create ("flvmux");
  TCase *tc_chain = tcase_create ("general");
  gint loop = 499;

  suite_add_tcase (s, tc_chain);

#ifdef HAVE_VALGRIND
  if (RUNNING_ON_VALGRIND) {
    loop = 140;
  }
#endif

  tcase_add_loop_test (tc_chain, test_index_writing, 1, loop);

  tcase_add_test (tc_chain, test_speex_streamable);

  return s;
}
コード例 #11
0
static Suite *
videorate_suite (void)
{
  Suite *s = suite_create ("videorate");
  TCase *tc_chain = tcase_create ("general");

  suite_add_tcase (s, tc_chain);
  tcase_add_test (tc_chain, test_one);
  tcase_add_test (tc_chain, test_more);
  tcase_add_test (tc_chain, test_wrong_order_from_zero);
  tcase_add_test (tc_chain, test_wrong_order);
  tcase_add_test (tc_chain, test_no_framerate);
  tcase_add_test (tc_chain, test_changing_size);
  tcase_add_test (tc_chain, test_non_ok_flow);
  tcase_add_test (tc_chain, test_upstream_caps_nego);
  tcase_add_test (tc_chain, test_selected_caps);
  tcase_add_loop_test (tc_chain, test_caps_negotiation,
      0, G_N_ELEMENTS (caps_negotiation_tests));

  return s;
}
コード例 #12
0
ファイル: check_regex.c プロジェクト: Yuyue/clamav-devel
END_TEST

Suite *test_regex_suite(void)
{
	Suite *s = suite_create("regex");
	TCase *tc_api, *tc_matching, *tc_phish, *tc_phish2, *tc_regex;

	tc_api = tcase_create("cli_regex2suffix");
	suite_add_tcase(s, tc_api);
	tcase_add_checked_fixture (tc_api, setup, teardown);
	tcase_add_test(tc_api, empty);
	tcase_add_test(tc_api, one);
#ifdef CHECK_HAVE_LOOPS
	tcase_add_loop_test(tc_api, test_suffix, 0, sizeof(tests)/sizeof(tests[0]));
#endif
	tc_matching = tcase_create("regex_list");
	suite_add_tcase(s, tc_matching);
	tcase_add_checked_fixture (tc_matching, rsetup, rteardown);
#ifdef CHECK_HAVE_LOOPS
	tcase_add_loop_test(tc_matching, regex_list_match_test, 0, sizeof(rtests)/sizeof(rtests[0]));
#endif
	tc_phish = tcase_create("phishingScan");
	suite_add_tcase(s, tc_phish);
	tcase_add_unchecked_fixture(tc_phish, psetup, pteardown);
#ifdef CHECK_HAVE_LOOPS
	tcase_add_loop_test(tc_phish, phishingScan_test, 0, sizeof(rtests)/sizeof(rtests[0]));
#endif
	tcase_add_test(tc_phish, phishing_fake_test);

	tc_phish2 = tcase_create("phishingScan with 2 dbs");
	suite_add_tcase(s, tc_phish2);
	tcase_add_unchecked_fixture(tc_phish2, psetup2, pteardown);
#ifdef CHECK_HAVE_LOOPS
	tcase_add_loop_test(tc_phish2, phishingScan_test, 0, sizeof(rtests)/sizeof(rtests[0]));
#endif
	tcase_add_test(tc_phish2, phishing_fake_test);
#ifdef CHECK_HAVE_LOOPS
	tcase_add_loop_test(tc_phish, test_url_canon, 0, sizeof(uc)/sizeof(uc[0]));
#endif

	tc_regex = tcase_create("cli_regcomp/execute");
	suite_add_tcase(s, tc_regex);
#ifdef CHECK_HAVE_LOOPS
	tcase_add_loop_test(tc_regex, test_regexes, 0, sizeof(rg)/sizeof(rg[0]));
#endif
	return s;
}
コード例 #13
0
ファイル: test_enumerator.c プロジェクト: mikma/strongswan
END_TEST

Suite *enumerator_suite_create()
{
	Suite *s;
	TCase *tc;

	s = suite_create("enumerator");

	tc = tcase_create("tokens");
	tcase_add_loop_test(tc, test_token, 0, countof(token_tests));
	suite_add_tcase(s, tc);

	tc = tcase_create("filtered");
	tcase_add_checked_fixture(tc, setup_destroy_data, teardown_destroy_data);
	tcase_add_test(tc, test_filtered);
	tcase_add_test(tc, test_filtered_filter);
	suite_add_tcase(s, tc);

	tc = tcase_create("nested");
	tcase_add_checked_fixture(tc, setup_destroy_data, teardown_destroy_data);
	tcase_add_test(tc, test_nested);
	tcase_add_test(tc, test_nested_reset);
	tcase_add_test(tc, test_nested_empty);
	tcase_add_test(tc, test_nested_null);
	suite_add_tcase(s, tc);

	tc = tcase_create("cleaner");
	tcase_add_checked_fixture(tc, setup_destroy_data, teardown_destroy_data);
	tcase_add_test(tc, test_cleaner);
	suite_add_tcase(s, tc);

	tc = tcase_create("single");
	tcase_add_test(tc, test_single);
	tcase_add_test(tc, test_single_cleanup);
	suite_add_tcase(s, tc);

	return s;
}
コード例 #14
0
ファイル: guess_test.c プロジェクト: nuts-io/nuts-io
END_TEST

TCase* tcase_kex_guess() {
  TCase *tc = tcase_create("kex_guess");
  tcase_add_checked_fixture(tc, setup, teardown);

  tcase_add_test(tc, kex_algorithm_null_kex);
  tcase_add_test(tc, kex_algorithm);
  tcase_add_test(tc, kex_algorithm_noent);
  tcase_add_loop_test(tc, encryption_algorithm_null_kex, NUTS_READ, NUTS_WRITE + 1);
  tcase_add_loop_test(tc, encryption_algorithm, NUTS_READ, NUTS_WRITE + 1);
  tcase_add_loop_test(tc, encryption_algorithm_noent, NUTS_READ, NUTS_WRITE + 1);
  tcase_add_loop_test(tc, mac_algorithm_null_kex, NUTS_READ, NUTS_WRITE + 1);
  tcase_add_loop_test(tc, mac_algorithm, NUTS_READ, NUTS_WRITE + 1);
  tcase_add_loop_test(tc, mac_algorithm_noent, NUTS_READ, NUTS_WRITE + 1);

  return tc;
}
コード例 #15
0
END_TEST

Suite *linked_list_enumerator_suite_create()
{
	Suite *s;
	TCase *tc;

	s = suite_create("linked list and enumerators");

	tc = tcase_create("enumerate");
	tcase_add_checked_fixture(tc, setup_list, teardown_list);
	tcase_add_test(tc, test_enumerate);
	tcase_add_test(tc, test_enumerate_null);
	tcase_add_test(tc, test_reset_enumerator);
	suite_add_tcase(s, tc);

	tc = tcase_create("insert_before()");
	tcase_add_checked_fixture(tc, setup_list, teardown_list);
	tcase_add_loop_test(tc, test_insert_before, 1, 5);
	tcase_add_test(tc, test_insert_before_ends);
	tcase_add_test(tc, test_insert_before_empty);
	suite_add_tcase(s, tc);

	tc = tcase_create("modify");
	tcase_add_checked_fixture(tc, setup_list, teardown_list);
	tcase_add_test(tc, test_remove_at);
	tcase_add_test(tc, test_remove_at_ends);
	tcase_add_test(tc, test_insert_before_remove_at);
	suite_add_tcase(s, tc);

	tc = tcase_create("create_from_enumerator");
	tcase_add_checked_fixture(tc, setup_list, teardown_list);
	tcase_add_test(tc, test_create_from_enumerator);
	suite_add_tcase(s, tc);

	return s;
}
コード例 #16
0
END_TEST

Suite* coord_system_suite(void)
{
  Suite *s = suite_create("Coordinate systems");

  /* Core test case */
  TCase *tc_core = tcase_create("Core");
  tcase_add_loop_test(tc_core, test_wgsllh2ecef, 0, NUM_COORDS);
  tcase_add_loop_test(tc_core, test_wgsecef2llh, 0, NUM_COORDS);
  tcase_add_loop_test(tc_core, test_wgsllh2ecef2llh, 0, NUM_COORDS);
  tcase_add_loop_test(tc_core, test_wgsecef2llh2ecef, 0, NUM_COORDS);
  suite_add_tcase(s, tc_core);

  TCase *tc_random = tcase_create("Random");
  tcase_add_loop_test(tc_random, test_random_wgsllh2ecef2llh, 0, 100);
  tcase_add_loop_test(tc_random, test_random_wgsecef2llh2ecef, 0, 100);
  tcase_add_loop_test(tc_random, test_random_wgsecef2ned_d_0, 0, 100);
  suite_add_tcase(s, tc_random);

  return s;
}
コード例 #17
0
END_TEST

Suite *socket_suite_create()
{
	Suite *s;
	TCase *tc;
	int count;

	count = tls_crypto_get_supported_suites(TRUE, NULL);

	s = suite_create("socket");

	tc = tcase_create("TLS 1.2/anon");
	tcase_add_checked_fixture(tc, setup_creds, teardown_creds);
	tcase_add_loop_test(tc, test_tls12, 0, count);
	suite_add_tcase(s, tc);

	tc = tcase_create("TLS 1.2/mutl");
	tcase_add_checked_fixture(tc, setup_creds, teardown_creds);
	tcase_add_loop_test(tc, test_tls12_mutual, 0, count);
	suite_add_tcase(s, tc);

	tc = tcase_create("TLS 1.1/anon");
	tcase_add_checked_fixture(tc, setup_creds, teardown_creds);
	tcase_add_loop_test(tc, test_tls11, 0, count);
	suite_add_tcase(s, tc);

	tc = tcase_create("TLS 1.1/mutl");
	tcase_add_checked_fixture(tc, setup_creds, teardown_creds);
	tcase_add_loop_test(tc, test_tls11_mutual, 0, count);
	suite_add_tcase(s, tc);

	tc = tcase_create("TLS 1.0/anon");
	tcase_add_checked_fixture(tc, setup_creds, teardown_creds);
	tcase_add_loop_test(tc, test_tls10, 0, count);
	suite_add_tcase(s, tc);

	tc = tcase_create("TLS 1.0/mutl");
	tcase_add_checked_fixture(tc, setup_creds, teardown_creds);
	tcase_add_loop_test(tc, test_tls10_mutual, 0, count);
	suite_add_tcase(s, tc);

	return s;
}
コード例 #18
0
ファイル: test_cntl_generic.c プロジェクト: zdenekc/SIVM
} END_TEST

/**
 * \brief Create test suite for generic controller module.
 * \return pointer to generic controller suite
 */
Suite* create_cntl_generic_suite (void) {

	Suite *suite = suite_create("Cntl");

	TCase *tc_manage = tcase_create("Manage");
	tcase_add_checked_fixture(tc_manage, common_setup, common_teardown);
	tcase_add_test(tc_manage, test_create_none);

	TCase *tc_automaton = tcase_create("Automaton");
	tcase_add_checked_fixture(tc_automaton, common_setup, common_teardown);
	tcase_add_test(tc_automaton, test_automaton_manage);
	tcase_add_loop_test(tc_automaton, test_automaton_manage, CNTL_NONE, CNTL_LAST - 1);

	suite_add_tcase(suite, tc_manage);
	suite_add_tcase(suite, tc_automaton);

	return suite;
}
コード例 #19
0
ファイル: common_tests.c プロジェクト: vergoh/vnstat
END_TEST

void add_common_tests(Suite *s)
{
	TCase *tc_common = tcase_create("Common");
	tcase_add_test(tc_common, printe_options);
	tcase_add_test(tc_common, logprint_options);
	tcase_add_loop_test(tc_common, dmonth_return_within_range, 0, 12);
	tcase_add_test(tc_common, leapyears_are_known);
	tcase_add_test(tc_common, mosecs_return_values);
	tcase_add_test(tc_common, mosecs_does_not_change_tz);
	tcase_add_test(tc_common, mosecs_does_not_change_struct_tm_pointer_content);
	tcase_add_test(tc_common, countercalc_no_change_32bit);
	tcase_add_test(tc_common, countercalc_no_change_64bit);
	tcase_add_test(tc_common, countercalc_small_change_32bit);
	tcase_add_test(tc_common, countercalc_small_change_64bit);
	tcase_add_test(tc_common, countercalc_rollover_with_32bit);
	tcase_add_test(tc_common, countercalc_rollover_with_64bit);
	tcase_add_test(tc_common, countercalc_rollover_with_64bit_2);
	tcase_add_test(tc_common, countercalc_rollover_with_32bit_starting_32bit);
	tcase_add_test(tc_common, countercalc_rollover_with_32bit_starting_over_32bit);
	tcase_add_test(tc_common, countercalc_rollover_with_64bit_starting_32bit);
	tcase_add_test(tc_common, countercalc_rollover_with_64bit_starting_64bit);
	tcase_add_test(tc_common, strncpy_nt_with_below_maximum_length_string);
	tcase_add_test(tc_common, strncpy_nt_with_maximum_length_string);
	tcase_add_test(tc_common, strncpy_nt_with_over_maximum_length_string);
	tcase_add_test(tc_common, isnumeric_empty);
	tcase_add_test(tc_common, isnumeric_it_is);
	tcase_add_test(tc_common, isnumeric_it_is_not);
	tcase_add_test(tc_common, getversion_returns_a_version);
	tcase_add_test(tc_common, timeused_debug_outputs_something_expected_when_debug_is_enabled);
	tcase_add_test(tc_common, timeused_debug_does_not_output_anything_when_debug_is_disabled);
	tcase_add_test(tc_common, timeused_tracks_used_time);
	tcase_add_exit_test(tc_common, can_panic, 1);
	suite_add_tcase(s, tc_common);
}
コード例 #20
0
ファイル: check_dbm.c プロジェクト: gokul-uf/chidb
END_TEST



int main (void)
{
    SRunner *sr;
    int number_failed;

    sr = srunner_create (NULL);

    int i = 0;
    DIR *dir1 = opendir (DBM_PROGRAMS_DIR);
    Suite *s;
    if (dir1)
    {
        struct dirent *ent1;
        while ((ent1 = readdir (dir1)) != NULL)
        {
            if (ent1->d_type == DT_DIR && strcmp(ent1->d_name, ".") && strcmp(ent1->d_name, ".."))
            {
                char *dirname2 = malloc(strlen(DBM_PROGRAMS_DIR) + strlen(ent1->d_name) + 2);
                sprintf(dirname2, "%s%s/", DBM_PROGRAMS_DIR, ent1->d_name);

                DIR *dir2 = opendir (dirname2);
                if(dir2)
                {
                    int snamelen = strlen("dbm-") + strlen(ent1->d_name) + 1;
                    char *sname = malloc(snamelen);
                    snprintf(sname, snamelen, "dbm-%s", ent1->d_name);
                    s = suite_create (sname);

                    struct dirent *ent2;
                    while ((ent2 = readdir (dir2)) != NULL)
                    {
                        if (ent2->d_type == DT_REG)
                        {
                            dbm_tests[i] = malloc(strlen(dirname2) + strlen(ent2->d_name) + 1);
                            sprintf(dbm_tests[i], "%s%s", dirname2, ent2->d_name);

                            TCase *tc = tcase_create (strdup(ent2->d_name));
                            tcase_add_loop_test(tc, test_dbm, i, i+1);
                            suite_add_tcase (s, tc);

                            i++;
                        }
                    }
                }
                else
                {
                    printf("Could not open DBM programs directory: %s\n", dirname2);
                    exit(1);
                }

                srunner_add_suite(sr, s);
                closedir(dir2);
            }
        }

        closedir(dir1);
    } else
    {
        printf("Could not open DBM programs directory: " DBM_PROGRAMS_DIR "\n");
        exit(1);
    }

    srunner_run_all (sr, CK_NORMAL);
    number_failed = srunner_ntests_failed (sr);
    srunner_free (sr);

    return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
コード例 #21
0
ファイル: test_chunk.c プロジェクト: LeiYuan/strongswan
END_TEST

Suite *chunk_suite_create()
{
	Suite *s;
	TCase *tc;

	s = suite_create("chunk");

	tc = tcase_create("equals");
	tcase_add_test(tc, test_chunk_equals);
	suite_add_tcase(s, tc);

	tc = tcase_create("chunk_compare");
	tcase_add_loop_test(tc, test_compare, 0, countof(compare_data));
	suite_add_tcase(s, tc);

	tc = tcase_create("clear");
	tcase_add_test(tc, test_chunk_clear);
	suite_add_tcase(s, tc);

	tc = tcase_create("chunk_length");
	tcase_add_test(tc, test_chunk_length);
	suite_add_tcase(s, tc);

	tc = tcase_create("chunk_create_cat");
	tcase_add_test(tc, test_chunk_create_cat);
	suite_add_tcase(s, tc);

	tc = tcase_create("chunk_split");
	tcase_add_test(tc, test_chunk_split);
	suite_add_tcase(s, tc);

	tc = tcase_create("chunk_skip");
	tcase_add_test(tc, test_chunk_skip);
	tcase_add_test(tc, test_chunk_skip_zero);
	suite_add_tcase(s, tc);

	tc = tcase_create("chunk_increment");
	tcase_add_loop_test(tc, test_increment, 0, countof(increment_data));
	suite_add_tcase(s, tc);

	tc = tcase_create("chunk_printable");
	tcase_add_loop_test(tc, test_printable, 0, countof(printable_data));
	tcase_add_loop_test(tc, test_printable_sanitize, 0, countof(printable_data));
	tcase_add_test(tc, test_printable_empty);
	suite_add_tcase(s, tc);

	tc = tcase_create("baseXX");
	tcase_add_test(tc, test_base64);
	tcase_add_test(tc, test_base32);
	tcase_add_test(tc, test_base16);
	suite_add_tcase(s, tc);

	tc = tcase_create("chunk_mac");
	tcase_add_test(tc, test_chunk_mac);
	suite_add_tcase(s, tc);

	tc = tcase_create("chunk_hash");
	tcase_add_test(tc, test_chunk_hash);
	suite_add_tcase(s, tc);

	tc = tcase_create("chunk_hash_static");
	tcase_add_test(tc, test_chunk_hash_static);
	suite_add_tcase(s, tc);

	tc = tcase_create("chunk_map");
	tcase_add_test(tc, test_chunk_map);
	suite_add_tcase(s, tc);

	tc = tcase_create("chunk_from_fd");
	tcase_add_test(tc, test_chunk_from_fd_file);
	tcase_add_test(tc, test_chunk_from_fd_skt);
	tcase_add_test(tc, test_chunk_from_fd_huge);
	suite_add_tcase(s, tc);

	tc = tcase_create("printf_hook");
	tcase_add_loop_test(tc, test_printf_hook_hash, 0, countof(printf_hook_data));
	tcase_add_loop_test(tc, test_printf_hook_plus, 0, countof(printf_hook_data));
	tcase_add_loop_test(tc, test_printf_hook, 0, countof(printf_hook_data));
	suite_add_tcase(s, tc);

	return s;
}
コード例 #22
0
ファイル: check_clamav.c プロジェクト: jobin-sun/clamav-devel
END_TEST
#endif

static Suite *test_cl_suite(void)
{
    Suite *s = suite_create("cl_api");
    TCase *tc_cl = tcase_create("cl_dup");
    TCase *tc_cl_scan = tcase_create("cl_scan");
    int expect = expected_testfiles;
    suite_add_tcase (s, tc_cl);
    tcase_add_test(tc_cl, test_cl_free);
    tcase_add_test(tc_cl, test_cl_dup);
    tcase_add_test(tc_cl, test_cl_build);
    tcase_add_test(tc_cl, test_cl_debug);
    tcase_add_test(tc_cl, test_cl_retdbdir);
    tcase_add_test(tc_cl, test_cl_retver);
    tcase_add_test(tc_cl, test_cl_cvdfree);
    tcase_add_test(tc_cl, test_cl_statfree);
    tcase_add_test(tc_cl, test_cl_retflevel);
    tcase_add_test(tc_cl, test_cl_cvdhead);
    tcase_add_test(tc_cl, test_cl_cvdparse);
    tcase_add_test(tc_cl, test_cl_load);
    tcase_add_test(tc_cl, test_cl_cvdverify);
    tcase_add_test(tc_cl, test_cl_statinidir);
    tcase_add_test(tc_cl, test_cl_statchkdir);
    tcase_add_test(tc_cl, test_cl_settempdir);
    tcase_add_test(tc_cl, test_cl_strerror);

    suite_add_tcase(s, tc_cl_scan);
    tcase_add_checked_fixture (tc_cl_scan, engine_setup, engine_teardown);
#ifdef CHECK_HAVE_LOOPS
    if (get_fpu_endian() == FPU_ENDIAN_UNKNOWN)
        expect--;
    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc_allscan, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile_allscan, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc_callback, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc_callback_allscan, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile_callback, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile_callback_allscan, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_handle, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_handle_allscan, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_mem, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_mem_allscan, 0, expect);
#endif
    return s;
}
コード例 #23
0
END_TEST

Suite *enum_suite_create()
{
	Suite *s;
	TCase *tc;

	s = suite_create("enum");

	tc = tcase_create("enum_to_name");
	tcase_add_loop_test(tc, test_enum_to_name_cont, 0, countof(name_tests_cont));
	tcase_add_loop_test(tc, test_enum_to_name_split, 0, countof(name_tests_split));
	suite_add_tcase(s, tc);

	tc = tcase_create("enum_from_name");
	tcase_add_loop_test(tc, test_enum_from_name_cont, 0, countof(enum_tests_cont));
	tcase_add_loop_test(tc, test_enum_from_name_split, 0, countof(enum_tests_split));
	suite_add_tcase(s, tc);

	tc = tcase_create("enum_flags_to_string");
	tcase_add_loop_test(tc, test_enum_flags_to_string, 0, countof(enum_flags_to_string_tests));
	tcase_add_loop_test(tc, test_enum_flags_to_string_noflagenum, 0, countof(printf_tests_flags_noflagenum));
	suite_add_tcase(s, tc);

	tc = tcase_create("enum_printf_hook");
	tcase_add_loop_test(tc, test_enum_printf_hook_cont, 0, countof(printf_tests_cont));
	tcase_add_loop_test(tc, test_enum_printf_hook_split, 0, countof(printf_tests_split));
	tcase_add_test(tc, test_enum_printf_hook_null);
	tcase_add_loop_test(tc, test_enum_printf_hook_flags, 0, countof(printf_tests_flags));
	tcase_add_loop_test(tc, test_enum_printf_hook_flags_incomplete, 0, countof(printf_tests_flags_incomplete));
	tcase_add_loop_test(tc, test_enum_printf_hook_flags_null, 0, countof(printf_tests_flags_null));
	tcase_add_loop_test(tc, test_enum_printf_hook_flags_overflow, 0, countof(printf_tests_flags_overflow));
	tcase_add_loop_test(tc, test_enum_printf_hook_flags_noflagenum, 0, countof(printf_tests_flags_noflagenum));
	tcase_add_test(tc, test_enum_printf_hook_width);
	suite_add_tcase(s, tc);

	return s;
}
コード例 #24
0
END_TEST


static Suite* Player_suite(void)
{
    Suite* s = suite_create("Player");

    const int timeout = DEFAULT_TIMEOUT;

#define BUILD_TCASE(name)                                                \
    TCase* tc_##name = tcase_create(#name);                              \
    suite_add_tcase(s, tc_##name);                                       \
    tcase_set_timeout(tc_##name, timeout);                               \
    tcase_add_checked_fixture(tc_##name, setup_empty, handle_teardown)

    BUILD_TCASE(general);
    BUILD_TCASE(notes);
    BUILD_TCASE(patterns);
    BUILD_TCASE(songs);
    BUILD_TCASE(events);

#undef BUILD_TCASE

    // Note mixing
    tcase_add_test(tc_notes, Complete_debug_note_renders_correctly);
    tcase_add_test(tc_notes, Note_off_stops_the_note_correctly);
    tcase_add_test(tc_notes, Note_end_is_reached_correctly_during_note_off);
    tcase_add_test(tc_notes, Implicit_note_off_is_triggered_correctly);
    tcase_add_test(tc_notes, Independent_notes_mix_correctly);
    tcase_add_test(tc_notes, Debug_single_shot_renders_one_pulse);

    // Patterns
    tcase_add_loop_test(
            tc_patterns, Empty_pattern_contains_silence,
            0, MIXING_RATE_COUNT);
    tcase_add_loop_test(tc_patterns, Note_on_at_pattern_end_is_handled, 0, 4);
    tcase_add_loop_test(tc_patterns, Note_on_after_pattern_end_is_ignored, 0, 4);
    tcase_add_test(tc_patterns, Note_on_at_pattern_start_is_handled);
    tcase_add_test(tc_patterns, Pattern_playback_repeats_pattern);
    tcase_add_test(tc_patterns, Pattern_playback_pauses_zero_length_pattern);

    // Songs
    tcase_add_test(tc_songs, Empty_composition_renders_zero_frames);
    tcase_add_test(tc_songs, Paused_empty_composition_contains_silence);
    tcase_add_loop_test(tc_songs, Initial_tempo_is_set_correctly, 0, 4);
    tcase_add_test(tc_songs, Infinite_mode_loops_composition);
    tcase_add_loop_test(tc_songs, Skipping_moves_position_forwards, 0, 4);

    // Events
    tcase_add_loop_test(
            tc_events, Pattern_delay_extends_gap_between_trigger_rows,
            0, 4);
    tcase_add_loop_test(
            tc_events, Pattern_delay_inserts_gap_between_adjacent_triggers,
            0, 4);
    tcase_add_loop_test(
            tc_events, Tempo_change_affects_playback_cursor,
            0, 4);
    tcase_add_loop_test(
            tc_events, Tempo_slide_affects_playback_cursor,
            0, 4);
    tcase_add_loop_test(
            tc_events, Jump_backwards_creates_a_loop,
            0, 4);
    tcase_add_test(tc_events, Events_appear_in_event_buffer);
    tcase_add_test(
            tc_events,
            Events_from_many_triggers_can_be_retrieved_with_multiple_receives);
    tcase_add_test(
            tc_events,
            Events_from_many_triggers_are_skipped_by_fire);
    tcase_add_test(
            tc_events,
            Events_from_complex_bind_can_be_retrieved_with_multiple_receives);
    tcase_add_test(
            tc_events,
            Fire_with_complex_bind_can_be_processed_with_multiple_receives);
    tcase_add_test(tc_events, Query_initial_location);
    tcase_add_test(tc_events, Query_final_location);
    tcase_add_test(tc_events, Query_voice_count_with_silence);
    tcase_add_test(tc_events, Query_voice_count_with_note);
    tcase_add_test(tc_events, Query_note_force);

    return s;
}
コード例 #25
0
END_TEST
#endif

static Suite *test_cl_suite(void)
{
    Suite *s = suite_create("cl_api");
    TCase *tc_cl = tcase_create("cl_dup");
    TCase *tc_cl_scan = tcase_create("cl_scan");
    char *user_timeout = NULL;
    int expect = expected_testfiles;
    suite_add_tcase (s, tc_cl);
    tcase_add_test(tc_cl, test_cl_free);
    tcase_add_test(tc_cl, test_cl_dup);
    tcase_add_test(tc_cl, test_cl_build);
    tcase_add_test(tc_cl, test_cl_debug);
    tcase_add_test(tc_cl, test_cl_retdbdir);
    tcase_add_test(tc_cl, test_cl_retver);
    tcase_add_test(tc_cl, test_cl_cvdfree);
    tcase_add_test(tc_cl, test_cl_statfree);
    tcase_add_test(tc_cl, test_cl_retflevel);
    tcase_add_test(tc_cl, test_cl_cvdhead);
    tcase_add_test(tc_cl, test_cl_cvdparse);
    tcase_add_test(tc_cl, test_cl_load);
    tcase_add_test(tc_cl, test_cl_cvdverify);
    tcase_add_test(tc_cl, test_cl_statinidir);
    tcase_add_test(tc_cl, test_cl_statchkdir);
    tcase_add_test(tc_cl, test_cl_settempdir);
    tcase_add_test(tc_cl, test_cl_strerror);

    suite_add_tcase(s, tc_cl_scan);
    tcase_add_checked_fixture (tc_cl_scan, engine_setup, engine_teardown);
#ifdef CHECK_HAVE_LOOPS
    if (get_fpu_endian() == FPU_ENDIAN_UNKNOWN)
        expect--;
    expect -= skip_files();
    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc_allscan, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile_allscan, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc_callback, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc_callback_allscan, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile_callback, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile_callback_allscan, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_handle, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_handle_allscan, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_mem, 0, expect);
    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_mem_allscan, 0, expect);

    user_timeout = getenv("T");
    if (user_timeout) {
        int timeout = atoi(user_timeout);
        tcase_set_timeout(tc_cl_scan, timeout);
	printf("Using test case timeout of %d seconds set by user\n", timeout);
    } else {
	printf("Using default test timeout; alter by setting 'T' env var (in seconds)\n");
    }
#endif
    return s;
}
コード例 #26
0
ファイル: test_utils.c プロジェクト: mikma/strongswan
END_TEST

Suite *utils_suite_create()
{
	Suite *s;
	TCase *tc;

	/* force a timezone to match non-UTC conversions */
#ifdef WIN32
	_putenv("TZ=GST-1GDT");
#else
	setenv("TZ", "Europe/Zurich", 1);
#endif
	tzset();

	s = suite_create("utils");

	tc = tcase_create("objects");
	tcase_add_test(tc, test_objects);
	suite_add_tcase(s, tc);

	tc = tcase_create("return functions");
	tcase_add_test(tc, test_return_functions);
	suite_add_tcase(s, tc);

	tc = tcase_create("timeval_add_ms");
	tcase_add_test(tc, test_timeval_add_ms);
	suite_add_tcase(s, tc);

	tc = tcase_create("timespan_from_string");
	tcase_add_loop_test(tc, test_timespan_from_string, 0, countof(ts_data));
	suite_add_tcase(s, tc);

	tc = tcase_create("htoun,untoh");
	tcase_add_test(tc, test_htoun);
	tcase_add_test(tc, test_untoh);
	suite_add_tcase(s, tc);

	tc = tcase_create("round");
	tcase_add_test(tc, test_round);
	suite_add_tcase(s, tc);

	tc = tcase_create("string helper");
	tcase_add_loop_test(tc, test_streq, 0, countof(streq_data));
	tcase_add_loop_test(tc, test_strneq, 0, countof(strneq_data));
	tcase_add_loop_test(tc, test_strpfx, 0, countof(strpfx_data));
	suite_add_tcase(s, tc);

	tc = tcase_create("malloc_align");
	tcase_add_test(tc, test_malloc_align);
	suite_add_tcase(s, tc);

	tc = tcase_create("memxor");
	tcase_add_test(tc, test_memxor);
	tcase_add_test(tc, test_memxor_aligned);
	suite_add_tcase(s, tc);

	tc = tcase_create("memeq");
	tcase_add_loop_test(tc, test_memeq, 0, countof(memeq_data));
	tcase_add_loop_test(tc, test_memeq_const, 0, countof(memeq_data));
	suite_add_tcase(s, tc);

	tc = tcase_create("memstr");
	tcase_add_loop_test(tc, test_memstr, 0, countof(memstr_data));
	suite_add_tcase(s, tc);

	tc = tcase_create("utils_memrchr");
	tcase_add_loop_test(tc, test_utils_memrchr, 0, countof(memrchr_data));
	suite_add_tcase(s, tc);

	tc = tcase_create("translate");
	tcase_add_loop_test(tc, test_translate, 0, countof(translate_data));
	suite_add_tcase(s, tc);

	tc = tcase_create("strreplace");
	tcase_add_loop_test(tc, test_strreplace, 0, countof(strreplace_data));
	suite_add_tcase(s, tc);

	tc = tcase_create("path_dirname");
	tcase_add_loop_test(tc, test_path_dirname, 0, countof(path_data));
	suite_add_tcase(s, tc);

	tc = tcase_create("path_basename");
	tcase_add_loop_test(tc, test_path_basename, 0, countof(path_data));
	suite_add_tcase(s, tc);

	tc = tcase_create("path_absolute");
	tcase_add_loop_test(tc, test_path_absolute, 0, countof(path_data));
	suite_add_tcase(s, tc);

	tc = tcase_create("printf_hooks");
	tcase_add_loop_test(tc, test_time_printf_hook, 0, countof(time_data));
	tcase_add_loop_test(tc, test_time_delta_printf_hook, 0, countof(time_delta_data));
	suite_add_tcase(s, tc);

	tc = tcase_create("mark_from_string");
	tcase_add_loop_test(tc, test_mark_from_string, 0, countof(mark_data));
	suite_add_tcase(s, tc);

	tc = tcase_create("signature_schemes_for_key");
	tcase_add_loop_test(tc, test_signature_schemes_for_key, 0, countof(scheme_data));
	suite_add_tcase(s, tc);

	return s;
}
コード例 #27
0
ファイル: nsurl.c プロジェクト: EyMenZ/NetSurf-OS3
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;
}