BurntSushi/quickcheck — pull request #41 by aepsil0n (2014-11-29 14:15:33+00:00)
Title: Restructure implementation of Arbitrary for tuples

Arbitrary is implemented for n-tuples up to n=12. For completeness this also includes 1-tuples, which were missing before. This is achieved by refactoring the shrink implementations for an n-tuple to recurse to the implementation for an (n-1)-tuple. The resulting code pattern is simple enough to be generalized as a macro, which is then applied to larger tuples. It is not possible to go beyond 12-tuples, since Rust does not implement Clone for them.

Note that I have not yet added tests for tuples larger than 4-tuples, as I am not too familiar with the properties shrinking is supposed to fulfill. My solution works for 2, 3 and 4 and appears to be algorithmically equivalent, so I am fairly certain that it is correct. But in any case, I think somebody who is actually familiar with shrinking should review this and write the tests.