Questions tagged [quickcheck]

QuickCheck is a Haskell library for software testing. It generates test cases and validates them against assertions provided by the programmer.

422 questions
0
votes
1 answer

Quickcheck: generate a string made of chars from a given pool

propertyForStringsFromMyCharPool :: String -> Bool -- implementation main = T.quickCheck propertyForStringsFromMyCharPool Right now QuickCheck generates all kinds of strings, but I want to test my property only for strings from my pool of…
Caridorc
  • 6,222
  • 2
  • 31
  • 46
0
votes
0 answers

QuickCheck together with haskell-mode in emacs, ^H

When using QuickCheck together with haskell-mode in emacs, the output starts with (continuing up to the default of 100 tests): (0 tests)^H^H^H^H^H^H^H^H^H ^H^H^H^H^H^H^H^H^H(1 test) where ^H (Control H) is the UNIX terminal representation…
hkBst
  • 2,818
  • 10
  • 29
0
votes
0 answers

Haskell - Quickcheck error

As a school project i am going to create a graphic calculator. The following code comes from two files, Expr.hs and ExprQC.hs. From Expr.hs readExpr :: String -> Maybe Expr readExpr s = case expr modS of Just (a,"") -> Just a _ …
e_phed
  • 21
  • 3
0
votes
1 answer

Test several functions with the same list of value with quickCheck

Is it possible with quickCheck to perform tests on several function with the same list of value with the aim of making a benchmark on these function ? For example, I would like prop_test1 prop_test2 prop_test3 to be checked with the same list of…
JeanJouX
  • 2,555
  • 1
  • 25
  • 37
0
votes
1 answer

unreadable quickcheck log file after a test routine

I made a test routine for a Haskell program with quickcheck. I declared it in my cabal file with : Test-Suite routine_de_test Type: exitcode-stdio-1.0 Hs-Source-Dirs: test Main-is: Tests.hs and launched it with :…
JeanJouX
  • 2,555
  • 1
  • 25
  • 37
0
votes
0 answers

Pass Args to generate

Does QuickCheck have a way to pass an Args object (or at least specify the seed) to the generate (:: Gen a -> IO a) function (or something equivalent)? I see that it has quickCheckWith which takes an Args, but it can only return a Result. There…
dspyz
  • 5,280
  • 2
  • 25
  • 63
0
votes
1 answer

What is the latest release of quickcheck for R?

What is the latest release of quickcheck for R? If this answer became outdated, how would I find out, by hand or from within a program?
piccolbo
  • 1,305
  • 7
  • 17
0
votes
1 answer

Cabal not performing quickCheck test

I'm writing a cabal file to install a library written with Haskell. I want some tests (written with quickCheck) to be performed at installation. The cabal file looks like : ... build-type: Simple cabal-version: >=1.8 Test-Suite…
JeanJouX
  • 2,555
  • 1
  • 25
  • 37
0
votes
1 answer

Test a function with different list of value with quickCheck

I need to test a function with quickCheck with different range of values. my function is : prop_test (x,y,z) (i,j,k) ndiv and I would like to perform tests with : x,y,z randomly taken in the range 0 to 1000 i,j,k randomly taken in the range 1000…
JeanJouX
  • 2,555
  • 1
  • 25
  • 37
0
votes
1 answer

Issue using quickCheckAll and GHC 7.10.1 RC1

The following example compiles with GHC 7.8.4 and QuickCheck 2.7.6: {-# LANGUAGE TemplateHaskell #-} import Test.QuickCheck prop_id :: Eq a => a -> Bool prop_id x = x == x -- Hack to make $quickCheckAll work under GHC >= 7.8. return [] main ::…
asr
  • 1,166
  • 6
  • 18
0
votes
1 answer

Taking a value from the Gen monad to the IO monad

I'm generating a minesweeper board and want to generate the board based on where the first click (actually not a click, just a string written in the cmd representing a click) was done. This is a problem though, as I have to mix the Gen and IO monad.…
SiXoS
  • 535
  • 3
  • 14
0
votes
2 answers

Haskell quickCheck property for half Evens

I have a program that takes a list and halves each even number in a list halfEvens :: [Int] -> [Int] halfEvens xs = [if x `mod` 2 == 0 then x `div` 2 else x | x <- xs] and I want to write a quickCheck property for this functions which verifies if…
Diana
  • 1,417
  • 5
  • 25
  • 48
0
votes
1 answer

QuickCheck Tests for Custom Type

With the following Algebraic Data Type: data Cons a = Cons a (Cons a) | Empty deriving (Show, Eq) I wrote an instance of Arbitrary: My understanding is that it's necessary to create an instance of Arbitrary for QuickCheck to know how to find a Cons…
Kevin Meredith
  • 41,036
  • 63
  • 209
  • 384
0
votes
1 answer

Quickcheck, defining Arbitrary instances using a function whose result depends on its arguments

I have a function arbExample to generate a random Example data type which depends on a numbers of functions. I am trying to do some property testing by doing quickCheck prop_example, the problem is I don't know how to define an Arbitrary instance…
Bilal Syed Hussain
  • 8,664
  • 11
  • 38
  • 44
0
votes
3 answers

create an arbitrary intance of "type"

I have the following, type Pos = (Int, Int) I want to generate random values of this type with some restrictions (both has to be 0-8) I would like to do something like instance Arbitrary Pos where arbitrary = do x <- choose(0,8) …