flint icon indicating copy to clipboard operation
flint copied to clipboard

Use `TEST_FUNCTION_FAIL` in tests

Open albinahlback opened this issue 2 years ago • 3 comments

We should sort of standardize how tests fails, which I think is very suitable to do with a one call to flint_throw.

With #1646, a new error code is added for test fails, and it will also support printing FLINT types. Hence, I think that every test function should utilize flint_throw instead after this PR has been merged.

albinahlback avatar Dec 13 '23 10:12 albinahlback

Just a thought: instead of

flint_throw(FLINT_ERROR, "msg");
flint_throw(FLINT_TEST_FAIL, "msg");

we could simply have

flint_error("msg");
flint_test_fail("msg");

fredrik-johansson avatar Dec 16 '23 16:12 fredrik-johansson

Sounds reasonable.

albinahlback avatar Dec 16 '23 16:12 albinahlback

Don't use this, but rather TEST_FUNCTION_FAIL, such as

TEST_FUNCTION_FAIL(
    "Failed due to n < 10\n"
    "Got n = %{fmpz}\n",
    n);

albinahlback avatar Feb 25 '24 23:02 albinahlback