quickcheck

What is the general case of QuickCheck's promote function?

Deadly 提交于 2020-01-11 04:50:06
问题 What is the general term for a functor with a structure resembling QuickCheck's promote function, i.e., a function of the form: promote :: (a -> f b) -> f (a -> b) (this is the inverse of flip $ fmap (flip ($)) :: f (a -> b) -> (a -> f b) ). Are there even any functors with such an operation, other than (->) r and Id ? (I'm sure there must be). Googling 'quickcheck promote' only turned up the QuickCheck documentation, which doesn't give promote in any more general context AFAICS; searching SO

QuickCheck: Arbitrary instances of nested data structures that generate balanced specimens

泄露秘密 提交于 2019-12-28 12:17:35
问题 tl;dr: how do you write instances of Arbitrary that don't explode if your data type allows for way too much nesting? And how would you guarantee these instances produce truly random specimens of your data structure? I want to generate random tree structures, then test certain properties of these structures after I've mangled them with my library code. (NB: I'm writing an implementation of a subtyping algorithm, i.e. given a hierarchy of types, is type A a subtype of type B. This can be made

Haskell, IO, monads, quickcheck

拟墨画扇 提交于 2019-12-25 07:59:17
问题 Beginner at Haskell here. I have a function, and a bunch of properties to test it with which I've written using quickcheck. The properties work when I run them individually in the interpreter, and the function checks out fine. However, manually quickchecking with each property in the interpreter by hand (quickCheck prop_this, quickCheck prop_that) is boring, monotonous, and time-consuming. I would like to stick all of this in a program, and have that program run all of the quickchecks. This

Clang error while installing QuickCheck for GHC 7.8.3 on OS X Yosemite 10.10 (14A389)

岁酱吖の 提交于 2019-12-23 11:59:40
问题 While installing the QuickCheck for Haskell GHC 7.8.3 on a OS X Yosemite 10.10 (14A389) system running on a Mac Pro 2013 with Xcode 6.1 (6A1052d), I'm running into the following clang error: $ cabal install QuickCheck Resolving dependencies... Configuring primitive-0.5.4.0... Building primitive-0.5.4.0... Preprocessing library primitive-0.5.4.0... [ 1 of 10] Compiling Data.Primitive.Internal.Compat ( Data/Primitive/Internal/Compat.hs, dist/build/Data/Primitive/Internal/Compat.o ) [ 2 of 10]

Clang error while installing QuickCheck for GHC 7.8.3 on OS X Yosemite 10.10 (14A389)

烈酒焚心 提交于 2019-12-23 11:59:03
问题 While installing the QuickCheck for Haskell GHC 7.8.3 on a OS X Yosemite 10.10 (14A389) system running on a Mac Pro 2013 with Xcode 6.1 (6A1052d), I'm running into the following clang error: $ cabal install QuickCheck Resolving dependencies... Configuring primitive-0.5.4.0... Building primitive-0.5.4.0... Preprocessing library primitive-0.5.4.0... [ 1 of 10] Compiling Data.Primitive.Internal.Compat ( Data/Primitive/Internal/Compat.hs, dist/build/Data/Primitive/Internal/Compat.o ) [ 2 of 10]

fscheck generating string with size between min & max

南楼画角 提交于 2019-12-23 10:18:38
问题 I try to write a FsCheck generator that generates strings with length in a given interval. My attempt is the following: let genString minLength maxLength = let isValidLength (s : string) = s.Length >= minLength && s.Length <= maxLength Arb.generate |> Gen.suchThat isValidLength |> Arb.fromGen ...and I get the error: "System.Exception : No instances of class FsCheck.Arbitrary`1[a] for type System.String with arguments set []" What am I doing wrong? thanks! UPDATE 1: I managed to write the

Have you used Quickcheck in a real project [closed]

江枫思渺然 提交于 2019-12-20 08:56:26
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . Quickcheck and its variants (even there is one in Java), seems to be interesting. However, apart from academic interest, is it really useful in a real application testing (Eg. a GUI application or Client/Server or even take StackOverflow itself)? Any experiences you had with

quickCheckAll always return “True”

[亡魂溺海] 提交于 2019-12-19 05:56:17
问题 I'm trying to use QuickCheck following another answer. I test like this: {-# LANGUAGE TemplateHaskell #-} import Test.QuickCheck import Test.QuickCheck.All last' :: [a] -> a last' [x] = x last' (_:xs) = last' xs prop_test x = last' x == last x check = do putStrLn "quickCheck" quickCheck (prop_test :: [Char]-> Bool) check2 = do putStrLn "quickCheckAll" $quickCheckAll Then I load it in winGHCI and call check and check2 . I get quickCheck *** Failed! (after 1 test): Exception: list.hs:(7,1)-(8

Testing IO actions with Monadic QuickCheck

痞子三分冷 提交于 2019-12-18 10:06:13
问题 Can anyone give me a brief example of testing IO actions using Monadic QuickCheck? 回答1: The Test.QuickCheck.Monadic module lets you test monadic code, even things that run in IO . A monadic property test is of type PropertyM m a , where m is the monad the test runs in and a is ultimately ignored. In the case of PropertyM IO a , you convert the monadic test to a Property by using monadicIO ; for all other monads, you use monadic instead (which takes a function to run the monad, something IO

“cookbook” for converting from QuickCheck1 to QuickCheck2?

爷,独闯天下 提交于 2019-12-12 10:33:08
问题 Is there a cookbook available for converting from QuickCheck1 to QuickCheck2? As some examples, defaultConfig (replaced by Args) and trivial were removed and CoArbitrary introduced. I did read the what's new in QuickCheck 2 (with single answer ...). 回答1: It appears that the author(s) of QuickCheck2 have not provided Release Notes which are typically used to answer questions like yours. Assuming (uh oh, we know what that means!) that the author(s) updated the API doc, you can compare it to the