Ejemplo n.º 1
0
END_TEST


Suite * io_suite(void) {
    Suite *s = suite_create("IO");

    TCase *tc_drop_comment    = tcase_create("drop_comment");
    TCase *tc_trim            = tcase_create("trim");
    TCase *tc_init_tokens     = tcase_create("init_tokens");
    TCase *tc_identify_tokens = tcase_create("identify_tokens");
    TCase *tc_output          = tcase_create("output");
    TCase *tc_input           = tcase_create("input");
    TCase *tc_parse           = tcase_create("parse_gtp");

    tcase_add_test( tc_drop_comment, test_drop_comment_1 );
    tcase_add_test( tc_drop_comment, test_drop_comment_2 );
    tcase_add_test( tc_drop_comment, test_drop_comment_3 );

    tcase_add_test( tc_trim, test_trim_1 );
    tcase_add_test( tc_trim, test_trim_2 );
    tcase_add_test( tc_trim, test_trim_3 );
    tcase_add_test( tc_trim, test_trim_4 );
    tcase_add_test( tc_trim, test_trim_5 );
    tcase_add_test( tc_trim, test_trim_6 );
    tcase_add_test( tc_trim, test_trim_7 );
    tcase_add_test( tc_trim, test_trim_8 );

    tcase_add_test( tc_init_tokens, test_init_tokens_1 );

    tcase_add_test( tc_identify_tokens, test_identify_tokens_1 );
    tcase_add_test( tc_identify_tokens, test_identify_tokens_2 );
    tcase_add_test( tc_identify_tokens, test_identify_tokens_3 );
    tcase_add_test( tc_identify_tokens, test_identify_tokens_4 );
    tcase_add_test( tc_identify_tokens, test_identify_tokens_5 );
    tcase_add_test( tc_identify_tokens, test_identify_tokens_6 );
    tcase_add_test( tc_identify_tokens, test_identify_tokens_7 );
    tcase_add_test( tc_identify_tokens, test_identify_tokens_8 );

    tcase_add_test( tc_output, test_add_output_1 );
    tcase_add_exit_test( tc_output, test_add_output_2, 1 );
    tcase_add_exit_test( tc_output, test_print_output, 0 );
    tcase_add_test( tc_output, test_output_error );

    tcase_add_test( tc_input, test_input );

    tcase_add_test( tc_parse, test_parse_gtp_input_1 );
    tcase_add_test( tc_parse, test_parse_gtp_input_2 );
    tcase_add_test( tc_parse, test_parse_gtp_input_3 );

    suite_add_tcase( s, tc_drop_comment    );
    suite_add_tcase( s, tc_trim            );
    suite_add_tcase( s, tc_init_tokens     );
    suite_add_tcase( s, tc_identify_tokens );
    suite_add_tcase( s, tc_output          );
    suite_add_tcase( s, tc_input           );
    suite_add_tcase( s, tc_parse           );


    return s;
}
Ejemplo n.º 2
0
END_TEST

Suite *
opts_suite(void)
{
	Suite *s;
	TCase *tc;
	s = suite_create("opts");

	tc = tcase_create("proxyspec_parse");
	tcase_add_test(tc, proxyspec_parse_01);
	tcase_add_test(tc, proxyspec_parse_02);
	tcase_add_exit_test(tc, proxyspec_parse_03, EXIT_FAILURE);
	tcase_add_exit_test(tc, proxyspec_parse_04, EXIT_FAILURE);
	tcase_add_test(tc, proxyspec_parse_05);
	tcase_add_test(tc, proxyspec_parse_06);
	tcase_add_test(tc, proxyspec_parse_07);
	tcase_add_test(tc, proxyspec_parse_08);
	tcase_add_exit_test(tc, proxyspec_parse_09, EXIT_FAILURE);
	tcase_add_exit_test(tc, proxyspec_parse_10, EXIT_FAILURE);
	tcase_add_test(tc, proxyspec_parse_11);
	tcase_add_exit_test(tc, proxyspec_parse_12, EXIT_FAILURE);
	tcase_add_test(tc, proxyspec_parse_13);
	tcase_add_test(tc, proxyspec_parse_14);
	suite_add_tcase(s, tc);

	tc = tcase_create("opts_debug");
	tcase_add_test(tc, opts_debug_01);
	suite_add_tcase(s, tc);

	return s;
}
Ejemplo n.º 3
0
END_TEST

