sympy/sympy — pull request #1353 by asmeurer (2012-06-14 05:22:15+00:00)
Title: Fix and test issue 3256

This is a fix and test for issue 3256, which is a test failure under a specific random seed. Thanks to @mattpap for the fix. To test this, I've modified the function `dmp_zz_wang` to take in a sequence of random numbers, and I then test the exact sequence that is produced by the problem seed. To verify that this fix works, I've cherry-picked just the test commit onto my 3256_no_fix branch. There, you will see that the test fails without @mattpap's commit that fixes the bug in the algorithm.

How do people feel about this method of testing random algorithms? It does not rely on any kind of random number generator, so there is no need to worry that a small change to a generator will invalidate an old test. Furthermore, it would be possible with this method to give any sequence of numbers, making it easy to test all parts of a given random algorithm (doing this with a seed would be either difficult or impossible, depending on how specific the sequence must be). The method is easy to do, and my little helper function could even be factored out if we find enough use for it. @smichr, what do you think?