On 06/22/2016 04:57 AM, Jeroen Demeyer wrote:
> 
>> b) randomized test, example: check for a number of randomly
>> generated number fields that arithmetic operations with randomly
>> generated number field elements gives the correct results.
>> Randomized tests help to identify issues that occur with input that
>> no one thought about testing.
> 
> This can be done with doctests.
> 

It's a little dangerous, our doctest framework uses the XKCD random
number generator. If you run ZZ.random_element() in a doctest it will
always output the same number. You have to work around it by calling
set_random_seed() before every test.

Apparently this was done so that doctest results involving random
numbers would be reproducible, which I find fascinating. A much better
approach would be to output the random seed whenever a test fails, but
now we have thousands of tests that don't know they're not getting
random numbers and will probably fail if we fix it.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to