Suite * snp_sites_suite (void)
{
  Suite *s = suite_create ("Creating_SNP_Sites");

  TCase *tc_alignment_file = tcase_create ("alignment_file");
  tcase_add_test (tc_alignment_file, valid_genome_length);
  tcase_add_test (tc_alignment_file, valid_genome_length_with_multiple_lines_per_sequence);
  tcase_add_test (tc_alignment_file, valid_number_of_sequences_in_file);
  tcase_add_test (tc_alignment_file, valid_number_of_sequences_in_file_with_multiple_lines_per_sequence);
  tcase_add_test (tc_alignment_file, number_of_snps_detected_small);
  tcase_add_test (tc_alignment_file, number_of_snps_detected);
  tcase_add_test (tc_alignment_file, sample_names_from_alignment_file);
  tcase_add_test (tc_alignment_file, check_strip_directory_from_filename_without_directory);
  tcase_add_test (tc_alignment_file, check_strip_directory_from_filename_with_directory);
  suite_add_tcase (s, tc_alignment_file);

  TCase *tc_snp_sites = tcase_create ("snp_sites");
  tcase_add_test (tc_snp_sites, valid_alignment_with_one_line_per_sequence);
  tcase_add_test (tc_snp_sites, valid_alignment_with_multiple_lines_per_sequence);
  tcase_add_test (tc_snp_sites, valid_alignment_with_one_line_per_sequence_gzipped);
  tcase_add_test (tc_snp_sites, valid_alignment_with_n_as_gap);
  tcase_add_test (tc_snp_sites, valid_with_only_aln_file_output);
  tcase_add_test (tc_snp_sites, valid_with_only_aln_file_output_with_custom_name);
  tcase_add_test (tc_snp_sites, valid_with_all_outputted_with_custom_name);
  tcase_add_test (tc_snp_sites, valid_with_only_aln_file_output_default);
  tcase_add_test (tc_snp_sites, valid_with_phylip_outputted_with_custom_name);
  tcase_add_exit_test(tc_snp_sites, invalid_with_uneven_file_lengths,EXIT_FAILURE);
  remove("uneven_alignment.aln.snp_sites.aln");
  suite_add_tcase (s, tc_snp_sites);

  return s;
}
Ejemplo n.º 4
0
END_TEST

Suite * run_program_suite(void) {
    Suite *s = suite_create("Run");

    TCase *tc_core = tcase_create("Core");
    TCase *tc_gtp  = tcase_create("GTP");

    //tcase_add_test( tc_core, run_no_param );
    tcase_add_exit_test( tc_core, run_h_param, EXIT_SUCCESS );
    tcase_add_exit_test( tc_core, run_v_param, EXIT_SUCCESS );
    tcase_add_exit_test( tc_core, run_invalid_param, EXIT_FAILURE );

    tcase_add_test( tc_gtp, test_select_command_1  );
    tcase_add_test( tc_gtp, test_select_command_2  );
    tcase_add_test( tc_gtp, test_select_command_3  );
    tcase_add_test( tc_gtp, test_select_command_4  );
    tcase_add_test( tc_gtp, test_select_command_5  );
    tcase_add_test( tc_gtp, test_select_command_6  );
    tcase_add_test( tc_gtp, test_select_command_7  );
    tcase_add_test( tc_gtp, test_select_command_8  );
    tcase_add_test( tc_gtp, test_select_command_9  );
    tcase_add_test( tc_gtp, test_select_command_10 );
    tcase_add_test( tc_gtp, test_select_command_11 );
    tcase_add_test( tc_gtp, test_select_command_12 );
    tcase_add_test( tc_gtp, test_select_command_13 );
    tcase_add_test( tc_gtp, test_select_command_14 );
    tcase_add_test( tc_gtp, test_select_command_15 );
    tcase_add_test( tc_gtp, test_select_command_16 );
    tcase_add_test( tc_gtp, test_select_command_17 );
    tcase_add_test( tc_gtp, test_select_command_18 );
    tcase_add_test( tc_gtp, test_select_command_19 );
    tcase_add_test( tc_gtp, test_select_command_20 );
    tcase_add_test( tc_gtp, test_select_command_21 );
    tcase_add_test( tc_gtp, test_select_command_22 );
    tcase_add_test( tc_gtp, test_select_command_23 );
    tcase_add_test( tc_gtp, test_select_command_24 );
    tcase_add_test( tc_gtp, test_select_command_25 );
    tcase_add_test( tc_gtp, test_fixed_handicap_1  );

    suite_add_tcase( s, tc_core );
    suite_add_tcase( s, tc_gtp  );

    tcase_set_timeout( tc_gtp, 120 );

    return s;
}
Ejemplo n.º 5
0
END_TEST

