Skip to content

Commit

Permalink
Unify arf tests
Browse files Browse the repository at this point in the history
  • Loading branch information
albinahlback committed Oct 18, 2023
1 parent 35a13af commit 24ce62b
Show file tree
Hide file tree
Showing 59 changed files with 324 additions and 636 deletions.
142 changes: 142 additions & 0 deletions src/arf/test/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/*
Copyright (C) 2023 Albin Ahlbäck
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <string.h>
#include <mpfr.h>

/* Include functions *********************************************************/

#include "t-abs_bound_le_2exp_fmpz.c"
#include "t-abs_bound_lt_2exp_fmpz.c"
#include "t-abs_bound_lt_2exp_si.c"
#include "t-add.c"
#include "t-add_fmpz_2exp.c"
#include "t-add_fmpz.c"
#include "t-addmul.c"
#include "t-addmul_fmpz.c"
#include "t-addmul_si.c"
#include "t-addmul_ui.c"
#include "t-add_si.c"
#include "t-add_ui.c"
#include "t-approx_dot.c"
#include "t-ceil.c"
#include "t-cmp_2exp_si.c"
#include "t-cmpabs_2exp_si.c"
#include "t-cmpabs.c"
#include "t-cmp.c"
#include "t-complex_mul.c"
#include "t-complex_sqr.c"
#include "t-div.c"
#include "t-dump_file.c"
#include "t-dump_str.c"
#include "t-floor.c"
#include "t-fma.c"
#include "t-frexp.c"
#include "t-get_d.c"
#include "t-get_fmpz.c"
#include "t-get_mpfr.c"
#include "t-get_str.c"
#include "t-is_int_2exp_si.c"
#include "t-mul.c"
#include "t-mul_fmpz.c"
#include "t-mul_si.c"
#include "t-mul_ui.c"
#include "t-mul_via_mpfr.c"
#include "t-neg_round.c"
#include "t-root.c"
#include "t-rsqrt.c"
#include "t-set_d.c"
#include "t-set_fmpq.c"
#include "t-set_fmpz_2exp.c"
#include "t-set_round.c"
#include "t-set_round_fmpz.c"
#include "t-set_round_mpz.c"
#include "t-set_round_ui.c"
#include "t-set_round_uiui.c"
#include "t-sosq.c"
#include "t-sqrt.c"
#include "t-sub.c"
#include "t-sub_fmpz.c"
#include "t-submul.c"
#include "t-submul_fmpz.c"
#include "t-submul_si.c"
#include "t-submul_ui.c"
#include "t-sub_si.c"
#include "t-sub_ui.c"
#include "t-sum.c"

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

