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
5
votes
3 answers

HTF does not test props generated by TH

I want to do a number of similar tests on various types in my library. To simplify things, assume I have a number of vector types implementing Num class, and I want to generate the same QuickCheck property check prop_absNorm x y = abs x + abs y >=…
artem
  • 363
  • 1
  • 9
5
votes
1 answer

Cabal installing quickcheck version problem

I'm trying to install quickcheck 2 via cabal on Ubuntu 10.04. No matter what I try to do, I always end up with the following: $ cabal list quickcheck * QuickCheck Synopsis: Automatic testing of Haskell programs Latest version available:…
qrest
  • 3,083
  • 3
  • 25
  • 26
5
votes
3 answers

Junit-Quickcheck: Generate String matching a pattern

I am using pholser's port. I have to generate strings matching a given pattern like \[a-zA-Z0-9\\.\\-\\\\;\\:\\_\\@\\[\\]\\^/\\|\\}\\{]* Length 40. I extend the Generator class as: public class InputGenerator extends Generator {...} It…
Mangat Rai Modi
  • 5,397
  • 8
  • 45
  • 75
5
votes
2 answers

Clang error while installing QuickCheck for GHC 7.8.3 on OS X Yosemite 10.10 (14A389)

While installing the QuickCheck for Haskell GHC 7.8.3 on a OS X Yosemite 10.10 (14A389) system running on a Mac Pro 2013 with Xcode 6.1 (6A1052d), I'm running into the following clang error: $ cabal install QuickCheck Resolving…
The Dude
  • 325
  • 1
  • 15
5
votes
1 answer

Use HSpec and QuickCheck to verify Data.Monoid properties

I'm trying to use HSpec and QuickCheck to verify properties of Monoids (associativity and identity element). I am going to verify particular instances, but would like to keep most of the code polymorphic. This is what I came up with after several…
maciekszajna
  • 325
  • 1
  • 4
  • 9
5
votes
1 answer

fscheck generating string with size between min & max

I try to write a FsCheck generator that generates strings with length in a given interval. My attempt is the following: let genString minLength maxLength = let isValidLength (s : string) = s.Length >= minLength && s.Length <=…
vidi
  • 2,056
  • 16
  • 34
5
votes
2 answers

QuickCheck giving up investigating a recursive data structure (rose tree.)

Given an arbitrary tree, I can construct a subtype relation over that tree, using Schubert numbering: constructH :: Tree a -> Tree (Type a) where Type nests the original label, and additionally provides the data needed to perform child/parent (or…
Aleksandar Dimitrov
  • 9,275
  • 3
  • 41
  • 48
5
votes
2 answers

Using QuickCheck to test intentional error conditions

I've seen how QuickCheck can be used to test monadic and non-monadic code, but how can I use it to test code that handles errors, i.e., prints some message and then calls exitWith?
Dan
  • 12,409
  • 3
  • 50
  • 87
5
votes
3 answers

How to use 'oneof' in quickCheck (Haskell)

I am trying to write a prop that changes a Sudoku and then checks if it's still valid. However, I am not sure how to use the "oneof"-function properly. Can you give me some hints, please? prop_candidates :: Sudoku -> Bool prop_candidates su =…
Mickel
  • 6,658
  • 5
  • 42
  • 59
4
votes
1 answer

How can we apply a non-vararg function over a va_list?

Backstory I'm porting the QuickCheck unit test framework to C (see the working code at GitHub). The syntax will be: for_all(property, gen1, gen2, gen3 ...); Where property is a function to test, for example bool is_odd(int). gen1, gen2, etc. are…
mcandre
  • 22,868
  • 20
  • 88
  • 147
4
votes
2 answers

How to use quickcheck in main

I am writing a test for a binary search function I wrote. module Tests where import Data.List (sort) import Test.QuickCheck import BinarySearch (binarySearch) prop_equals_elem x xs = (binarySearch x $ sort xs) == (x `elem` xs) args = Args {replay…
matio2matio
  • 303
  • 4
  • 11
4
votes
2 answers

QuickCheck for Smalltalk?

Is there a QuickCheck module for Smalltalk, especially for Gnu Smalltalk, Squeak, and/or Pharo? Wikipedia: QuickCheck
mcandre
  • 22,868
  • 20
  • 88
  • 147
4
votes
3 answers

Haskell QuickCheck Unique Random Number Generation

Does anyone know exactly how to define a generator in Haskell using QuickCheck such that chosen elements are picked only ONCE? I've gotten as far as realizing that I might need a "Gen (Maybe Positive)" generator, but of course that will generate…
Mark
  • 41
  • 2
4
votes
2 answers

Haskell - could not find module 'Test.QuickCheck'

I'm getting an error that says the module doesn't exist when I try to runhaskell. It's odd because I try to install it first and says its up to date. Any idea how to fix this?
Matthew Lu
  • 123
  • 1
  • 5
4
votes
1 answer

How to write Functor instance of Continuation Monad?

newtype Cont k a = Cont { runCont :: (a -> k) -> k } instance Functor (Cont k) where -- fmap :: (a -> b) -> (Cont k a) -> (Cont k b) fmap f (Cont akTok) = Cont $ ??? My doubts: We can only write Functor instance to any data type that can…
Pawan Kumar
  • 1,443
  • 2
  • 16
  • 30