Suite* make_lib_utils_suite(void) {

    Suite *s = suite_create ("Utils");

    /* String test case */
    TCase *tc_string = tcase_create ("string");
    tcase_add_test(tc_string, test_strcat);
    tcase_add_test(tc_string, test_strcat_space);
    tcase_add_test(tc_string, test_strcat_comma);
    tcase_add_test(tc_string, test_strcmp);
    tcase_add_test(tc_string, test_strcmp_diff);
    tcase_add_test(tc_string, test_strcmp_inverse);
    tcase_add_test(tc_string, test_strcmp_inverse_diff);
    tcase_add_test(tc_string, test_sprintf_ok);
#ifndef OS_FREEBSD
    tcase_add_exit_test(tc_string, test_sprintf_fail, 2);
#endif
    tcase_add_test(tc_string, test_snprintf_ok);
    tcase_add_exit_test(tc_string, test_snprintf_long, 2);
    tcase_add_test(tc_string, test_asprintf_ok);
    tcase_add_test(tc_string, test_human_size);
    tcase_add_test(tc_string, test_strmatch);
    suite_add_tcase (s, tc_string);

    /* Memory test case */
    TCase *tc_mem = tcase_create ("memory");
    tcase_add_test(tc_mem, test_malloc_ok);
    tcase_add_test(tc_mem, test_calloc_ok);
    tcase_add_test(tc_mem, test_realloc_ok);
    suite_add_tcase (s, tc_mem);

    /* Array test case */
    TCase *tc_array = tcase_create ("array");
    tcase_add_test(tc_array, test_array_push);
    tcase_add_test(tc_array, test_array_push_multi);
    tcase_add_test(tc_array, test_array_push_int);
    suite_add_tcase (s, tc_array);

    return s;
}
END_TEST

Suite * numerals_suite(void) {
    Suite *s;
    TCase *tc_basic;

    s = suite_create("numerals");
    tc_basic = tcase_create("basic");

    tcase_add_test(tc_basic, add_i_and_i_produces_ii);
    tcase_add_test(tc_basic, add_i_and_ii_produces_iii);
    tcase_add_test(tc_basic, add_iv_and_viii_produces_xii);
    tcase_add_test(tc_basic, add_xxvii_and_xl_produces_lxvii);

    tcase_add_test(tc_basic, subtract_ix_from_c_produces_xci);
    tcase_add_test(tc_basic, subtract_xix_from_xliii_produces_xxiv);

    tcase_add_test(tc_basic, char_i_or_I_translates_to_int_1);
    tcase_add_test(tc_basic, char_v_or_V_translates_to_int_5);
    tcase_add_test(tc_basic, char_x_or_X_translates_to_int_10);
    tcase_add_test(tc_basic, char_l_or_L_translates_to_int_50);
    tcase_add_test(tc_basic, char_c_or_C_translates_to_int_100);
    tcase_add_test(tc_basic, char_d_or_D_translates_to_int_500);
    tcase_add_test(tc_basic, char_m_or_M_translates_to_int_1000);
    tcase_add_exit_test(tc_basic, invalid_char_causes_program_exit_with_status_1, 1);

    tcase_add_test(tc_basic, numeral_ii_translates_to_int_2);
    tcase_add_test(tc_basic, numeral_iii_translates_to_int_3);
    tcase_add_test(tc_basic, numeral_iv_translates_to_int_4);
    tcase_add_test(tc_basic, numeral_vi_translates_to_value_6);
    tcase_add_test(tc_basic, numeral_vii_translates_to_value_7);
    tcase_add_test(tc_basic, numeral_viii_translates_to_value_8);
    tcase_add_test(tc_basic, numeral_ix_translates_to_value_9);
    tcase_add_test(tc_basic, numeral_xl_translates_to_value_40);
    tcase_add_test(tc_basic, numeral_mcmxcii_translates_to_value_1992);
    tcase_add_test(tc_basic, numeral_mmxvi_translates_to_value_2016);
    tcase_add_test(tc_basic, numeral_mmdxxv_translates_to_value_2525);
    tcase_add_test(tc_basic, numeral_mmmcmxcix_translates_to_value_3999);

    tcase_add_test(tc_basic, int_2_translates_to_numeral_ii);
    tcase_add_test(tc_basic, int_3_translates_to_numeral_iii);
    tcase_add_test(tc_basic, int_2_translates_to_numeral_ii);
    tcase_add_test(tc_basic, int_3_translates_to_numeral_iii);
    tcase_add_test(tc_basic, int_4_translates_to_numeral_iv);
    tcase_add_test(tc_basic, int_9_translates_to_numeral_ix);
    tcase_add_test(tc_basic, int_40_translates_to_numeral_xl);
    tcase_add_test(tc_basic, int_90_translates_to_numeral_xc);
    tcase_add_test(tc_basic, int_400_translates_to_numeral_cd);
    tcase_add_test(tc_basic, int_900_translates_to_numeral_cm);

    suite_add_tcase(s, tc_basic);

    return s;
}
Ejemplo n.º 7
0
TCase *
bt_core_test_case (void)
{
  TCase *tc = tcase_create ("BtCoreTests");

  tcase_add_test (tc, test_bt_core_init_bad_arg_value);
  tcase_add_test (tc, test_bt_core_init_bad_arg);
  tcase_add_exit_test (tc, test_bt_core_init_bad_arg_exits, 1);
  tcase_add_checked_fixture (tc, test_setup, test_teardown);
  tcase_add_unchecked_fixture (tc, case_setup, case_teardown);
  return tc;
}
Ejemplo n.º 8
0
END_TEST

