#ifdef T
#include "test_helpers.h"
#include "templates.h"
TEST_TEMPLATE_FUNCTION_START(T, poly_mulmod, state)
{
int i, result;
for (i = 0; i < 10 * flint_test_multiplier(); i++)
{
TEMPLATE(T, ctx_t) ctx;
TEMPLATE(T, poly_t) a, b, res, f;
TEMPLATE(T, ctx_init_randtest)(ctx, state, 3);
TEMPLATE(T, poly_init) (a, ctx);
TEMPLATE(T, poly_init) (b, ctx);
TEMPLATE(T, poly_init) (f, ctx);
TEMPLATE(T, poly_init) (res, ctx);
TEMPLATE(T, poly_randtest) (a, state, n_randint(state, 50), ctx);
TEMPLATE(T, poly_randtest) (b, state, n_randint(state, 50), ctx);
TEMPLATE(T, poly_randtest_not_zero) (f, state,
n_randint(state, 50) + 1, ctx);
TEMPLATE(T, poly_mulmod) (res, a, b, f, ctx);
TEMPLATE(T, poly_mulmod) (a, a, b, f, ctx);
result = (TEMPLATE(T, poly_equal) (res, a, ctx));
if (!result)
{
flint_printf("FAIL:\n");
flint_printf("a:\n");
TEMPLATE(T, poly_print) (a, ctx), flint_printf("\n\n");
flint_printf("b:\n");
TEMPLATE(T, poly_print) (b, ctx), flint_printf("\n\n");
flint_printf("f:\n");
TEMPLATE(T, poly_print) (f, ctx), flint_printf("\n\n");
flint_printf("res:\n");
TEMPLATE(T, poly_print) (res, ctx), flint_printf("\n\n");
fflush(stdout);
flint_abort();
}
TEMPLATE(T, poly_clear) (a, ctx);
TEMPLATE(T, poly_clear) (b, ctx);
TEMPLATE(T, poly_clear) (f, ctx);
TEMPLATE(T, poly_clear) (res, ctx);
TEMPLATE(T, ctx_clear) (ctx);
}
for (i = 0; i < 10 * flint_test_multiplier(); i++)
{
TEMPLATE(T, ctx_t) ctx;
TEMPLATE(T, poly_t) a, b, f, res;
TEMPLATE(T, ctx_init_randtest)(ctx, state, 3);
TEMPLATE(T, poly_init) (a, ctx);
TEMPLATE(T, poly_init) (b, ctx);
TEMPLATE(T, poly_init) (f, ctx);
TEMPLATE(T, poly_init) (res, ctx);
TEMPLATE(T, poly_randtest) (a, state, n_randint(state, 50), ctx);
TEMPLATE(T, poly_randtest) (b, state, n_randint(state, 50), ctx);
TEMPLATE(T, poly_randtest_not_zero) (f, state,
n_randint(state, 50) + 1, ctx);
TEMPLATE(T, poly_mulmod) (res, a, b, f, ctx);
TEMPLATE(T, poly_mulmod) (b, a, b, f, ctx);
result = (TEMPLATE(T, poly_equal) (res, b, ctx));
if (!result)
{
flint_printf("FAIL:\n");
flint_printf("a:\n");
TEMPLATE(T, poly_print) (a, ctx), flint_printf("\n\n");
flint_printf("b:\n");
TEMPLATE(T, poly_print) (b, ctx), flint_printf("\n\n");
flint_printf("f:\n");
TEMPLATE(T, poly_print) (f, ctx), flint_printf("\n\n");
flint_printf("res:\n");
TEMPLATE(T, poly_print) (res, ctx), flint_printf("\n\n");
fflush(stdout);
flint_abort();
}
TEMPLATE(T, poly_clear) (a, ctx);
TEMPLATE(T, poly_clear) (b, ctx);
TEMPLATE(T, poly_clear) (f, ctx);
TEMPLATE(T, poly_clear) (res, ctx);
TEMPLATE(T, ctx_clear) (ctx);
}
for (i = 0; i < 10 * flint_test_multiplier(); i++)
{
TEMPLATE(T, ctx_t) ctx;
TEMPLATE(T, poly_t) a, b, f, res;
TEMPLATE(T, ctx_init_randtest)(ctx, state, 3);
TEMPLATE(T, poly_init) (a, ctx);
TEMPLATE(T, poly_init) (b, ctx);
TEMPLATE(T, poly_init) (f, ctx);
TEMPLATE(T, poly_init) (res, ctx);
TEMPLATE(T, poly_randtest) (a, state, n_randint(state, 50), ctx);
TEMPLATE(T, poly_randtest) (b, state, n_randint(state, 50), ctx);
TEMPLATE(T, poly_randtest_not_zero) (f, state,
n_randint(state, 50) + 1, ctx);
TEMPLATE(T, poly_mulmod) (res, a, b, f, ctx);
TEMPLATE(T, poly_mulmod) (f, a, b, f, ctx);
result = (TEMPLATE(T, poly_equal) (res, f, ctx));
if (!result)
{
flint_printf("FAIL:\n");
flint_printf("a:\n");
TEMPLATE(T, poly_print) (a, ctx), flint_printf("\n\n");
flint_printf("b:\n");
TEMPLATE(T, poly_print) (b, ctx), flint_printf("\n\n");
flint_printf("f:\n");
TEMPLATE(T, poly_print) (f, ctx), flint_printf("\n\n");
flint_printf("res:\n");
TEMPLATE(T, poly_print) (res, ctx), flint_printf("\n\n");
fflush(stdout);
flint_abort();
}
TEMPLATE(T, poly_clear) (a, ctx);
TEMPLATE(T, poly_clear) (b, ctx);
TEMPLATE(T, poly_clear) (f, ctx);
TEMPLATE(T, poly_clear) (res, ctx);
TEMPLATE(T, ctx_clear) (ctx);
}
for (i = 0; i < 100 * flint_test_multiplier(); i++)
{
TEMPLATE(T, ctx_t) ctx;
TEMPLATE(T, poly_t) a, b, res1, res2, t, f;
TEMPLATE(T, ctx_init_randtest)(ctx, state, 3);
TEMPLATE(T, poly_init) (a, ctx);
TEMPLATE(T, poly_init) (b, ctx);
TEMPLATE(T, poly_init) (f, ctx);
TEMPLATE(T, poly_randtest) (a, state, n_randint(state, 50), ctx);
TEMPLATE(T, poly_randtest) (b, state, n_randint(state, 50), ctx);
TEMPLATE(T, poly_randtest_not_zero) (f, state,
n_randint(state, 50) + 1, ctx);
TEMPLATE(T, poly_init) (res1, ctx);
TEMPLATE(T, poly_init) (res2, ctx);
TEMPLATE(T, poly_init) (t, ctx);
TEMPLATE(T, poly_mulmod) (res1, a, b, f, ctx);
TEMPLATE(T, poly_mul) (res2, a, b, ctx);
TEMPLATE(T, poly_divrem) (t, res2, res2, f, ctx);
result = (TEMPLATE(T, poly_equal) (res1, res2, ctx));
if (!result)
{
flint_printf("FAIL:\n");
flint_printf("a:\n");
TEMPLATE(T, poly_print) (a, ctx), flint_printf("\n\n");
flint_printf("b:\n");
TEMPLATE(T, poly_print) (b, ctx), flint_printf("\n\n");
flint_printf("f:\n");
TEMPLATE(T, poly_print) (f, ctx), flint_printf("\n\n");
flint_printf("res1:\n");
TEMPLATE(T, poly_print) (res1, ctx), flint_printf("\n\n");
flint_printf("res2:\n");
TEMPLATE(T, poly_print) (res2, ctx), flint_printf("\n\n");
fflush(stdout);
flint_abort();
}
TEMPLATE(T, poly_clear) (a, ctx);
TEMPLATE(T, poly_clear) (b, ctx);
TEMPLATE(T, poly_clear) (f, ctx);
TEMPLATE(T, poly_clear) (res1, ctx);
TEMPLATE(T, poly_clear) (res2, ctx);
TEMPLATE(T, poly_clear) (t, ctx);
TEMPLATE(T, ctx_clear) (ctx);
}
TEST_FUNCTION_END(state);
}
#endif