nick8325 / quickcheck

Automatic testing of Haskell programs.
Other
714 stars 119 forks source link

Unused argument to Test.QuickCheck.Test.localMin #200

Closed danr closed 6 years ago

danr commented 6 years ago

The third argument to localMin is never used: https://github.com/nick8325/quickcheck/blob/44379d9e7d406a8a6ca35d45b23cfc81b6a502b0/Test/QuickCheck/Test.hs#L441-L446

The only place I find where it is called with different arguments is from localMin': https://github.com/nick8325/quickcheck/blob/44379d9e7d406a8a6ca35d45b23cfc81b6a502b0/Test/QuickCheck/Test.hs#L467-L468

While I'm on the subject of the shrink loop: it seems like this loop never backtracks, is this correct? Is the intent with shrink-lists that the "best" shrinks are first in the list?

nick8325 commented 6 years ago

How weird! It looks like the extra parameter was introduced in ebc7cf2d but even then was never used.

Yes, no backtracking, it just picks the first failing element in the shrink list, in other words it finds a local minimum. This is because if you do backtracking there will be exponentially many shrink candidates. It can help to put more aggressive shrinks first as that can reduce the number of shrink steps needed.