Suite *qsub_functions_suite(void)
  {
  Suite *s = suite_create("qsub_functions methods");
  TCase *tc_core = tcase_create("test x11_get_proto_1");
  tcase_add_test(tc_core, test_x11_get_proto_1);
  tcase_add_test(tc_core, test_process_opt_d);
  tcase_add_test(tc_core, test_process_opt_j);
  tcase_add_test(tc_core, test_process_opt_k);
  tcase_add_test(tc_core, test_process_opt_m);
  tcase_add_test(tc_core, test_process_opt_p);
  tcase_add_test(tc_core, test_retry_submit_error);
  suite_add_tcase(s, tc_core);

  tc_core = tcase_create("test isWindowsFormat");
  tcase_add_test(tc_core, test_isWindowsFormat);
  tcase_add_test(tc_core, test_process_opt_L);
  tcase_add_test(tc_core, test_add_new_request_if_present);
  tcase_add_test(tc_core, test_validate_basic_resourcing);
  suite_add_tcase(s, tc_core);
  
  if (are_we_forking() == true)
    {
    tc_core = tcase_create("test_failures");
    tcase_add_exit_test(tc_core, test_process_opt_L_fail1, 2);
    tcase_add_exit_test(tc_core, test_process_opt_L_fail2, 2);
    suite_add_tcase(s, tc_core);
    }

  tc_core = tcase_create("test_make_argv");
  tcase_add_test(tc_core, test_make_argv);
  suite_add_tcase(s, tc_core);

  return s;
  }
Ejemplo n.º 9
0
END_TEST

Suite* make_lib_utils_suite(void) {

    Suite *s = suite_create ("Utils");

    /* String test case */
    TCase *tc_string = tcase_create ("string");
    tcase_add_test(tc_string, test_sprintf_ok);
    tcase_add_exit_test(tc_string, test_sprintf_fail, 2);
    tcase_add_test(tc_string, test_snprintf_ok);
    tcase_add_exit_test(tc_string, test_snprintf_long, 2);
    tcase_add_test(tc_string, test_asprintf_ok);
    suite_add_tcase (s, tc_string);

    /* Memory test case */
    TCase *tc_mem = tcase_create ("memory");
    tcase_add_test(tc_mem, test_malloc_ok);
    tcase_add_test(tc_mem, test_calloc_ok);
    tcase_add_test(tc_mem, test_realloc_ok);
    suite_add_tcase (s, tc_mem);

    return s;
}
Ejemplo n.º 10
0
END_TEST

