[Haskell-cafe] the purpose of QuickCheck's size parameter

Simon Thompson S.J.Thompson at kent.ac.uk
Sun Jun 17 10:40:08 UTC 2018


Because it works by increasing size, yes, it doesn’t need guidance about the order. On the other hand, you’re exploring a different part of the space of possible inputs. There’s also Lazy SmallCheck, too.

Which is best? There’s no clear answer to this, but a reasonable principle is to try a bundle of approaches if you want to argue that you have used a limited amount of testing resource in as prudent as possible a way.

Simon

> On 17 Jun 2018, at 11:28, Oliver Charles <ollie at ocharles.org.uk> wrote:
> 
> Is SmallCheck more principled in this regard, or would people consider that equally hacky?
> 
> On Sun, 17 Jun 2018, 10:18 am Petr Pudlák, <petr.mvd at gmail.com <mailto:petr.mvd at gmail.com>> wrote:
> PS: Just to make clear, it's not that I have something against QuickCheck or similar libraries, on the contrary, they're great! I'm just playing the devil's advocate to analyze and understand the concept.
> 
> ne 17. 6. 2018 v 4:05 odesílatel Oleg Grenrus <oleg.grenrus at iki.fi <mailto:oleg.grenrus at iki.fi>> napsal:
> Not only avoid extremely large trees, but in general guarantee termination of the generation process
> 
> Sent from my iPhone
> 
> On 15 Jun 2018, at 0.31, David Feuer <david.feuer at gmail.com <mailto:david.feuer at gmail.com>> wrote:
> 
>> data Foo a = Leaf a | Node [Foo a]
>> 
>> Without the size parameter, it's a bit tricky to control the distribution to avoid generating extremely large trees. I certainly agree, however, that the size parameter is an ugly and ill-specified hack.
>> 
>> On Thu, Jun 14, 2018, 4:20 PM Petr Pudlák <petr.mvd at gmail.com <mailto:petr.mvd at gmail.com>> wrote:
>> Hi everyone,
>> 
>> I'd like to better understand the principles behind the 'size' parameter. Looking at quickCheckWithResult [1], its computation seems to be somewhat non-trivial, or even arbitrary. As far as I understand it, the size is varied throughout tests, increasing from small to larger values. I see two main purposes:
>> 
>> - Test on smaller as well as larger values. But with generators having proper distribution of values, this should happen anyway, just as if we had a constant, larger 'size' parameter.
>> - Starting with smaller sizes allows to find smaller count-examples first. But with shrinking, it doesn't matter that much, big counter-examples are shrunk to smaller ones anyway in most cases.
>> 
>> So is this parameter actually necessary? Would anything change considerably if it was dropped?
>> 
>> Thanks,
>> Petr
>> 
>> [1] http://hackage.haskell.org/package/QuickCheck-2.11.3/docs/src/Test-QuickCheck-Test.html#quickCheckWithResult <http://hackage.haskell.org/package/QuickCheck-2.11.3/docs/src/Test-QuickCheck-Test.html#quickCheckWithResult>_______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe <http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe>
>> Only members subscribed via the mailman list are allowed to post.
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe <http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe>
>> Only members subscribed via the mailman list are allowed to post.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe <http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe>
> Only members subscribed via the mailman list are allowed to post.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.

Simon Thompson | Professor of Logic and Computation 
School of Computing | University of Kent | Canterbury, CT2 7NF, UK
s.j.thompson at kent.ac.uk <mailto:s.j.thompson at kent.ac.uk> | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt <http://www.cs.kent.ac.uk/~sjt>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180617/eb59832f/attachment.html>


More information about the Haskell-Cafe mailing list