Skip to main content
Filter by
Sorted by
Tagged with
3 votes
1 answer
114 views

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 ...
sjakobi's user avatar
  • 3,608
0 votes
2 answers
92 views

I have a Haskell datatype data Document where DocumentKind1 :: { head :: Head body :: Body } -> Document DocumentKind2 :: { head :: Head body :: Body } -> Document data Head ...
Delfin's user avatar
  • 353
0 votes
1 answer
101 views

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, ...
Lucas Carraro's user avatar
3 votes
0 answers
61 views

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 <-...
Enlico's user avatar
  • 30.3k
2 votes
1 answer
56 views

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 ...
Enlico's user avatar
  • 30.3k
0 votes
1 answer
67 views

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&...
OrenIshShalom's user avatar
1 vote
1 answer
86 views

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 ...
F. Zer's user avatar
  • 1,311
1 vote
0 answers
137 views

Current solution: I am currently using counterexample function from Test.Quickcheck: counterexample :: Testable prop => String -> prop -> Property to add informative messages in order to ...
F. Zer's user avatar
  • 1,311
1 vote
2 answers
131 views

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 ...
Geoffrey Warne's user avatar
0 votes
1 answer
57 views

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" $...
FacundoAlvarado's user avatar
1 vote
0 answers
66 views

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: ...
Arraytics New's user avatar
1 vote
1 answer
78 views

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 ...
RandomB's user avatar
  • 3,749
0 votes
1 answer
121 views

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 :: ...
Refael Sheinker's user avatar
2 votes
1 answer
234 views

