File: State.hs

package info (click to toggle)
haskell-quickcheck 2.1.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 152 kB
  • ctags: 2
  • sloc: haskell: 1,508; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 1,534 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module Test.QuickCheck.State where

import Test.QuickCheck.Text
import System.Random( StdGen )

--------------------------------------------------------------------------
-- State

-- | State represents QuickCheck's internal state while testing a property.
-- | The state is made visible to callback functions.
data State
  = MkState
  -- static
  { terminal          :: Terminal   -- ^ the current terminal
  , maxSuccessTests   :: Int        -- ^ maximum number of successful tests needed
  , maxDiscardedTests :: Int        -- ^ maximum number of tests that can be discarded
  , computeSize       :: Int -> Int -> Int -- ^ how to compute the size of test cases from
                                    -- #tests and #discarded tests
  
  -- dynamic
  , numSuccessTests   :: Int        -- ^ the current number of tests that have succeeded
  , numDiscardedTests :: Int        -- ^ the current number of discarded tests
  , collected         :: [[(String,Int)]] -- ^ all labels that have been collected so far
  , expectedFailure   :: Bool       -- ^ indicates if the property is expected to fail
  , randomSeed        :: StdGen     -- ^ the current random seed
  
  -- shrinking
  , isShrinking       :: Bool       -- ^ are we in a shrinking phase?
  , numSuccessShrinks :: Int        -- ^ number of successful shrinking steps so far
  , numTryShrinks     :: Int        -- ^ number of failed shrinking steps since the last successful shrink
  }

--------------------------------------------------------------------------
-- the end.