Skip to content

Commit

Permalink
Debloat rest of current implemented test/main.c
Browse files Browse the repository at this point in the history
  • Loading branch information
albinahlback committed Oct 17, 2023
1 parent 3c11903 commit 62ee62d
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 2,628 deletions.
188 changes: 2 additions & 186 deletions src/acb/test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

/* Array of test functions ***************************************************/

int (*test_functions[])(void) =
test_struct tests[] =
{
TEST_FUNCTION(acb_acos),
TEST_FUNCTION(acb_acosh),
Expand Down Expand Up @@ -162,190 +162,6 @@ int (*test_functions[])(void) =
TEST_FUNCTION(acb_zeta)
};

char acb_acos_name[] = "acb_acos";
char acb_acosh_name[] = "acb_acosh";
char acb_agm1_name[] = "acb_agm1";
char acb_agm_name[] = "acb_agm";
char acb_approx_dot_name[] = "acb_approx_dot";
char acb_asin_name[] = "acb_asin";
char acb_asinh_name[] = "acb_asinh";
char acb_atan_name[] = "acb_atan";
char acb_atanh_name[] = "acb_atanh";
char acb_barnes_g_name[] = "acb_barnes_g";
char acb_bernoulli_poly_ui_name[] = "acb_bernoulli_poly_ui";
char acb_chebyshev_t_ui_name[] = "acb_chebyshev_t_ui";
char acb_chebyshev_u_ui_name[] = "acb_chebyshev_u_ui";
char acb_cos_pi_name[] = "acb_cos_pi";
char acb_cot_name[] = "acb_cot";
char acb_coth_name[] = "acb_coth";
char acb_cot_pi_name[] = "acb_cot_pi";
char acb_csc_name[] = "acb_csc";
char acb_csch_name[] = "acb_csch";
char acb_csc_pi_name[] = "acb_csc_pi";
char acb_csgn_name[] = "acb_csgn";
char acb_digamma_name[] = "acb_digamma";
char acb_div_name[] = "acb_div";
char acb_dot_name[] = "acb_dot";
char acb_dot_fmpz_name[] = "acb_dot_fmpz";
char acb_dot_si_name[] = "acb_dot_si";
char acb_dot_siui_name[] = "acb_dot_siui";
char acb_dot_ui_name[] = "acb_dot_ui";
char acb_dot_uiui_name[] = "acb_dot_uiui";
char acb_exp_name[] = "acb_exp";
char acb_exp_invexp_name[] = "acb_exp_invexp";
char acb_expm1_name[] = "acb_expm1";
char acb_exp_pi_i_name[] = "acb_exp_pi_i";
char acb_gamma_name[] = "acb_gamma";
char acb_get_abs_lbound_arf_name[] = "acb_get_abs_lbound_arf";
char acb_get_abs_ubound_arf_name[] = "acb_get_abs_ubound_arf";
char acb_get_mag_name[] = "acb_get_mag";
char acb_get_mag_lower_name[] = "acb_get_mag_lower";
char acb_inv_name[] = "acb_inv";
char acb_lambertw_name[] = "acb_lambertw";
char acb_lgamma_name[] = "acb_lgamma";
char acb_log1p_name[] = "acb_log1p";
char acb_log_name[] = "acb_log";
char acb_log_sin_pi_name[] = "acb_log_sin_pi";
char acb_mul_name[] = "acb_mul";
char acb_mul_naive_name[] = "acb_mul_naive";
char acb_polygamma_name[] = "acb_polygamma";
char acb_pow_name[] = "acb_pow";
char acb_pow_fmpz_name[] = "acb_pow_fmpz";
char acb_quadratic_roots_fmpz_name[] = "acb_quadratic_roots_fmpz";
char acb_rel_accuracy_bits_name[] = "acb_rel_accuracy_bits";
char acb_rgamma_name[] = "acb_rgamma";
char acb_rising2_ui_name[] = "acb_rising2_ui";
char acb_rising_ui_name[] = "acb_rising_ui";
char acb_rising_ui_get_mag_name[] = "acb_rising_ui_get_mag";
char acb_root_ui_name[] = "acb_root_ui";
char acb_rsqrt_name[] = "acb_rsqrt";
char acb_sec_name[] = "acb_sec";
char acb_sech_name[] = "acb_sech";
char acb_sgn_name[] = "acb_sgn";
char acb_sinc_name[] = "acb_sinc";
char acb_sin_cos_name[] = "acb_sin_cos";
char acb_sinc_pi_name[] = "acb_sinc_pi";
char acb_sinh_cosh_name[] = "acb_sinh_cosh";
char acb_sin_pi_name[] = "acb_sin_pi";
char acb_sqrt_name[] = "acb_sqrt";
char acb_tan_name[] = "acb_tan";
char acb_tanh_name[] = "acb_tanh";
char acb_tan_pi_name[] = "acb_tan_pi";
char acb_vec_unit_roots_name[] = "acb_vec_unit_roots";
char acb_zeta_name[] = "acb_zeta";