Suite *
opts_suite(void)
{
	Suite *s;
	TCase *tc;
	s = suite_create("opts");

	tc = tcase_create("proxyspec_parse");
	tcase_add_test(tc, proxyspec_parse_01);
#ifndef TRAVIS
	tcase_add_test(tc, proxyspec_parse_02); /* IPv6 */
#endif /* !TRAVIS */
#ifndef DOCKER
	tcase_add_exit_test(tc, proxyspec_parse_03, EXIT_FAILURE);
	tcase_add_exit_test(tc, proxyspec_parse_04, EXIT_FAILURE);
#endif /* !DOCKER */
	tcase_add_test(tc, proxyspec_parse_05);
	tcase_add_test(tc, proxyspec_parse_06);
	tcase_add_test(tc, proxyspec_parse_07);
	tcase_add_test(tc, proxyspec_parse_08);
#ifndef DOCKER
	tcase_add_exit_test(tc, proxyspec_parse_09, EXIT_FAILURE);
	tcase_add_exit_test(tc, proxyspec_parse_10, EXIT_FAILURE);
#endif /* !DOCKER */
	tcase_add_test(tc, proxyspec_parse_11);
#ifndef DOCKER
	tcase_add_exit_test(tc, proxyspec_parse_12, EXIT_FAILURE);
#endif /* !DOCKER */
#ifndef TRAVIS
	tcase_add_test(tc, proxyspec_parse_13); /* IPv6 */
	tcase_add_test(tc, proxyspec_parse_14); /* IPv6 */
#endif /* !TRAVIS */
	tcase_add_test(tc, proxyspec_parse_15);
	tcase_add_test(tc, proxyspec_parse_16);
#ifndef DOCKER
	tcase_add_exit_test(tc, proxyspec_parse_17, EXIT_FAILURE);
#endif /* !DOCKER */
	tcase_add_test(tc, proxyspec_parse_18);
	suite_add_tcase(s, tc);

	tc = tcase_create("opts_debug");
	tcase_add_test(tc, opts_debug_01);
	suite_add_tcase(s, tc);

#ifdef DOCKER
	fprintf(stderr, "opts: 6 tests omitted because building in docker\n");
#endif
#ifdef TRAVIS
	fprintf(stderr, "opts: 3 tests omitted because building in travis\n");
#endif

	return s;
}
Ejemplo n.º 11
0
END_TEST

Suite *make_exit_suite(void)
{
  Suite *s;
  TCase *tc;

  s = suite_create("Exit");
  tc = tcase_create("Core");

  suite_add_tcase (s, tc);
  tcase_add_test(tc,test_early_exit_normal);
  tcase_add_exit_test(tc,test_early_exit_with_allowed_error,-1);
  tcase_add_loop_test(tc,loop_early_exit_normal,0,5);
  tcase_add_loop_exit_test(tc,loop_early_exit_allowed_exit,-2,0,5);
  return s;
}
Ejemplo n.º 12
0
END_TEST

Suite * eureject_suite(void) {
    Suite * s = suite_create("eureject");

    TCase * tc_eureject_config = tcase_create("config_test_case");
    tcase_add_test(tc_eureject_config, test_init_free_config);
    suite_add_tcase(s, tc_eureject_config);

    TCase * tc_summarize_stat_samples = tcase_create(
            "summarize_stat_samples_test_case");
    tcase_add_test(tc_summarize_stat_samples,
            test_summarize_stat_samples_p1_n4);
    tcase_add_test(tc_summarize_stat_samples,
            test_summarize_stat_samples_p1_n3);
    tcase_add_test(tc_summarize_stat_samples,
            test_summarize_stat_samples_p1_n3_c2);
    tcase_add_test(tc_summarize_stat_samples,
            test_summarize_stat_samples_p2_n3);
    tcase_add_test(tc_summarize_stat_samples,
            test_summarize_stat_samples_p2_n4);
    tcase_add_test(tc_summarize_stat_samples,
            test_summarize_stat_samples_p2_n5);
    tcase_add_exit_test(tc_summarize_stat_samples,
            test_summarize_stat_samples_p1_n4_missing_cell, 1);
    suite_add_tcase(s, tc_summarize_stat_samples);

    TCase * tc_reject = tcase_create("reject_test_case");
    tcase_add_test(tc_reject, test_reject_p1_n1_c4);
    tcase_add_test(tc_reject, test_reject_p1_n1_c2);
    tcase_add_test(tc_reject, test_reject_p2_n1_c4);
    tcase_add_test(tc_reject, test_reject_p1_n2_c4);
    tcase_add_test(tc_reject, test_reject_p2_n2_c4);
    tcase_add_test(tc_reject, test_reject_p2_n3_c4);
    suite_add_tcase(s, tc_reject);

    return s;
}
Ejemplo n.º 13
0
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);
}
Ejemplo n.º 14
0
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;
}
Ejemplo n.º 15
0
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;
}
Ejemplo n.º 16
0
END_TEST

