diff --git a/src/arith/test/main.c b/src/arith/test/main.c
new file mode 100644
index 0000000000..673706ec10
--- /dev/null
+++ b/src/arith/test/main.c
@@ -0,0 +1,69 @@
+/*
+ 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 .
+*/
+
+#include
+
+/* Include functions *********************************************************/
+
+#include "t-bell_number.c"
+#include "t-bell_number_multi_mod.c"
+#include "t-bell_number_nmod.c"
+#include "t-bell_number_nmod_vec.c"
+#include "t-bell_number_vec.c"
+#include "t-bernoulli_number.c"
+#include "t-bernoulli_number_denom.c"
+#include "t-bernoulli_number_vec.c"
+#include "t-bernoulli_polynomial.c"
+#include "t-chebyshev_t_polynomial.c"
+#include "t-chebyshev_u_polynomial.c"
+#include "t-divisors.c"
+#include "t-euler_number_vec.c"
+#include "t-euler_number_zeta.c"
+#include "t-euler_polynomial.c"
+#include "t-harmonic_number.c"
+#include "t-landau_function_vec.c"
+#include "t-number_of_partitions_vec.c"
+#include "t-ramanujan_tau.c"
+#include "t-stirling.c"
+#include "t-sum_of_squares.c"
+#include "t-swinnerton_dyer_polynomial.c"
+
+/* Array of test functions ***************************************************/
+
+test_struct tests[] =
+{
+ TEST_FUNCTION(arith_bell_number),
+ TEST_FUNCTION(arith_bell_number_multi_mod),
+ TEST_FUNCTION(arith_bell_number_nmod),
+ TEST_FUNCTION(arith_bell_number_nmod_vec),
+ TEST_FUNCTION(arith_bell_number_vec),
+ TEST_FUNCTION(arith_bernoulli_number),
+ TEST_FUNCTION(arith_bernoulli_number_denom),
+ TEST_FUNCTION(arith_bernoulli_number_vec),
+ TEST_FUNCTION(arith_bernoulli_polynomial),
+ TEST_FUNCTION(arith_chebyshev_t_polynomial),
+ TEST_FUNCTION(arith_chebyshev_u_polynomial),
+ TEST_FUNCTION(arith_divisors),
+ TEST_FUNCTION(arith_euler_number_vec),
+ TEST_FUNCTION(arith_euler_number_zeta),
+ TEST_FUNCTION(arith_euler_polynomial),
+ TEST_FUNCTION(arith_harmonic_number),
+ TEST_FUNCTION(arith_landau_function_vec),
+ TEST_FUNCTION(arith_number_of_partitions_vec),
+ TEST_FUNCTION(arith_ramanujan_tau),
+ TEST_FUNCTION(arith_stirling),
+ TEST_FUNCTION(arith_sum_of_squares),
+ TEST_FUNCTION(arith_swinnerton_dyer_polynomial)
+};
+
+/* main function *************************************************************/
+
+TEST_MAIN(tests)
diff --git a/src/arith/test/t-bell_number.c b/src/arith/test/t-bell_number.c
index 602a455b5d..94552892fa 100644
--- a/src/arith/test/t-bell_number.c
+++ b/src/arith/test/t-bell_number.c
@@ -9,6 +9,7 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "nmod.h"
#include "nmod_vec.h"
#include "fmpz.h"
@@ -25,13 +26,8 @@
#define MAXN_VEC 500
#endif
-int main(void)
+TEST_FUNCTION_START(arith_bell_number, state)
{
- FLINT_TEST_INIT(state);
-
- flint_printf("bell_number....");
- fflush(stdout);
-
{
slong len, prev_len;
fmpz * vb1, * vb2;
@@ -147,8 +143,5 @@ int main(void)
fmpz_clear(b);
}
- FLINT_TEST_CLEANUP(state);
-
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-bell_number_multi_mod.c b/src/arith/test/t-bell_number_multi_mod.c
index 0dce524816..9d6c7c533d 100644
--- a/src/arith/test/t-bell_number_multi_mod.c
+++ b/src/arith/test/t-bell_number_multi_mod.c
@@ -9,18 +9,14 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_bell_number_multi_mod, state)
{
slong i;
- FLINT_TEST_INIT(state);
-
- flint_printf("bell_number_multi_mod....");
- fflush(stdout);
-
for (i = 0; i < 100; i++)
{
slong n;
@@ -46,8 +42,5 @@ int main(void)
fmpz_clear(b2);
}
- FLINT_TEST_CLEANUP(state);
-
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-bell_number_nmod.c b/src/arith/test/t-bell_number_nmod.c
index e15d44cb01..6be43b95a5 100644
--- a/src/arith/test/t-bell_number_nmod.c
+++ b/src/arith/test/t-bell_number_nmod.c
@@ -9,19 +9,15 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "nmod.h"
#include "nmod_vec.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_bell_number_nmod, state)
{
slong i, j, iter;
- FLINT_TEST_INIT(state);
-
- flint_printf("bell_number_nmod....");
- fflush(stdout);
-
for (i = 0; i < 100 * flint_test_multiplier(); i++)
{
mp_ptr b;
@@ -56,8 +52,5 @@ int main(void)
_nmod_vec_clear(b);
}
- FLINT_TEST_CLEANUP(state);
-
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-bell_number_nmod_vec.c b/src/arith/test/t-bell_number_nmod_vec.c
index 11179f14d6..405fc97fc8 100644
--- a/src/arith/test/t-bell_number_nmod_vec.c
+++ b/src/arith/test/t-bell_number_nmod_vec.c
@@ -9,21 +9,18 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "nmod.h"
#include "nmod_vec.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_bell_number_nmod_vec, state)
{
mp_ptr b1, b2, b3;
slong n;
const slong maxn = 3000;
- FLINT_TEST_INIT(state);
-
- flint_printf("bell_number_nmod_vec....");
- fflush(stdout);
b1 = _nmod_vec_init(maxn);
b2 = _nmod_vec_init(maxn);
@@ -66,8 +63,5 @@ int main(void)
_nmod_vec_clear(b2);
_nmod_vec_clear(b3);
- FLINT_TEST_CLEANUP(state);
-
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-bell_number_vec.c b/src/arith/test/t-bell_number_vec.c
index 051ed9f33d..8ec0348b4a 100644
--- a/src/arith/test/t-bell_number_vec.c
+++ b/src/arith/test/t-bell_number_vec.c
@@ -9,10 +9,11 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz_vec.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_bell_number_vec, state)
{
fmpz * b1;
fmpz * b2;
@@ -20,10 +21,6 @@ int main(void)
const slong maxn = 1000;
- FLINT_TEST_INIT(state);
-
- flint_printf("bell_number_vec....");
- fflush(stdout);
b1 = _fmpz_vec_init(maxn);
b2 = _fmpz_vec_init(maxn);
@@ -45,7 +42,5 @@ int main(void)
_fmpz_vec_clear(b1, maxn);
_fmpz_vec_clear(b2, maxn);
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-bernoulli_number.c b/src/arith/test/t-bernoulli_number.c
index 3db5c16969..9dfd5668a0 100644
--- a/src/arith/test/t-bernoulli_number.c
+++ b/src/arith/test/t-bernoulli_number.c
@@ -9,12 +9,13 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz.h"
#include "fmpz_vec.h"
#include "fmpq.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_bernoulli_number, state)
{
fmpz * num1;
fmpz * den1;
@@ -22,10 +23,6 @@ int main(void)
fmpz_t den2;
slong n, N;
- FLINT_TEST_INIT(state);
-
- flint_printf("bernoulli_number....");
- fflush(stdout);
N = 4000;
@@ -96,7 +93,5 @@ int main(void)
fmpz_clear(num2);
fmpz_clear(den2);
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-bernoulli_number_denom.c b/src/arith/test/t-bernoulli_number_denom.c
index 047aef249e..348a53c9ca 100644
--- a/src/arith/test/t-bernoulli_number_denom.c
+++ b/src/arith/test/t-bernoulli_number_denom.c
@@ -9,19 +9,16 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "ulong_extras.h"
#include "fmpz.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_bernoulli_number_denom, state)
{
fmpz_t s, t;
slong n;
- FLINT_TEST_INIT(state);
-
- flint_printf("bernoulli_number_denom....");
- fflush(stdout);
fmpz_init(s);
fmpz_init(t);
@@ -44,7 +41,5 @@ int main(void)
fmpz_clear(s);
fmpz_clear(t);
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-bernoulli_number_vec.c b/src/arith/test/t-bernoulli_number_vec.c
index 56e69b80c4..3f3fab1cda 100644
--- a/src/arith/test/t-bernoulli_number_vec.c
+++ b/src/arith/test/t-bernoulli_number_vec.c
@@ -9,11 +9,12 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz.h"
#include "fmpz_vec.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_bernoulli_number_vec, state)
{
fmpz * num1;
fmpz * num2;
@@ -21,10 +22,6 @@ int main(void)
fmpz * den2;
slong i, n, N;
- FLINT_TEST_INIT(state);
-
- flint_printf("bernoulli_number_vec....");
- fflush(stdout);
N = 2000;
@@ -65,7 +62,5 @@ int main(void)
_fmpz_vec_clear(den1, N);
_fmpz_vec_clear(den2, N);
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-bernoulli_polynomial.c b/src/arith/test/t-bernoulli_polynomial.c
index 4c841b7f3d..2672ad5e21 100644
--- a/src/arith/test/t-bernoulli_polynomial.c
+++ b/src/arith/test/t-bernoulli_polynomial.c
@@ -9,21 +9,18 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz.h"
#include "fmpq_poly.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_bernoulli_polynomial, state)
{
fmpq_poly_t P, Q;
fmpz_t t;
slong k, n;
- FLINT_TEST_INIT(state);
-
- flint_printf("bernoulli_polynomial....");
- fflush(stdout);
for (n = 0; n <= 100; n++)
{
@@ -62,7 +59,5 @@ int main(void)
fmpq_poly_clear(Q);
}
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-chebyshev_t_polynomial.c b/src/arith/test/t-chebyshev_t_polynomial.c
index 49f9bdd5ae..7797d23ca4 100644
--- a/src/arith/test/t-chebyshev_t_polynomial.c
+++ b/src/arith/test/t-chebyshev_t_polynomial.c
@@ -9,18 +9,15 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz_poly.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_chebyshev_t_polynomial, state)
{
fmpz_poly_t T0, T1, T2, t;
slong n;
- FLINT_TEST_INIT(state);
-
- flint_printf("chebyshev_t_polynomial....");
- fflush(stdout);
fmpz_poly_init(T0);
fmpz_poly_init(T1);
@@ -57,7 +54,5 @@ int main(void)
fmpz_poly_clear(T2);
fmpz_poly_clear(t);
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-chebyshev_u_polynomial.c b/src/arith/test/t-chebyshev_u_polynomial.c
index c64ce38545..3f8ff90cca 100644
--- a/src/arith/test/t-chebyshev_u_polynomial.c
+++ b/src/arith/test/t-chebyshev_u_polynomial.c
@@ -9,19 +9,16 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz_poly.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_chebyshev_u_polynomial, state)
{
fmpz_poly_t T, U;
slong n;
- FLINT_TEST_INIT(state);
-
- flint_printf("chebyshev_u_polynomial....");
- fflush(stdout);
fmpz_poly_init(T);
fmpz_poly_init(U);
@@ -47,7 +44,5 @@ int main(void)
fmpz_poly_clear(T);
fmpz_poly_clear(U);
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-divisors.c b/src/arith/test/t-divisors.c
index 8b16812020..d1e5699df2 100644
--- a/src/arith/test/t-divisors.c
+++ b/src/arith/test/t-divisors.c
@@ -9,6 +9,7 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz.h"
#include "fmpz_poly.h"
#include "arith.h"
@@ -31,16 +32,12 @@ void arith_divisors_naive(fmpz_poly_t p, slong n)
}
}
-int main(void)
+TEST_FUNCTION_START(arith_divisors, state)
{
fmpz_t t;
fmpz_poly_t a, b;
slong n;
- FLINT_TEST_INIT(state);
-
- flint_printf("divisors....");
- fflush(stdout);
fmpz_init(t);
fmpz_poly_init(a);
@@ -64,7 +61,5 @@ int main(void)
fmpz_poly_clear(a);
fmpz_poly_clear(b);
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-euler_number_vec.c b/src/arith/test/t-euler_number_vec.c
index 816ce3df02..d199103ea8 100644
--- a/src/arith/test/t-euler_number_vec.c
+++ b/src/arith/test/t-euler_number_vec.c
@@ -9,20 +9,17 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz.h"
#include "fmpz_vec.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_euler_number_vec, state)
{
fmpz * r;
fmpz_t s, t;
slong k, n;
- FLINT_TEST_INIT(state);
-
- flint_printf("euler_number_vec....");
- fflush(stdout);
for (n = 2; n <= 3000; n += (n<100) ? 2 : n/3)
{
@@ -55,7 +52,5 @@ int main(void)
_fmpz_vec_clear(r, n + 1);
}
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-euler_number_zeta.c b/src/arith/test/t-euler_number_zeta.c
index f2dab3a54d..450f7f25fa 100644
--- a/src/arith/test/t-euler_number_zeta.c
+++ b/src/arith/test/t-euler_number_zeta.c
@@ -9,20 +9,17 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz.h"
#include "fmpz_vec.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_euler_number_zeta, state)
{
fmpz * ress;
fmpz_t res;
slong n, N;
- FLINT_TEST_INIT(state);
-
- flint_printf("euler_number_zeta....");
- fflush(stdout);
N = 50;
@@ -47,7 +44,5 @@ int main(void)
_fmpz_vec_clear(ress, N);
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-euler_polynomial.c b/src/arith/test/t-euler_polynomial.c
index 9bea7b46ec..0ae436ea27 100644
--- a/src/arith/test/t-euler_polynomial.c
+++ b/src/arith/test/t-euler_polynomial.c
@@ -9,21 +9,18 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz.h"
#include "fmpq_poly.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_euler_polynomial, state)
{
fmpq_poly_t P, Q;
fmpz_t t;
slong k, n;
- FLINT_TEST_INIT(state);
-
- flint_printf("euler_polynomial....");
- fflush(stdout);
for (n = 0; n <= 100; n++)
{
@@ -66,7 +63,5 @@ int main(void)
fmpq_poly_clear(Q);
}
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-harmonic.c b/src/arith/test/t-harmonic_number.c
similarity index 94%
rename from src/arith/test/t-harmonic.c
rename to src/arith/test/t-harmonic_number.c
index 3272ec2bcd..ceaef4c523 100644
--- a/src/arith/test/t-harmonic.c
+++ b/src/arith/test/t-harmonic_number.c
@@ -9,6 +9,7 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "gmpcompat.h"
#include "mpn_extras.h"
#include "fmpq.h"
@@ -64,16 +65,12 @@ mpq_harmonic_balanced(mpq_t res, slong a, slong b)
mpq_clear(t);
}
-int main(void)
+TEST_FUNCTION_START(arith_harmonic_number, state)
{
slong i;
mpq_t x, y;
fmpq_t t;
- FLINT_TEST_INIT(state);
-
- flint_printf("harmonic_number....");
- fflush(stdout);
fmpq_init(t);
mpq_init(x);
@@ -128,7 +125,5 @@ int main(void)
mpq_clear(y);
fmpq_clear(t);
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-landau_function_vec.c b/src/arith/test/t-landau_function_vec.c
index 287e2bce24..d78ea454ef 100644
--- a/src/arith/test/t-landau_function_vec.c
+++ b/src/arith/test/t-landau_function_vec.c
@@ -9,10 +9,13 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz.h"
#include "fmpz_vec.h"
#include "arith.h"
+/* Defined in t-landau_function_vec.c and t-sum_of_squares.c */
+#define known known_landau_function_vec
static const mp_limb_t known[] = {
1, 1, 2, 3, 4, 6, 6, 12, 15, 20, 30, 30, 60, 60, 84, 105, 140, 210,
210, 420, 420, 420, 420, 840, 840, 1260, 1260, 1540, 2310, 2520,
@@ -20,15 +23,11 @@ static const mp_limb_t known[] = {
27720, 30030, 32760, 60060, 60060, 60060, 60060, 120120
};
-int main(void)
+TEST_FUNCTION_START(arith_landau_function_vec, state)
{
fmpz * res;
slong k, n;
- FLINT_TEST_INIT(state);
-
- flint_printf("landau_function_vec....");
- fflush(stdout);
n = 45;
res = _fmpz_vec_init(n);
@@ -48,7 +47,6 @@ int main(void)
_fmpz_vec_clear(res, n);
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
+#undef known
diff --git a/src/arith/test/t-number_of_partitions_vec.c b/src/arith/test/t-number_of_partitions_vec.c
index f5c09bf6c4..e4450f6abd 100644
--- a/src/arith/test/t-number_of_partitions_vec.c
+++ b/src/arith/test/t-number_of_partitions_vec.c
@@ -9,13 +9,14 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "nmod.h"
#include "nmod_vec.h"
#include "fmpz.h"
#include "fmpz_vec.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_number_of_partitions_vec, state)
{
fmpz * p;
mp_ptr pmod;
@@ -23,10 +24,6 @@ int main(void)
const slong maxn = 1000;
- FLINT_TEST_INIT(state);
-
- flint_printf("number_of_partitions_vec....");
- fflush(stdout);
p = _fmpz_vec_init(maxn);
pmod = _nmod_vec_init(maxn);
@@ -96,8 +93,5 @@ int main(void)
_fmpz_vec_clear(p, maxn);
_nmod_vec_clear(pmod);
- FLINT_TEST_CLEANUP(state);
-
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-ramanujan_tau.c b/src/arith/test/t-ramanujan_tau.c
index d8c7090244..afd4f34b0c 100644
--- a/src/arith/test/t-ramanujan_tau.c
+++ b/src/arith/test/t-ramanujan_tau.c
@@ -9,6 +9,7 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz.h"
#include "fmpz_poly.h"
#include "arith.h"
@@ -75,12 +76,8 @@ void consistency_check(slong n)
fmpz_poly_clear(p);
}
-int main(void)
+TEST_FUNCTION_START(arith_ramanujan_tau, state)
{
- FLINT_TEST_INIT(state);
-
- flint_printf("ramanujan_tau....");
- fflush(stdout);
check_value(0, "0");
check_value(1, "1");
@@ -153,7 +150,5 @@ int main(void)
consistency_check(11);
consistency_check(100);
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-stirling.c b/src/arith/test/t-stirling.c
index e3848ee36d..2266196fde 100644
--- a/src/arith/test/t-stirling.c
+++ b/src/arith/test/t-stirling.c
@@ -9,12 +9,13 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz.h"
#include "fmpz_vec.h"
#include "fmpz_mat.h"
#include "arith.h"
-int main(void)
+TEST_FUNCTION_START(arith_stirling, state)
{
fmpz_mat_t mat, mat2, mat3;
fmpz * row;
@@ -24,10 +25,6 @@ int main(void)
const slong maxn = 40;
- FLINT_TEST_INIT(state);
-
- flint_printf("stirling....");
- fflush(stdout);
fmpz_init(s);
@@ -307,7 +304,5 @@ int main(void)
fmpz_clear(s);
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
diff --git a/src/arith/test/t-sum_of_squares.c b/src/arith/test/t-sum_of_squares.c
index 22e09e08f5..7f060d41e8 100644
--- a/src/arith/test/t-sum_of_squares.c
+++ b/src/arith/test/t-sum_of_squares.c
@@ -9,12 +9,15 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz.h"
#include "fmpz_vec.h"
#include "arith.h"
#define N 10
+/* Defined in t-landau_function_vec.c and t-sum_of_squares.c */
+#define known known_sum_of_squares
static const fmpz known[N][N] = {
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 2, 0, 0, 2, 0, 0, 0, 0, 2},
@@ -28,16 +31,12 @@ static const fmpz known[N][N] = {
{1, 18, 144, 672, 2034, 4320, 7392, 12672, 22608, 34802}
};
-int main(void)
+TEST_FUNCTION_START(arith_sum_of_squares, state)
{
fmpz * r;
fmpz_t t;
slong i, j;
- FLINT_TEST_INIT(state);
-
- flint_printf("sum_of_squares....");
- fflush(stdout);
r = _fmpz_vec_init(N);
fmpz_init(t);
@@ -66,7 +65,7 @@ int main(void)
_fmpz_vec_clear(r, N);
fmpz_clear(t);
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}
+#undef N
+#undef known
diff --git a/src/arith/test/t-swinnerton_dyer_polynomial.c b/src/arith/test/t-swinnerton_dyer_polynomial.c
index 0fbba724d2..2f5ac32753 100644
--- a/src/arith/test/t-swinnerton_dyer_polynomial.c
+++ b/src/arith/test/t-swinnerton_dyer_polynomial.c
@@ -9,6 +9,7 @@
(at your option) any later version. See .
*/
+#include "test_helpers.h"
#include "fmpz_poly.h"
#include "arith.h"
@@ -27,16 +28,12 @@ static const mp_limb_t known_values[] =
UWORD(394942914)
};
-int main(void)
+TEST_FUNCTION_START(arith_swinnerton_dyer_polynomial, state)
{
fmpz_poly_t S;
mp_limb_t r;
slong n;
- FLINT_TEST_INIT(state);
-
- flint_printf("swinnerton_dyer_polynomial....");
- fflush(stdout);
for (n = 0; n <= 10; n++)
{
@@ -54,7 +51,5 @@ int main(void)
fmpz_poly_clear(S);
}
- FLINT_TEST_CLEANUP(state);
- flint_printf("PASS\n");
- return 0;
+ TEST_FUNCTION_END(state);
}