flintlib / flint

FLINT (Fast Library for Number Theory)
http://www.flintlib.org
GNU Lesser General Public License v3.0
401 stars 235 forks source link

More `is_canonical` functions for tests #1990

Open albinahlback opened 1 month ago

albinahlback commented 1 month ago

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

fredrik-johansson commented 1 month ago

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

albinahlback commented 1 month ago

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.