tag:blogger.com,1999:blog-2615156186192493130.post8640248175803711548..comments2023-11-02T04:52:30.047-07:00Comments on Abstract Absurdities: Sussman, Robustness, & QuickcheckCreighton Hogghttp://www.blogger.com/profile/09820771070038676909noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-2615156186192493130.post-34510692437229112152010-07-16T09:11:19.851-07:002010-07-16T09:11:19.851-07:00meet my best site -
[url=http://www.young-dro.com...meet my best site -<br /><br />[url=http://www.young-dro.com/profiles/blogs/buy-cheap-paxil-paxil-lawsuits] paxil lawsuits [/url]<br /><br />http://www.young-dro.com/profiles/blogs/buy-cheap-paxil-paxil-lawsuits <br />[url=http://www.young-dro.com/profiles/blogs/buy-cheap-paxil-paxil-lawsuits] paxil lawyers in indiana [/url]Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2615156186192493130.post-57647115519426567222007-02-21T12:36:00.000-08:002007-02-21T12:36:00.000-08:00Thanks Tom, you're right. I thought that doing df...Thanks Tom, you're right. I thought that doing <BR/>dfs x t ==> bfs x t <BR/>would be a cute way to show that feature of QuickCheck but you're quite correct.Creighton Hogghttps://www.blogger.com/profile/09820771070038676909noreply@blogger.comtag:blogger.com,1999:blog-2615156186192493130.post-73496240698126307872007-02-21T08:31:00.000-08:002007-02-21T08:31:00.000-08:00Whoops. Typo in my previous post. I meant to write...Whoops. Typo in my previous post. I meant to write this: "For example, you can replace (bfs x t) with the constant True, which certainly is *not* a correct breadth-first-search implementation ..."Tom Moertelhttps://www.blogger.com/profile/10226129953235804273noreply@blogger.comtag:blogger.com,1999:blog-2615156186192493130.post-9990360007637804262007-02-21T08:27:00.000-08:002007-02-21T08:27:00.000-08:00Tom Moertel (http://blog.moertel.com/) here, posti...Tom Moertel (http://blog.moertel.com/) here, posting from who-knows-what Blogger account. Anyway...<BR/><BR/>As your QC property is currently defined,<BR/><BR/>prop_Search t x = dfs x t ==> bfs x t<BR/><BR/>you're only testing that (bfs x t) returns True when (dfs x t) does, which probably isn't what you want. For example, you can replace (bfs x t) with the constant True, which certainly is a correct breadth-first-search implementation, and the property checks:<BR/><BR/>prop_Search t x = dfs x t ==> True <BR/><BR/>*Test> quickCheck prop_Search<BR/>OK, passed 100 tests.<BR/><BR/>Try using a straight equality test instead:<BR/><BR/>prop_Search' t x = dfs x t == bfs x t<BR/><BR/>*Test> quickCheck prop_Search'<BR/>OK, passed 100 tests.<BR/><BR/><BR/>Also, you might want to monitor the sizes of the trees tested, just to make sure you're actually testing non-trivial trees. Something like this ought to do it:<BR/><BR/>size :: Tree a -> Int<BR/>size t = size' 0 t where<BR/> size' n (Node _) = 1 + n<BR/> size' n (Branch l x r) = size' (size' (1 + n) l) r<BR/><BR/>prop_Search' t x =<BR/> label (show (size t)) $<BR/> dfs x t == bfs x t<BR/><BR/>*Test> quickCheck prop_Search'<BR/>OK, passed 100 tests.<BR/>54% 1.<BR/>11% 3.<BR/>6% 5.<BR/>4% 7.<BR/>4% 15.<BR/>3% 11.<BR/>2% 9.<BR/>2% 13.<BR/>1% 83.<BR/>1% 53.<BR/>1% 511.<BR/>1% 47.<BR/>1% 43467.<BR/>1% 43.<BR/>1% 415.<BR/>1% 35.<BR/>1% 299.<BR/>1% 25.<BR/>1% 21.<BR/>1% 199.<BR/>1% 17.<BR/>1% 105.<BR/><BR/><BR/>Cheers,<BR/>TomTom Moertelhttps://www.blogger.com/profile/10226129953235804273noreply@blogger.com