flint icon indicating copy to clipboard operation
flint copied to clipboard

More `is_canonical` functions for tests

Open albinahlback opened this issue 1 year ago • 2 comments

A good test should check that the output is canonical. Most modules miss such a function.

albinahlback avatar May 20 '24 12:05 albinahlback

BTW, a good way to automate such testing is to put a FLINT_ASSERT(is_canonical(...)) in the clear method.

fredrik-johansson avatar May 20 '24 13:05 fredrik-johansson

Yes, but I think it can be nice to be even more specific and check after function calls.

My thinking is that assertions should only be used to check (1) internal states and (2) that the user did not give any weird inputs (say user trying to multiply 7 by 3 in the integers modulo 5). Hence, it is my opinion that it is the test code's responsibility to check that the outputs are correct.

albinahlback avatar May 20 '24 14:05 albinahlback