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
1
vote
0 answers

How to get quickcheck failure details from hspec being run with cabal test

I am using hspec with quickcheck, as per http://hspec.github.io/quickcheck.html however, on failures, I simply get that a failure happened in a spec, no details about the data used by quickcheck so I can start diagnosing the failure. How do I get…
Michael Neale
  • 19,248
  • 19
  • 77
  • 109
1
vote
1 answer

Is there an R port of the testing software QuickCheck?

Now that I find myself spending so much time programming in R, I really want to get back to automated testing (which I learned to do by habit in Perl). Besides being user-friendly, I would also be particularly interested in being able to generate…
Christopher Bottoms
  • 11,218
  • 8
  • 50
  • 99
1
vote
1 answer

Progress output with Distribution.TestSuite.QuickCheck

I am using Distribution.TestSuite.QuickCheck to run QuickCheck tests via cabal test. My test module exports a single definition: module MOS6502.Tests.Main (tests) where import Distribution.TestSuite.QuickCheck as QC import MOS6502.Tests import…
Cactus
  • 27,075
  • 9
  • 69
  • 149
1
vote
1 answer

Rewriting Arbitrary Double in QuickCheck2

Sorry for a newbie question, but how can I redefine Arbitrary Double to produce +/- infinity and NaNs as well as usual doubles? And how to use my version of this Arbitrary?
meldo
  • 291
  • 3
  • 11
1
vote
3 answers

Exhaustive properties in Haskell QuickCheck?

Consider the following QuickCheck program in Haskell {-# LANGUAGE TemplateHaskell #-} import Test.QuickCheck import Test.QuickCheck.All prop_trivial :: Bool prop_trivial = 42 == (6 * 7) -- Wacky boilerplate to make all tests run. return…
Reb.Cabin
  • 5,426
  • 3
  • 35
  • 64
1
vote
1 answer

How can I specialize a type in a Frege QuickCheck?

I'd like to run the classical test for reversing a list. To this end, I have to specialize the list to a list of "Arbitrary" (sic!) types, e.g. [Int]. What works is module ListCheck where import Test.QuickCheck myReverse :: [Int] ->…
Dierk
  • 1,308
  • 7
  • 13
1
vote
1 answer

Using qtest and quickcheck, fail to compile the test code

My ocaml setting is the following : ocaml 4.01.0 opam 1.1.2 qtest 2.0.1 (opam list qtest) quickcheck 1.0.0 The source code with test inlined : let rec foo x0 f = function [] -> 0 | x::xs -> f x (foo x0 f xs);; (*$T foo foo…
Pierre G.
  • 4,346
  • 1
  • 12
  • 25
1
vote
2 answers

haskell double precision underflow with repa

I've written some code calculating a distance matrix using repa: distance :: Int -> Int -> Mat -> Double distance aindx bindx arr = let a = slice arr (Any :. aindx :. All) b = slice arr (Any :. bindx :. All)- …
nont
  • 9,322
  • 7
  • 62
  • 82
1
vote
1 answer

How to generate random elements depending on previous elements using Quickcheck?

I'm using QuickCheck to do generative testing in Clojure. However I don't know it well and often I end up doing convoluted things. One thing that I need to do quite often is something like that: generate a first prime number from a list of…
Cedric Martin
  • 5,945
  • 4
  • 34
  • 66
1
vote
3 answers

Make similar QuickCheck properties DRY

I have a bunch of QuickCheck properties defined as follows: ... prop_scaleData3 d n = n > 1 ⇛ length (scaleData d n) ≡ n prop_scaleData4 d n = n > 1 ⇛ head (scaleData d n) ≡ -d prop_scaleData5 d n = n > 1 ⇛ last (scaleData d n) ≡ d ... …
Rudolf Adamkovič
  • 31,030
  • 13
  • 103
  • 118
1
vote
2 answers

Haskell, IO, monads, quickcheck

Beginner at Haskell here. I have a function, and a bunch of properties to test it with which I've written using quickcheck. The properties work when I run them individually in the interpreter, and the function checks out fine. However, manually…
user3355020
  • 315
  • 1
  • 9
1
vote
1 answer

test-framework/quickcheck/cabal: Passing options to testfunction with 'cabal test'

I'm using cabal to build and test my projects with the commands: cabal configure --enable-tests cabal build cabal test As a framework I use testing-framework (https://batterseapower.github.io/test-framework/). Everything works, however the number…
jules
  • 1,897
  • 2
  • 16
  • 19
1
vote
1 answer

How to write a Haskell QuickCheck generator for a Data.MeldableHeap priority queue

As a learning exercise I want to write a generator of Data.MeldableHeap. I patterned it after: https://gitorious.org/aocapq/aocapq/source/7f24bb1571b3bd89ada668ea81c37ccdeb825498:src/PriorityQueue/QuickCheck.hs : genericArbitrary ::…
haroldcarr
  • 1,523
  • 15
  • 17
1
vote
2 answers

QuickCheck test randomly hangs

I'm new to Haskell. I'm playing with QuickCheck tests, trying to test a simple function calculateStrengthSingle (see the source of testee below) # Fighter.hs module Fighter ( Quantity(Quantity) , Fighter(TeamPlayer, LoneWolf, Polymorph) ,…
Michael Pankov
  • 3,581
  • 2
  • 23
  • 31
1
vote
2 answers

Please provide a simple test-framework example that uses QuickCheck2

I'm struggling a little to get this basic test-framework example to work with QuickCheck2. I get the following error that is mentioned on the above page, due to the example's use of QuickCheck 1. I assume that using QuickCheck2 is generally…
Chris
  • 941
  • 9
  • 18