Consider the following piece of code: data Slice = Slice { text :: String, color :: Color } newtype Color = Color { string :: String } mainList :: [FilePath] -> [FilePath] -> [...
Refael Sheinker's user avatar
0 votes
0 answers
171 views

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 ...
OwlZeroOne's user avatar
0 votes
1 answer
125 views

I am trying to write a test which depends on non-empty vector of tuples as an argument but unsure of how to add such a constraint using quickcheck. #[quickcheck] fn graph_contains_vertex(vs: Vec<(...
Kity Cartman's user avatar
1 vote
0 answers
31 views

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 ...
Piskator's user avatar
  • 657
3 votes
2 answers
118 views

I'm learning Monad Transformers, and one of the exercises asks to implement the Monad instance for StateT. I want to test that my implementation admits to the Monad laws using the validity package, ...
Abhijit Sarkar's user avatar
1 vote
1 answer
117 views

I would like to check that homomorphism Applicative law holds for datatype BinTree: {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE TypeApplications #-} {-# ...
F. Zer's user avatar
  • 1,311
0 votes
1 answer
105 views

I am aware that the following question exists: haskell - How to quickcheck applicative homomorphism property? - Stack Overflow However, the introduction of the following PRAGMA {-# LANGUAGE ...
F. Zer's user avatar
  • 1,311
0 votes
1 answer
65 views

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 ...
l7r7's user avatar
  • 1,358
0 votes
1 answer
125 views

I am using QuickCheck as a test suite in Haskell. I want to run a single test that is always the same in the IO Monad. The problem is that QuickCheck generates 100 tests automatically even though the ...
Terra's user avatar
  • 120
3 votes
1 answer
164 views

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 ...
Johannes Riecken's user avatar
2 votes
1 answer
217 views

I am learning to use QuickCheck and find it is a very powerful library. I wrote some toy program with stack, involving a few customized data type and defined all Arbitrary instances in one file in my ...
dhu's user avatar
  • 718
1 vote
1 answer
244 views

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> ...
Piskator's user avatar
  • 657
1 vote
1 answer
196 views

I'd like to do quickcheck/property-based testing and have it run in CI, but I don't want to add a randomized test to CI (since it could potentially fail when someone else is attempting to merge an ...
David Spies's user avatar
0 votes
1 answer
206 views

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 { ...
James Burton's user avatar
2 votes
1 answer
421 views

Haskell's Test.QuickCheck module exports pattern Fn, which I have been using. When I import it with: import Test.QuickCheck it works fine. However, when I import it with: import Test.QuickCheck (Fn) ...
mherzl's user avatar
  • 6,320
0 votes
1 answer
740 views

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 ...
Hongtao Yang's user avatar
4 votes
2 answers
385 views

So I have the code below and I am trying to make it an instance of Arbitrary: data MyData = I Int | B Bool instance Arbitrary MyData where arbitrary = do { frequency [(1, return (I 1)), ...
Max Podpera's user avatar
1 vote
1 answer
241 views

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 ...
sucks-at-javascript's user avatar
3 votes
1 answer
835 views

I've recently started learning Zig. As a little project I wanted to implement a small QuickCheck [1] style helper library for writing randomized tests. However, I can't figure out how to write a ...
fav's user avatar
  • 33
3 votes
1 answer
501 views

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 ...
danielbeard's user avatar
  • 9,137
2 votes
3 answers
279 views

I'm looking at maxSize in Args. its description says: "Size to use for the biggest test cases". But how is the size of test cases determined? I'd rather to ask than to go through the source ...
Tarek Soliman's user avatar
3 votes
2 answers
248 views

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 = ...
Ben Heilman's user avatar
1 vote
0 answers
244 views

After updating the OS, I have updated the command line tools as well and have tried reinstalling QuickCheck using cabal which shows something like "resolving dependencies". Now every time I ...
arnz's user avatar
  • 19
2 votes
1 answer
234 views

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 :: ...
Alex Altair's user avatar
  • 3,805
2 votes
1 answer
266 views

This question applies to any particular programming language. Let us imagine I have a function that converts a data structure to a string of hex. func toHex(input: data) => string Let's say I now ...
Finlay Weber's user avatar
  • 4,323
1 vote
2 answers
148 views

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 ...
harleengulati03's user avatar
1 vote
1 answer
89 views

I want to write a function search :: String -> Char -> [Int] that returns the positions of all occurrences of the second argument in the first. For example: search "Bookshop" 'o' == [1,...
idontknowhowtocode's user avatar
0 votes
1 answer
195 views

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 ...
Kranthi's user avatar
  • 47
2 votes
0 answers
125 views

I'm trying to understand how shrink works in Haskell's QuickCheck, so I've come up with a minimal example shown below, but when I run it, the falsified examples are not shrunk. The result object shows ...
Ernesto Posse's user avatar
1 vote
1 answer
180 views

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 ...
JeanJouX's user avatar
  • 2,751
0 votes
1 answer
266 views

I am learning Haskell and recently worked on a small project to mimic arithmetics in the way how human does it, ultimately I can keep as many decimal places as I want and computation results are not ...
dhu's user avatar
  • 718
0 votes
1 answer
255 views

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 (...
Alimagadov K.'s user avatar
7 votes
2 answers
331 views

I have two functions. They are: f1 [] = [] f1 (x:xs) = if contains x xs then f1 xs else x:f1 xs and f6 xs = f1 (rev xs) It would not make sense that these two functions return the same list for ...
knowledge_seeker's user avatar
3 votes
1 answer
129 views

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 ...
wide_eyed_pupil's user avatar
3 votes
0 answers
143 views

I'm currently working through the book Thinking with Types. In the third chapter Variance, the author provides an exercise in which the reader should implement the functor instance for T1. newtype T1 ...
Jezen Thomas's user avatar
  • 13.8k
0 votes
2 answers
595 views

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 ...
Mahdis Ghaffarian's user avatar
1 vote
2 answers
188 views

This QuickCheck generator notEqual :: Gen (Int, Int) notEqual = do (a, b) <- arbitrary if a /= b then return (a, b) else notEqual Doesn't seem to terminate when passed to forAll. I'm ...
Ari Fordsham's user avatar
  • 2,524

1
2 3 4 5
9