#include "test_helpers.h"
#include "fmpq_poly.h"
TEST_FUNCTION_START(fmpq_poly_cmp, state)
{
int i, result;
for (i = 0; i < 1000 * flint_test_multiplier(); i++)
{
fmpq_poly_t f;
fmpq_poly_init(f);
fmpq_poly_randtest(f, state, n_randint(state, 100), 200);
result = (fmpq_poly_cmp(f, f) == 0);
if (!result)
{
flint_printf("FAIL:\n");
fmpq_poly_debug(f), flint_printf("\n");
fflush(stdout);
flint_abort();
}
fmpq_poly_clear(f);
}
for (i = 0; i < 1000 * flint_test_multiplier(); i++)
{
fmpq_poly_t f, g, h;
fmpq_poly_init(f);
fmpq_poly_init(g);
fmpq_poly_init(h);
fmpq_poly_randtest(f, state, n_randint(state, 100), 200);
fmpq_poly_randtest(g, state, n_randint(state, 100), 200);
fmpq_poly_randtest(h, state, n_randint(state, 100), 200);
result = !(fmpq_poly_cmp(f, g) <= 0) || !(fmpq_poly_cmp(g, h) <= 0)
|| (fmpq_poly_cmp(f, h) <= 0);
if (!result)
{
flint_printf("FAIL:\n");
fmpq_poly_debug(f), flint_printf("\n");
fmpq_poly_debug(g), flint_printf("\n");
fmpq_poly_debug(h), flint_printf("\n");
fflush(stdout);
flint_abort();
}
fmpq_poly_clear(f);
fmpq_poly_clear(g);
fmpq_poly_clear(h);
}
for (i = 0; i < 1000 * flint_test_multiplier(); i++)
{
fmpq_poly_t f, g;
fmpq_poly_init(f);
fmpq_poly_init(g);
fmpq_poly_randtest(f, state, n_randint(state, 100), 200);
fmpq_poly_randtest(g, state, n_randint(state, 100), 200);
result = (fmpq_poly_cmp(f, g) < 0) || (fmpq_poly_equal(f, g))
|| (fmpq_poly_cmp(f, g) > 0);
if (!result)
{
flint_printf("FAIL:\n");
fmpq_poly_debug(f), flint_printf("\n");
fmpq_poly_debug(g), flint_printf("\n");
flint_printf("cmp(f,g) = %d\n", fmpq_poly_cmp(f, g));
fflush(stdout);
flint_abort();
}
fmpq_poly_clear(f);
fmpq_poly_clear(g);
}
TEST_FUNCTION_END(state);
}