char * test_names[] =
{
acb_acos_name,
acb_acosh_name,
acb_agm1_name,
acb_agm_name,
acb_approx_dot_name,
acb_asin_name,
acb_asinh_name,
acb_atan_name,
acb_atanh_name,
acb_barnes_g_name,
acb_bernoulli_poly_ui_name,
acb_chebyshev_t_ui_name,
acb_chebyshev_u_ui_name,
acb_cos_pi_name,
acb_cot_name,
acb_coth_name,
acb_cot_pi_name,
acb_csc_name,
acb_csch_name,
acb_csc_pi_name,
acb_csgn_name,
acb_digamma_name,
acb_div_name,
acb_dot_name,
acb_dot_fmpz_name,
acb_dot_si_name,
acb_dot_siui_name,
acb_dot_ui_name,
acb_dot_uiui_name,
acb_exp_name,
acb_exp_invexp_name,
acb_expm1_name,
acb_exp_pi_i_name,
acb_gamma_name,
acb_get_abs_lbound_arf_name,
acb_get_abs_ubound_arf_name,
acb_get_mag_name,
acb_get_mag_lower_name,
acb_inv_name,
acb_lambertw_name,
acb_lgamma_name,
acb_log1p_name,
acb_log_name,
acb_log_sin_pi_name,
acb_mul_name,
acb_mul_naive_name,
acb_polygamma_name,
acb_pow_name,
acb_pow_fmpz_name,
acb_quadratic_roots_fmpz_name,
acb_rel_accuracy_bits_name,
acb_rgamma_name,
acb_rising2_ui_name,
acb_rising_ui_name,
acb_rising_ui_get_mag_name,
acb_root_ui_name,
acb_rsqrt_name,
acb_sec_name,
acb_sech_name,
acb_sgn_name,
acb_sinc_name,
acb_sin_cos_name,
acb_sinc_pi_name,
acb_sinh_cosh_name,
acb_sin_pi_name,
acb_sqrt_name,
acb_tan_name,
acb_tanh_name,
acb_tan_pi_name,
acb_vec_unit_roots_name,
acb_zeta_name
};

/* main function *************************************************************/

#define NUMBER_OF_TESTS (sizeof(test_functions) / sizeof(int (*)(void)))

int
main(int argc, char ** argv)
{
int ix, jx;

if (argc < 2)
{
for (ix = 0; ix < NUMBER_OF_TESTS; ix++)
if (test_functions[ix]())
flint_abort();
}
else
{
for (ix = 1; ix < argc; ix++)
{
for (jx = 0; jx < NUMBER_OF_TESTS; jx++)
{
/* If argument equals to test name, run it */
if (strcmp(argv[ix], test_names[jx]) == 0)
{
if (test_functions[jx]())
flint_abort();
break;
}
}

if (jx == NUMBER_OF_TESTS)
{
fprintf(stderr, "Error: Could not find test function for %s\n", argv[ix]);
flint_abort();
}
}
}

return 0;
}
TEST_MAIN(tests)
52 changes: 2 additions & 50 deletions src/acb_calc/test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,61 +19,13 @@

/* Array of test functions ***************************************************/

int (*test_functions[])(void) =
test_struct tests[] =
{
TEST_FUNCTION(acb_calc_cauchy_bound),
TEST_FUNCTION(acb_calc_integrate),
TEST_FUNCTION(acb_calc_integrate_taylor)
};

char acb_calc_cauchy_bound_name[] = "acb_calc_cauchy_bound";
char acb_calc_integrate_name[] = "acb_calc_integrate";
char acb_calc_integrate_taylor_name[] = "acb_calc_integrate_taylor";

char * test_names[] =
{
acb_calc_cauchy_bound_name,
acb_calc_integrate_name,
acb_calc_integrate_taylor_name
};

/* main function *************************************************************/

#define NUMBER_OF_TESTS (sizeof(test_functions) / sizeof(int (*)(void)))

int
main(int argc, char ** argv)
{
int ix, jx;

if (argc < 2)
{
for (ix = 0; ix < NUMBER_OF_TESTS; ix++)
if (test_functions[ix]())
flint_abort();
}
else
{
for (ix = 1; ix < argc; ix++)
{
for (jx = 0; jx < NUMBER_OF_TESTS; jx++)
{
/* If argument equals to test name, run it */
if (strcmp(argv[ix], test_names[jx]) == 0)
{
if (test_functions[jx]())
flint_abort();
break;
}
}

if (jx == NUMBER_OF_TESTS)
{
fprintf(stderr, "Error: Could not find test function for %s\n", argv[ix]);
flint_abort();
}
}
}

return 0;
}
TEST_MAIN(tests)
Loading

0 comments on commit 62ee62d

Please sign in to comment.