void add_database_tests(Suite *s)
{
	TCase *tc_db = tcase_create("Database");
	tcase_add_test(tc_db, initdb_activates_database);
	tcase_add_test(tc_db, cleanhours_really_cleans_hours);
	tcase_add_test(tc_db, cleanhours_does_not_remove_current_data);
	tcase_add_test(tc_db, rotatedays_really_rotates_days);
	tcase_add_test(tc_db, rotatedays_updates_top10);
	tcase_add_test(tc_db, rotatemonths_really_rotates_months);
	tcase_add_test(tc_db, cachecount_when_empty);
	tcase_add_test(tc_db, cacheadd_success);
	tcase_add_test(tc_db, cachecount_when_filled);
	tcase_add_test(tc_db, cacheupdate_when_empty);
	tcase_add_test(tc_db, cacheupdate_when_filled);
	tcase_add_test(tc_db, cacheget_when_empty);
	tcase_add_test(tc_db, cacheget_when_filled);
	tcase_add_test(tc_db, cacheremove_when_empty);
	tcase_add_test(tc_db, cacheremove_when_filled);
	tcase_add_test(tc_db, simplehash_with_empty_strings);
	tcase_add_test(tc_db, simplehash_with_simple_strings);
	tcase_add_test(tc_db, cacheshow_empty);
	tcase_add_test(tc_db, cacheshow_filled);
	tcase_add_test(tc_db, cachestatus_empty);
	tcase_add_test(tc_db, cachestatus_filled);
	tcase_add_test(tc_db, cachestatus_full);
	tcase_add_test(tc_db, cacheflush_flushes_cache);
	tcase_add_test(tc_db, removedb_with_existing_files);
	tcase_add_test(tc_db, removedb_with_nonexisting_file);
	tcase_add_test(tc_db, checkdb_finds_existing_file);
	tcase_add_test(tc_db, checkdb_does_not_find_nonexisting_file);
	tcase_add_test(tc_db, readdb_with_empty_file);
	tcase_add_test(tc_db, readdb_with_empty_file_and_backup);
	tcase_add_test(tc_db, readdb_with_nonexisting_file);
	tcase_add_test(tc_db, readdb_with_existing_dbfile);
	tcase_add_test(tc_db, readdb_with_existing_dbfile_and_max_name_length);
	tcase_add_test(tc_db, readdb_with_existing_dbfile_with_rename);
	tcase_add_test(tc_db, readdb_with_existing_dbfile_and_over_max_name_length);
	tcase_add_test(tc_db, cleartop10_clears_top10);
	tcase_add_exit_test(tc_db, cleartop10_with_nonexisting_file, 1);
	tcase_add_test(tc_db, rebuilddbtotal_rebuilds_total);
	tcase_add_exit_test(tc_db, rebuilddbtotal_with_nonexisting_file, 1);
	tcase_add_test(tc_db, validatedb_with_initdb);
	tcase_add_test(tc_db, validatedb_with_invalid_totals);
	tcase_add_test(tc_db, validatedb_with_top10_use);
	tcase_add_test(tc_db, dbcheck_with_no_interfaces);
	tcase_add_test(tc_db, dbcheck_with_empty_cache);
	tcase_add_test(tc_db, dbcheck_with_no_changes_in_iflist);
	tcase_add_test(tc_db, dbcheck_with_filled_cache);
	tcase_add_test(tc_db, importdb_can_parse_exported_database);
	tcase_add_test(tc_db, database_outputs_do_not_crash);
	tcase_add_test(tc_db, showbar_with_zero_len_is_nothing);
	tcase_add_test(tc_db, showbar_with_big_max_and_small_numbers);
	tcase_add_test(tc_db, showbar_with_all_rx);
	tcase_add_test(tc_db, showbar_with_all_tx);
	tcase_add_test(tc_db, showbar_with_half_and_half);
	tcase_add_test(tc_db, showbar_with_one_tenth);
	tcase_add_test(tc_db, showbar_with_small_rx_shows_all_tx);
	tcase_add_test(tc_db, showbar_with_max_smaller_than_real_max);
	tcase_add_test(tc_db, showbar_can_also_do_mb_calculations);
	suite_add_tcase(s, tc_db);
}