test_struct tests[] =
{
TEST_FUNCTION(arf_abs_bound_le_2exp_fmpz),
TEST_FUNCTION(arf_abs_bound_lt_2exp_fmpz),
TEST_FUNCTION(arf_abs_bound_lt_2exp_si),
TEST_FUNCTION(arf_add),
TEST_FUNCTION(arf_add_fmpz_2exp),
TEST_FUNCTION(arf_add_fmpz),
TEST_FUNCTION(arf_addmul),
TEST_FUNCTION(arf_addmul_fmpz),
TEST_FUNCTION(arf_addmul_si),
TEST_FUNCTION(arf_addmul_ui),
TEST_FUNCTION(arf_add_si),
TEST_FUNCTION(arf_add_ui),
TEST_FUNCTION(arf_approx_dot),
TEST_FUNCTION(arf_ceil),
TEST_FUNCTION(arf_cmp_2exp_si),
TEST_FUNCTION(arf_cmpabs_2exp_si),
TEST_FUNCTION(arf_cmpabs),
TEST_FUNCTION(arf_cmp),
TEST_FUNCTION(arf_complex_mul),
TEST_FUNCTION(arf_complex_sqr),
TEST_FUNCTION(arf_div),
TEST_FUNCTION(arf_dump_file),
TEST_FUNCTION(arf_dump_str),
TEST_FUNCTION(arf_floor),
TEST_FUNCTION(arf_fma),
TEST_FUNCTION(arf_frexp),
TEST_FUNCTION(arf_get_d),
TEST_FUNCTION(arf_get_fmpz),
TEST_FUNCTION(arf_get_mpfr),
TEST_FUNCTION(arf_get_str),
TEST_FUNCTION(arf_is_int_2exp_si),
TEST_FUNCTION(arf_mul),
TEST_FUNCTION(arf_mul_fmpz),
TEST_FUNCTION(arf_mul_si),
TEST_FUNCTION(arf_mul_ui),
TEST_FUNCTION(arf_mul_via_mpfr),
TEST_FUNCTION(arf_neg_round),
TEST_FUNCTION(arf_root),
TEST_FUNCTION(arf_rsqrt),
TEST_FUNCTION(arf_set_d),
TEST_FUNCTION(arf_set_fmpq),
TEST_FUNCTION(arf_set_fmpz_2exp),
TEST_FUNCTION(arf_set_round),
TEST_FUNCTION(arf_set_round_fmpz),
TEST_FUNCTION(arf_set_round_mpz),
TEST_FUNCTION(arf_set_round_ui),
TEST_FUNCTION(arf_set_round_uiui),
TEST_FUNCTION(arf_sosq),
TEST_FUNCTION(arf_sqrt),
TEST_FUNCTION(arf_sub),
TEST_FUNCTION(arf_sub_fmpz),
TEST_FUNCTION(arf_submul),
TEST_FUNCTION(arf_submul_fmpz),
TEST_FUNCTION(arf_submul_si),
TEST_FUNCTION(arf_submul_ui),
TEST_FUNCTION(arf_sub_si),
TEST_FUNCTION(arf_sub_ui),
TEST_FUNCTION(arf_sum)
};

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

TEST_MAIN(tests)
14 changes: 3 additions & 11 deletions src/arf/test/t-abs_bound_le_2exp_fmpz.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/

#include "test_helpers.h"
#include "arf.h"

int main(void)
TEST_FUNCTION_START(arf_abs_bound_le_2exp_fmpz, state)
{
slong iter;
flint_rand_t state;

flint_printf("abs_bound_le_2exp_fmpz....");
fflush(stdout);

flint_randinit(state);

for (iter = 0; iter < 10000 * 0.1 * flint_test_multiplier(); iter++)
{
Expand Down Expand Up @@ -60,8 +55,5 @@ int main(void)
fmpz_clear(b);
}

flint_randclear(state);
flint_cleanup();
flint_printf("PASS\n");
return 0;
TEST_FUNCTION_END(state);
}
14 changes: 3 additions & 11 deletions src/arf/test/t-abs_bound_lt_2exp_fmpz.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/

#include "test_helpers.h"
#include "arf.h"

int main(void)
TEST_FUNCTION_START(arf_abs_bound_lt_2exp_fmpz, state)
{
slong iter;
flint_rand_t state;

flint_printf("abs_bound_lt_2exp_fmpz....");
fflush(stdout);

flint_randinit(state);

for (iter = 0; iter < 10000 * 0.1 * flint_test_multiplier(); iter++)
{
Expand Down Expand Up @@ -60,8 +55,5 @@ int main(void)
fmpz_clear(b);
}

flint_randclear(state);
flint_cleanup();
flint_printf("PASS\n");
return 0;
TEST_FUNCTION_END(state);
}
14 changes: 3 additions & 11 deletions src/arf/test/t-abs_bound_lt_2exp_si.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/

#include "test_helpers.h"
#include "arf.h"

