tag:blogger.com,1999:blog-21123659.post48783029780432694..comments2014-08-24T08:38:43.131+02:00Comments on koweycode: practical quickcheck (wanted)koweyhttp://www.blogger.com/profile/11175806459477851520noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-21123659.post-91399472753562195462009-02-05T10:11:00.000+01:002009-02-05T10:11:00.000+01:00Thanks for the comments, everyone! This makes me ...Thanks for the comments, everyone! This makes me even more motivated to work something out (Josef's remark that the bookkeeping is also not so bad in practice particularly interests me).<BR/><BR/>@blackdog: the test-framework package may help. Also, I checked out Stuart's TH solution, and commented in an email:<BR/><BR/>I wonder if it's worthwhile to spin something like this into a general<BR/>solution. Maybe it could print out some JSON with the property, its<BR/>module and the results, which one could then pass to a display script.<BR/>Or maybe I'm making things overly complicated :-)koweyhttp://www.blogger.com/profile/11175806459477851520noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-1494675658845514802009-02-05T01:47:00.000+01:002009-02-05T01:47:00.000+01:00I've been wrestling with the same thing - my exper...I've been wrestling with the same thing - my experience in the perl world is that there's a nice infrastructure for writing tests, and I haven't found it in Haskell. I'm sure people are writing tests, but we all hack up harnesses in our own idiosyncratic ways....blackdoghttp://www.blogger.com/profile/18068332203259510868noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-40239133974721444962009-02-04T15:23:00.000+01:002009-02-04T15:23:00.000+01:00For Bimap, I wrote a little haskell module that se...For Bimap, I wrote a little haskell module that searches a file for functions starting with "prop_" and uses TH to splice them into a little test harness.<BR/><BR/>There might be something better up on Hackage these days, but if not check out <A HREF="http://code.haskell.org/bimap/Test/" REL="nofollow">my solution</A>.Stuart Cookhttp://www.blogger.com/profile/05895745267633543750noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-24353418900148049832009-02-04T14:47:00.000+01:002009-02-04T14:47:00.000+01:00I totally recognize these thoughts. At one point I...I totally recognize these thoughts. At one point I had had a lot of exposure to QuickCheck (the authors sit down the hall) but I had various not particularly clear doubts about how to make it work for my code. But then I had to teach some people Haskell, including using QuickCheck, which meant that I had to learn it myself. And after that I was hooked.<BR/><BR/>Ok, so address your questions I can tell you how have done it. But I should say that I mostly have experience with QuickChecking small code bases. <BR/><BR/>I tend to write tests in the same module as the thing they're testing. I find this especially appropriate when I want to test for stuff that isn't exported, like the internal state of a data structure. However, I use cpp so that my tests are only there if I want them to, that is, they don't ship with the final compiled code. Since I'm using cpp anyway I might just as well have exported the internals in that case but I find this approach fits my mind more easily. <BR/><BR/>I do maintain a list of properties that are going to be run. I don't find that cumbersome at all, but maybe that's because I've mostly worked on small projects. I use this list for various things, like giving the properties nice names which I print out while testing them. I sometimes also have special testing parameters that I give in this list.<BR/><BR/>As for making sure that the properties are being tested, I make sure darcs run the tests each time I record a change.<BR/><BR/>Generally I find the bookkeeping that you seem to be afraid of not to be a problem in practice. The important thing is to decide on a setup, once you've done that it's not so hard to maintain.<BR/><BR/>Happy QuickChecking!Josefhttp://www.blogger.com/profile/13272830598221833253noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-56089242143460726982009-02-04T14:17:00.000+01:002009-02-04T14:17:00.000+01:00Ah-hah! So these dilemmas that I'm facing are not...Ah-hah! So these dilemmas that I'm facing are not only in my head then, if somebody is willing to write some scripts for them. Thanks! Hope to see something on hackage... :-) (still playing with the test-framework package at the moment)koweyhttp://www.blogger.com/profile/11175806459477851520noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-87049954591472455542009-02-04T12:52:00.000+01:002009-02-04T12:52:00.000+01:00I started writing a script to scan source code for...I started writing a script to scan source code for tests, then run them via Test.Framework. (But then I hosed my cabal install so stopped before I got very far. I need to fix that.)<BR/><BR/>My approach was to write tests in the module they test, and for the script to rewrite a copy of the source code if necessary to ensure they are exported.mooismhttp://mooism.livejournal.com/noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-58547272609516543342009-02-04T12:44:00.000+01:002009-02-04T12:44:00.000+01:00Second thought: maybe what I really want is a sort...Second thought: maybe what I really want is a sort of driver like quickcheck-script that scans my source code for properties and runs them. The twist is that it should accept some sort of text file that lets me organise my properties if I want. If it finds properties that aren't in the text file, it could emit a sort of warning about orphan properties.koweyhttp://www.blogger.com/profile/11175806459477851520noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-60632799514542263522009-02-04T12:40:00.000+01:002009-02-04T12:40:00.000+01:00Some notes on the thought process: if I put proper...Some notes on the thought process: if I put properties in a big properties module, then I have to export the functions I want to test, but to hide (ugh).<BR/><BR/>If I put all my properties in the same module as the functions I'm testing, then I may have to also (a) export them (b) import them somewhere else, and if I write my own custom driver (c) stick them in a list of properties. I guess I can live with that sort of pain if things I set up so I don't forget to do these things. But then again, maybe the convenience of just putting them all in one module makes sense.<BR/><BR/>Harumph.<BR/><BR/>Playing with test-frameworkkoweyhttp://www.blogger.com/profile/11175806459477851520noreply@blogger.com