Name: hstest Version: 0.0.0 Cabal-Version: >= 1.2 Build-Type: Custom License: BSD3 License-File: LICENSE Copyright: © Dave Hinton, 2010; portions © Koen Claessen Author: Dave Hinton Maintainer: Dave Hinton Stability: alpha Homepage: http://bitbucket.org/dave4420/hstest/wiki/Home Tested-With: GHC == 6.10.1 Category: Testing Synopsis: Tests properties in specified modules via QuickCheck; uses GHC api for speed Description: . 'hstest' looks through all Haskell source files in the current directory (by default), finds all properties to test (properties must have a name that starts 'prop_'), and runs them via QuickCheck. . For example, suppose you have this Haskell source file called 'mysort.hs': . > mySort xs = ... -- a function you wish to test (definition elided) > > prop_lengthStaysTheSame xs = length xs == length (mySort xs) > prop_sumStaysTheSame xs = sum xs == sum (mySort xs) > prop_lowestElementAtStart, prop_highestElementAtEnd :: [Int] -> Bool > prop_lowestElementAtStart xs = not (null xs) ==> minimum xs = head (mySort xs) > prop_highestElementAtEnd xs = not (null xs) ==> maximum xs = last (mySort xs) . Then to check all these tests, you run . > $ hstest > Failed prop_highestElementAtEnd: > * [-3,2,-2] > mysort.hs: Failed 1 property, passed 3 properties . Oops! Fix 'mySort' and try again: . > $ hstest > mysort.hs: Passed 4 properties Executable hstest Main-Is: hstest.hs Build-Depends: base >= 4.0.0 && < 4.2, -- tested with 4.0.0.0 and 4.1.0.0 directory >= 1.0.0 && < 1.1, -- tested with 1.0.0.2 and 1.0.0.3 ghc >= 6.10.1 && < 6.12, -- tested with 6.10.1 and 6.10.3 ghc-paths >= 0.1.0 && < 0.2, -- tested with 0.1.0.5 mtl >= 1.1.0 && < 1.2, -- tested with 1.1.0.2 QuickCheck >= 1.2.0.0 && < 1.3, -- tested with 1.2.0.0 random >= 1.0.0 && < 1.1 -- tested with 1.0.0.1