From 978827e05609da2ea9eb9ec77222469e56dc0bbb Mon Sep 17 00:00:00 2001 From: Jake-Moss Date: Tue, 1 Oct 2024 10:04:09 +1000 Subject: [PATCH] Use `TEST_FUNCTION_FAIL` macro --- .../test/t-compose_fmpz_mod_mpoly.c | 67 +++---------------- 1 file changed, 11 insertions(+), 56 deletions(-) diff --git a/src/fmpz_mod_mpoly/test/t-compose_fmpz_mod_mpoly.c b/src/fmpz_mod_mpoly/test/t-compose_fmpz_mod_mpoly.c index a0bb4523e4..101fdd54b8 100644 --- a/src/fmpz_mod_mpoly/test/t-compose_fmpz_mod_mpoly.c +++ b/src/fmpz_mod_mpoly/test/t-compose_fmpz_mod_mpoly.c @@ -46,12 +46,7 @@ TEST_FUNCTION_START(fmpz_mod_mpoly_compose, state) if (fmpz_mod_mpoly_compose_fmpz_mod_mpoly(A, B, Cp, ctxB, ctxAC) || fmpz_mod_mpoly_compose_fmpz_mod_mpoly_horner(A1, B, Cp, ctxB, ctxAC) || fmpz_mod_mpoly_compose_fmpz_mod_mpoly_geobucket(A2, B, Cp, ctxB, ctxAC)) - { - printf("FAIL\n"); - flint_printf("Check non-example 1\n", i); - fflush(stdout); - flint_abort(); - } + TEST_FUNCTION_FAIL("Check non-example 1\n"); fmpz_mod_mpoly_set_str_pretty(C + 0, "x1", NULL, ctxAC); fmpz_mod_mpoly_set_str_pretty(C + 1, "2*x2", NULL, ctxAC); @@ -59,12 +54,7 @@ TEST_FUNCTION_START(fmpz_mod_mpoly_compose, state) if (!fmpz_mod_mpoly_compose_fmpz_mod_mpoly(A, B, Cp, ctxB, ctxAC) || !fmpz_mod_mpoly_compose_fmpz_mod_mpoly_horner(A1, B, Cp, ctxB, ctxAC) || !fmpz_mod_mpoly_compose_fmpz_mod_mpoly_geobucket(A2, B, Cp, ctxB, ctxAC)) - { - printf("FAIL\n"); - flint_printf("Check non-example 2\n", i); - fflush(stdout); - flint_abort(); - } + TEST_FUNCTION_FAIL("Check non-example 2\n"); fmpz_mod_mpoly_set_str_pretty(C + 0, "2*x1", NULL, ctxAC); fmpz_mod_mpoly_set_str_pretty(C + 1, "x2", NULL, ctxAC); @@ -72,12 +62,7 @@ TEST_FUNCTION_START(fmpz_mod_mpoly_compose, state) if (!fmpz_mod_mpoly_compose_fmpz_mod_mpoly(A, B, Cp, ctxB, ctxAC) || !fmpz_mod_mpoly_compose_fmpz_mod_mpoly_horner(A1, B, Cp, ctxB, ctxAC) || !fmpz_mod_mpoly_compose_fmpz_mod_mpoly_geobucket(A2, B, Cp, ctxB, ctxAC)) - { - printf("FAIL\n"); - flint_printf("Check example 3\n", i); - fflush(stdout); - flint_abort(); - } + TEST_FUNCTION_FAIL("Check example 3\n"); fmpz_mod_mpoly_clear(B, ctxB); fmpz_mod_mpoly_clear(A, ctxAC); @@ -144,24 +129,14 @@ TEST_FUNCTION_START(fmpz_mod_mpoly_compose, state) if (!fmpz_mod_mpoly_compose_fmpz_mod_mpoly(A1, B, C, ctxB, ctxAC) || !fmpz_mod_mpoly_compose_fmpz_mod_mpoly_horner(A2, B, C, ctxB, ctxAC) || !fmpz_mod_mpoly_compose_fmpz_mod_mpoly_geobucket(A3, B, C, ctxB, ctxAC)) - { - printf("FAIL\n"); - flint_printf("Check composition success with generators\n" - "i: %wd, j: %wd\n", i, j); - fflush(stdout); - flint_abort(); - } + TEST_FUNCTION_FAIL("Check composition success with generators\n" + "i: %wd, j: %wd\n", i, j); if (!fmpz_mod_mpoly_equal(A, A1, ctxAC) || !fmpz_mod_mpoly_equal(A, A2, ctxAC) || !fmpz_mod_mpoly_equal(A, A3, ctxAC)) - { - printf("FAIL\n"); - flint_printf("Check composition with generators\n" - "i: %wd, j: %wd\n", i, j); - fflush(stdout); - flint_abort(); - } + TEST_FUNCTION_FAIL("Check composition with generators\n" + "i: %wd, j: %wd\n", i, j); fmpz_mod_mpoly_assert_canonical(A, ctxAC); fmpz_mod_mpoly_assert_canonical(A1, ctxAC); @@ -223,24 +198,14 @@ TEST_FUNCTION_START(fmpz_mod_mpoly_compose, state) !fmpz_mod_mpoly_compose_fmpz_mod_mpoly_geobucket(g2, f, vals1, ctx, ctx) || !fmpz_mod_mpoly_equal(g, g1, ctx) || !fmpz_mod_mpoly_equal(g, g2, ctx)) - { - printf("FAIL\n"); - flint_printf("Check composition success\ni: %wd\n", i); - fflush(stdout); - flint_abort(); - } + TEST_FUNCTION_FAIL("Check composition success\ni: %wd\n", i); fmpz_mod_mpoly_assert_canonical(g, ctx); fmpz_mod_mpoly_assert_canonical(g1, ctx); fmpz_mod_mpoly_assert_canonical(g2, ctx); if (!fmpz_mod_mpoly_equal(f, g, ctx)) - { - printf("FAIL\n"); - flint_printf("Check composition with identity\ni: %wd\n", i); - fflush(stdout); - flint_abort(); - } + TEST_FUNCTION_FAIL("Check composition with identity\ni: %wd\n", i); fmpz_mod_mpoly_clear(f, ctx); fmpz_mod_mpoly_clear(g, ctx); @@ -322,12 +287,7 @@ TEST_FUNCTION_START(fmpz_mod_mpoly_compose, state) !fmpz_mod_mpoly_compose_fmpz_mod_mpoly_geobucket(g2, f, vals1, ctx1, ctx2) || !fmpz_mod_mpoly_equal(g, g1, ctx2) || !fmpz_mod_mpoly_equal(g, g2, ctx2)) - { - printf("FAIL\n"); - flint_printf("Check composition success\ni: %wd\n", i); - fflush(stdout); - flint_abort(); - } + TEST_FUNCTION_FAIL("Check composition success\ni: %wd\n", i); fmpz_mod_mpoly_assert_canonical(g, ctx2); fmpz_mod_mpoly_assert_canonical(g1, ctx2); @@ -337,12 +297,7 @@ TEST_FUNCTION_START(fmpz_mod_mpoly_compose, state) fmpz_mod_mpoly_evaluate_all_fmpz(ge, g, vals2, ctx2); if (!fmpz_equal(fe, ge)) - { - printf("FAIL\n"); - flint_printf("Check composition and evalall commute\ni: %wd\n", i); - fflush(stdout); - flint_abort(); - } + TEST_FUNCTION_FAIL("Check composition and evalall commute\ni: %wd\n", i); for (v = 0; v < nvars1; v++) {