int main(void)
TEST_FUNCTION_START(arf_abs_bound_lt_2exp_si, state)
{
slong iter;
flint_rand_t state;

flint_printf("abs_bound_lt_2exp_si....");
fflush(stdout);

flint_randinit(state);

for (iter = 0; iter < 10000 * 0.1 * flint_test_multiplier(); iter++)
{
Expand Down Expand Up @@ -81,8 +76,5 @@ int main(void)
fmpz_clear(b);
}

flint_randclear(state);
flint_cleanup();
flint_printf("PASS\n");
return 0;
TEST_FUNCTION_END(state);
}
14 changes: 3 additions & 11 deletions src/arf/test/t-add.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/

#include "test_helpers.h"
#include "arf.h"

int
Expand Down Expand Up @@ -62,15 +63,9 @@ arf_add_naive(arf_t z, const arf_t x, const arf_t y, slong prec, arf_rnd_t rnd)
}
}

int main(void)
TEST_FUNCTION_START(arf_add, state)
{
slong iter, iter2;
flint_rand_t state;

flint_printf("add....");
fflush(stdout);

flint_randinit(state);

for (iter = 0; iter < 10000 * 0.1 * flint_test_multiplier(); iter++)
{
Expand Down Expand Up @@ -201,8 +196,5 @@ int main(void)
fmpz_clear(t);
}

flint_randclear(state);
flint_cleanup();
flint_printf("PASS\n");
return 0;
TEST_FUNCTION_END(state);
}
14 changes: 3 additions & 11 deletions src/arf/test/t-add_fmpz.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/

#include "test_helpers.h"
#include "arf.h"

int
Expand All @@ -23,15 +24,9 @@ arf_add_fmpz_naive(arf_t z, const arf_t x, const fmpz_t y, slong prec, arf_rnd_t
return r;
}

int main(void)
TEST_FUNCTION_START(arf_add_fmpz, state)
{
slong iter, iter2;
flint_rand_t state;

flint_printf("add_fmpz....");
fflush(stdout);

flint_randinit(state);

for (iter = 0; iter < 10000 * 0.1 * flint_test_multiplier(); iter++)
{
Expand Down Expand Up @@ -106,8 +101,5 @@ int main(void)
fmpz_clear(y);
}

flint_randclear(state);
flint_cleanup();
flint_printf("PASS\n");
return 0;
TEST_FUNCTION_END(state);
}
14 changes: 3 additions & 11 deletions src/arf/test/t-add_fmpz_2exp.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/

#include "test_helpers.h"
#include "arf.h"

int
Expand All @@ -24,15 +25,9 @@ arf_add_fmpz_2exp_naive(arf_t z, const arf_t x,
return r;
}

int main(void)
TEST_FUNCTION_START(arf_add_fmpz_2exp, state)
{
slong iter, iter2;
flint_rand_t state;

flint_printf("add_fmpz_2exp_fmpz....");
fflush(stdout);

flint_randinit(state);

for (iter = 0; iter < 1000 * 0.1 * flint_test_multiplier(); iter++)
{
Expand Down Expand Up @@ -112,8 +107,5 @@ int main(void)
fmpz_clear(e);
}

flint_randclear(state);
flint_cleanup();
flint_printf("PASS\n");
return 0;
TEST_FUNCTION_END(state);
}
14 changes: 3 additions & 11 deletions src/arf/test/t-add_si.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/

#include "test_helpers.h"
#include "arf.h"
#include "long_extras.h"

Expand All @@ -24,15 +25,9 @@ arf_add_si_naive(arf_t z, const arf_t x, slong y, slong prec, arf_rnd_t rnd)
return r;
}

int main(void)
TEST_FUNCTION_START(arf_add_si, state)
{
slong iter, iter2;
flint_rand_t state;

flint_printf("add_si....");
fflush(stdout);

flint_randinit(state);

for (iter = 0; iter < 10000 * 0.1 * flint_test_multiplier(); iter++)
{
Expand Down Expand Up @@ -105,8 +100,5 @@ int main(void)
arf_clear(v);
}

flint_randclear(state);
flint_cleanup();
flint_printf("PASS\n");
return 0;
TEST_FUNCTION_END(state);
}
Loading

0 comments on commit 24ce62b

Please sign in to comment.