Skip to content

Commit 978827e

Browse files
committed
Use TEST_FUNCTION_FAIL macro
1 parent 20cfc06 commit 978827e

File tree

1 file changed

+11
-56
lines changed

1 file changed

+11
-56
lines changed

src/fmpz_mod_mpoly/test/t-compose_fmpz_mod_mpoly.c

Lines changed: 11 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -46,38 +46,23 @@ TEST_FUNCTION_START(fmpz_mod_mpoly_compose, state)
4646
if (fmpz_mod_mpoly_compose_fmpz_mod_mpoly(A, B, Cp, ctxB, ctxAC) ||
4747
fmpz_mod_mpoly_compose_fmpz_mod_mpoly_horner(A1, B, Cp, ctxB, ctxAC) ||
4848
fmpz_mod_mpoly_compose_fmpz_mod_mpoly_geobucket(A2, B, Cp, ctxB, ctxAC))
49-
{
50-
printf("FAIL\n");
51-
flint_printf("Check non-example 1\n", i);
52-
fflush(stdout);
53-
flint_abort();
54-
}
49+
TEST_FUNCTION_FAIL("Check non-example 1\n");
5550

5651
fmpz_mod_mpoly_set_str_pretty(C + 0, "x1", NULL, ctxAC);
5752
fmpz_mod_mpoly_set_str_pretty(C + 1, "2*x2", NULL, ctxAC);
5853
fmpz_mod_mpoly_set_str_pretty(C + 2, "1", NULL, ctxAC);
5954
if (!fmpz_mod_mpoly_compose_fmpz_mod_mpoly(A, B, Cp, ctxB, ctxAC) ||
6055
!fmpz_mod_mpoly_compose_fmpz_mod_mpoly_horner(A1, B, Cp, ctxB, ctxAC) ||
6156
!fmpz_mod_mpoly_compose_fmpz_mod_mpoly_geobucket(A2, B, Cp, ctxB, ctxAC))
62-
{
63-
printf("FAIL\n");
64-
flint_printf("Check non-example 2\n", i);
65-
fflush(stdout);
66-
flint_abort();
67-
}
57+
TEST_FUNCTION_FAIL("Check non-example 2\n");
6858

6959
fmpz_mod_mpoly_set_str_pretty(C + 0, "2*x1", NULL, ctxAC);
7060
fmpz_mod_mpoly_set_str_pretty(C + 1, "x2", NULL, ctxAC);
7161
fmpz_mod_mpoly_set_str_pretty(C + 2, "1", NULL, ctxAC);
7262
if (!fmpz_mod_mpoly_compose_fmpz_mod_mpoly(A, B, Cp, ctxB, ctxAC) ||
7363
!fmpz_mod_mpoly_compose_fmpz_mod_mpoly_horner(A1, B, Cp, ctxB, ctxAC) ||
7464
!fmpz_mod_mpoly_compose_fmpz_mod_mpoly_geobucket(A2, B, Cp, ctxB, ctxAC))
75-
{
76-
printf("FAIL\n");
77-
flint_printf("Check example 3\n", i);
78-
fflush(stdout);
79-
flint_abort();
80-
}
65+
TEST_FUNCTION_FAIL("Check example 3\n");
8166

8267
fmpz_mod_mpoly_clear(B, ctxB);
8368
fmpz_mod_mpoly_clear(A, ctxAC);
@@ -144,24 +129,14 @@ TEST_FUNCTION_START(fmpz_mod_mpoly_compose, state)
144129
if (!fmpz_mod_mpoly_compose_fmpz_mod_mpoly(A1, B, C, ctxB, ctxAC) ||
145130
!fmpz_mod_mpoly_compose_fmpz_mod_mpoly_horner(A2, B, C, ctxB, ctxAC) ||
146131
!fmpz_mod_mpoly_compose_fmpz_mod_mpoly_geobucket(A3, B, C, ctxB, ctxAC))
147-
{
148-
printf("FAIL\n");
149-
flint_printf("Check composition success with generators\n"
150-
"i: %wd, j: %wd\n", i, j);
151-
fflush(stdout);
152-
flint_abort();
153-
}
132+
TEST_FUNCTION_FAIL("Check composition success with generators\n"
133+
"i: %wd, j: %wd\n", i, j);
154134

