target-0.1.1.0: Generate test-suites from refinement types.

Safe HaskellNone
LanguageHaskell2010

Test.Target

Synopsis

Documentation

target Source

Arguments

:: Testable f 
=> f

the function

-> Name

the name of the function

-> FilePath

the path to the module that defines the function

-> IO () 

Test whether a function inhabits its refinement type by enumerating valid inputs and calling the function.

targetResult :: Testable f => f -> Name -> FilePath -> IO Result Source

Like target, but returns the Result instead of printing to standard out.

targetWith :: Testable f => f -> Name -> FilePath -> TargetOpts -> IO () Source

Like target, but accepts options to control the enumeration depth, solver, and verbosity.

targetResultWith :: Testable f => f -> Name -> FilePath -> TargetOpts -> IO Result Source

Like targetWith, but returns the Result instead of printing to standard out.

data Result Source

Constructors

Passed !Int 
Failed !String 
Errored !String 

Instances

class (AllHave Targetable (Args f), Targetable (Res f), AllHave Show (Args f)) => Testable f Source

A class of functions that Target can test. A function is Testable iff all of its component types are Targetable and all of its argument types are Showable.

You should never have to define a new Testable instance.

Minimal complete definition

queryArgs, decodeArgs, apply, mkExprs

Instances

(Targetable a, (~) [*] (Args a) ([] *), (~) * (Res a) a) => Testable a 
(Show a, Targetable a, Testable b) => Testable (a -> b) 

data TargetOpts Source

Constructors

TargetOpts 

Fields

depth :: !Int
 
solver :: !SMTSolver
 
verbose :: !Bool
 
logging :: !Bool
 
keepGoing :: !Bool

whether to keep going after finding a counter-example, useful for checking coverage

maxSuccess :: !(Maybe Int)

whether to stop after a certain number of successful tests, or enumerate the whole input space

scDepth :: !Bool

whether to use SmallCheck's notion of depth

data Test Source

Constructors

forall t . Testable t => T t