433 questions
3
votes
1
answer
109
views
Which test inputs cause my QuickCheck property to hang? (`QC.within` is insufficient to break the loop)
I have a testcase for a complicated function that for unclear reasons tends to hang on certain platforms. I would like to know which test inputs cause the hanging behaviour.
I have tried to use ...
0
votes
1
answer
99
views
Adding the QuickCheck library to a stack project
I'm trying to add the QuickCheck library to my stack project, I've already added it to build depends on the .cabal file and when I run the stack build command I can see that the library was compiled, ...
2
votes
1
answer
53
views
How to approach testing for polymorphic functions taking newtype smart wrappers around simple types?
I have written a program in whcih I've defined several functions for which I've defined a concrete signature, say
work :: Foo -> [(Foo, Bar)] -> [(Foo, Bar)]
When approaching QuickCheck-based ...
1
vote
1
answer
80
views
Printing an expression using Dump library fails
I would like to print the property being tested alongside the argument that caused failure. So, I am trying to solve the second part of the problem by using Debug.Dump from the dump package. This is a ...
1
vote
2
answers
128
views
Haskell: Using quickCheckAll with a size constraint (e.g. quickCheckWith (stdArgs {maxSize = n}))
I want to be able to use quickCheckAll to run a number of tests together. At the same time, I need to specify size constraints on my tests.
In the following program, there are two tests that are ...
1
vote
0
answers
63
views
Model based property failed after few tests
I am developing a property based test generator in Erlang. I have developed all the properties successfully, but only model based properties are failed after few tests.
Here is my code:
...
0
votes
1
answer
117
views
How to write a Quickcheck property for ANSI escaped coded string parser?
Please consider the following piece of code:
-- Represents a parsing result of an ANSI coded string.
data Slice = Slice
{ text :: String,
color :: Color
}
newtype Color = Color
{ string :: ...
0
votes
0
answers
167
views
Issues with installing QuickCheck
I am having issues with installing QuickCheck for Haskell using GHC 9.4.4 and GHC 8.8.4, and I get the same output. Any assistance would be greatly appreciated!
Resolving dependencies...
cabal: Could ...
1
vote
0
answers
31
views
Is there an easy way to integrate QuickCheck (Quiviq) with Erlang Eunit and if so how?
Whenever I have tried to use Quiviq I am not able to run it within the eunit:test/2. Is there a way to do so, such that you can get the Eunit report, but also showing in detail if the Quiviq fails and ...
1
vote
1
answer
112
views
QuickCheck returns "0 tests" when checking Applicative homomorphism property (Binary Tree)
I would like to check that homomorphism Applicative law holds for datatype BinTree:
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE TypeApplications #-}
{-# ...
0
votes
1
answer
63
views
Using QuickCheck properties with coverage inside a monadic context
I'm trying to write a QuickCheck property that uses cover to make sure that the test data covers certain cases in combination with the fact that the test involves an IO action.
The problem essentially ...
3
votes
1
answer
159
views
Generate stateful function pointer for FFI testing
I want to generate stateful functions (C signature T f()) with QuickCheck as arguments for foreign functions. Preferably I also want to make them (or their inner s->(T,s)) showable.
I know that for ...
1
vote
1
answer
235
views
Symbolic calls with Quickcheck in erlang
Hi I am trying to learn quickcheck (quviq) in erlang and I have come across an exercise where I have to test a simulated cache with symbolic calls. However I encounter problems because
I get an
31> ...
0
votes
1
answer
198
views
QuickCheck Stack Overflow
I have the following struct:
pub struct Restriction {
pub min: Option<u64>,
pub max: Option<u64>,
}
for which I have defined Arbitrary as follows:
impl Arbitrary for Restriction {
...
0
votes
1
answer
735
views
How to configure QuickCheck with cabal?
I'm learning to build a Haskell package. One thing I'm stuck with is running tests with QuickCheck.
Specifically, how can I configure the number of trials to run?
Here is my test file (Test.hs) with a ...
1
vote
1
answer
240
views
Generating random binary search trees with the Arbitrary typeclass
I am working on a problem set where I must write an arbitrary instance for binary search trees. Here is the code I've written so far:
data Tree e = E | N (Tree e) e (Tree e)
insert :: (Ord e) => e ...
3
votes
1
answer
495
views
Using IO within a QuickCheck property test?
I'm currently writing a Haskell library to replace a closed-source 3rd party command line application. This 3rd party CLI has a spec that I've replicated, but the actually binary allows much more ...
3
votes
2
answers
245
views
Why cannot I get `where` to work in Hspec
I'm struggling with the semantics of where within do blocks, specifically with Test.Hspec. The following works:
module ExampleSpec where
import Test.Hspec
import Test.QuickCheck
spec :: Spec
spec = ...
2
votes
1
answer
227
views
No instance for (Arbitrary Natural) arising from a use of ‘prop’
I'm trying to write the following test for an implementation of the dyadic rational numbers.
import Numeric.Natural
import Test.Hspec
import Test.Hspec.QuickCheck
import Dyadics
dyadic_add :: ...
1
vote
2
answers
148
views
Issues with QuickCheck involving a data type with a function as a constructor
wrote the code below and am getting some issues with it :
The error I am getting is : Data constructor not in scope: Int :: Int
If I eradicate the Numeric Int element from my array the code works ...
0
votes
1
answer
194
views
How to make the property test get a collection of entities an entity-generator can return?
I have recently started exploring property based testing using junit-quickcheck. I came across an usecase where a property has to take a list of entities(I have a generator for a standalone entity). I ...
1
vote
1
answer
173
views
Is it possible to pass and retrieve a state in a quickcheck generator
I would like to create a quickcheck generator to generate a data structure like a tree. Due to the specifics caracteristics of this structure I would like the value to be generated according to its ...
0
votes
1
answer
254
views
Functor laws checking with QuickCheck-classes library
I want to check functor laws for instance:
instance Functor Stream where
fmap f (x :> xs) = (f x) :> fmap f xs
where Stream is
data Stream a = a :> Stream a
I use QuickCheck.Classes (...
3
votes
1
answer
127
views
What's wrong with my quickCheck type declaration?
I roll my own elem function called elem'
elem' :: (Eq a) => a -> [a] -> Bool
elem' n ys = foldl (\acc p -> if (p == n) then True else False) False ys
Seems to work but I want to ...
0
votes
2
answers
594
views
Is there any ways to traverse a random json string created by a generator in java?
I have a generator which is generating a completely json scripts with random keys and values(quickcheck.generator). I want to read this string and get the values of the keys. The problem is that each ...