155135
if (!fmpz_mod_mpoly_equal(A, A1, ctxAC) ||
156136
!fmpz_mod_mpoly_equal(A, A2, ctxAC) ||
157137
!fmpz_mod_mpoly_equal(A, A3, ctxAC))
158-
{
159-
printf("FAIL\n");
160-
flint_printf("Check composition with generators\n"
161-
"i: %wd, j: %wd\n", i, j);
162-
fflush(stdout);
163-
flint_abort();
164-
}
138+
TEST_FUNCTION_FAIL("Check composition with generators\n"
139+
"i: %wd, j: %wd\n", i, j);
165140

166141
fmpz_mod_mpoly_assert_canonical(A, ctxAC);
167142
fmpz_mod_mpoly_assert_canonical(A1, ctxAC);
@@ -223,24 +198,14 @@ TEST_FUNCTION_START(fmpz_mod_mpoly_compose, state)
223198
!fmpz_mod_mpoly_compose_fmpz_mod_mpoly_geobucket(g2, f, vals1, ctx, ctx) ||
224199
!fmpz_mod_mpoly_equal(g, g1, ctx) ||
225200
!fmpz_mod_mpoly_equal(g, g2, ctx))
226-
{
227-
printf("FAIL\n");
228-
flint_printf("Check composition success\ni: %wd\n", i);
229-
fflush(stdout);
230-
flint_abort();
231-
}
201+
TEST_FUNCTION_FAIL("Check composition success\ni: %wd\n", i);
232202

233203
fmpz_mod_mpoly_assert_canonical(g, ctx);
234204
fmpz_mod_mpoly_assert_canonical(g1, ctx);
235205
fmpz_mod_mpoly_assert_canonical(g2, ctx);
236206

237207
if (!fmpz_mod_mpoly_equal(f, g, ctx))
238-
{
239-
printf("FAIL\n");
240-
flint_printf("Check composition with identity\ni: %wd\n", i);
241-
fflush(stdout);
242-
flint_abort();
243-
}
208+
TEST_FUNCTION_FAIL("Check composition with identity\ni: %wd\n", i);
244209

245210
fmpz_mod_mpoly_clear(f, ctx);
246211
fmpz_mod_mpoly_clear(g, ctx);
@@ -322,12 +287,7 @@ TEST_FUNCTION_START(fmpz_mod_mpoly_compose, state)
322287
!fmpz_mod_mpoly_compose_fmpz_mod_mpoly_geobucket(g2, f, vals1, ctx1, ctx2) ||
323288
!fmpz_mod_mpoly_equal(g, g1, ctx2) ||
324289
!fmpz_mod_mpoly_equal(g, g2, ctx2))
325-
{
326-
printf("FAIL\n");
327-
flint_printf("Check composition success\ni: %wd\n", i);
328-
fflush(stdout);
329-
flint_abort();
330-
}
290+
TEST_FUNCTION_FAIL("Check composition success\ni: %wd\n", i);
331291

332292
fmpz_mod_mpoly_assert_canonical(g, ctx2);
333293
fmpz_mod_mpoly_assert_canonical(g1, ctx2);
@@ -337,12 +297,7 @@ TEST_FUNCTION_START(fmpz_mod_mpoly_compose, state)
337297
fmpz_mod_mpoly_evaluate_all_fmpz(ge, g, vals2, ctx2);
338298

339299
if (!fmpz_equal(fe, ge))
340-
{
341-
printf("FAIL\n");
342-
flint_printf("Check composition and evalall commute\ni: %wd\n", i);
343-
fflush(stdout);
344-
flint_abort();
345-
}
300+
TEST_FUNCTION_FAIL("Check composition and evalall commute\ni: %wd\n", i);
346301

347302
for (v = 0; v < nvars1; v++)
348303
{

0 commit comments

Comments
 (0)