433 questions
3
votes
1
answer
111
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
2
answers
92
views
How can I use quicktest to test subsets of constrained types?
I have a Haskell datatype
data Document where
DocumentKind1 :: {
head :: Head
body :: Body
} -> Document
DocumentKind2 :: {
head :: Head
body :: Body
} -> Document
data Head ...
0
votes
1
answer
100
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, ...
3
votes
0
answers
61
views
Never-ending QuickCheck test leaves running process even after interrupting "cabal test"
Take this silly test, which is meant to never terminate:
module Main where
import Control.Monad (unless)
import System.Exit (exitFailure)
import Test.QuickCheck
main :: IO ()
main = do
result <-...
2
votes
1
answer
55
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 ...
0
votes
1
answer
65
views
cabal test is inconsistent with its QuickCheck log [duplicate]
The following example fails (like it should) after 5 attempts:
prop_varName :: VarName -> Bool
prop_varName v = let s = content (getVarNameToken v) in
length s <= 2 || isPrefixOf "a&...
1
vote
1
answer
86
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
0
answers
136
views
How can I pinpoint the specific location where property tests fail when using QuickCheck more efficiently?
Current solution:
I am currently using counterexample function from Test.Quickcheck:
counterexample :: Testable prop => String -> prop -> Property
to add informative messages in order to ...
1
vote
2
answers
129
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 ...
0
votes
1
answer
57
views
Haskell - QuickCheck: Checking Equality in TestTree
I am trying to write a TestTree in which I check the following axiom for my data type
type Deque a = [a]
My approach is the following
prop1 :: TestTree
prop1 = QC.testProperty "read_empty" $...
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:
...
1
vote
1
answer
76
views
How is arbitrary distributed for Int? Why is it limited by so small values?
I am trying to compare the QuickCheck library to the SmallCheck one. In SmallCheck I can reach particular value manipulating depth parameter. In QuickCheck:
>a<-generate (replicateM 10000 ...
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 :: ...
2
votes
1
answer
225
views
Using mocks in unit testing in Haskell?
Consider the following piece of code:
data Slice = Slice
{ text :: String,
color :: Color
}
newtype Color = Color
{ string :: String
}
mainList :: [FilePath] -> [FilePath] -> [...
0
votes
0
answers
170
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 ...