Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Week 3 Exercise 4 (First reaction) #5

Open
BertLisser opened this issue Sep 26, 2017 · 0 comments
Open

Week 3 Exercise 4 (First reaction) #5

BertLisser opened this issue Sep 26, 2017 · 0 comments

Comments

@BertLisser
Copy link

BertLisser commented Sep 26, 2017

First reaction:

Whilst the quickCheck run was successful it was slow, taking an average of 1:39, to complete 100 tests over 5 runs.

try (for example)

verboseCheckWith stdArgs { maxSize = 15 }
propIdGen = frequency [
    (60, choose(1, 3)),
    (30, choose(4, 7)),
    (9, choose(8, 20)),
    (1, choose(21, 10000000))]

Why this distribution?
I propose

(4, ...)
(2,...)
(1,...)

The sum of the frequencies doesn't need be 100.

Nice work. I continue with reading and understanding.

Important test cases are missed by excluding the empty list as argument.
See

lenGen::Gen Int
lenGen = frequency [
    (90, choose(2, 3)),
    (9, choose(4, 10)),
(1, choose(11, 50))]

I changed this into for example

lenGen::Gen Int
lenGen = frequency [
    (90, choose(0, 3))   --,
  --  (9, choose(4, 10)),
   -- (1, choose(11, 50))]

and added the line

fdg s' 0 = do return []

to fdg
and verboseCheck prop_validCnfConversion accepts al the test cases.

Very good work (=9)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant