QuickCheck is a Haskell library for software testing. It generates test cases and validates them against assertions provided by the programmer.
Questions tagged [quickcheck]
422 questions
0
votes
2 answers
Multiple arbitrary calls returning same value
I expect the below code to produce a generator of lists of a of size 1, 2 or 3, with each element generated independently.
shortlist :: Arbitrary a => Gen [a]
shortlist = oneof $ map promote [[arbitrary],
…

pkinsky
- 1,718
- 2
- 23
- 28
0
votes
1 answer
QuickCheck prop to tasty prop
Im trying to go from from _prop example to write the same thing in Tasty.
(example from http://primitive-automaton.logdown.com/posts/142511/tdd-with-quickcheck)
game9_prop :: Game9 -> Bool
game9_prop = (9==) . length . unGame . unGame9
This is what…

user3139545
- 6,882
- 13
- 44
- 87
0
votes
1 answer
How to tap into hpc information during execution
Consider the following use case:
I have a QuickCheck test suite consisting of two test cases prop_testCase1 and prop_testCase2. Using hpc I can observe the code coverage of my test suite.
However, I'd like to get separate results for the coverage of…

DanielM
- 1,023
- 8
- 18
0
votes
4 answers
How do I constrain QuickCheck when using type synonyms?
I am using QuickCheck to run arbitrary test cases on my code. However, in one portion of my code I have the type synonym:
type Vector = [Double]
I also have a few functions that accept a number of Vectors as input. However, all of these functions…

sdasdadas
- 23,917
- 20
- 63
- 148
0
votes
1 answer
Weird string generated in QuickCheck
I have a small Parsec program which I test using a QuickCheck script that generates an input file and an intended parse in parallel.
My test usually run the 100 tests fine, but then suddenly as I was casually testing something, they failed with a…

Thomas Ahle
- 30,774
- 21
- 92
- 114
0
votes
1 answer
Error linking test-suite to library
I'm trying to write a test using quickcheck for a simple lexer i've written.
However, I seem to be falling foul of some sort of link error
I've building using cabal-dev
my .cabal file is building a library "mylib"
The library section has under its…

OllieB
- 1,431
- 9
- 14
0
votes
1 answer
Quick Check for CoffeeScript
Does it exist? I can't find it and it isn't listed on wikipedia. (which means it doesn't exist :) )
I know node.js has it. Not sure if writing my node app in coffeescript and applying quick check would…

The Internet
- 7,959
- 10
- 54
- 89
0
votes
1 answer
Generate triple (Network.HTTP.ResponseCode) using an instance of Arbitrary
I have a function that takes a ResponseCode from Network.HTTP. In order to test it with QuickCheck, I wanted to write an instance of Arbitrary for ResponseCode. (In case you don't know, a ResponseCode is just a triple of ints in that library: type…

rethab
- 7,170
- 29
- 46
-1
votes
1 answer
function application with lambda in haskell?
Having this code to test:
-- | this function checks if string or list are a palindrome
isPalindrome :: (Eq a) => [a] -> Bool
isPalindrome x =
if reverse x == x
then True
else False
I managed to write this:
--…
user3292534
-1
votes
1 answer
QuickCheck Generator - Arbitrary element of custom type
I am trying to generate arbitrary sized element for my custom data type:
newtype ZippList a = ZPL ([a], [a])
deriving (Show)
This is what I got:
instance Arbitrary a => Arbitrary (ZippList a) where
arbitrary = sized zipplist where
zipplist…

VSZM
- 1,341
- 2
- 17
- 31
-1
votes
1 answer
How do you generate a data frame with certain properties in QuickCheck
I'd like to generate a data.frame using the QuickCheck R library. The data.frame must have some non-random named columns that must have a certain type. When you run rdata.frame you get a completely random data.frame, with column names like col.1,…

JoelKuiper
- 4,362
- 2
- 22
- 33
-1
votes
1 answer
quickcheck test failing
I have a simple function set of converse functions (simple shift codes):
encode, decode :: Int -> String -> String
and they test fine by some simple manual tests, but a quickCheck test reports a failure:
*** Failed! Falsifiable (after 8 tests and…

guthrie
- 4,529
- 4
- 26
- 31
-2
votes
2 answers
How to falsify commutativity of function composition with QuickCheck
What is ex that should be pass to CoArbitrary of the following code?
How to use Function in Test.QuickCheck.Function to represent f and g in proposition?
is it correct to write , if not, how?
where types = [f, g] :: [Function]
Can variant accept…

M-Askman
- 400
- 4
- 17
-2
votes
2 answers
How to print generated result from arbitrary?
quickCheckResult only accept something -> Bool, then i mimic some example,
pass
[Colour] -> Bool
what is function of the bracket of [Colour]? why not Colour -> Bool?
How to pass Arbitrary instance to quickCheckResult?
data Colour = Green |…

M-Askman
- 400
- 4
- 17
-2
votes
1 answer
Haskell: create Function instance
I'm currently learning Haskell from the ever awesome Haskell from first principles, and while trying to check the functor instances for each datatype using QuickCheck, I've stumbled against a mayor problem creating a Function instance for my Four…