Re: [Haskell-cafe] QuickCheck Questions

2011-08-02 Thread Øystein Kolsrud
Hi! I usually use the function 'sized' for this. The function would look something like this: myIntGen :: Gen Int myIntGen = sized $ \n - choose (0,f n) where 'f' is a function that uses the size value to generate an upper value for your random range. I usually use ^2 or sqrt or something like

[Haskell-cafe] QuickCheck Questions

2011-07-24 Thread Mark Spezzano
Hi all, I would appreciate it if someone can point me in the right direction with the following problem. I'm deliberately implementing a naive Queues packages that uses finite lists as the underlying representation. I've already read through Hughes' paper and the article in The Fun of

Re: [Haskell-cafe] QuickCheck Questions

2011-07-24 Thread Kevin Quick
On Sun, 24 Jul 2011 07:30:56 -0700, Mark Spezzano mark.spezz...@chariot.net.au wrote: Hi all, I would appreciate it if someone can point me in the right direction with the following problem. I'm deliberately implementing a naive Queues packages that uses finite lists as the underlying

Re: [Haskell-cafe] QuickCheck Questions

2011-07-24 Thread Mark Spezzano
Hi Kevin, Thanks for the response. The first part works well with minor modifications. Part 2 is still a bit vague to me. I basically want to clamp the Integers generated within the Queue to between 0 and some positive number. At present they're giving me numbers all over the place

Re: [Haskell-cafe] QuickCheck Questions

2011-07-24 Thread Ivan Lazar Miljenovic
On 25 July 2011 14:31, Mark Spezzano mark.spezz...@chariot.net.au wrote: Hi Kevin, Thanks for the response. The first part works well with minor modifications. Part 2 is still a bit vague to me. I basically want to clamp the Integers generated within the Queue to between 0 and some positive

Re: [Haskell-cafe] QuickCheck Questions

2009-09-28 Thread Yusaku Hashimoto
After a few more investigations, I can say QuickCheck does: - make easy to finding couter-cases and refactoring codes - make easy to test some functions if they have good mathematical properties - generate random test cases But QuickCheck does *not*: - help us to find good properties So what I

Re: [Haskell-cafe] QuickCheck Questions

2009-09-28 Thread Gwern Branwen
On Mon, Sep 28, 2009 at 10:59 AM, Yusaku Hashimoto nonow...@gmail.com wrote: After a few more investigations, I can say QuickCheck does: - make easy to finding couter-cases and refactoring codes - make easy to test some functions if they have good mathematical properties - generate random test

Re: [Haskell-cafe] QuickCheck Questions

2009-09-28 Thread Emil Axelsson
Not sure this is what you want, but I thought I'd mention Formal Specifications for Free: http://www.erlang.org/euc/08/1005Hughes2.pdf (I wasn't able to find a better link. That talk is for Erlang, but people are working on this for Haskell QuickCheck.) / Emil Yusaku Hashimoto skrev:

Re: [Haskell-cafe] QuickCheck Questions

2009-09-28 Thread Duncan Coutts
On Mon, 2009-09-28 at 23:59 +0900, Yusaku Hashimoto wrote: After a few more investigations, I can say QuickCheck does: - make easy to finding couter-cases and refactoring codes - make easy to test some functions if they have good mathematical properties - generate random test cases But

Re: [Haskell-cafe] QuickCheck Questions

2009-09-28 Thread Pasqualino Titto Assini
Fantastic. If I understand correctly it inductively derives equations that hold for a set of examples. I am looking forward to see it in Haskell, who is working on the port? titto 2009/9/28 Emil Axelsson e...@chalmers.se: Not sure this is what you want, but I thought I'd mention Formal

Re: [Haskell-cafe] QuickCheck Questions

2009-09-28 Thread Emil Axelsson
Pasqualino Titto Assini skrev: Fantastic. If I understand correctly it inductively derives equations that hold for a set of examples. AFAIU, it enumerates a set of terms and uses random testing to approximate an equivalence relation for these. The real trick, apparently, is in filtering out

[Haskell-cafe] QuickCheck Questions

2009-09-27 Thread Yusaku Hashimoto
Hello, I recently worked with QuickCheck for a while, But I still can't handle it well, And a few questions come to my mind. 1. How to find properties In QuickCheck examples on the codes or the papers, they find good properties easily. How did they find these properties? What property can make

Re: [Haskell-cafe] QuickCheck Questions

2009-09-27 Thread Gwern Branwen
On Sun, Sep 27, 2009 at 3:19 PM, Yusaku Hashimoto nonow...@gmail.com wrote: ... Do you think I wasted times? Have you ever tried PDD? And has it worked? If you have experience with TDD, how do you think about PDD? If you have any answers in any questions above, please tell me them. Thanks in

Re: [Haskell-cafe] QuickCheck Questions

2009-09-27 Thread Yusaku Hashimoto
On Mon, Sep 28, 2009 at 4:42 AM, Gwern Branwen gwe...@gmail.com wrote: On Sun, Sep 27, 2009 at 3:19 PM, Yusaku Hashimoto nonow...@gmail.com wrote: ... Do you think I wasted times? Have you ever tried PDD? And has it worked? If you have experience with TDD, how do you think about PDD? If