You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to chalmer...@googlegroups.com
Hi!
When we are trying to test the update function with quickcheck, it often fails due to indices being out of bounds. When bounding positions to correct values, we get "Gave up! Only passed 7 tests". Is there a way to get quickcheck to create better values, without using a new Arbitrary? (since it seems that we should not write an Arbitrary for the Pos type)
Philip Steingrüber
unread,
Nov 27, 2014, 9:17:41 AM11/27/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to chalmer...@googlegroups.com
I have run into similar problems. I seem to remember that a way of discarding "invalid" test data was shown on one of the lectures. Can't find it now though. :/
David Sands
unread,
Nov 27, 2014, 9:29:29 AM11/27/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to chalmer...@googlegroups.com, Cecilia G
Generate and throw away bad values is not a sensible strategy as you discovered. QuickCheck just gives up.
We discussed several ways to tackle this problem in the lecture
Use arbitrary values but apply a function to them to get them in the right “shape”. E.g. If you want a natural number apply abs to an arbitrary integer.
Define a new data type containing the data you need and make it an instance of Arbitrary by defining the generator you want. Note that Pos is not a new data type, it is just a name for an existing data type.
Define the generator you need and use the quickCheck function forAll (see the documentation)