Skip to content

Commit

Permalink
Use TEST_FUNCTION_FAIL macro
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Moss committed Oct 1, 2024
1 parent 20cfc06 commit 978827e
Showing 1 changed file with 11 additions and 56 deletions.
67 changes: 11 additions & 56 deletions src/fmpz_mod_mpoly/test/t-compose_fmpz_mod_mpoly.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,38 +46,23 @@ 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);
fmpz_mod_mpoly_set_str_pretty(C + 2, "1", NULL, ctxAC);
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);
fmpz_mod_mpoly_set_str_pretty(C + 2, "1", NULL, ctxAC);
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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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++)
{
Expand Down

0 comments on commit 978827e

Please sign in to comment.