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
13
votes
2 answers

Use QuickCheck by generating primes

Background For fun, I'm trying to write a property for quick-check that can test the basic idea behind cryptography with RSA. Choose two distinct primes, p and q. Let N = p*q e is some number relatively prime to (p-1)(q-1) (in practice, e is…
Dan Burton
  • 53,238
  • 27
  • 117
  • 198
13
votes
1 answer

Why does my implementation of SVG arc conversion not pass QuickCheck?

I implemented W3s recommended algorithm for converting SVG-path arcs from endpoint-arcs to center-arcs and back in Haskell. type EndpointArc = ( Double, Double, Double, Double , Bool, Bool, Double, Double, Double ) type…
kasbah
  • 903
  • 5
  • 23
13
votes
1 answer

Why the presence/absence of the HsColour binary forces to recompile the QuickCheck library?

Let's suppose I have no the HsColour program installed and I install QuickCheck $ cd /tmp/ $ cabal get QuickCheck $ cd QuickCheck $ cabal install ... [ 1 of 15] Compiling Test.QuickCheck.Random ... [15 of 15] Compiling…
asr
  • 1,166
  • 6
  • 18
13
votes
4 answers

QuickCheck for Javascript

Is there a version of quickcheck that works for Javascript and that is well maintained? I have found several such as check.js and claire, but none of them seem to support shrinking of failing test cases, which has always struck me as the most useful…
Zachary K
  • 3,205
  • 1
  • 29
  • 36
12
votes
4 answers

How to display a reason of a failed test property with quickcheck?

What is the best practice to display reasons for a failed property test when it is tested via QuickCheck? Consider for example: prop a b = res /= [] where (res, reason) = checkCode a b Then the a session could look like: > quickCheck…
maxschlepzig
  • 35,645
  • 14
  • 145
  • 182
12
votes
1 answer

Only generate positive integers with QuickCheck

We have two functions that compare two different power functions, and return true if they return the same value (on the same input). Then we have two other functions that test these functions against two lists to see if there is any value that…
mrfr
  • 1,724
  • 2
  • 23
  • 44
12
votes
1 answer

Generically derive Arbitrary for massive algebraic data types?

I've got a protocol that I've typed like so: data ProtocolPacket = Packet1 Word8 Text Int8 | Packet2 Text | Packet3 Int Text Text Text Text | Packet4 Int Double Double Double Int16 Int16 Int16 ... deriving (Show,Eq) In addition, I've…
carpemb
  • 691
  • 1
  • 8
  • 19
12
votes
2 answers

What is the difference between Agitar and Quickcheck property based testing?

A number of years ago a Java testing tool called Agitar was popular. It appeared to do something like property based testing. Nowadays - property based testing based on Haskell's Quickcheck is popular. There are a number of ports to Java…
hawkeye
  • 34,745
  • 30
  • 150
  • 304
12
votes
1 answer

Why does QuickCheck give up?

I am using QuickCheck to test the following program: {-# LANGUAGE TemplateHaskell #-} import Test.QuickCheck import Test.QuickCheck.All elementAt :: (Integral b) => [a] -> b -> a elementAt [x] _ = x elementAt (x:xs) 1 = x elementAt (x:xs) b =…
sdasdadas
  • 23,917
  • 20
  • 63
  • 148
12
votes
1 answer

Testing QuickCheck properties against multiple types?

I have a type class Atomic, which defines functions for converting certain types to/from a wrapper value (Atom). I'd like to define a QuickCheck property which states: "for all instances of Atomic, any value may be stored and retrieved safely". The…
John Millikin
  • 197,344
  • 39
  • 212
  • 226
11
votes
2 answers

QuickCheck exit status on failures, and cabal integration

I'm trying to understand how to integrate some quickcheck tests with cabal. This gist suggests that the quickCheck function returns non-zero status on failure, but I am not getting that behavior, so using cabal's exitcode-stdio-1.0 test-suite type…
jberryman
  • 16,334
  • 5
  • 42
  • 83
11
votes
1 answer

Haskell QuickCheck2 using ByteString?

The RWH books says that to get ByteString support, I need to add: instance Arbitrary B.ByteString where arbitrary = fmap B.pack arbitrary coarbitrary = coarbitrary . B.unpack But my GHC 7.2 with QuickCheck 2.4.1.1 tells me: `coarbitrary'…
user1002430
11
votes
2 answers

HUnit/QuickCheck with Continuous Integration

Are there any extensions to HUnit or QuickCheck that allow a continuous integration system like Bamboo to do detailed reporting of test results? So far, my best idea is to simply trigger the tests as part of a build script, and rely on the tests to…
acfoltzer
  • 5,588
  • 31
  • 48
11
votes
0 answers

Abort evaluating Haskell expression if memory limit reached

I'm using QuickCheck to test automatically-generated properties (similar to QuickSpec) but one common problem I'm running into is exhausting the memory, either due to naive recursive generators or very large function outputs (e.g. one failure was…
Warbo
  • 2,611
  • 1
  • 29
  • 23
11
votes
2 answers

Show-ing functions used in QuickCheck properties

I'm trying to write a QuickCheck property that takes one or more functions as input. To keep things simple, consider a property to check that function composition is equivalent to successive function application, and a quick-and-dirty test…
Paul Kuliniewicz
  • 2,711
  • 18
  • 24
1 2
3
28 29